From eb503296fcd4f6e2afbf2bebda63da23354058b0 Mon Sep 17 00:00:00 2001 From: Rizwan Qureshi Date: Sun, 17 Feb 2019 11:04:51 +0530 Subject: soc/intel/cannonlake: Add ASL function for setting pad mode Add a function in gpio ASL library to set pad mode. BUG=b:123350329 Change-Id: I6c683f27ddffc3132001706d1694c71bb5664577 Signed-off-by: Rizwan Qureshi Reviewed-on: https://review.coreboot.org/c/31444 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh --- src/soc/intel/cannonlake/acpi/gpio_op.asl | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/soc/intel/cannonlake/acpi') diff --git a/src/soc/intel/cannonlake/acpi/gpio_op.asl b/src/soc/intel/cannonlake/acpi/gpio_op.asl index 0618601b9e..0c89e998c1 100644 --- a/src/soc/intel/cannonlake/acpi/gpio_op.asl +++ b/src/soc/intel/cannonlake/acpi/gpio_op.asl @@ -72,3 +72,25 @@ Method (CTXS, 1, Serialized) } And (Not (GPIOTXSTATE_MASK), VAL0, VAL0) } + +/* + * Set Pad mode + * Arg0 - GPIO Number + * Arg1 - Pad mode + * 0 = GPIO control pad + * 1 = Native Function 1 + * 2 = Native Function 2 + * 3 = Native Function 3 + */ +Method (GPMO, 2, Serialized) +{ + OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) + Field (PREG, AnyAcc, NoLock, Preserve) + { + VAL0, 32 + } + Store (VAL0, Local0) + And (Not (GPIOPADMODE_MASK), Local0, Local0) + And (ShiftLeft (Arg1, GPIOPADMODE_SHIFT, Arg1), GPIOPADMODE_MASK, Arg1) + Or (Local0, Arg1, VAL0) +} -- cgit v1.2.3