| 1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 |
|
| 3 |
Scope (\_SB) |
| 4 |
{ |
| 5 |
/* Get Pad Configuration DW0 register value */ |
| 6 |
Method (GPC0, 0x1, Serialized) |
| 7 |
{ |
| 8 |
/* Arg0 - GPIO DW0 address */ |
| 9 |
Local0 = Arg0 |
| 10 |
OperationRegion (PDW0, SystemMemory, Local0, 4) |
| 11 |
Field (PDW0, AnyAcc, NoLock, Preserve) { |
| 12 |
TEMP, 32 |
| 13 |
} |
| 14 |
Return (TEMP) |
| 15 |
} |
| 16 |
|
| 17 |
/* Set Pad Configuration DW0 register value */ |
| 18 |
Method (SPC0, 0x2, Serialized) |
| 19 |
{ |
| 20 |
/* Arg0 - GPIO DW0 address */ |
| 21 |
/* Arg1 - Value for DW0 register */ |
| 22 |
Local0 = Arg0 |
| 23 |
OperationRegion (PDW0, SystemMemory, Local0, 4) |
| 24 |
Field (PDW0, AnyAcc, NoLock, Preserve) { |
| 25 |
TEMP,32 |
| 26 |
} |
| 27 |
TEMP = Arg1 |
| 28 |
} |
| 29 |
|
| 30 |
/* Get Pad Configuration DW1 register value */ |
| 31 |
Method (GPC1, 0x1, Serialized) |
| 32 |
{ |
| 33 |
/* Arg0 - GPIO DW0 address */ |
| 34 |
Local0 = Arg0 + 4 |
| 35 |
OperationRegion (PDW1, SystemMemory, Local0, 4) |
| 36 |
Field (PDW1, AnyAcc, NoLock, Preserve) { |
| 37 |
TEMP, 32 |
| 38 |
} |
| 39 |
Return (TEMP) |
| 40 |
} |
| 41 |
|
| 42 |
/* Set Pad Configuration DW1 register value */ |
| 43 |
Method (SPC1, 0x2, Serialized) |
| 44 |
{ |
| 45 |
/* Arg0 - GPIO DW0 address */ |
| 46 |
/* Arg1 - Value for DW1 register */ |
| 47 |
Local0 = Arg0 + 4 |
| 48 |
OperationRegion (PDW1, SystemMemory, Local0, 4) |
| 49 |
Field(PDW1, AnyAcc, NoLock, Preserve) { |
| 50 |
TEMP,32 |
| 51 |
} |
| 52 |
TEMP = Arg1 |
| 53 |
} |
| 54 |
|
| 55 |
/* Get DW0 address of a given pad */ |
| 56 |
Method (GDW0, 0x2, Serialized) |
| 57 |
{ |
| 58 |
/* Arg0 - GPIO portid */ |
| 59 |
/* Arg1 - GPIO pad offset relative to the community */ |
| 60 |
Local1 = 0 |
| 61 |
Local1 |= (Arg0 << 16) | CONFIG_PCR_BASE_ADDRESS |
| 62 |
Local1 |= (PAD_CFG_BASE + Arg1 * GPIO_NUM_PAD_CFG_REGS * 4) |
| 63 |
Return (Local1) |
| 64 |
} |
| 65 |
|
| 66 |
/* Calculate HOSTSW_REG address */ |
| 67 |
Method (CHSA, 0x1, Serialized) |
| 68 |
{ |
| 69 |
/* Arg0 - GPIO pad offset relative to the community */ |
| 70 |
Local1 = HOSTSW_OWN_REG_0 + Arg0 / 32 * 4 |
| 71 |
Return (Local1) |
| 72 |
} |
| 73 |
|
| 74 |
/* Get Host ownership register of GPIO Community */ |
| 75 |
Method (GHO, 0x2, Serialized) |
| 76 |
{ |
| 77 |
/* Arg0 - GPIO portid */ |
| 78 |
/* Arg1 - GPIO pad offset relative to the community */ |
| 79 |
|
| 80 |
OperationRegion (SHO0, SystemMemory, CONFIG_PCR_BASE_ADDRESS | |
| 81 |
(Arg0 << 16) | CHSA (Arg1), 4) |
| 82 |
Field (SHO0, AnyAcc, NoLock, Preserve) { |
| 83 |
TEMP, 32 |
| 84 |
} |
| 85 |
Return (TEMP) |
| 86 |
} |
| 87 |
|
| 88 |
/* Set Host ownership register of GPIO Community */ |
| 89 |
Method (SHO, 0x3, Serialized) |
| 90 |
{ |
| 91 |
/* Arg0 - GPIO portid */ |
| 92 |
/* Arg1 - GPIO pad offset relative to the community */ |
| 93 |
/* Arg2 - Value for Host own register */ |
| 94 |
|
| 95 |
OperationRegion (SHO0, SystemMemory, CONFIG_PCR_BASE_ADDRESS | |
| 96 |
(Arg0 << 16) | CHSA (Arg1), 4) |
| 97 |
Field (SHO0, AnyAcc, NoLock, Preserve) { |
| 98 |
TEMP, 32 |
| 99 |
} |
| 100 |
TEMP = Arg2 |
| 101 |
} |
| 102 |
} |