coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
gpio.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <soc/gpe.h>
4 #include <soc/gpio.h>
5 #include <variant/gpio.h>
6 
7 /* Name format: <pad name> / <net/pin name in schematics> */
8 static const struct pad_config gpio_table[] = {
9  /* ------- GPIO Group GPD ------- */
10  PAD_NC(GPD0, NONE),
11  PAD_CFG_NF(GPD1, NATIVE, DEEP, NF1), /* ACPRESENT / AC_PRESENT */
12  PAD_NC(GPD2, NONE),
13  PAD_CFG_NF(GPD3, UP_20K, DEEP, NF1), /* PWRBTN# / PWR_BTN# */
14  PAD_CFG_NF(GPD4, NONE, DEEP, NF1), /* SLP_S3# / SUSB#_PCH */
15  PAD_CFG_NF(GPD5, NONE, DEEP, NF1), /* SLP_S4# / SUSC#_PCH */
16  PAD_NC(GPD6, NONE),
17  PAD_NC(GPD7, NONE),
18  PAD_CFG_NF(GPD8, NONE, DEEP, NF1), /* SUSCLK / SUS_CLK */
19  PAD_NC(GPD9, NONE),
20  PAD_NC(GPD10, NONE),
21  PAD_NC(GPD11, NONE),
22 
23  /* ------- GPIO Group GPP_A ------- */
24  PAD_CFG_NF(GPP_A0, UP_20K, DEEP, NF1), /* ESPI_IO0 / ESPI_IO_0 */
25  PAD_CFG_NF(GPP_A1, UP_20K, DEEP, NF1), /* ESPI_IO1 / ESPI_IO_1 */
26  PAD_CFG_NF(GPP_A2, UP_20K, DEEP, NF1), /* ESPI_IO2 / ESPI_IO_2 */
27  PAD_CFG_NF(GPP_A3, UP_20K, DEEP, NF1), /* ESPI_IO3 / ESPI_IO_3 */
28  PAD_CFG_NF(GPP_A4, UP_20K, DEEP, NF1), /* ESPI_CS# / ESPI_CS_N */
29  PAD_CFG_NF(GPP_A5, DN_20K, DEEP, NF1), /* ESPI_CLK */
30  PAD_CFG_NF(GPP_A6, NONE, DEEP, NF1), /* ESPI_RESET# / ESPI_RESET_N */
31  PAD_NC(GPP_A7, NONE),
32  PAD_CFG_NF(GPP_A8, NONE, DEEP, NF2), /* CNV_RF_RESET# / CNVI_RST# */
33  PAD_CFG_NF(GPP_A9, UP_20K, DEEP, NF2), /* MODEM_CLKREQ / CNVI_CLKREQ */
36  PAD_CFG_NF(GPP_A12, UP_20K, DEEP, NF1), /* SATAXPCIE1 / SATAGP1 (wrong name!) */
37  PAD_CFG_GPO(GPP_A13, 1, DEEP), /* GPP_A13 / PCH_BT_EN */
42  PAD_CFG_NF(GPP_A18, NONE, DEEP, NF1), /* DDSP_HPDB / HDMI_HPD */
47  PAD_CFG_GPO(GPP_A23, 0, PLTRST), /* GPP_A23 / TC_RETIMER_FORCE_PWR */
48 
49  /* ------- GPIO Group GPP_B ------- */
50  PAD_CFG_NF(GPP_B0, NONE, DEEP, NF1), /* CORE_VID0 / VCCIN_AUX_VID0 */
51  PAD_CFG_NF(GPP_B1, NONE, DEEP, NF1), /* CORE_VID1 / VCCIN_AUX_VID1 */
52  PAD_CFG_NF(GPP_B2, NONE, DEEP, NF1), /* VRALERT# */
53  PAD_CFG_GPI_APIC_LOW(GPP_B3, NONE, DEEP), /* GPP_B3 (touchpad interrupt) */
54  PAD_NC(GPP_B4, NONE),
55  PAD_NC(GPP_B5, NONE),
56  PAD_NC(GPP_B6, NONE),
57  PAD_NC(GPP_B7, NONE),
58  PAD_NC(GPP_B8, NONE),
59  PAD_NC(GPP_B9, NONE),
61  PAD_CFG_NF(GPP_B11, NONE, DEEP, NF1), /* GPP_B11 / TBTA_I2C_INT */
62  PAD_CFG_NF(GPP_B12, NONE, DEEP, NF1), /* SLP_S0# */
63  PAD_CFG_NF(GPP_B13, NONE, DEEP, NF1), /* PLT_RST# */
64  PAD_CFG_NF(GPP_B14, NONE, DEEP, NF1), /* SPKR / PCH_SPKR */
74 
75  /* ------- GPIO Group GPP_C ------- */
76  PAD_CFG_NF(GPP_C0, NONE, DEEP, NF1), /* SMBCLK / SMB_CLK_DDR */
77  PAD_CFG_NF(GPP_C1, NONE, DEEP, NF1), /* SMBDATA / SMB_DAT_DDR */
78  PAD_NC(GPP_C2, NONE),
79  PAD_CFG_NF(GPP_C3, NONE, DEEP, NF1), /* SML0CLK */
80  PAD_CFG_NF(GPP_C4, NONE, DEEP, NF1), /* SML0_DATA */
81  PAD_NC(GPP_C5, NONE),
82  PAD_CFG_NF(GPP_C6, NONE, DEEP, NF1), /* SML1CLK / TBT_I2C_SCL */
83  PAD_CFG_NF(GPP_C7, NONE, DEEP, NF1), /* SML1_DATA / TBT_I2C_SDA */
84  PAD_NC(GPP_C8, NONE),
85  PAD_CFG_GPI_APIC_LOW(GPP_C9, NONE, DEEP), /* GPP_C9 / TPM_PIRQ# */
89  PAD_CFG_GPO(GPP_C13, 1, DEEP), /* GPP_C13 / SSD1_PWR_DN# */
92  PAD_CFG_NF(GPP_C16, NONE, DEEP, NF1), /* I2C0_SDA / T_SDA (touchpad) */
93  PAD_CFG_NF(GPP_C17, NONE, DEEP, NF1), /* I2C0_SCL / T_SCL (touchpad) */
94  PAD_CFG_NF(GPP_C18, NONE, DEEP, NF1), /* I2C1_SDA / PCH_I2C_SDA (retimer rom) */
95  PAD_CFG_NF(GPP_C19, NONE, DEEP, NF1), /* I2C1_SCL / PCH_I2C_SCL (retimer rom) */
96  PAD_CFG_NF(GPP_C20, UP_20K, DEEP, NF1), /* UART2_RXD */
97  PAD_CFG_NF(GPP_C21, UP_20K, DEEP, NF1), /* UART2_TXD */
98  PAD_CFG_GPO(GPP_C22, 1, DEEP), /* GPP_C22 / GPP_C12_RTD3 (SSD1) */
99  PAD_NC(GPP_C23, UP_20K), /* GPP_C23 / PCH_GPP_C23 (WLAN_WAKEUP#) */
100 
101  /* ------- GPIO Group GPP_D ------- */
102  PAD_CFG_GPO(GPP_D0, 1, DEEP), /* GPP_D0 / SB_BLON */
103  PAD_NC(GPP_D1, NONE),
104  PAD_NC(GPP_D2, NONE), /* LEDKB_DET# (unused; not sold w/o KBLED) */
105  PAD_NC(GPP_D3, NONE), /* BOARD_ID (unused; always high) */
106  PAD_NC(GPP_D4, NONE),
107  PAD_CFG_NF(GPP_D5, NONE, DEEP, NF1), /* SRCCLKREQ0# / SSD1_CLKREQ# (for SSD2!) */
108  PAD_CFG_NF(GPP_D6, NONE, DEEP, NF1), /* SRCCLKREQ1# / WLAN_CLKREQ# */
109  PAD_CFG_NF(GPP_D7, NONE, DEEP, NF1), /* SRCCLKREQ2# / CARD_CLKREQ# */
110  PAD_CFG_NF(GPP_D8, NONE, DEEP, NF1), /* SRCCLKREQ3# / SSD2_CLKREQ# (for SSD1!) */
111  PAD_CFG_GPO(GPP_D9, 1, DEEP), /* GPP_D9 / GPP_D13_RTD3 (SSD2) */
112  PAD_NC(GPP_D10, NONE),
113  PAD_NC(GPP_D11, NONE),
114  PAD_NC(GPP_D12, NONE),
115  PAD_NC(GPP_D13, NONE),
116  PAD_CFG_GPO(GPP_D14, 1, DEEP), /* GPP_D14 / SSD2_PWR_DN# */
117  PAD_NC(GPP_D15, NONE),
118  PAD_NC(GPP_D16, NONE),
119  PAD_NC(GPP_D17, NONE),
120  PAD_NC(GPP_D18, NONE),
121  PAD_NC(GPP_D19, NONE),
122 
123  /* ------- GPIO Group GPP_E ------- */
124  PAD_NC(GPP_E0, NONE),
125  PAD_CFG_GPO(GPP_E1, 0, DEEP), /* GPP_E1 / ROM_I2C_EN */
126  PAD_NC(GPP_E2, NONE),
127  PAD_NC(GPP_E3, NONE), /* SB_KBCRST# (eSPI Virtual Wire) */
128  PAD_NC(GPP_E4, NONE),
129  PAD_CFG_NF(GPP_E5, NONE, DEEP, NF1), /* DEVSLP1 */
130  PAD_NC(GPP_E6, NONE),
131  PAD_NC(GPP_E7, NONE),
132  PAD_NC(GPP_E8, NONE),
133  PAD_NC(GPP_E9, NONE),
134  PAD_NC(GPP_E10, NONE),
135  PAD_NC(GPP_E11, NONE),
136  PAD_NC(GPP_E12, NONE),
137  PAD_NC(GPP_E13, NONE),
138  PAD_CFG_NF(GPP_E14, NONE, DEEP, NF1), /* DDSP_HPDA / EDP_HPD */
139  PAD_NC(GPP_E15, NONE), /* SCI# (eSPI Virtual Wire) */
140  PAD_NC(GPP_E16, NONE), /* SMI# (eSPI Virtual Wire) */
141  PAD_NC(GPP_E17, NONE),
142  PAD_CFG_NF(GPP_E18, NONE, DEEP, NF2), /* TBT_LSX0_TXD */
143  PAD_CFG_NF(GPP_E19, NONE, DEEP, NF2), /* TBT_LSX0_RXD */
144  PAD_NC(GPP_E20, NONE), /* SWI# (eSPI Virtual Wire) */
145  PAD_NC(GPP_E21, NONE),
146  PAD_NC(GPP_E22, NONE),
147  PAD_NC(GPP_E23, NONE),
148 
149  /* ------- GPIO Group GPP_F ------- */
150  PAD_CFG_NF(GPP_F0, NONE, DEEP, NF1), /* CNV_BRI_DT / CNVI_BRI_DT */
151  PAD_CFG_NF(GPP_F1, UP_20K, DEEP, NF1), /* CNV_BRI_RSP / CNVI_BRI_RSP */
152  PAD_CFG_NF(GPP_F2, NONE, DEEP, NF1), /* CNV_RGI_DT / CNVI_RGI_DT */
153  PAD_CFG_NF(GPP_F3, UP_20K, DEEP, NF1), /* CNV_RGI_RSP / CNVI_RGI_RSP */
154  PAD_NC(GPP_F4, NONE),
155  PAD_NC(GPP_F5, NONE),
156  PAD_NC(GPP_F6, NONE),
157  PAD_NC(GPP_F7, NONE),
158  PAD_NC(GPP_F8, NONE),
159  PAD_NC(GPP_F9, NONE),
160  PAD_NC(GPP_F10, NONE),
161  PAD_NC(GPP_F11, NONE),
162  PAD_NC(GPP_F12, NONE),
163  PAD_NC(GPP_F13, NONE),
164  PAD_NC(GPP_F14, NONE),
165  PAD_NC(GPP_F15, NONE),
166  PAD_NC(GPP_F16, NONE),
167  PAD_CFG_GPI(GPP_F17, UP_20K, DEEP), /* GPP_F17 / TPM_DET# */
168  PAD_NC(GPP_F18, NONE),
169  PAD_NC(GPP_F19, NONE),
170  PAD_NC(GPP_F20, NONE),
171  PAD_NC(GPP_F21, NONE),
172  PAD_NC(GPP_F22, NONE),
173  PAD_NC(GPP_F23, NONE),
174 
175  /* ------- GPIO Group GPP_H ------- */
176  PAD_NC(GPP_H0, NONE),
177  PAD_NC(GPP_H1, NONE),
178  PAD_NC(GPP_H2, NONE),
179  PAD_NC(GPP_H3, NONE),
180  PAD_NC(GPP_H4, NONE),
181  PAD_NC(GPP_H5, NONE),
182  PAD_NC(GPP_H6, NONE),
183  PAD_NC(GPP_H7, NONE),
184  PAD_NC(GPP_H8, NONE),
185  PAD_NC(GPP_H9, NONE),
186  PAD_NC(GPP_H10, NONE),
187  PAD_NC(GPP_H11, NONE),
188  PAD_NC(GPP_H12, NONE),
189  PAD_NC(GPP_H13, NONE),
190  PAD_NC(GPP_H14, NONE),
191  PAD_NC(GPP_H15, NONE),
192  PAD_CFG_NF(GPP_H16, NONE, DEEP, NF1), /* DDPB_CTRLCLK / HDMI_CTRLCLK */
193  PAD_CFG_NF(GPP_H17, NONE, DEEP, NF1), /* DDPB_CTRLDATA / HDMI_CTRLDATA */
194  PAD_CFG_NF(GPP_H18, NONE, DEEP, NF1), /* CPU_C10_GATE# */
195  PAD_NC(GPP_H19, NONE), /* GPP_H19 / CNVI_WAKE#
196  (UART_WAKE# in M.2 spec; unused)
197  */
198  PAD_NC(GPP_H20, NONE),
199  PAD_NC(GPP_H21, NONE),
200  PAD_NC(GPP_H22, NONE),
201  PAD_NC(GPP_H23, NONE),
202 
203  /* ------- GPIO Group GPP_R ------- */
204  PAD_CFG_NF(GPP_R0, NONE, DEEP, NF1), /* HDA_BCLK / HDA_BITCLK */
205  PAD_CFG_NF(GPP_R1, NATIVE, DEEP, NF1), /* HDA_SYNC */
206  PAD_CFG_NF(GPP_R2, NATIVE, DEEP, NF1), /* HDA_SDO / HDA_SDOUT */
207  PAD_CFG_NF(GPP_R3, NATIVE, DEEP, NF1), /* HDA_SDI0 / HDA_SDIN0 */
208  PAD_CFG_NF(GPP_R4, NONE, DEEP, NF1), /* HDA_RST# / AZ_RST#_R */
209  PAD_NC(GPP_R5, NONE),
210  PAD_NC(GPP_R6, NONE),
211  PAD_NC(GPP_R7, NONE),
212 
213  /* ------- GPIO Group GPP_S ------- */
214  PAD_NC(GPP_S0, NONE),
215  PAD_NC(GPP_S1, NONE),
216  PAD_NC(GPP_S2, NONE),
217  PAD_NC(GPP_S3, NONE),
218  PAD_NC(GPP_S4, NONE),
219  PAD_NC(GPP_S5, NONE),
220  PAD_NC(GPP_S6, NONE),
221  PAD_NC(GPP_S7, NONE),
222 
223  /* ------- GPIO Group GPP_T ------- */
224  PAD_NC(GPP_T2, NONE),
225  PAD_NC(GPP_T3, NONE),
226 
227  /* ------- GPIO Group GPP_U ------- */
228  PAD_NC(GPP_U4, NONE),
229  PAD_NC(GPP_U5, NONE),
230 };
231 
233 {
235 }
#define GPD11
#define GPP_A4
#define GPP_H22
#define GPP_C15
#define GPP_T3
Definition: gpio_soc_defs.h:94
#define GPD3
#define GPP_H20
#define GPP_B6
Definition: gpio_soc_defs.h:59
#define GPP_H19
#define GPP_D1
#define GPD9
#define GPP_C2
#define GPP_D10
#define GPP_D8
#define GPP_D17
#define GPP_E3
#define GPP_A18
#define GPP_F21
#define GPP_C12
#define GPP_F12
#define GPP_F16
#define GPP_S4
#define GPP_H15
#define GPP_H16
#define GPP_R4
#define GPP_E0
#define GPP_R7
#define GPP_F6
#define GPP_H18
#define GPP_D14
#define GPP_B1
Definition: gpio_soc_defs.h:54
#define GPP_F20
#define GPP_S0
#define GPP_F23
#define GPP_C5
#define GPP_H11
#define GPP_A14
#define GPP_B12
Definition: gpio_soc_defs.h:65
#define GPP_H17
#define GPP_D12
#define GPP_S5
#define GPP_B16
Definition: gpio_soc_defs.h:69
#define GPP_A5
#define GPP_B2
Definition: gpio_soc_defs.h:55
#define GPP_D7
#define GPP_R3
#define GPP_B13
Definition: gpio_soc_defs.h:66
#define GPP_E6
#define GPP_F0
#define GPP_D6
#define GPP_A19
#define GPP_D2
#define GPP_H12
#define GPP_H6
#define GPP_C9
#define GPP_H2
#define GPP_C22
#define GPP_R6
#define GPP_H9
#define GPD0
#define GPP_D9
#define GPP_R0
#define GPP_F5
#define GPP_B15
Definition: gpio_soc_defs.h:68
#define GPP_E13
#define GPP_A2
#define GPP_H21
#define GPP_C23
#define GPP_H13
#define GPP_C8
#define GPP_S7
#define GPP_D11
#define GPP_H7
#define GPP_A6
#define GPP_H1
#define GPP_C11
#define GPP_H14
#define GPP_D5
#define GPP_B22
Definition: gpio_soc_defs.h:75
#define GPP_A23
#define GPP_C18
#define GPP_F9
#define GPP_S3
#define GPP_C13
#define GPP_E14
#define GPP_E23
#define GPP_E9
#define GPP_C17
#define GPP_E8
#define GPP_A7
#define GPP_E5
#define GPP_A0
#define GPD7
#define GPP_B8
Definition: gpio_soc_defs.h:61
#define GPP_S1
#define GPP_C20
#define GPP_B20
Definition: gpio_soc_defs.h:73
#define GPP_A20
#define GPP_A16
#define GPP_F1
#define GPP_F17
#define GPP_A12
#define GPP_F15
#define GPP_D4
#define GPP_C10
#define GPP_C6
#define GPD2
#define GPP_F10
#define GPP_A3
#define GPP_E7
#define GPP_C16
#define GPP_F7
#define GPD1
#define GPP_F13
#define GPP_C4
#define GPP_D18
#define GPP_S6
#define GPP_B19
Definition: gpio_soc_defs.h:72
#define GPP_E17
#define GPP_E2
#define GPP_E19
#define GPP_H0
#define GPP_H5
#define GPP_C21
#define GPP_R2
#define GPP_B9
Definition: gpio_soc_defs.h:62
#define GPD10
#define GPP_E18
#define GPP_F14
#define GPP_H3
#define GPP_F4
#define GPP_A10
#define GPP_A8
#define GPP_D0
#define GPP_A1
#define GPP_B14
Definition: gpio_soc_defs.h:67
#define GPP_B11
Definition: gpio_soc_defs.h:64
#define GPP_D13
#define GPP_B18
Definition: gpio_soc_defs.h:71
#define GPP_B5
Definition: gpio_soc_defs.h:58
#define GPP_B0
Definition: gpio_soc_defs.h:53
#define GPP_A11
#define GPP_R5
#define GPP_C14
#define GPP_E20
#define GPP_A15
#define GPP_A9
#define GPP_E10
#define GPP_F8
#define GPP_C19
#define GPD8
#define GPP_A13
#define GPP_S2
#define GPP_A21
#define GPP_B23
Definition: gpio_soc_defs.h:76
#define GPP_E15
#define GPP_B10
Definition: gpio_soc_defs.h:63
#define GPP_E16
#define GPP_D19
#define GPP_T2
Definition: gpio_soc_defs.h:93
#define GPP_C1
#define GPP_F2
#define GPP_E11
#define GPD6
#define GPP_F18
#define GPP_B3
Definition: gpio_soc_defs.h:56
#define GPP_A22
#define GPP_F22
#define GPP_D15
#define GPP_F11
#define GPP_B21
Definition: gpio_soc_defs.h:74
#define GPD4
#define GPP_B4
Definition: gpio_soc_defs.h:57
#define GPP_D16
#define GPP_F3
#define GPP_E22
#define GPP_H10
#define GPP_E21
#define GPP_C3
#define GPP_E12
#define GPP_A17
#define GPP_B17
Definition: gpio_soc_defs.h:70
#define GPP_E4
#define GPP_C0
#define GPD5
#define GPP_E1
#define GPP_H8
#define GPP_F19
#define GPP_H4
#define GPP_H23
#define GPP_B7
Definition: gpio_soc_defs.h:60
#define GPP_C7
#define GPP_D3
#define GPP_R1
#define ARRAY_SIZE(a)
Definition: helpers.h:12
#define GPP_U5
#define GPP_U4
void variant_configure_gpios(void)
Definition: gpio.c:238
static const struct pad_config gpio_table[]
Definition: gpio.c:8
void gpio_configure_pads(const struct soc_amd_gpio *gpio_list_ptr, size_t size)
program a particular set of GPIO
Definition: gpio.c:307
#define PAD_NC(pin)
Definition: gpio_defs.h:263
#define PAD_CFG_GPI(pad, pull, rst)
Definition: gpio_defs.h:284
#define PAD_CFG_NF(pad, pull, rst, func)
Definition: gpio_defs.h:197
#define PAD_CFG_GPO(pad, val, rst)
Definition: gpio_defs.h:247
#define PAD_CFG_GPI_APIC_LOW(pad, pull, rst)
Definition: gpio_defs.h:402