soc/intel/tigerlake: Add method to look up GPIO com ID for an index

This patch adds GPID, a helper method to look up GPIO community ID for
an index.

This patch also includes Intel's common GPIO ASL code. CGPM method in
the common code uses the GPID method introduced in this patch.

BUG=b:148892882
BRANCH=none
TEST="BUILD volteer and ripto"

Signed-off-by: Venkata Krishna Nimmagadda <venkata.krishna.nimmagadda@intel.com>
Change-Id: Id6a00fb8adef0285d6bbc35cd5a44539bd3be6b8
Reviewed-on: https://review.coreboot.org/c/coreboot/+/40478
Reviewed-by: Venkata Krishna Nimmagadda <Venkata.krishna.nimmagadda@intel.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Venkata Krishna Nimmagadda 2020-04-17 00:21:22 -07:00 committed by Duncan Laurie
parent f98bbda5fb
commit cd41fa378d
1 changed files with 33 additions and 0 deletions

View File

@ -4,6 +4,7 @@
#include <soc/irq.h>
#include <soc/pcr_ids.h>
#include <intelblocks/gpio.h>
#include <soc/intel/common/acpi/gpio.asl>
#include "gpio_op.asl"
Device (GCM0)
@ -142,3 +143,35 @@ Method (GADD, 1, NotSerialized)
Local2 = PCRB(Local0) + PAD_CFG_BASE + (Local1 * 16)
Return (Local2)
}
/*
* Return PCR Port ID of GPIO Communities
*
* Arg0: GPIO Community (0-5)
*/
Method (GPID, 1, Serialized)
{
Switch (ToInteger (Arg0))
{
Case (0) {
Local0 = PID_GPIOCOM0
}
Case (1) {
Local0 = PID_GPIOCOM1
}
Case (2) {
Local0 = PID_GPIOCOM2
}
Case (4) {
Local0 = PID_GPIOCOM4
}
Case (5) {
Local0 = PID_GPIOCOM5
}
Default {
Return (0)
}
}
Return (Local0)
}