From a8cb7ed784f51b071873585359257110c1bcc8be Mon Sep 17 00:00:00 2001 From: Shaunak Saha Date: Wed, 15 Jan 2020 15:35:41 -0800 Subject: soc/intel/tigerlake: Add GPIO helper function This patch adds ASL methods like GRXS, GTXS, STXS and CTXS which are used to get, set and clear gpio values. We use ASL 2.0 syntax here for gpio.asl. BUG=b:144680462 BRANCH=none TEST=Build and boot tigerlake rvp board Change-Id: I17e75ff2a7cb67e94669059a1ed9d73a720ebcb1 Signed-off-by: Shaunak Saha Reviewed-on: https://review.coreboot.org/c/coreboot/+/38442 Reviewed-by: Subrata Banik Reviewed-by: Nick Vaccaro Reviewed-by: Wonkyu Kim Tested-by: build bot (Jenkins) --- src/soc/intel/tigerlake/acpi/gpio.asl | 46 ++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/src/soc/intel/tigerlake/acpi/gpio.asl b/src/soc/intel/tigerlake/acpi/gpio.asl index dc76a387b7..f6cccfb801 100644 --- a/src/soc/intel/tigerlake/acpi/gpio.asl +++ b/src/soc/intel/tigerlake/acpi/gpio.asl @@ -163,7 +163,51 @@ Method (GRXS, 1, Serialized) { VAL0, 32 } - And (GPIORXSTATE_MASK, ShiftRight (VAL0, GPIORXSTATE_SHIFT), Local0) + Local0 = GPIORXSTATE_MASK & (VAL0 >> GPIORXSTATE_SHIFT) Return (Local0) } + +/* + * Get GPIO Tx Value + * Arg0 - GPIO Number + */ +Method (GTXS, 1, Serialized) +{ + OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) + Field (PREG, AnyAcc, NoLock, Preserve) + { + VAL0, 32 + } + Local0 = GPIOTXSTATE_MASK & VAL0 + + Return (Local0) +} + +/* + * Set GPIO Tx Value + * Arg0 - GPIO Number + */ +Method (STXS, 1, Serialized) +{ + OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) + Field (PREG, AnyAcc, NoLock, Preserve) + { + VAL0, 32 + } + VAL0 |= GPIOTXSTATE_MASK +} + +/* + * Clear GPIO Tx Value + * Arg0 - GPIO Number + */ +Method (CTXS, 1, Serialized) +{ + OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) + Field (PREG, AnyAcc, NoLock, Preserve) + { + VAL0, 32 + } + VAL0 &= ~GPIOTXSTATE_MASK +} -- cgit v1.2.3