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#define name_gpioA \
29 gpio_name_to_num(ASIC_DEV_RST_N) \
30 gpio_name_to_num(ASIC_PERST0_N) \
31 gpio_name_to_num(ASIC_PERST1_N) \
32 gpio_name_to_num(ASIC_FAIL_N) \
33 gpio_name_to_num(ASIC_EVENT_N) \
34 gpio_name_to_num(ASIC_DUALPORTEN_N) \
35 gpio_name_to_num(JTAG2_BIC_ASIC_NTRST2) \
36 gpio_name_to_num(ASIC_TAP_SEL)
37
38#define name_gpioB \
39 gpio_name_to_num(ASIC_CPU_BOOT_0) \
40 gpio_name_to_num(ASIC_CPU_BOOT_1) \
41 gpio_name_to_num(ASIC_M_SCAN_PCAP_SEL) \
42 gpio_name_to_num(ASIC_GPIO_R_0) \
43 gpio_name_to_num(ASIC_GPIO_R_1) \
44 gpio_name_to_num(AUX_PWR_EN_4C) \
45 gpio_name_to_num(I2CS_SRSTB_GPIO) \
46 gpio_name_to_num(FM_ISOLATED_EN_N)
47
48#define name_gpioC \
49 gpio_name_to_num(FM_P0V8_ASICD_EN) \
50 gpio_name_to_num(P1V8_ASIC_EN_R) \
51 gpio_name_to_num(FM_P0V8_ASICA_EN) \
52 gpio_name_to_num(PVTT_AB_EN_R) \
53 gpio_name_to_num(PVTT_CD_EN_R) \
54 gpio_name_to_num(FM_P0V9_ASICA_EN) \
55 gpio_name_to_num(PVPP_CD_EN_R) \
56 gpio_name_to_num(FM_PVDDQ_AB_EN)
57
58#define name_gpioD \
59 gpio_name_to_num(PVPP_AB_EN_R) \
60 gpio_name_to_num(FM_PVDDQ_CD_EN) \
61 gpio_name_to_num(SLOT_ID0) \
62 gpio_name_to_num(PVPP_CD_PG_R) \
63 gpio_name_to_num(P0V8_ASICA_PWRGD) \
64 gpio_name_to_num(PVTT_AB_PG_R) \
65 gpio_name_to_num(SMB_SENSOR_LVC3_ALERT_N) \
66 gpio_name_to_num(PVTT_CD_PG_R)
67
68#define name_gpioE \
69 gpio_name_to_num(FM_POWER_EN) \
70 gpio_name_to_num(PWRGD_CARD_PWROK) \
71 gpio_name_to_num(RST_MB_N) \
72 gpio_name_to_num(SPI_MASTER_SEL) \
73 gpio_name_to_num(FM_SPI_MUX_OE_CTL_N) \
74 gpio_name_to_num(SMB_12V_INA_ALRT_N) \
75 gpio_name_to_num(SMB_3V3_INA_ALRT_N) \
76 gpio_name_to_num(FM_MEM_THERM_EVENT_LVT3_N)
77
78#define name_gpioF \
79 gpio_name_to_num(SPI_RST_FLASH_N) \
80 gpio_name_to_num(SMBUS_ALERT_R_N) \
81 gpio_name_to_num(LSFT_SMB_DIMM_EN) \
82 gpio_name_to_num(P0V9_ASICA_PWRGD) \
83 gpio_name_to_num(P1V8_ASIC_PG_R) \
84 gpio_name_to_num(JTAG2_ASIC_PORT_SEL_EN_R) \
85 gpio_name_to_num(SAVE_N_BIC) \
86 gpio_name_to_num(FM_ADR_COMPLETE_DLY)
87
88#define name_gpioG \
89 gpio_name_to_num(P5V_STBY_PG) \
90 gpio_name_to_num(PVPP_AB_PG_R) \
91 gpio_name_to_num(P1V2_STBY_PG_R) \
92 gpio_name_to_num(SLOT_ID1) \
93 gpio_name_to_num(SMB_VR_PVDDQ_CD_ALERT_N) \
94 gpio_name_to_num(P0V8_ASICD_PWRGD) \
95 gpio_name_to_num(PWRGD_PVDDQ_CD) \
96 gpio_name_to_num(SMB_VR_PASICA_ALERT_N)
97
98#define name_gpioH \
99 gpio_name_to_num(JTAG2_BIC_SHIFT_EN) \
100 gpio_name_to_num(SMB_VR_PVDDQ_AB_ALERT_N) \
101 gpio_name_to_num(SPI_BIC_SHIFT_EN) \
102 gpio_name_to_num(PWRGD_PVDDQ_AB) \
103 gpio_name_to_num(Reserve_GPIOH4) \
104 gpio_name_to_num(Reserve_GPIOH5) \
105 gpio_name_to_num(Reserve_GPIOH6) \
106 gpio_name_to_num(Reserve_GPIOH7)
107
108#define name_gpioI \
109 gpio_name_to_num(Reserve_GPIOI0) \
110 gpio_name_to_num(Reserve_GPIOI1) \
111 gpio_name_to_num(Reserve_GPIOI2) \
112 gpio_name_to_num(Reserve_GPIOI3) \
113 gpio_name_to_num(P0V9_ASICA_FT_R) \
114 gpio_name_to_num(PVDDQ_AB_FT_R) \
115 gpio_name_to_num(PVDDQ_CD_FT_R) \
116 gpio_name_to_num(FM_PWRBRK_PRIMARY_R_N)
117
118#define name_gpioJ \
119 gpio_name_to_num(Reserve_GPIOJ0) \
120 gpio_name_to_num(Reserve_GPIOJ1) \
121 gpio_name_to_num(P0V8_ASICD_FT_R) \
122 gpio_name_to_num(P0V8_ASICA_FT_R) \
123 gpio_name_to_num(Reserve_GPIOJ4) \
124 gpio_name_to_num(Reserve_GPIOJ5) \
125 gpio_name_to_num(Reserve_GPIOJ6) \
126 gpio_name_to_num(Reserve_GPIOJ7)
127
128#define name_gpioK \
129 gpio_name_to_num(Reserve_GPIOK0) \
130 gpio_name_to_num(Reserve_GPIOK1) \
131 gpio_name_to_num(Reserve_GPIOK2) \
132 gpio_name_to_num(Reserve_GPIOK3) \
133 gpio_name_to_num(Reserve_GPIOK4) \
134 gpio_name_to_num(Reserve_GPIOK5) \
135 gpio_name_to_num(Reserve_GPIOK6) \
136 gpio_name_to_num(Reserve_GPIOK7)
137
138#define name_gpioL \
139 gpio_name_to_num(Reserve_GPIOL0) \
140 gpio_name_to_num(Reserve_GPIOL1) \
141 gpio_name_to_num(LED_CXL_POWER) \
142 gpio_name_to_num(FM_BOARD_REV_ID2) \
143 gpio_name_to_num(FM_BOARD_REV_ID1) \
144 gpio_name_to_num(FM_BOARD_REV_ID0) \
145 gpio_name_to_num(BOARD_ID0) \
146 gpio_name_to_num(BOARD_ID1)
147
148// GPIOM6, M7 hardware not define
149#define name_gpioM \
150 gpio_name_to_num(BIC_SECUREBOOT) \
151 gpio_name_to_num(BOARD_ID2) \
152 gpio_name_to_num(BOARD_ID3) \
153 gpio_name_to_num(BIC_ESPI_SELECT) \
154 gpio_name_to_num(LED_CXL_FAULT) \
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(CLK_100M_OSC_EN) \
164 gpio_name_to_num(Reserve_GPION4) \
165 gpio_name_to_num(Reserve_GPION5) \
166 gpio_name_to_num(Reserve_GPION6) \
167 gpio_name_to_num(Reserve_GPION7)
168
169#define name_gpioO \
170 gpio_name_to_num(Reserve_GPIOO0) \
171 gpio_name_to_num(Reserve_GPIOO1) \
172 gpio_name_to_num(Reserve_GPIOO2) \
173 gpio_name_to_num(Reserve_GPIOO3) \
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// GPIOQ5 hardware not define
190#define name_gpioQ \
191 gpio_name_to_num(Reserve_GPIOQ0) \
192 gpio_name_to_num(Reserve_GPIOQ1) \
193 gpio_name_to_num(Reserve_GPIOQ2) \
194 gpio_name_to_num(Reserve_GPIOQ3) \
195 gpio_name_to_num(Reserve_GPIOQ4) \
196 gpio_name_to_num(Reserve_GPIOQ5) \
197 gpio_name_to_num(Reserve_GPIOQ6) \
198 gpio_name_to_num(Reserve_GPIOQ7)
199
200#define name_gpioR \
201 gpio_name_to_num(Reserve_GPIOR0) \
202 gpio_name_to_num(Reserve_GPIOR1) \
203 gpio_name_to_num(Reserve_GPIOR2) \
204 gpio_name_to_num(Reserve_GPIOR3) \
205 gpio_name_to_num(Reserve_GPIOR4) \
206 gpio_name_to_num(Reserve_GPIOR5) \
207 gpio_name_to_num(Reserve_GPIOR6) \
208 gpio_name_to_num(Reserve_GPIOR7)
209
210// GPIOS3, S4, S5, S6, S7 hardware not define
211#define name_gpioS \
212 gpio_name_to_num(Reserve_GPIOS0) \
213 gpio_name_to_num(Reserve_GPIOS1) \
214 gpio_name_to_num(Reserve_GPIOS2) \
215 gpio_name_to_num(Reserve_GPIOS3) \
216 gpio_name_to_num(Reserve_GPIOS4) \
217 gpio_name_to_num(Reserve_GPIOS5) \
218 gpio_name_to_num(Reserve_GPIOS6) \
219 gpio_name_to_num(Reserve_GPIOS7)
220
221// GPIOT input only
222#define name_gpioT \
223 gpio_name_to_num(Reserve_GPIOT0) \
224 gpio_name_to_num(Reserve_GPIOT1) \
225 gpio_name_to_num(Reserve_GPIOT2) \
226 gpio_name_to_num(Reserve_GPIOT3) \
227 gpio_name_to_num(Reserve_GPIOT4) \
228 gpio_name_to_num(Reserve_GPIOT5) \
229 gpio_name_to_num(Reserve_GPIOT6) \
230 gpio_name_to_num(Reserve_GPIOT7)
231
232// GPIOU input only
233#define name_gpioU \
234 gpio_name_to_num(Reserve_GPIOU0) \
235 gpio_name_to_num(Reserve_GPIOU1) \
236 gpio_name_to_num(Reserve_GPIOU2) \
237 gpio_name_to_num(Reserve_GPIOU3) \
238 gpio_name_to_num(Reserve_GPIOU4) \
239 gpio_name_to_num(Reserve_GPIOU5) \
240 gpio_name_to_num(Reserve_GPIOU6) \
241 gpio_name_to_num(Reserve_GPIOU7)
242
243// clang-format on
244
245#define gpio_name_to_num(x) x,
251
252extern enum _GPIO_NUMS_ GPIO_NUMS;
253#undef gpio_name_to_num
254
255extern char *gpio_name[];
256
257#endif
char * gpio_name[]
Definition: hal_gpio.c:49
_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:128
#define name_gpioH
Definition: plat_gpio.h:98
#define name_gpioF
Definition: plat_gpio.h:78
#define name_gpioQ
Definition: plat_gpio.h:190
#define name_gpioR
Definition: plat_gpio.h:200
#define name_gpioP
Definition: plat_gpio.h:179
#define name_gpioE
Definition: plat_gpio.h:68
#define name_gpioL
Definition: plat_gpio.h:138
#define name_gpioC
Definition: plat_gpio.h:48
#define name_gpioD
Definition: plat_gpio.h:58
#define name_gpioT
Definition: plat_gpio.h:222
#define name_gpioN
Definition: plat_gpio.h:159
#define name_gpioM
Definition: plat_gpio.h:149
#define name_gpioI
Definition: plat_gpio.h:108
#define name_gpioB
Definition: plat_gpio.h:38
#define name_gpioJ
Definition: plat_gpio.h:118
#define name_gpioA
Definition: plat_gpio.h:28
#define name_gpioG
Definition: plat_gpio.h:88
#define name_gpioS
Definition: plat_gpio.h:211
#define name_gpioU
Definition: plat_gpio.h:233