1 /* SPDX-License-Identifier: GPL-2.0-only */
4 #include <soc/intel/common/acpi/gpio.asl>
5 #include <soc/intel/common/block/acpi/acpi/gpio_op.asl>
7 #include <soc/pcr_ids.h>
11 Name (_HID, CROS_GPIO_NAME)
13 Name (_DDN, "GPIO Controller")
15 Name (RBUF, ResourceTemplate()
17 Memory32Fixed (ReadWrite, 0, 0, COM0)
18 Memory32Fixed (ReadWrite, 0, 0, COM1)
19 Memory32Fixed (ReadWrite, 0, 0, COM2)
20 Memory32Fixed (ReadWrite, 0, 0, COM3)
21 Memory32Fixed (ReadWrite, 0, 0, COM4)
22 Memory32Fixed (ReadWrite, 0, 0, COM5)
23 Interrupt (ResourceConsumer, Level, ActiveLow, Shared,,, GIRQ)
27 Method (_CRS, 0, NotSerialized)
29 /* GPIO Community 0 */
30 CreateDWordField (^RBUF, ^COM0._BAS, BAS0)
31 CreateDWordField (^RBUF, ^COM0._LEN, LEN0)
32 BAS0 = ^^PCRB (PID_GPIOCOM0)
35 /* GPIO Community 1 */
36 CreateDWordField (^RBUF, ^COM1._BAS, BAS1)
37 CreateDWordField (^RBUF, ^COM1._LEN, LEN1)
38 BAS1 = ^^PCRB (PID_GPIOCOM1)
41 /* GPIO Community 2 */
42 CreateDWordField (^RBUF, ^COM2._BAS, BAS2)
43 CreateDWordField (^RBUF, ^COM2._LEN, LEN2)
44 BAS2 = ^^PCRB (PID_GPIOCOM2)
47 /* GPIO Community 3 */
48 CreateDWordField (^RBUF, ^COM3._BAS, BAS3)
49 CreateDWordField (^RBUF, ^COM3._LEN, LEN3)
50 BAS3 = ^^PCRB (PID_GPIOCOM3)
53 /* GPIO Community 4 */
54 CreateDWordField (^RBUF, ^COM4._BAS, BAS4)
55 CreateDWordField (^RBUF, ^COM4._LEN, LEN4)
56 BAS4 = ^^PCRB (PID_GPIOCOM4)
59 /* GPIO Community 5 */
60 CreateDWordField (^RBUF, ^COM5._BAS, BAS5)
61 CreateDWordField (^RBUF, ^COM5._LEN, LEN5)
62 BAS5 = ^^PCRB (PID_GPIOCOM5)
68 Method (_STA, 0, NotSerialized)
74 * Get GPIO DW0 Address
77 Method (GADD, 1, NotSerialized)
79 /* GPIO Community 0 */
80 If (Arg0 >= GPIO_COM0_START && Arg0 <= GPIO_COM0_END)
83 Local1 = Arg0 - GPIO_COM0_START
85 /* GPIO Community 1 */
86 If (Arg0 >= GPIO_COM1_START && Arg0 <= GPIO_COM1_END)
89 Local1 = Arg0 - GPIO_COM1_START
91 /* GPIO Community 2 */
92 If (Arg0 >= GPIO_COM2_START && Arg0 <= GPIO_COM2_END)
95 Local1 = Arg0 - GPIO_COM2_START
97 /* GPIO Community 3 */
98 If (Arg0 >= GPIO_COM3_START && Arg0 <= GPIO_COM3_END)
100 Local0 = PID_GPIOCOM3
101 Local1 = Arg0 - GPIO_COM3_START
103 /* GPIO Community 4 */
104 If (Arg0 >= GPIO_COM4_START && Arg0 <= GPIO_COM4_END)
106 Local0 = PID_GPIOCOM4
107 Local1 = Arg0 - GPIO_COM4_START
109 /* GPIO Community 5 */
110 If (Arg0 >= GPIO_COM5_START && Arg0 <= GPIO_COM5_END)
112 Local0 = PID_GPIOCOM5
113 Local1 = Arg0 - GPIO_COM5_START
116 Local2 = PCRB(Local0) + PAD_CFG_BASE + (Local1 * 16)
121 * Return PCR Port ID of GPIO Communities
123 * Arg0: GPIO Community (0-5)
125 Method (GPID, 1, Serialized)
127 Switch (ToInteger (Arg0))
130 Local0 = PID_GPIOCOM0
133 Local0 = PID_GPIOCOM1
136 Local0 = PID_GPIOCOM2
139 Local0 = PID_GPIOCOM3
142 Local0 = PID_GPIOCOM4
145 Local0 = PID_GPIOCOM5