1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <soc/intel/common/acpi/gpio.asl>
4 #include <soc/intel/common/block/acpi/acpi/gpio_op.asl>
6 #include <soc/pcr_ids.h>
10 Name (_HID, "INT34C5")
12 Name (_DDN, "GPIO Controller")
14 Name (RBUF, ResourceTemplate()
16 Memory32Fixed (ReadWrite, 0, 0, COM0)
17 Memory32Fixed (ReadWrite, 0, 0, COM1)
18 Memory32Fixed (ReadWrite, 0, 0, COM4)
19 Memory32Fixed (ReadWrite, 0, 0, COM5)
20 Interrupt (ResourceConsumer, Level, ActiveLow, Shared,,, GIRQ)
23 Method (_CRS, 0, NotSerialized)
25 /* GPIO Community 0 */
26 CreateDWordField (^RBUF, ^COM0._BAS, BAS0)
27 CreateDWordField (^RBUF, ^COM0._LEN, LEN0)
28 BAS0 = ^^PCRB (PID_GPIOCOM0)
31 /* GPIO Community 1 */
32 CreateDWordField (^RBUF, ^COM1._BAS, BAS1)
33 CreateDWordField (^RBUF, ^COM1._LEN, LEN1)
34 BAS1 = ^^PCRB (PID_GPIOCOM1)
37 /* GPIO Community 4 */
38 CreateDWordField (^RBUF, ^COM4._BAS, BAS4)
39 CreateDWordField (^RBUF, ^COM4._LEN, LEN4)
40 BAS4 = ^^PCRB (PID_GPIOCOM4)
43 /* GPIO Community 5 */
44 CreateDWordField (^RBUF, ^COM5._BAS, BAS5)
45 CreateDWordField (^RBUF, ^COM5._LEN, LEN5)
46 BAS5 = ^^PCRB (PID_GPIOCOM5)
52 Method (_STA, 0, NotSerialized)
59 * Get GPIO DW0 Address
62 Method (GADD, 1, NotSerialized)
64 /* GPIO Community 0 */
65 If (Arg0 >= GPIO_COM0_START && Arg0 <= GPIO_COM0_END)
68 Local1 = Arg0 - GPIO_COM0_START
70 /* GPIO Community 1 */
71 If (Arg0 >= GPIO_COM1_START && Arg0 <= GPIO_COM1_END)
74 Local1 = Arg0 - GPIO_COM1_START
76 /* GPIO Community 2 */
77 If (Arg0 >= GPIO_COM2_START && Arg0 <= GPIO_COM2_END)
80 Local1 = Arg0 - GPIO_COM2_START
82 /* GPIO Community 4 */
83 If (Arg0 >= GPIO_COM4_START && Arg0 <= GPIO_COM4_END)
86 Local1 = Arg0 - GPIO_COM4_START
88 /* GPIO Community 05*/
89 If (Arg0 >= GPIO_COM5_START && Arg0 <= GPIO_COM5_END)
92 Local1 = Arg0 - GPIO_COM5_START
95 Local2 = PCRB(Local0) + PAD_CFG_BASE + (Local1 * 16)
100 * Return PCR Port ID of GPIO Communities
102 * Arg0: GPIO Community (0-5)
104 Method (GPID, 1, Serialized)
106 Switch (ToInteger (Arg0))
109 Local0 = PID_GPIOCOM0
112 Local0 = PID_GPIOCOM1
115 Local0 = PID_GPIOCOM2
118 Local0 = PID_GPIOCOM4
121 Local0 = PID_GPIOCOM5