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 <rizwan.qureshi@intel.com>
Reviewed-on: https://review.coreboot.org/c/31444
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
Rizwan Qureshi 2019-02-17 11:04:51 +05:30 committed by Patrick Georgi
parent 3ba6caf81e
commit eb503296fc
3 changed files with 26 additions and 0 deletions

View File

@ -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)
}

View File

@ -253,4 +253,6 @@
#define GPIORXSTATE_MASK 0x1
#define GPIORXSTATE_SHIFT 1
#define GPIOTXSTATE_MASK 0x1
#define GPIOPADMODE_MASK 0xC00
#define GPIOPADMODE_SHIFT 10
#endif

View File

@ -327,4 +327,6 @@
#define GPIORXSTATE_MASK 0x1
#define GPIORXSTATE_SHIFT 1
#define GPIOTXSTATE_MASK 0x1
#define GPIOPADMODE_MASK 0xC00
#define GPIOPADMODE_SHIFT 10
#endif