1 /* SPDX-License-Identifier: GPL-2.0-only */
4 #include <soc/pcr_ids.h>
6 #include <soc/intel/common/block/acpi/acpi/gpio_op.asl>
7 #include <soc/intel/common/acpi/pch_pcr.asl>
11 Name (_HID, "INT3536")
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) { PCH_IRQ14 }
26 /* Current Resource Settings */
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 /* Return status of power resource */
69 Method (_STA, 0, NotSerialized)
76 * Get GPIO DW0 Address
79 Method (GADD, 1, NotSerialized)
81 /* GPIO Community 0 */
82 if ((Arg0 >= GPP_A0) && (Arg0 <= GPP_F23))
85 Local1 = Arg0 - GPP_A0
88 /* GPIO Community 1 */
89 if ((Arg0 >= GPP_C0) && (Arg0 <= GPP_E12))
92 Local1 = Arg0 - GPP_C0
95 /* GPIO Community 2 */
96 if ((Arg0 >= GPD0) && (Arg0 <= GPD11))
102 /* GPIO Community 3 */
103 if ((Arg0 >= GPP_I0) && (Arg0 <= GPP_I10))
105 Local0 = PID_GPIOCOM3
106 Local1 = Arg0 - GPP_I0
109 /* GPIO Community 4 */
110 if ((Arg0 >= GPP_J0) && (Arg0 <= GPP_K10))
112 Local0 = PID_GPIOCOM4
113 Local1 = Arg0 - GPP_J0
116 /* GPIO Community 5 */
117 if ((Arg0 >= GPP_G0) && (Arg0 <= GPP_L19))
119 Local0 = PID_GPIOCOM5
120 Local1 = Arg0 - GPP_G0
123 Local2 = PCRB (Local0)
124 Local2 += PAD_CFG_BASE
125 Return (Local2 + (Local1 * 8))
129 * Return PCR Port ID of GPIO Communities
131 * Arg0: GPIO Community (0-5)
133 Method (GPID, 1, Serialized)
135 Switch (ToInteger (Arg0))
139 Local0 = PID_GPIOCOM0
144 Local0 = PID_GPIOCOM1
149 Local0 = PID_GPIOCOM2
154 Local0 = PID_GPIOCOM3
159 Local0 = PID_GPIOCOM4
164 Local0 = PID_GPIOCOM5