payloads/edk2: Disable the CPU Timer Lib unless supported
[coreboot.git] / src / mainboard / system76 / oryp5 / gpio.c
blob02cb3c0f18212370dad7226244bf5ca6b5c512d8
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <mainboard/gpio.h>
4 #include <soc/gpe.h>
5 #include <soc/gpio.h>
7 static const struct pad_config gpio_table[] = {
8 /* ------- GPIO Group GPD ------- */
9 PAD_CFG_NF(GPD0, NONE, DEEP, NF1), // PM_BATLOW#
10 PAD_CFG_NF(GPD1, NATIVE, DEEP, NF1), // AC_PRESENT
11 PAD_CFG_GPI(GPD2, NATIVE, PWROK), // LAN_WAKEUP#
12 PAD_CFG_NF(GPD3, UP_20K, DEEP, NF1), // PWR_BTN#
13 PAD_CFG_NF(GPD4, NONE, DEEP, NF1), // SUSB#_PCH
14 PAD_CFG_NF(GPD5, NONE, DEEP, NF1), // SUSC#_PCH
15 PAD_NC(GPD6, NONE),
16 PAD_CFG_GPI(GPD7, UP_20K, PWROK), /* GPD_7 (crystal input
17 low = single ended,
18 high = differential)
20 PAD_CFG_NF(GPD8, NONE, DEEP, NF1), // PCH_SUSCLK
21 PAD_NC(GPD9, NONE),
22 PAD_NC(GPD10, NONE),
23 PAD_CFG_GPO(GPD11, 1, DEEP), // LAN_DISABLE#
25 /* ------- GPIO Group GPP_A ------- */
26 PAD_CFG_NF(GPP_A0, NONE, DEEP, NF1), // SB_KBCRST#
27 PAD_CFG_NF(GPP_A1, NONE, DEEP, NF1), // LPC_AD0
28 PAD_CFG_NF(GPP_A2, NONE, DEEP, NF1), // LPC_AD1
29 PAD_CFG_NF(GPP_A3, NONE, DEEP, NF1), // LPC_AD2
30 PAD_CFG_NF(GPP_A4, NONE, DEEP, NF1), // LPC_AD3
31 PAD_CFG_NF(GPP_A5, NONE, DEEP, NF1), // LPC_FRAME#
32 PAD_CFG_NF(GPP_A6, NONE, DEEP, NF1), // SERIRQ
33 PAD_CFG_NF(GPP_A7, NONE, DEEP, NF1), // LPC_PIRQA#
34 PAD_CFG_NF(GPP_A8, NONE, DEEP, NF1), // PM_CLKRUN#
35 PAD_CFG_NF(GPP_A9, NONE, DEEP, NF1), // PCLK_KBC
36 PAD_NC(GPP_A10, NONE),
37 PAD_CFG_GPI_APIC_HIGH(GPP_A11, NONE, PLTRST), // INTP_OUT
38 PAD_NC(GPP_A12, NONE),
39 PAD_NC(GPP_A13, NONE), // SUSWARN# (test point)
40 PAD_NC(GPP_A14, NONE), // (test point)
41 PAD_NC(GPP_A15, NONE), // SUS_PWR_ACK# (test point)
42 PAD_NC(GPP_A16, NONE),
43 PAD_NC(GPP_A17, NONE),
44 PAD_NC(GPP_A18, NONE),
45 PAD_CFG_GPO(GPP_A19, 1, DEEP), // SB_BLON
46 PAD_CFG_GPI(GPP_A20, NONE, DEEP), // PEX_WAKE#
47 PAD_NC(GPP_A21, NONE),
48 PAD_CFG_GPO(GPP_A22, 1, DEEP), // WLAN_SSD2_GPIO1
49 PAD_CFG_GPO(GPP_A23, 1, DEEP), // WLAN_SSD2_GPIO
51 /* ------- GPIO Group GPP_B ------- */
52 PAD_CFG_GPI(GPP_B0, UP_20K, DEEP), // TPM_PIRQ#
53 PAD_NC(GPP_B1, NONE),
54 PAD_NC(GPP_B2, NONE),
55 PAD_CFG_GPO(GPP_B3, 1, DEEP), // BT_RF_KILL_R_N
56 PAD_CFG_GPO(GPP_B4, 1, DEEP), // WIFI_RF_KILL_R_N
57 PAD_NC(GPP_B5, NONE),
58 PAD_NC(GPP_B6, NONE),
59 PAD_CFG_GPO(GPP_B7, 1, PLTRST), // CR_GPIO_RST#
60 PAD_CFG_GPO(GPP_B8, 1, PLTRST), // CR_GPIO_WAKE#
61 PAD_NC(GPP_B9, NONE),
62 PAD_NC(GPP_B10, NONE),
63 PAD_NC(GPP_B11, NONE),
64 PAD_CFG_GPI(GPP_B12, UP_20K, DEEP), // SLP_S0#
65 PAD_CFG_NF(GPP_B13, NONE, DEEP, NF1), // PLT_RST#
66 PAD_CFG_NF(GPP_B14, NONE, DEEP, NF1), // PCH_SPKR
67 PAD_NC(GPP_B15, NONE),
68 PAD_NC(GPP_B16, NONE),
69 PAD_NC(GPP_B17, NONE),
70 PAD_NC(GPP_B18, NONE), // LPSS_GSPI0_MOSI (test point)
71 PAD_NC(GPP_B19, NONE),
72 PAD_CFG_GPI_SMI(GPP_B20, NONE, DEEP, EDGE_SINGLE, NONE), // SMI#
73 PAD_NC(GPP_B21, NONE),
74 PAD_CFG_GPI(GPP_B22, UP_20K, DEEP), // LPSS_GSPI1_MOSI
75 PAD_CFG_GPI_SCI_LOW(GPP_B23, UP_20K, PLTRST, LEVEL), // SCI#
77 /* ------- GPIO Group GPP_C ------- */
78 PAD_CFG_NF(GPP_C0, NONE, DEEP, NF1), // SMB_CLK
79 PAD_CFG_NF(GPP_C1, NONE, DEEP, NF1), // SMB_DATA
80 PAD_CFG_GPI(GPP_C2, UP_20K, DEEP), // GPP_C2_BT_UART_WAKE_N
81 PAD_NC(GPP_C3, NONE),
82 PAD_NC(GPP_C4, NONE),
83 PAD_CFG_GPI(GPP_C5, UP_20K, DEEP), // M.2_WLAN_WIFI_WAKE_N
84 PAD_CFG_GPI(GPP_C6, UP_20K, DEEP), // SMC_CPU_THERM
85 PAD_CFG_GPI(GPP_C7, UP_20K, DEEP), // SMD_CPU_THERM
86 PAD_CFG_GPI(GPP_C8, NONE, DEEP), // TPM_DET
87 PAD_CFG_GPI(GPP_C9, DN_20K, DEEP), // BOARD_ID1
88 PAD_CFG_GPI(GPP_C10, DN_20K, DEEP), // BOARD_ID2
89 PAD_CFG_GPI(GPP_C11, DN_20K, DEEP), // BOARD_ID3
90 PAD_CFG_GPI(GPP_C12, NONE, DEEP), // GC6_FB_EN_PCH
91 PAD_CFG_GPO(GPP_C13, 1, DEEP), // GPU_EVENT#
92 PAD_CFG_GPO(GPP_C14, 1, DEEP), // M.2_PLT_RST_CNTRL1#
93 PAD_CFG_GPO(GPP_C15, 1, DEEP), // M.2_PLT_RST_CNTRL2#
94 PAD_CFG_NF(GPP_C16, NONE, PLTRST, NF1), // I2C_SDA_TP
95 PAD_CFG_NF(GPP_C17, NONE, PLTRST, NF1), // I2C_SCL_TP
96 PAD_CFG_NF(GPP_C18, NONE, PLTRST, NF1), // SMD_7411_I2C
97 PAD_CFG_NF(GPP_C19, NONE, PLTRST, NF1), // SMC_7411_I2C
98 //PAD_CFG_NF(GPP_C20, NONE, DEEP, NF1), // UART2_RXD
99 //PAD_CFG_NF(GPP_C21, NONE, DEEP, NF1), // UART2_TXD
100 PAD_CFG_NF(GPP_C22, UP_20K, DEEP, NF1), // UART2_RTS# / LAN_PLT_RST#
101 PAD_CFG_NF(GPP_C23, UP_20K, DEEP, NF1), // BOARD_ID4
103 /* ------- GPIO Group GPP_D ------- */
104 PAD_NC(GPP_D0, NONE),
105 PAD_NC(GPP_D1, NONE),
106 PAD_NC(GPP_D2, NONE),
107 PAD_NC(GPP_D3, NONE),
108 PAD_NC(GPP_D4, NONE),
109 PAD_CFG_NF(GPP_D5, NONE, DEEP, NF3), // M.2_BT_PCMFRM_CRF_RST_N
110 PAD_CFG_NF(GPP_D6, NONE, DEEP, NF3), // M.2_BT_PCMOUT_CLKREQ0
111 PAD_CFG_GPI(GPP_D7, UP_20K, DEEP), // M.2_BT_PCMIN
112 PAD_CFG_GPI(GPP_D8, UP_20K, DEEP), // M.2_BT_PCMCLK
113 PAD_NC(GPP_D9, NONE),
114 PAD_NC(GPP_D10, NONE),
115 PAD_NC(GPP_D11, NONE),
116 PAD_NC(GPP_D12, NONE),
117 PAD_NC(GPP_D13, NONE), // 10k pull up
118 PAD_NC(GPP_D14, NONE), // 10k pull up
119 PAD_NC(GPP_D15, NONE),
120 PAD_NC(GPP_D16, NONE),
121 PAD_NC(GPP_D17, NONE),
122 PAD_NC(GPP_D18, NONE),
123 PAD_NC(GPP_D19, NONE),
124 PAD_NC(GPP_D20, NONE),
125 PAD_NC(GPP_D21, NONE),
126 PAD_NC(GPP_D22, NONE),
127 PAD_NC(GPP_D23, NONE),
129 /* ------- GPIO Group GPP_E ------- */
130 PAD_NC(GPP_E0, NONE),
131 PAD_CFG_NF(GPP_E1, NONE, DEEP, NF1), // SATAGP1 / M.2_SSD1_PEDET
132 PAD_NC(GPP_E2, NONE),
133 PAD_NC(GPP_E3, NONE),
134 PAD_NC(GPP_E4, NONE),
135 PAD_CFG_GPI(GPP_E5, UP_20K, DEEP), // M2_P0_SATA_DEVSLP
136 PAD_NC(GPP_E6, NONE),
137 PAD_CFG_GPI_APIC_EDGE_LOW(GPP_E7, NONE, PLTRST), // TP_ATTN#
138 PAD_CFG_NF(GPP_E8, NONE, DEEP, NF1), // PCH_SATAHDD_LED#
139 PAD_NC(GPP_E9, NONE), // USB_OC0# (test point)
140 PAD_NC(GPP_E10, NONE), // USB_OC1# (test point)
141 PAD_NC(GPP_E11, NONE), // USB_OC2# (test point)
142 PAD_NC(GPP_E12, NONE), // USB_OC3# (test point)
144 /* ------- GPIO Group GPP_F ------- */
145 PAD_NC(GPP_F0, NONE),
146 PAD_CFG_NF(GPP_F1, NONE, DEEP, NF1), // SATAGP4 / M.2_SSD2_PEDET
147 PAD_NC(GPP_F2, NONE),
148 PAD_NC(GPP_F3, NONE),
149 PAD_NC(GPP_F4, NONE),
150 PAD_NC(GPP_F5, NONE),
151 PAD_CFG_NF(GPP_F6, NONE, DEEP, NF1), // M2_P4_SATA_DEVSLP
152 PAD_NC(GPP_F7, NONE),
153 PAD_NC(GPP_F8, NONE),
154 PAD_NC(GPP_F9, NONE),
155 PAD_CFG_GPI(GPP_F10, UP_20K, DEEP), // BIOS_REC
156 PAD_CFG_GPI(GPP_F11, UP_20K, DEEP), // GPP_F11
157 PAD_NC(GPP_F12, NONE),
158 PAD_CFG_GPI(GPP_F13, UP_20K, DEEP), // GP39_GFX_CRB_DETECT
159 PAD_CFG_GPI(GPP_F14, UP_20K, DEEP), // H_SKTOCC_N
160 PAD_NC(GPP_F15, NONE), // USB_OC4# (test point)
161 PAD_NC(GPP_F16, NONE),
162 PAD_NC(GPP_F17, NONE),
163 PAD_NC(GPP_F18, NONE), // USB_OC7# (test point)
164 PAD_CFG_NF(GPP_F19, NONE, DEEP, NF1), // NB_ENAVDD
165 PAD_CFG_NF(GPP_F20, NONE, DEEP, NF1), // BLON
166 PAD_CFG_NF(GPP_F21, NONE, DEEP, NF1), // EDP_BRIGHTNESS
167 // GPP_F22 (DGPU_RST#_PCH) configured in bootblock
168 // GPP_F23 (DGPU_PWR_EN) configured in bootblock
170 /* ------- GPIO Group GPP_G ------- */
171 PAD_NC(GPP_G0, NONE),
172 PAD_CFG_NF(GPP_G1, NONE, DEEP, NF1), // CNVI_WIGIG_DET#
173 PAD_NC(GPP_G2, NONE),
174 PAD_NC(GPP_G3, NONE),
175 PAD_NC(GPP_G4, NONE),
176 PAD_NC(GPP_G5, NONE),
177 PAD_CFG_GPI_SCI_LOW(GPP_G6, NONE, DEEP, LEVEL), // SWI#
178 PAD_NC(GPP_G7, NONE),
180 /* ------- GPIO Group GPP_H ------- */
181 PAD_NC(GPP_H0, NONE),
182 PAD_NC(GPP_H1, NONE),
183 PAD_CFG_NF(GPP_H2, NONE, DEEP, NF1), // CLK_REQ9_PEG#
184 PAD_NC(GPP_H3, NONE),
185 PAD_NC(GPP_H4, NONE),
186 PAD_CFG_NF(GPP_H5, NONE, DEEP, NF1), // CLK_REQ12_SSD2#
187 PAD_CFG_NF(GPP_H6, NONE, DEEP, NF1), // CLK_REQ13_SSD1#
188 PAD_CFG_NF(GPP_H7, NONE, DEEP, NF1), // GPP_H_0_SRCCLKREQB_14
189 PAD_CFG_NF(GPP_H8, NONE, DEEP, NF1), // CLK_REQ15_LAN#
190 PAD_CFG_NF(GPP_H9, NONE, DEEP, NF1), // CLK_REQ16_CARD#
191 PAD_NC(GPP_H10, NONE),
192 PAD_NC(GPP_H11, NONE),
193 PAD_NC(GPP_H12, NONE), // GPP_H_12 (test point)
194 PAD_NC(GPP_H13, NONE),
195 PAD_NC(GPP_H14, NONE),
196 PAD_NC(GPP_H15, NONE), // GPP_H15 (reserved)
197 PAD_NC(GPP_H16, NONE),
198 PAD_NC(GPP_H17, NONE),
199 PAD_NC(GPP_H18, NONE),
200 PAD_CFG_GPI(GPP_H19, UP_20K, DEEP), // GPIO_CARD1
201 PAD_CFG_GPI(GPP_H20, UP_20K, DEEP), // GPIO_CARD
202 PAD_CFG_GPI(GPP_H21, DN_20K, DEEP), // 4.7k pull up, 20k pull down
203 PAD_NC(GPP_H22, NONE),
204 PAD_NC(GPP_H23, NONE),
206 /* ------- GPIO Group GPP_I ------- */
207 PAD_CFG_GPI_SCI_LOW(GPP_I0, NONE, DEEP, EDGE_BOTH), // G_DP_DHPD_A
208 PAD_CFG_GPI_SCI_LOW(GPP_I1, NONE, DEEP, EDGE_BOTH), // HDMI_HPD
209 PAD_CFG_GPI_SCI_LOW(GPP_I2, NONE, DEEP, EDGE_BOTH), // G_DP_DHPD_E
210 PAD_NC(GPP_I3, NONE),
211 PAD_CFG_NF(GPP_I4, NONE, DEEP, NF1), // EDP_HDP
212 PAD_NC(GPP_I5, NONE),
213 PAD_NC(GPP_I6, NONE),
214 PAD_NC(GPP_I7, NONE),
215 PAD_NC(GPP_I8, NONE),
216 PAD_NC(GPP_I9, NONE),
217 PAD_NC(GPP_I10, NONE),
218 PAD_CFG_GPI(GPP_I11, UP_20K, DEEP), // H_SKTOCC_N
219 PAD_CFG_GPO(GPP_I12, 1, DEEP), // SATA_PWR_EN
220 PAD_NC(GPP_I13, NONE),
221 PAD_NC(GPP_I14, NONE),
223 /* ------- GPIO Group GPP_J ------- */
224 PAD_CFG_NF(GPP_J0, NONE, DEEP, NF1), // CNVI_GNSS_PA_BLANKING
225 PAD_CFG_GPO(GPP_J1, 1, DEEP), // GPP_J1
226 PAD_NC(GPP_J2, NONE),
227 PAD_NC(GPP_J3, NONE),
228 PAD_CFG_NF(GPP_J4, NONE, DEEP, NF1), // M.2_CNV_VRI_DT_BT_UART0_RTS
229 PAD_CFG_NF(GPP_J5, UP_20K, DEEP, NF1), // M.2_CNV_BRI_RSP
230 PAD_CFG_NF(GPP_J6, NONE, DEEP, NF1), // M.2_CNV_RGI_DT_BT_UART0_TX
231 PAD_CFG_NF(GPP_J7, UP_20K, DEEP, NF1), // M.2_CNV_RGI_RSP
232 PAD_NC(GPP_J8, NONE),
233 PAD_CFG_GPI(GPP_J9, UP_20K, DEEP), // CNVI_MFUART2_TXD
234 PAD_NC(GPP_J10, NONE),
235 PAD_NC(GPP_J11, NONE),
237 /* ------- GPIO Group GPP_K ------- */
238 PAD_NC(GPP_K0, NONE),
239 PAD_NC(GPP_K1, NONE),
240 PAD_NC(GPP_K2, NONE),
241 PAD_NC(GPP_K3, NONE),
242 PAD_NC(GPP_K4, NONE),
243 PAD_NC(GPP_K5, NONE),
244 PAD_NC(GPP_K6, NONE),
245 PAD_NC(GPP_K7, NONE),
246 PAD_CFG_GPO(GPP_K8, 1, DEEP), // SATA_M2_PWR_EN1
247 PAD_CFG_GPO(GPP_K9, 1, DEEP), // SATA_M2_PWR_EN2
248 PAD_NC(GPP_K10, NONE),
249 PAD_NC(GPP_K11, NONE),
250 PAD_NC(GPP_K12, NONE),
251 PAD_NC(GPP_K13, NONE),
252 PAD_CFG_GPO(GPP_K14, 0, DEEP), // GPP_K_14_GSXDIN (test point), 7411_TEST_R
253 PAD_NC(GPP_K15, NONE),
254 PAD_NC(GPP_K16, NONE),
255 PAD_NC(GPP_K17, NONE),
256 PAD_NC(GPP_K18, NONE),
257 PAD_NC(GPP_K19, NONE),
258 PAD_NC(GPP_K20, NONE),
259 PAD_NC(GPP_K21, NONE),
260 PAD_NC(GPP_K22, NONE),
261 PAD_NC(GPP_K23, NONE),
264 void mainboard_configure_gpios(void)
266 gpio_configure_pads(gpio_table, ARRAY_SIZE(gpio_table));