1 /* SPDX-License-Identifier: GPL-2.0-only */
4 #include <soc/gpio_defs_pch_h.h>
5 #include <soc/intel/common/acpi/gpio.asl>
6 #include <soc/intel/common/block/acpi/acpi/gpio_op.asl>
8 #include <soc/pcr_ids.h>
12 Name (_HID, "INT34C6")
14 Name (_DDN, "GPIO Controller")
16 Name (RBUF, ResourceTemplate()
18 Memory32Fixed (ReadWrite, 0, 0, COM0)
19 Memory32Fixed (ReadWrite, 0, 0, COM1)
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)
26 Method (_CRS, 0, NotSerialized)
28 /* GPIO Community 0 */
29 CreateDWordField (^RBUF, ^COM0._BAS, BAS0)
30 CreateDWordField (^RBUF, ^COM0._LEN, LEN0)
31 BAS0 = ^^PCRB (PID_GPIOCOM0)
34 /* GPIO Community 1 */
35 CreateDWordField (^RBUF, ^COM1._BAS, BAS1)
36 CreateDWordField (^RBUF, ^COM1._LEN, LEN1)
37 BAS1 = ^^PCRB (PID_GPIOCOM1)
40 /* GPIO Community 3 */
41 CreateDWordField (^RBUF, ^COM3._BAS, BAS3)
42 CreateDWordField (^RBUF, ^COM3._LEN, LEN3)
43 BAS3 = ^^PCRB (PID_GPIOCOM3)
46 /* GPIO Community 4 */
47 CreateDWordField (^RBUF, ^COM4._BAS, BAS4)
48 CreateDWordField (^RBUF, ^COM4._LEN, LEN4)
49 BAS4 = ^^PCRB (PID_GPIOCOM4)
52 /* GPIO Community 5 */
53 CreateDWordField (^RBUF, ^COM5._BAS, BAS5)
54 CreateDWordField (^RBUF, ^COM5._LEN, LEN5)
55 BAS5 = ^^PCRB (PID_GPIOCOM5)
61 Method (_STA, 0, NotSerialized)
68 * Get GPIO DW0 Address
71 Method (GADD, 1, NotSerialized)
73 /* GPIO Community 0 */
74 If (Arg0 >= GPIO_COM0_START && Arg0 <= GPIO_COM0_END)
77 Local1 = Arg0 - GPIO_COM0_START
79 /* GPIO Community 1 */
80 If (Arg0 >= GPIO_COM1_START && Arg0 <= GPIO_COM1_END)
83 Local1 = Arg0 - GPIO_COM1_START
85 /* GPIO Community 2 */
86 If (Arg0 >= GPIO_COM2_START && Arg0 <= GPIO_COM2_END)
89 Local1 = Arg0 - GPIO_COM2_START
91 /* GPIO Community 3 */
92 If (Arg0 >= GPIO_COM3_START && Arg0 <= GPIO_COM3_END)
95 Local1 = Arg0 - GPIO_COM3_START
97 /* GPIO Community 4 */
98 If (Arg0 >= GPIO_COM4_START && Arg0 <= GPIO_COM4_END)
100 Local0 = PID_GPIOCOM4
101 Local1 = Arg0 - GPIO_COM4_START
103 /* GPIO Community 05*/
104 If (Arg0 >= GPIO_COM5_START && Arg0 <= GPIO_COM5_END)
106 Local0 = PID_GPIOCOM5
107 Local1 = Arg0 - GPIO_COM5_START
110 Local2 = PCRB(Local0) + PAD_CFG_BASE + (Local1 * 16)
115 * Return PCR Port ID of GPIO Communities
117 * Arg0: GPIO Community (0-5)
119 Method (GPID, 1, Serialized)
121 Switch (ToInteger (Arg0))
124 Local0 = PID_GPIOCOM0
127 Local0 = PID_GPIOCOM1
130 Local0 = PID_GPIOCOM2
133 Local0 = PID_GPIOCOM3
136 Local0 = PID_GPIOCOM4
139 Local0 = PID_GPIOCOM5