1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #include <soc/gpio_defs_cnp_h.h>
3 #include <soc/intel/common/block/acpi/acpi/gpio_op.asl>
5 #include <soc/pcr_ids.h>
11 Name (_DDN, "GPIO Controller")
13 Name (RBUF, ResourceTemplate()
15 Memory32Fixed (ReadWrite, 0, 0, COM0)
16 Memory32Fixed (ReadWrite, 0, 0, COM1)
17 Memory32Fixed (ReadWrite, 0, 0, COM3)
18 Memory32Fixed (ReadWrite, 0, 0, COM4)
19 Interrupt (ResourceConsumer, Level, ActiveLow, Shared,,, GIRQ)
24 * GPIO communities 0, 1, 3, and 4 are exported for the OS.
25 * This is based on the Linux kernel provided community map at
26 * drivers/pinctrl/intel/pinctrl-cannonlake.c:cnhl_communities[]
28 Method (_CRS, 0, NotSerialized)
30 /* GPIO Community 0 */
31 CreateDWordField (^RBUF, ^COM0._BAS, BAS0)
32 CreateDWordField (^RBUF, ^COM0._LEN, LEN0)
33 BAS0 = ^^PCRB (PID_GPIOCOM0)
36 /* GPIO Community 1 */
37 CreateDWordField (^RBUF, ^COM1._BAS, BAS1)
38 CreateDWordField (^RBUF, ^COM1._LEN, LEN1)
39 BAS1 = ^^PCRB (PID_GPIOCOM1)
42 /* GPIO Community 3 */
43 CreateDWordField (^RBUF, ^COM3._BAS, BAS3)
44 CreateDWordField (^RBUF, ^COM3._LEN, LEN3)
45 BAS3 = ^^PCRB (PID_GPIOCOM3)
48 /* GPIO Community 4 */
49 CreateDWordField (^RBUF, ^COM4._BAS, BAS4)
50 CreateDWordField (^RBUF, ^COM4._LEN, LEN4)
51 BAS4 = ^^PCRB (PID_GPIOCOM4)
57 Method (_STA, 0, NotSerialized)
64 * Get GPIO DW0 Address
67 Method (GADD, 1, NotSerialized)
69 /* GPIO Community 0 */
70 If (Arg0 >= GPP_A0 && Arg0 <= GSPI1_CLK_LOOPBK)
73 Local1 = Arg0 - GPP_A0
75 /* GPIO Community 1 */
76 If (Arg0 >= GPP_C0 && Arg0 <= vSSP2_RXD)
79 Local1 = Arg0 - GPP_C0
82 If (Arg0 >= GPP_K0 && Arg0 <= SPI0_CLK_LOOPBK)
85 Local1 = Arg0 - GPP_K0
88 If (Arg0 >= HDACPU_SDI && Arg0 <= GPP_J11)
91 Local1 = Arg0 - GPP_I0
93 Local2 = PCRB (Local0)
94 Local2 += PAD_CFG_BASE
95 Return (Local2 + Local1 * 16)