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, UP_20K),
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, UP_20K),
17  PAD_NC(GPD7, NONE),
18  PAD_CFG_NF(GPD8, NONE, DEEP, NF1), /* SUSCLK / SUS_CLK */
19  PAD_NC(GPD9, UP_20K),
20  PAD_NC(GPD10, UP_20K),
21  PAD_NC(GPD11, UP_20K),
22 
23  /* ------- GPIO Group GPP_A ------- */
24  PAD_CFG_NF(GPP_A0, NONE, DEEP, NF1), /* RCIN# / SB_KBCRST# */
25  PAD_CFG_NF(GPP_A1, NATIVE, DEEP, NF1), /* LAD0 / LPC_AD0 */
26  PAD_CFG_NF(GPP_A2, NATIVE, DEEP, NF1), /* LAD1 / LPC_AD1 */
27  PAD_CFG_NF(GPP_A3, NATIVE, DEEP, NF1), /* LAD2 / LPC_AD2 */
28  PAD_CFG_NF(GPP_A4, NATIVE, DEEP, NF1), /* LAD3 / LPC_AD3 */
29  PAD_CFG_NF(GPP_A5, NONE, DEEP, NF1), /* LFRAME# / LPC_FRAME# */
30  PAD_CFG_NF(GPP_A6, NONE, DEEP, NF1), /* SERIRQ */
31  PAD_CFG_NF(GPP_A7, NONE, DEEP, NF1), /* PIRQA# / TPM_PIRQ# */
32  PAD_CFG_NF(GPP_A8, NONE, DEEP, NF1), /* CLKRUN# / PM_CLKRUN#
33  Note: R209 is populated despite being
34  marked no-stuff in schematic
35  */
36  PAD_CFG_NF(GPP_A9, DN_20K, DEEP, NF1), /* CLKOUT_LPC0 / PCLK_KBC */
37  PAD_NC(GPP_A10, UP_20K),
38  PAD_NC(GPP_A11, NONE), /* INTP_OUT (unknown and unused) */
39  PAD_NC(GPP_A12, UP_20K),
40  PAD_NC(GPP_A13, UP_20K), /* SUSWARN#
41  (unused due to missing DeepSx support)
42  */
43  PAD_NC(GPP_A14, UP_20K),
44  PAD_NC(GPP_A15, UP_20K),
45  PAD_NC(GPP_A16, UP_20K),
46  PAD_NC(GPP_A17, NONE), /* LEDKB_DET#
47  (unused in cb; all devices of that
48  model have KB LED)
49  */
50  PAD_NC(GPP_A18, UP_20K),
51  PAD_NC(GPP_A19, UP_20K),
52  PAD_CFG_GPO(GPP_A20, 0, DEEP), /* GPP_A20 / TEST_R */
53  PAD_NC(GPP_A21, UP_20K),
54  PAD_NC(GPP_A22, UP_20K),
55  PAD_NC(GPP_A23, UP_20K),
56 
57  /* ------- GPIO Group GPP_B ------- */
58  PAD_NC(GPP_B0, UP_20K),
59  PAD_NC(GPP_B1, UP_20K),
60  PAD_NC(GPP_B2, UP_20K), /* CNVI_WAKE#
61  (UART_WAKE# in M.2 spec; unused)
62  */
63  PAD_CFG_GPI_APIC_LOW(GPP_B3, NONE, PLTRST), /* GPP_B3 (touchpad interrupt) */
64  PAD_NC(GPP_B4, UP_20K),
65  PAD_NC(GPP_B5, UP_20K),
66  PAD_NC(GPP_B6, UP_20K),
67  PAD_CFG_NF(GPP_B7, NONE, DEEP, NF1), /* SRCCLKREQ2# / WLAN_CLKREQ# */
68  PAD_CFG_NF(GPP_B8, NONE, DEEP, NF1), /* SRCCLKREQ3# / CARD_CLKREQ# */
69  PAD_CFG_NF(GPP_B9, NONE, DEEP, NF1), /* SRCCLKREQ4# / SSD2_CLKREQ# */
70  PAD_CFG_NF(GPP_B10, NONE, DEEP, NF1), /* SRCCLKREQ5# / SSD1_CLKREQ# */
72  PAD_CFG_NF(GPP_B12, NONE, DEEP, NF1), /* SLP_S0# */
73  PAD_CFG_NF(GPP_B13, NONE, DEEP, NF1), /* PLT_RST# */
74  PAD_CFG_NF(GPP_B14, NONE, DEEP, NF1), /* SPKR / PCH_SPKR */
75  PAD_NC(GPP_B15, UP_20K),
76  PAD_NC(GPP_B16, UP_20K),
78  PAD_NC(GPP_B18, UP_20K),
79  PAD_NC(GPP_B19, UP_20K),
80  PAD_NC(GPP_B20, UP_20K),
81  PAD_NC(GPP_B21, UP_20K),
82  PAD_NC(GPP_B22, UP_20K),
83  PAD_NC(GPP_B23, UP_20K),
84 
85  /* ------- GPIO Group GPP_C ------- */
86  PAD_CFG_NF(GPP_C0, NONE, DEEP, NF1), /* SMBCLK / SMB_CLK_DDR */
87  PAD_CFG_NF(GPP_C1, NONE, DEEP, NF1), /* SMBDATA / SMB_DAT_DDR */
88  PAD_NC(GPP_C2, UP_20K),
89  PAD_NC(GPP_C3, UP_20K),
90  PAD_NC(GPP_C4, UP_20K),
91  PAD_NC(GPP_C5, UP_20K),
92  PAD_NC(GPP_C6, UP_20K),
93  PAD_NC(GPP_C7, UP_20K),
94  PAD_NC(GPP_C8, UP_20K),
95  PAD_NC(GPP_C9, UP_20K),
96  PAD_NC(GPP_C10, UP_20K),
97  PAD_NC(GPP_C11, UP_20K),
98  PAD_NC(GPP_C12, UP_20K),
99  PAD_CFG_GPO(GPP_C13, 1, PLTRST), /* GPP_C13 / SSD1_PWR_DN# */
100  PAD_NC(GPP_C14, UP_20K),
101  PAD_NC(GPP_C15, UP_20K),
102  PAD_CFG_NF(GPP_C16, NONE, DEEP, NF1), /* I2C0_SDA / T_SDA */
103  PAD_CFG_NF(GPP_C17, NONE, DEEP, NF1), /* I2C0_SCL / T_SCL */
104  PAD_NC(GPP_C18, UP_20K),
105  PAD_NC(GPP_C19, UP_20K),
106  PAD_CFG_NF(GPP_C20, NONE, DEEP, NF1), /* UART2_RXD */
107  PAD_CFG_NF(GPP_C21, NONE, DEEP, NF1), /* UART2_TXD */
108  PAD_NC(GPP_C22, UP_20K),
109  PAD_NC(GPP_C23, UP_20K),
110 
111  /* ------- GPIO Group GPP_D ------- */
112  PAD_NC(GPP_D0, UP_20K),
113  PAD_NC(GPP_D1, UP_20K),
114  PAD_NC(GPP_D2, UP_20K),
115  PAD_NC(GPP_D3, UP_20K),
116  PAD_NC(GPP_D4, UP_20K),
117  PAD_NC(GPP_D5, UP_20K),
118  PAD_NC(GPP_D6, UP_20K),
119  PAD_NC(GPP_D7, UP_20K),
120  PAD_CFG_GPO(GPP_D8, 1, DEEP), /* SB_BLON */
121  PAD_CFG_GPI_SCI_LOW(GPP_D9, NONE, DEEP, LEVEL), /* EC SWI# */
122  PAD_NC(GPP_D10, NONE), /* DDR_TYPE_D10
123  (unused; there is only one on-board
124  ram type/model)
125  */
126  PAD_NC(GPP_D11, NONE), /* BOARD_ID
127  (unused in cb; we already know the
128  device model)
129  */
130  PAD_NC(GPP_D12, UP_20K),
131  PAD_NC(GPP_D13, UP_20K),
132  PAD_CFG_GPO(GPP_D14, 1, PLTRST), /* SSD2_PWR_DN# */
133  PAD_NC(GPP_D15, UP_20K),
134  PAD_NC(GPP_D16, UP_20K),
135  PAD_NC(GPP_D17, UP_20K),
136  PAD_NC(GPP_D18, UP_20K),
137  PAD_NC(GPP_D19, UP_20K),
138  PAD_NC(GPP_D20, UP_20K),
139  PAD_NC(GPP_D21, NONE), /* TPM_DET#
140  (currently unused in cb; there seem
141  to be no devices without TPM)
142  */
143  PAD_NC(GPP_D22, NONE), /* DDR_TYPE_D22
144  (unused in cb; there is only one
145  on-board ram type)
146  */
147  PAD_NC(GPP_D23, UP_20K),
148 
149  /* ------- GPIO Group GPP_E ------- */
150  PAD_NC(GPP_E0, UP_20K),
151  PAD_CFG_NF(GPP_E1, NONE, DEEP, NF1), /* SATAXPCIE1 / SATAGP1 */
152  PAD_CFG_NF(GPP_E2, NONE, DEEP, NF1), /* SATAXPCIE2 / SATAGP2 */
153  PAD_NC(GPP_E3, UP_20K),
154  PAD_NC(GPP_E4, UP_20K),
155  PAD_CFG_NF(GPP_E5, NONE, DEEP, NF1), /* DEVSLP1 */
156  PAD_CFG_NF(GPP_E6, NONE, DEEP, NF1), /* DEVSLP2 */
157  PAD_NC(GPP_E7, UP_20K),
158  PAD_NC(GPP_E8, NONE),
159  PAD_NC(GPP_E9, NONE),
160  PAD_NC(GPP_E10, NONE),
161  PAD_NC(GPP_E11, NONE),
162  PAD_NC(GPP_E12, NONE),
163  PAD_CFG_NF(GPP_E13, NONE, DEEP, NF1), /* DDPB_HPD0 / MUX_HPD */
164  PAD_CFG_NF(GPP_E14, NONE, DEEP, NF1), /* DDPC_HPD1 / HDMI_HPD */
165  PAD_CFG_GPI_SMI_LOW(GPP_E15, NONE, DEEP, EDGE_SINGLE), /* EC SMI# */
166  PAD_CFG_GPI_SCI_LOW(GPP_E16, NONE, PLTRST, LEVEL), /* EC SCI# */
167  PAD_CFG_NF(GPP_E17, NONE, DEEP, NF1), /* EDP_HPD */
168  PAD_NC(GPP_E18, UP_20K),
169  PAD_NC(GPP_E19, NONE),
170  PAD_CFG_NF(GPP_E20, NONE, DEEP, NF1), /* DPPC_CTRLCLK / HDMI_CTRLCLK */
171  PAD_CFG_NF(GPP_E21, NONE, DEEP, NF1), /* DPPC_CTRLDATA / HDMI_CTRLDATA */
172  PAD_NC(GPP_E22, UP_20K),
173  PAD_NC(GPP_E23, UP_20K),
174 
175  /* ------- GPIO Group GPP_F ------- */
176  PAD_NC(GPP_F0, UP_20K),
177  PAD_NC(GPP_F1, UP_20K),
178  PAD_NC(GPP_F2, UP_20K),
179  PAD_NC(GPP_F3, UP_20K),
180  PAD_CFG_NF(GPP_F4, NONE, DEEP, NF1), /* CNV_BRI_DT / CNVI_BRI_DT */
181  PAD_CFG_NF(GPP_F5, UP_20K, DEEP, NF1), /* CNV_BRI_RSP / CNVI_BRI_RSP */
182  PAD_CFG_NF(GPP_F6, NONE, DEEP, NF1), /* CNV_RGI_DT / CNVI_RGI_DT */
183  PAD_CFG_NF(GPP_F7, UP_20K, DEEP, NF1), /* CNV_RGI_RSP / CNVI_RGI_RSP */
184  PAD_NC(GPP_F8, UP_20K),
185  PAD_NC(GPP_F9, UP_20K),
186  PAD_NC(GPP_F10, UP_20K),
187  PAD_NC(GPP_F11, UP_20K),
188  PAD_NC(GPP_F12, UP_20K),
189  PAD_NC(GPP_F13, UP_20K),
190  PAD_NC(GPP_F14, UP_20K),
191  PAD_NC(GPP_F15, UP_20K),
192  PAD_NC(GPP_F16, UP_20K),
193  PAD_NC(GPP_F17, UP_20K),
194  PAD_NC(GPP_F18, UP_20K),
195  PAD_NC(GPP_F19, UP_20K),
196  PAD_NC(GPP_F20, UP_20K),
197  PAD_NC(GPP_F21, UP_20K),
198  PAD_NC(GPP_F22, UP_20K),
199  PAD_NC(GPP_F23, NONE),
200 
201  /* ------- GPIO Group GPP_G ------- */
202  PAD_NC(GPP_G0, UP_20K),
203  PAD_NC(GPP_G1, UP_20K),
204  PAD_NC(GPP_G2, UP_20K),
205  PAD_NC(GPP_G3, UP_20K),
206  PAD_NC(GPP_G4, UP_20K),
207  PAD_NC(GPP_G5, UP_20K),
208  PAD_NC(GPP_G6, UP_20K),
209  PAD_NC(GPP_G7, UP_20K),
210 
211  /* ------- GPIO Group GPP_H ------- */
212  PAD_NC(GPP_H0, UP_20K),
213  PAD_CFG_NF(GPP_H1, NONE, DEEP, NF3), /* CNV_RF_RESET# / CNVI_RST# */
214  PAD_CFG_NF(GPP_H2, DN_20K, DEEP, NF3), /* MODEM_CLKREQ / CNVI_CLKREQ */
215  PAD_NC(GPP_H3, UP_20K),
216  PAD_CFG_NF(GPP_H4, NONE, DEEP, NF1), /* I2C2_SDA / SMD_7411 */
217  PAD_CFG_NF(GPP_H5, NONE, DEEP, NF1), /* I2C2_SCL / SMC_7411 */
218  PAD_NC(GPP_H6, UP_20K),
219  PAD_NC(GPP_H7, UP_20K),
220  PAD_NC(GPP_H8, UP_20K),
221  PAD_NC(GPP_H9, UP_20K),
222  PAD_NC(GPP_H10, UP_20K),
223  PAD_NC(GPP_H11, UP_20K),
224  PAD_NC(GPP_H12, UP_20K),
225  PAD_NC(GPP_H13, UP_20K),
226  PAD_NC(GPP_H14, UP_20K),
227  PAD_NC(GPP_H15, UP_20K),
228  PAD_NC(GPP_H16, UP_20K),
229  PAD_NC(GPP_H17, UP_20K),
230  PAD_CFG_NF(GPP_H18, NONE, DEEP, NF1), /* CPU_C10_GATE# */
231  PAD_NC(GPP_H19, UP_20K),
232  PAD_NC(GPP_H20, UP_20K),
233  PAD_NC(GPP_H21, NONE),
234  PAD_NC(GPP_H22, UP_20K),
235  PAD_NC(GPP_H23, UP_20K),
236 };
237 
239 {
241 }
#define GPD11
#define GPP_A4
#define GPP_H22
#define GPP_C15
#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_H15
#define GPP_H16
#define GPP_E0
#define GPP_F6
#define GPP_H18
#define GPP_D14
#define GPP_B1
Definition: gpio_soc_defs.h:54
#define GPP_F20
#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_B16
Definition: gpio_soc_defs.h:69
#define GPP_A5
#define GPP_B2
Definition: gpio_soc_defs.h:55
#define GPP_D7
#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_H9
#define GPD0
#define GPP_D9
#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_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_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_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_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_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_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_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_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 ARRAY_SIZE(a)
Definition: helpers.h:12
#define GPP_D23
#define GPP_G1
Definition: gpio_soc_defs.h:89
#define GPP_G7
Definition: gpio_soc_defs.h:95
#define GPP_D22
#define GPP_G4
Definition: gpio_soc_defs.h:92
#define GPP_G2
Definition: gpio_soc_defs.h:90
#define GPP_D21
#define GPP_G6
Definition: gpio_soc_defs.h:94
#define GPP_G0
Definition: gpio_soc_defs.h:88
#define GPP_D20
#define GPP_G3
Definition: gpio_soc_defs.h:91
#define GPP_G5
Definition: gpio_soc_defs.h:93
static const struct pad_config gpio_table[]
Definition: gpio.c:8
void variant_configure_gpios(void)
Definition: gpio.c:238
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_SCI_LOW(pad, pull, rst, trig)
Definition: gpio_defs.h:452
#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_SMI_LOW(pad, pull, rst, trig)
Definition: gpio_defs.h:425
#define PAD_CFG_GPI_APIC_LOW(pad, pull, rst)
Definition: gpio_defs.h:402