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#define POC_Reserve_GPIOF2 42
23#define POC_Reserve_GPIOF3 43
24#define POC_EN_P3V3_E1S_0_R 48
25#define POC_PWRGD_P3V3_E1S_0_R 49
26
27// clang-format off
28#define name_gpioA \
29 gpio_name_to_num(PWR_ON_RST_ASIC1_N) \
30 gpio_name_to_num(SYS_RST_ASIC1_N_R) \
31 gpio_name_to_num(PERST_ASIC1_N_R) \
32 gpio_name_to_num(PERST_ASIC2_N_R) \
33 gpio_name_to_num(RST_PCIE_MB_EXP_N) \
34 gpio_name_to_num(BIC_PWR_EN_MCIO) \
35 gpio_name_to_num(PG_CARD_OK) \
36 gpio_name_to_num(FM_POWER_EN_R)
37
38#define name_gpioB \
39 gpio_name_to_num(PWRGD_AUX_R) \
40 gpio_name_to_num(BIC_READY_R) \
41 gpio_name_to_num(EN_P0V85_BIC_ASIC2_R) \
42 gpio_name_to_num(PWRGD_P0V85_ASIC2) \
43 gpio_name_to_num(EN_P1V2_BIC_ASIC2_R) \
44 gpio_name_to_num(PWRGD_P1V2_ASIC2) \
45 gpio_name_to_num(EN_P1V8_BIC_ASIC2_R) \
46 gpio_name_to_num(PWRGD_P1V8_ASIC2)
47
48#define name_gpioC \
49 gpio_name_to_num(EN_P0V85_BIC_ASIC1_R) \
50 gpio_name_to_num(PWRGD_P0V85_ASIC1) \
51 gpio_name_to_num(EN_P1V2_BIC_ASIC1_R) \
52 gpio_name_to_num(PWRGD_P1V2_ASIC1) \
53 gpio_name_to_num(EN_P1V8_BIC_ASIC1_R) \
54 gpio_name_to_num(PWRGD_P1V8_ASIC1) \
55 gpio_name_to_num(EN_P0V8_BIC_ASIC1_R) \
56 gpio_name_to_num(PWRGD_P0V8_ASIC1)
57
58#define name_gpioD \
59 gpio_name_to_num(EN_PVPP_AB_ASIC1_2V5_R) \
60 gpio_name_to_num(PWRGD_PVPP_AB_ASIC1) \
61 gpio_name_to_num(EN_PVPP_CD_ASIC1_2V5_R) \
62 gpio_name_to_num(PWRGD_PVPP_CD_ASIC1) \
63 gpio_name_to_num(EN_PVTT_AB_ASIC1_0V6_R) \
64 gpio_name_to_num(PWRGD_PVTT_AB_ASIC1) \
65 gpio_name_to_num(EN_PVTT_CD_ASIC1_0V6_R) \
66 gpio_name_to_num(PWRGD_PVTT_CD_ASIC1)
67
68#define name_gpioE \
69 gpio_name_to_num(EN_P0V8_BIC_ASIC2_R) \
70 gpio_name_to_num(PWRGD_P0V8_ASIC2) \
71 gpio_name_to_num(PWR_ON_RST_ASIC2_N) \
72 gpio_name_to_num(SYS_RST_ASIC2_N_R) \
73 gpio_name_to_num(EN_PVPP_AB_ASIC2_2V5_R) \
74 gpio_name_to_num(PWRGD_PVPP_AB_ASIC2) \
75 gpio_name_to_num(EN_PVPP_CD_ASIC2_2V5_R) \
76 gpio_name_to_num(PWRGD_PVPP_CD_ASIC2)
77
78#define name_gpioF \
79 gpio_name_to_num(PWRGD_PVDDQ_CD_ASIC2) \
80 gpio_name_to_num(PWRGD_P0V75_ASIC2) \
81 gpio_name_to_num(EN_P3V3_E1S_0_R) \
82 gpio_name_to_num(PWRGD_P3V3_E1S_0_R) \
83 gpio_name_to_num(EN_PVTT_AB_ASIC2_0V6_R) \
84 gpio_name_to_num(PWRGD_PVTT_AB_ASIC2) \
85 gpio_name_to_num(EN_PVTT_CD_ASIC2_0V6_R) \
86 gpio_name_to_num(PWRGD_PVTT_CD_ASIC2)
87
88#define name_gpioG \
89 gpio_name_to_num(LED_ASIC1_LS_HB) \
90 gpio_name_to_num(LED_ASIC2_LS_HB) \
91 gpio_name_to_num(EN_P12V_E1S_0_R) \
92 gpio_name_to_num(PWRGD_P12V_E1S_0_R) \
93 gpio_name_to_num(EN_PVDDQ_AB_ASIC1_R) \
94 gpio_name_to_num(PWRGD_PVDDQ_AB_ASIC1) \
95 gpio_name_to_num(EN_PVDDQ_CD_ASIC1_R) \
96 gpio_name_to_num(PWRGD_PVDDQ_CD_ASIC1)
97
98#define name_gpioH \
99 gpio_name_to_num(EN_P0V75_BIC_ASIC1_R) \
100 gpio_name_to_num(PWRGD_P0V75_ASIC1) \
101 gpio_name_to_num(EN_P5V_STBY_BIC_R) \
102 gpio_name_to_num(PWRGD_P5V_STBY_BIC_R) \
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(Reserve_GPIOI4) \
114 gpio_name_to_num(Reserve_GPIOI5) \
115 gpio_name_to_num(Reserve_GPIOI6) \
116 gpio_name_to_num(Reserve_GPIOI7)
117
118#define name_gpioJ \
119 gpio_name_to_num(Reserve_GPIOJ0) \
120 gpio_name_to_num(Reserve_GPIOJ1) \
121 gpio_name_to_num(Reserve_GPIOJ2) \
122 gpio_name_to_num(Reserve_GPIOJ3) \
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(Reserve_GPIOL2) \
142 gpio_name_to_num(Reserve_GPIOL3) \
143 gpio_name_to_num(PWRGD_P1V2_STBY) \
144 gpio_name_to_num(EN_PVDDQ_AB_ASIC2_R) \
145 gpio_name_to_num(PWRGD_PVDDQ_AB_ASIC2) \
146 gpio_name_to_num(EN_PVDDQ_CD_ASIC2_R)
147
148#define name_gpioM \
149 gpio_name_to_num(EN_SPI_BIC_ASIC2_SHIFT_R) \
150 gpio_name_to_num(EN_P0V75_BIC_ASIC2_R) \
151 gpio_name_to_num(EN_SPI_BIC_ASIC1_SHIFT_R) \
152 gpio_name_to_num(FM_PWRBRK_PRIMARY_R_N) \
153 gpio_name_to_num(Reserve_GPIOM4) \
154 gpio_name_to_num(Reserve_GPIOM5) \
155 gpio_name_to_num(Reserve_GPIOM6) \
156 gpio_name_to_num(Reserve_GPIOM7)
157
158#define name_gpioN \
159 gpio_name_to_num(Reserve_GPION0) \
160 gpio_name_to_num(EN_CLK_100M_ASIC1_OSC) \
161 gpio_name_to_num(Reserve_GPION2) \
162 gpio_name_to_num(EN_CLK_100M_ASIC2_OSC) \
163 gpio_name_to_num(Reserve_GPION4) \
164 gpio_name_to_num(Reserve_GPION5) \
165 gpio_name_to_num(Reserve_GPION6) \
166 gpio_name_to_num(Reserve_GPION7)
167
168#define name_gpioO \
169 gpio_name_to_num(Reserve_GPIOO0) \
170 gpio_name_to_num(Reserve_GPIOO1) \
171 gpio_name_to_num(Reserve_GPIOO2) \
172 gpio_name_to_num(Reserve_GPIOO3) \
173 gpio_name_to_num(Reserve_GPIOO4) \
174 gpio_name_to_num(Reserve_GPIOO5) \
175 gpio_name_to_num(Reserve_GPIOO6) \
176 gpio_name_to_num(Reserve_GPIOO7)
177
178#define name_gpioP \
179 gpio_name_to_num(Reserve_GPIOP0) \
180 gpio_name_to_num(Reserve_GPIOP1) \
181 gpio_name_to_num(Reserve_GPIOP2) \
182 gpio_name_to_num(Reserve_GPIOP3) \
183 gpio_name_to_num(Reserve_GPIOP4) \
184 gpio_name_to_num(Reserve_GPIOP5) \
185 gpio_name_to_num(Reserve_GPIOP6) \
186 gpio_name_to_num(Reserve_GPIOP7)
187
188#define name_gpioQ \
189 gpio_name_to_num(Reserve_GPIOQ0) \
190 gpio_name_to_num(Reserve_GPIOQ1) \
191 gpio_name_to_num(Reserve_GPIOQ2) \
192 gpio_name_to_num(Reserve_GPIOQ3) \
193 gpio_name_to_num(Reserve_GPIOQ4) \
194 gpio_name_to_num(Reserve_GPIOQ5) \
195 gpio_name_to_num(Reserve_GPIOQ6) \
196 gpio_name_to_num(Reserve_GPIOQ7)
197
198#define name_gpioR \
199 gpio_name_to_num(Reserve_GPIOR0) \
200 gpio_name_to_num(Reserve_GPIOR1) \
201 gpio_name_to_num(Reserve_GPIOR2) \
202 gpio_name_to_num(Reserve_GPIOR3) \
203 gpio_name_to_num(Reserve_GPIOR4) \
204 gpio_name_to_num(Reserve_GPIOR5) \
205 gpio_name_to_num(Reserve_GPIOR6) \
206 gpio_name_to_num(Reserve_GPIOR7)
207
208#define name_gpioS \
209 gpio_name_to_num(Reserve_GPIOS0) \
210 gpio_name_to_num(Reserve_GPIOS1) \
211 gpio_name_to_num(Reserve_GPIOS2) \
212 gpio_name_to_num(Reserve_GPIOS3) \
213 gpio_name_to_num(Reserve_GPIOS4) \
214 gpio_name_to_num(Reserve_GPIOS5) \
215 gpio_name_to_num(Reserve_GPIOS6) \
216 gpio_name_to_num(Reserve_GPIOS7)
217
218#define name_gpioT \
219 gpio_name_to_num(Reserve_GPIOT0) \
220 gpio_name_to_num(Reserve_GPIOT1) \
221 gpio_name_to_num(Reserve_GPIOT2) \
222 gpio_name_to_num(Reserve_GPIOT3) \
223 gpio_name_to_num(Reserve_GPIOT4) \
224 gpio_name_to_num(Reserve_GPIOT5) \
225 gpio_name_to_num(Reserve_GPIOT6) \
226 gpio_name_to_num(Reserve_GPIOT7)
227
228#define name_gpioU \
229 gpio_name_to_num(Reserve_GPIOU0) \
230 gpio_name_to_num(Reserve_GPIOU1) \
231 gpio_name_to_num(Reserve_GPIOU2) \
232 gpio_name_to_num(Reserve_GPIOU3) \
233 gpio_name_to_num(Reserve_GPIOU4) \
234 gpio_name_to_num(Reserve_GPIOU5) \
235 gpio_name_to_num(Reserve_GPIOU6) \
236 gpio_name_to_num(Reserve_GPIOU7)
237
238// clang-format on
239
240#define gpio_name_to_num(x) x,
246
247extern enum _GPIO_NUMS_ GPIO_NUMS;
248#undef gpio_name_to_num
249
250extern char *gpio_name[];
251
252/*IO expander cofiguration*/
253
271};
272
273int get_ioe_value(uint8_t ioe_addr, uint8_t ioe_reg, uint8_t *value);
274int set_ioe_value(uint8_t ioe_addr, uint8_t ioe_reg, uint8_t value);
275void init_ioe_config();
277
278#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:168
#define name_gpioK
Definition: plat_gpio.h:128
#define name_gpioH
Definition: plat_gpio.h:98
int set_ioe_value(uint8_t ioe_addr, uint8_t ioe_reg, uint8_t value)
Definition: plat_gpio.c:319
int get_ioe_value(uint8_t ioe_addr, uint8_t ioe_reg, uint8_t *value)
Definition: plat_gpio.c:295
#define name_gpioF
Definition: plat_gpio.h:78
#define name_gpioQ
Definition: plat_gpio.h:188
#define name_gpioR
Definition: plat_gpio.h:198
#define name_gpioP
Definition: plat_gpio.h:178
#define name_gpioE
Definition: plat_gpio.h:68
void init_ioe_config()
Definition: plat_gpio.c:343
#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:218
#define name_gpioN
Definition: plat_gpio.h:158
#define name_gpioM
Definition: plat_gpio.h:148
#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
IOE_PIN_NUM
Definition: plat_gpio.h:254
@ IOE_P00
Definition: plat_gpio.h:255
@ IOE_P01
Definition: plat_gpio.h:256
@ IOE_P14
Definition: plat_gpio.h:267
@ IOE_P03
Definition: plat_gpio.h:258
@ IOE_P11
Definition: plat_gpio.h:264
@ IOE_P12
Definition: plat_gpio.h:265
@ IOE_P10
Definition: plat_gpio.h:263
@ IOE_P04
Definition: plat_gpio.h:259
@ IOE_P17
Definition: plat_gpio.h:270
@ IOE_P07
Definition: plat_gpio.h:262
@ IOE_P02
Definition: plat_gpio.h:257
@ IOE_P13
Definition: plat_gpio.h:266
@ IOE_P16
Definition: plat_gpio.h:269
@ IOE_P05
Definition: plat_gpio.h:260
@ IOE_P06
Definition: plat_gpio.h:261
@ IOE_P15
Definition: plat_gpio.h:268
#define name_gpioG
Definition: plat_gpio.h:88
int check_ioe4_e1s_prsnt_pin()
Definition: plat_gpio.c:399
#define name_gpioS
Definition: plat_gpio.h:208
#define name_gpioU
Definition: plat_gpio.h:228