1 /* SPDX-License-Identifier: GPL-2.0-only */
4 #include <soc/intel/common/block/acpi/acpi/gpio_op.asl>
6 #include <soc/pcr_ids.h>
8 #include <soc/intel/common/acpi/gpio.asl>
12 Name (_HID, CROS_GPIO_NAME)
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, COM4)
21 Memory32Fixed (ReadWrite, 0, 0, COM5)
22 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 4 */
41 CreateDWordField (^RBUF, ^COM4._BAS, BAS4)
42 CreateDWordField (^RBUF, ^COM4._LEN, LEN4)
43 BAS4 = ^^PCRB (PID_GPIOCOM4)
46 /* GPIO Community 5 */
47 CreateDWordField (^RBUF, ^COM5._BAS, BAS5)
48 CreateDWordField (^RBUF, ^COM5._LEN, LEN5)
49 BAS5 = ^^PCRB (PID_GPIOCOM5)
55 Method (_STA, 0, NotSerialized)
61 * Get GPIO DW0 Address
64 Method (GADD, 1, NotSerialized)
66 /* GPIO Community 0 */
67 If (Arg0 >= GPIO_COM0_START && Arg0 <= GPIO_COM0_END)
70 Local1 = Arg0 - GPIO_COM0_START
72 /* GPIO Community 1 */
73 If (Arg0 >= GPIO_COM1_START && Arg0 <= GPIO_COM1_END)
76 Local1 = Arg0 - GPIO_COM1_START
78 /* GPIO Community 2 */
79 If (Arg0 >= GPIO_COM2_START && Arg0 <= GPIO_COM2_END)
82 Local1 = Arg0 - GPIO_COM2_START
84 /* GPIO Community 4 */
85 If (Arg0 >= GPIO_COM4_START && Arg0 <= GPIO_COM4_END)
88 Local1 = Arg0 - GPIO_COM4_START
90 /* GPIO Community 05*/
91 If (Arg0 >= GPIO_COM5_START && Arg0 <= GPIO_COM5_END)
94 Local1 = Arg0 - GPIO_COM5_START
97 Local2 = PCRB(Local0) + PAD_CFG_BASE + (Local1 * 16)
102 * Return PCR Port ID of GPIO Communities
104 * Arg0: GPIO Community (0-5)
106 Method (GPID, 1, Serialized)
108 Switch (ToInteger (Arg0))
111 Local0 = PID_GPIOCOM0
114 Local0 = PID_GPIOCOM1
117 Local0 = PID_GPIOCOM2
120 Local0 = PID_GPIOCOM4
123 Local0 = PID_GPIOCOM5