OpenBIC
OpenSource Bridge-IC
plat_gpio.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef PLAT_GPIO_H
18#define PLAT_GPIO_H
19
20#include "hal_gpio.h"
21
22// gpio_cfg(chip, number, is_init, direction, status, int_type, int_callback)
23// dedicate gpio A0~A7, B0~B7, C0~C7, D0~D7, E0~E7, total 40 gpios
24// Default name: Reserve_GPIOH0
25
26// clang-format off
27
28// For Pre-DVT BIC GPIO name
29#define name_gpioA \
30 gpio_name_to_num(Reserve_GPIOA0) \
31 gpio_name_to_num(INT_SMB_BIC_PEX0_N_R) \
32 gpio_name_to_num(INT_SMB_BIC_PEX1_N_R) \
33 gpio_name_to_num(SMB_P1V25_ALRT_N_R) \
34 gpio_name_to_num(Reserve_GPIOA4) \
35 gpio_name_to_num(SMB_INA233_ACCL1_6_12V_ALRT_N) \
36 gpio_name_to_num(SMB_INA233_ACCL7_12_12V_ALRT_N) \
37 gpio_name_to_num(FIO_PWRBTN_N_R)
38
39#define name_gpioB \
40 gpio_name_to_num(ASD_MUX2_SEL) \
41 gpio_name_to_num(ASD_MUX2_EN_R4_N) \
42 gpio_name_to_num(Reserve_GPIOB2) \
43 gpio_name_to_num(Reserve_GPIOB3) \
44 gpio_name_to_num(Reserve_GPIOB4) \
45 gpio_name_to_num(TYPE_C_PLUG_DETECT_R) \
46 gpio_name_to_num(MEB_STRAP0_N_R) \
47 gpio_name_to_num(MEB_STRAP1_N_R)
48
49#define name_gpioC \
50 gpio_name_to_num(RST_SMB_MUX0_ACCL_N) \
51 gpio_name_to_num(RST_SMB_MUX1_ACCL_N) \
52 gpio_name_to_num(RST_BMC_FROM_ACB_N) \
53 gpio_name_to_num(Reserve_GPIOC3) \
54 gpio_name_to_num(SPI_ROM0_SEL) \
55 gpio_name_to_num(SPI_ROM1_SEL) \
56 gpio_name_to_num(ACB_THERM_OVERT_N) \
57 gpio_name_to_num(RST_BIC_SELF_HW_RST_N)
58
59#define name_gpioD \
60 gpio_name_to_num(RST_USB_HUB0_N) \
61 gpio_name_to_num(RST_USB_HUB1_N) \
62 gpio_name_to_num(RST_USB_HUB2_N) \
63 gpio_name_to_num(RST_USB_HUB3_N) \
64 gpio_name_to_num(RST_USB_HUB4_N) \
65 gpio_name_to_num(RST_USB_HUB5_N) \
66 gpio_name_to_num(RST_U13_N) \
67 gpio_name_to_num(Reserve_GPIOD7)
68
69#define name_gpioE \
70 gpio_name_to_num(FIO_REV_ID0_R) \
71 gpio_name_to_num(FIO_REV_ID1_R) \
72 gpio_name_to_num(FIO_REV_ID2_R) \
73 gpio_name_to_num(PRSNT_FIO_N) \
74 gpio_name_to_num(HS1_UV_WARN_N) \
75 gpio_name_to_num(HS1_OC_WARN_N) \
76 gpio_name_to_num(HS2_UV_WARN_N) \
77 gpio_name_to_num(HS2_OC_WARN_N)
78
79#define name_gpioF \
80 gpio_name_to_num(SMB_P0V8_ALERT_N) \
81 gpio_name_to_num(HS1_FAULT_N) \
82 gpio_name_to_num(HS2_FAULT_N) \
83 gpio_name_to_num(ACB_BIC_READY_N) \
84 gpio_name_to_num(USB2_MUX0_SEL) \
85 gpio_name_to_num(USB2_MUX1_SEL) \
86 gpio_name_to_num(USB2_MUX3_SEL) \
87 gpio_name_to_num(EN_JTAG_BIC_CPLD_N)
88
89#define name_gpioG \
90 gpio_name_to_num(INT_SMB_MEB_0_N_R) \
91 gpio_name_to_num(INT_SMB_MEB_1_N_R) \
92 gpio_name_to_num(INT_U228_N) \
93 gpio_name_to_num(INT_U229_N) \
94 gpio_name_to_num(INT_U230_N) \
95 gpio_name_to_num(INT_U233_N) \
96 gpio_name_to_num(INT_POWER_STATUS_N_R) \
97 gpio_name_to_num(EN_5V_EFUSE)
98
99#define name_gpioH \
100 gpio_name_to_num(Reserve_GPIOH0) \
101 gpio_name_to_num(Reserve_GPIOH1) \
102 gpio_name_to_num(Reserve_GPIOH2) \
103 gpio_name_to_num(Reserve_GPIOH3) \
104 gpio_name_to_num(Reserve_GPIOH4) \
105 gpio_name_to_num(Reserve_GPIOH5) \
106 gpio_name_to_num(Reserve_GPIOH6) \
107 gpio_name_to_num(Reserve_GPIOH7)
108
109#define name_gpioI \
110 gpio_name_to_num(Reserve_GPIOI0) \
111 gpio_name_to_num(Reserve_GPIOI1) \
112 gpio_name_to_num(Reserve_GPIOI2) \
113 gpio_name_to_num(Reserve_GPIOI3) \
114 gpio_name_to_num(Reserve_GPIOI4) \
115 gpio_name_to_num(Reserve_GPIOI5) \
116 gpio_name_to_num(Reserve_GPIOI6) \
117 gpio_name_to_num(Reserve_GPIOI7)
118
119#define name_gpioJ \
120 gpio_name_to_num(Reserve_GPIOJ0) \
121 gpio_name_to_num(Reserve_GPIOJ1) \
122 gpio_name_to_num(Reserve_GPIOJ2) \
123 gpio_name_to_num(Reserve_GPIOJ3) \
124 gpio_name_to_num(Reserve_GPIOJ4) \
125 gpio_name_to_num(Reserve_GPIOJ5) \
126 gpio_name_to_num(Reserve_GPIOJ6) \
127 gpio_name_to_num(Reserve_GPIOJ7)
128
129#define name_gpioK \
130 gpio_name_to_num(Reserve_GPIOK0) \
131 gpio_name_to_num(Reserve_GPIOK1) \
132 gpio_name_to_num(Reserve_GPIOK2) \
133 gpio_name_to_num(Reserve_GPIOK3) \
134 gpio_name_to_num(Reserve_GPIOK4) \
135 gpio_name_to_num(Reserve_GPIOK5) \
136 gpio_name_to_num(Reserve_GPIOK6) \
137 gpio_name_to_num(Reserve_GPIOK7)
138
139#define name_gpioL \
140 gpio_name_to_num(Reserve_GPIOL0) \
141 gpio_name_to_num(Reserve_GPIOL1) \
142 gpio_name_to_num(Reserve_GPIOL2) \
143 gpio_name_to_num(Reserve_GPIOL3) \
144 gpio_name_to_num(Reserve_GPIOL4) \
145 gpio_name_to_num(Reserve_GPIOL5) \
146 gpio_name_to_num(Reserve_GPIOL6) \
147 gpio_name_to_num(Reserve_GPIOL7)
148
149#define name_gpioM \
150 gpio_name_to_num(Reserve_GPIOM0) \
151 gpio_name_to_num(Reserve_GPIOM1) \
152 gpio_name_to_num(Reserve_GPIOM2) \
153 gpio_name_to_num(Reserve_GPIOM3) \
154 gpio_name_to_num(Reserve_GPIOM4) \
155 gpio_name_to_num(Reserve_GPIOM5) \
156 gpio_name_to_num(Reserve_GPIOM6) \
157 gpio_name_to_num(Reserve_GPIOM7)
158
159#define name_gpioN \
160 gpio_name_to_num(Reserve_GPION0) \
161 gpio_name_to_num(Reserve_GPION1) \
162 gpio_name_to_num(Reserve_GPION2) \
163 gpio_name_to_num(Reserve_GPION3) \
164 gpio_name_to_num(BOARD_ID1) \
165 gpio_name_to_num(BOARD_ID2) \
166 gpio_name_to_num(BOARD_ID3) \
167 gpio_name_to_num(Reserve_GPION7)
168
169#define name_gpioO \
170 gpio_name_to_num(BOARD_ID0) \
171 gpio_name_to_num(REV_ID0) \
172 gpio_name_to_num(REV_ID1) \
173 gpio_name_to_num(REV_ID2) \
174 gpio_name_to_num(Reserve_GPIOO4) \
175 gpio_name_to_num(Reserve_GPIOO5) \
176 gpio_name_to_num(Reserve_GPIOO6) \
177 gpio_name_to_num(Reserve_GPIOO7)
178
179#define name_gpioP \
180 gpio_name_to_num(Reserve_GPIOP0) \
181 gpio_name_to_num(Reserve_GPIOP1) \
182 gpio_name_to_num(Reserve_GPIOP2) \
183 gpio_name_to_num(Reserve_GPIOP3) \
184 gpio_name_to_num(Reserve_GPIOP4) \
185 gpio_name_to_num(Reserve_GPIOP5) \
186 gpio_name_to_num(Reserve_GPIOP6) \
187 gpio_name_to_num(Reserve_GPIOP7)
188
189#define name_gpioQ \
190 gpio_name_to_num(Reserve_GPIOQ0) \
191 gpio_name_to_num(Reserve_GPIOQ1) \
192 gpio_name_to_num(Reserve_GPIOQ2) \
193 gpio_name_to_num(Reserve_GPIOQ3) \
194 gpio_name_to_num(Reserve_GPIOQ4) \
195 gpio_name_to_num(Reserve_GPIOQ5) \
196 gpio_name_to_num(Reserve_GPIOQ6) \
197 gpio_name_to_num(Reserve_GPIOQ7)
198
199#define name_gpioR \
200 gpio_name_to_num(Reserve_GPIOR0) \
201 gpio_name_to_num(Reserve_GPIOR1) \
202 gpio_name_to_num(Reserve_GPIOR2) \
203 gpio_name_to_num(Reserve_GPIOR3) \
204 gpio_name_to_num(Reserve_GPIOR4) \
205 gpio_name_to_num(Reserve_GPIOR5) \
206 gpio_name_to_num(Reserve_GPIOR6) \
207 gpio_name_to_num(Reserve_GPIOR7)
208
209#define name_gpioS \
210 gpio_name_to_num(Reserve_GPIOS0) \
211 gpio_name_to_num(Reserve_GPIOS1) \
212 gpio_name_to_num(Reserve_GPIOS2) \
213 gpio_name_to_num(Reserve_GPIOS3) \
214 gpio_name_to_num(Reserve_GPIOS4) \
215 gpio_name_to_num(Reserve_GPIOS5) \
216 gpio_name_to_num(Reserve_GPIOS6) \
217 gpio_name_to_num(Reserve_GPIOS7)
218
219#define name_gpioT \
220 gpio_name_to_num(Reserve_GPIOT0) \
221 gpio_name_to_num(Reserve_GPIOT1) \
222 gpio_name_to_num(Reserve_GPIOT2) \
223 gpio_name_to_num(Reserve_GPIOT3) \
224 gpio_name_to_num(Reserve_GPIOT4) \
225 gpio_name_to_num(Reserve_GPIOT5) \
226 gpio_name_to_num(Reserve_GPIOT6) \
227 gpio_name_to_num(Reserve_GPIOT7)
228
229#define name_gpioU \
230 gpio_name_to_num(Reserve_GPIOU0) \
231 gpio_name_to_num(Reserve_GPIOU1) \
232 gpio_name_to_num(Reserve_GPIOU2) \
233 gpio_name_to_num(Reserve_GPIOU3) \
234 gpio_name_to_num(Reserve_GPIOU4) \
235 gpio_name_to_num(Reserve_GPIOU5) \
236 gpio_name_to_num(Reserve_GPIOU6) \
237 gpio_name_to_num(Reserve_GPIOU7)
238
239#define update_name_gpioA \
240 gpio_name_to_num(SMB_PMBUS_ALERT_N_R) \
241 gpio_name_to_num(INT_SMB_BIC_PEX0_N_R) \
242 gpio_name_to_num(INT_SMB_BIC_PEX1_N_R) \
243 gpio_name_to_num(SMB_P1V25_ALRT_N_R) \
244 gpio_name_to_num(INA233_ACCL1_ALRT_N_R) \
245 gpio_name_to_num(INA233_ACCL2_ALRT_N_R) \
246 gpio_name_to_num(INA233_ACCL3_ALRT_N_R) \
247 gpio_name_to_num(FIO_PWRBTN_N_R)
248
249#define update_name_gpioB \
250 gpio_name_to_num(ASD_MUX2_SEL) \
251 gpio_name_to_num(ASD_MUX2_EN_R4_N) \
252 gpio_name_to_num(INA233_ACCL4_ALRT_N_R) \
253 gpio_name_to_num(INA233_ACCL5_ALRT_N_R) \
254 gpio_name_to_num(INA233_ACCL6_ALRT_N_R) \
255 gpio_name_to_num(TYPE_C_PLUG_DETECT_R) \
256 gpio_name_to_num(MEB_STRAP0_N_R) \
257 gpio_name_to_num(MEB_STRAP1_N_R)
258
259#define update_name_gpioC \
260 gpio_name_to_num(RST_SMB_MUX0_ACCL_N) \
261 gpio_name_to_num(RST_SMB_MUX1_ACCL_N) \
262 gpio_name_to_num(RST_BMC_FROM_ACB_N) \
263 gpio_name_to_num(INA233_ACCL7_ALRT_N_R) \
264 gpio_name_to_num(SPI_ROM0_SEL) \
265 gpio_name_to_num(SPI_ROM1_SEL) \
266 gpio_name_to_num(ACB_THERM_OVERT_N) \
267 gpio_name_to_num(RST_BIC_SELF_HW_RST_N)
268
269#define update_name_gpioD \
270 gpio_name_to_num(RST_USB_HUB0_N) \
271 gpio_name_to_num(RST_USB_HUB1_N) \
272 gpio_name_to_num(RST_USB_HUB2_N) \
273 gpio_name_to_num(RST_USB_HUB3_N) \
274 gpio_name_to_num(RST_USB_HUB4_N) \
275 gpio_name_to_num(RST_USB_HUB5_N) \
276 gpio_name_to_num(Reserve_GPIOD6) \
277 gpio_name_to_num(Reserve_GPIOD7)
278
279#define update_name_gpioL \
280 gpio_name_to_num(P3V3_ACCL12_PG) \
281 gpio_name_to_num(P3V3_ACCL11_PG) \
282 gpio_name_to_num(P3V3_ACCL10_PG) \
283 gpio_name_to_num(P3V3_ACCL9_PG) \
284 gpio_name_to_num(P3V3_ACCL8_PG) \
285 gpio_name_to_num(P3V3_ACCL7_PG) \
286 gpio_name_to_num(P3V3_ACCL6_PG) \
287 gpio_name_to_num(P3V3_ACCL5_PG)
288
289#define update_name_gpioM \
290 gpio_name_to_num(Reserve_GPIOM0) \
291 gpio_name_to_num(P3V3_ACCL4_PG) \
292 gpio_name_to_num(Reserve_GPIOM2) \
293 gpio_name_to_num(P3V3_ACCL3_PG) \
294 gpio_name_to_num(P3V3_ACCL2_PG) \
295 gpio_name_to_num(P3V3_ACCL1_PG) \
296 gpio_name_to_num(Reserve_GPIOM6) \
297 gpio_name_to_num(Reserve_GPIOM7)
298
299#define update_name_gpioP \
300 gpio_name_to_num(Reserve_GPIOP0) \
301 gpio_name_to_num(Reserve_GPIOP1) \
302 gpio_name_to_num(Reserve_GPIOP2) \
303 gpio_name_to_num(Reserve_GPIOP3) \
304 gpio_name_to_num(Reserve_GPIOP4) \
305 gpio_name_to_num(Reserve_GPIOP5) \
306 gpio_name_to_num(Reserve_GPIOP6) \
307 gpio_name_to_num(INA233_ACCL10_ALRT_N_R)
308
309#define update_name_gpioQ \
310 gpio_name_to_num(Reserve_GPIOQ0) \
311 gpio_name_to_num(Reserve_GPIOQ1) \
312 gpio_name_to_num(Reserve_GPIOQ2) \
313 gpio_name_to_num(INA233_ACCL11_ALRT_N_R) \
314 gpio_name_to_num(INA233_ACCL12_ALRT_N_R) \
315 gpio_name_to_num(Reserve_GPIOQ5) \
316 gpio_name_to_num(Reserve_GPIOQ6) \
317 gpio_name_to_num(Reserve_GPIOQ7)
318
319#define update_name_gpioS \
320 gpio_name_to_num(Reserve_GPIOS0) \
321 gpio_name_to_num(INA233_ACCL8_ALRT_N_R) \
322 gpio_name_to_num(INA233_ACCL9_ALRT_N_R) \
323 gpio_name_to_num(Reserve_GPIOS3) \
324 gpio_name_to_num(Reserve_GPIOS4) \
325 gpio_name_to_num(Reserve_GPIOS5) \
326 gpio_name_to_num(Reserve_GPIOS6) \
327 gpio_name_to_num(Reserve_GPIOS7)
328// clang-format on
329
330#define gpio_name_to_num(x) x,
337
338extern enum _GPIO_NUMS_ GPIO_NUMS;
339#undef gpio_name_to_num
340
344
345#endif
_GPIO_NUMS_
Definition: plat_gpio.h:228
enum _GPIO_NUMS_ GPIO_NUMS
#define name_gpioO
Definition: plat_gpio.h:169
#define name_gpioK
Definition: plat_gpio.h:129
#define name_gpioH
Definition: plat_gpio.h:99
#define update_name_gpioL
Definition: plat_gpio.h:279
#define update_name_gpioM
Definition: plat_gpio.h:289
#define update_name_gpioP
Definition: plat_gpio.h:299
#define name_gpioF
Definition: plat_gpio.h:79
void init_board_rev_gpio()
Definition: plat_gpio.c:300
#define name_gpioR
Definition: plat_gpio.h:199
#define name_gpioE
Definition: plat_gpio.h:69
#define update_name_gpioC
Definition: plat_gpio.h:259
#define name_gpioT
Definition: plat_gpio.h:219
#define update_name_gpioD
Definition: plat_gpio.h:269
#define name_gpioN
Definition: plat_gpio.h:159
void enable_PRDY_interrupt()
Definition: plat_gpio.c:265
#define update_name_gpioB
Definition: plat_gpio.h:249
#define update_name_gpioS
Definition: plat_gpio.h:319
#define name_gpioI
Definition: plat_gpio.h:109
#define name_gpioJ
Definition: plat_gpio.h:119
#define update_name_gpioQ
Definition: plat_gpio.h:309
#define name_gpioG
Definition: plat_gpio.h:89
void disable_PRDY_interrupt()
Definition: plat_gpio.c:270
#define name_gpioU
Definition: plat_gpio.h:229
#define update_name_gpioA
Definition: plat_gpio.h:239