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
22void gpio_int_default();
23
24// clang-format off
25
26// gpio_cfg(chip, number, is_init, direction, status, int_type, int_callback)
27// dedicate gpio A0~A7, B0~B7, C0~C7, D0~D7, E0~E7, total 40 gpios
28// Default name: Reserve_GPIOH0
29#define name_gpioA \
30 gpio_name_to_num(IRQ_P12V_E1S_3_FLT_N) \
31 gpio_name_to_num(IRQ_P12V_E1S_2_FLT_N) \
32 gpio_name_to_num(IRQ_P12V_E1S_1_FLT_N) \
33 gpio_name_to_num(IRQ_P12V_E1S_0_FLT_N) \
34 gpio_name_to_num(IRQ_P3V3_E1S_3_FLT_N) \
35 gpio_name_to_num(IRQ_P3V3_E1S_2_FLT_N) \
36 gpio_name_to_num(IRQ_P3V3_E1S_1_FLT_N) \
37 gpio_name_to_num(IRQ_P3V3_E1S_0_FLT_N)
38#define name_gpioB \
39 gpio_name_to_num(PWRGD_P12V_AUX) \
40 gpio_name_to_num(IRQ_P12V_HSC_ALERT1_N) \
41 gpio_name_to_num(IRQ_P12V_HSC_ALERT2_N) \
42 gpio_name_to_num(PU_DB800_HI_BW) \
43 gpio_name_to_num(LED_PWRGD_P12V_E1S_ALL) \
44 gpio_name_to_num(FM_AUX_PWR_EN) \
45 gpio_name_to_num(RST_SMB_E1S_3_N) \
46 gpio_name_to_num(RST_SMB_E1S_2_N)
47#define name_gpioC \
48 gpio_name_to_num(BOARD_ID0) \
49 gpio_name_to_num(BOARD_ID1) \
50 gpio_name_to_num(BOARD_ID2) \
51 gpio_name_to_num(BOARD_ID3) \
52 gpio_name_to_num(RST_BIC_E1S_3_N) \
53 gpio_name_to_num(RST_BIC_E1S_2_N) \
54 gpio_name_to_num(RST_BIC_E1S_1_N) \
55 gpio_name_to_num(RST_BIC_E1S_0_N)
56#define name_gpioD \
57 gpio_name_to_num(FM_MB_SLOT_ID0) \
58 gpio_name_to_num(FM_PWRDIS_E1S_3) \
59 gpio_name_to_num(FM_PWRDIS_E1S_2) \
60 gpio_name_to_num(FM_PWRDIS_E1S_1) \
61 gpio_name_to_num(FM_PWRDIS_E1S_0) \
62 gpio_name_to_num(FM_P12V_E1S_0_EN) \
63 gpio_name_to_num(IRQ_TMP75_ALERT_N) \
64 gpio_name_to_num(FM_P3V3_E1S_0_SW_EN)
65#define name_gpioE \
66 gpio_name_to_num(FM_POWER_EN) \
67 gpio_name_to_num(PWRGD_EXP_PWROK) \
68 gpio_name_to_num(RST_MB_N) \
69 gpio_name_to_num(Reserve_GPIOE3) \
70 gpio_name_to_num(FM_FRU_WC_N) \
71 gpio_name_to_num(P1V2_VDD_PG_R) \
72 gpio_name_to_num(RST_SMB_E1S_1_N) \
73 gpio_name_to_num(RST_SMB_E1S_0_N)
74#define name_gpioF \
75 gpio_name_to_num(Reserve_GPIOF0) \
76 gpio_name_to_num(IRQ_SMB_ALERT_N) \
77 gpio_name_to_num(FM_P3V3_E1S_EN) \
78 gpio_name_to_num(FM_P12V_EDGE_EN) \
79 gpio_name_to_num(Reserve_GPIOF4) \
80 gpio_name_to_num(IRQ_P3V3_EDGE_FLT_N) \
81 gpio_name_to_num(IRQ_P12V_EDGE_FLT_N) \
82 gpio_name_to_num(Reserve_GPIOF7)
83#define name_gpioG \
84 gpio_name_to_num(LED_BIC_E1S_3) \
85 gpio_name_to_num(LED_BIC_E1S_2) \
86 gpio_name_to_num(LED_BIC_E1S_1) \
87 gpio_name_to_num(LED_BIC_E1S_0) \
88 gpio_name_to_num(FM_MB_SLOT_ID1) \
89 gpio_name_to_num(FM_PRSNT_E1S_3_N) \
90 gpio_name_to_num(FM_PRSNT_E1S_2_N) \
91 gpio_name_to_num(FM_PRSNT_E1S_1_N)
92#define name_gpioH \
93 gpio_name_to_num(FM_PRSNT_E1S_0_N) \
94 gpio_name_to_num(Reserve_GPIOH1) \
95 gpio_name_to_num(Reserve_GPIOH2) \
96 gpio_name_to_num(Reserve_GPIOH3) \
97 gpio_name_to_num(Reserve_GPIOH4) \
98 gpio_name_to_num(Reserve_GPIOH5) \
99 gpio_name_to_num(Reserve_GPIOH6) \
100 gpio_name_to_num(Reserve_GPIOH7)
101#define name_gpioI \
102 gpio_name_to_num(Reserve_GPIOI0) \
103 gpio_name_to_num(Reserve_GPIOI1) \
104 gpio_name_to_num(Reserve_GPIOI2) \
105 gpio_name_to_num(Reserve_GPIOI3) \
106 gpio_name_to_num(Reserve_GPIOI4) \
107 gpio_name_to_num(Reserve_GPIOI5) \
108 gpio_name_to_num(Reserve_GPIOI6) \
109 gpio_name_to_num(Reserve_GPIOI7)
110#define name_gpioJ \
111 gpio_name_to_num(Reserve_GPIOJ0) \
112 gpio_name_to_num(Reserve_GPIOJ1) \
113 gpio_name_to_num(Reserve_GPIOJ2) \
114 gpio_name_to_num(Reserve_GPIOJ3) \
115 gpio_name_to_num(Reserve_GPIOJ4) \
116 gpio_name_to_num(Reserve_GPIOJ5) \
117 gpio_name_to_num(Reserve_GPIOJ6) \
118 gpio_name_to_num(Reserve_GPIOJ7)
119#define name_gpioK \
120 gpio_name_to_num(Reserve_GPIOK0) \
121 gpio_name_to_num(Reserve_GPIOK1) \
122 gpio_name_to_num(Reserve_GPIOK2) \
123 gpio_name_to_num(Reserve_GPIOK3) \
124 gpio_name_to_num(Reserve_GPIOK4) \
125 gpio_name_to_num(Reserve_GPIOK5) \
126 gpio_name_to_num(Reserve_GPIOK6) \
127 gpio_name_to_num(Reserve_GPIOK7)
128#define name_gpioL \
129 gpio_name_to_num(Reserve_GPIOL0) \
130 gpio_name_to_num(Reserve_GPIOL1) \
131 gpio_name_to_num(FM_BOARD_REV_ID2) \
132 gpio_name_to_num(FM_BOARD_REV_ID1) \
133 gpio_name_to_num(FM_BOARD_REV_ID0) \
134 gpio_name_to_num(HSC_SEL_ID2) \
135 gpio_name_to_num(HSC_SEL_ID1) \
136 gpio_name_to_num(HSC_SEL_ID0)
137// GPIOM6, M7 hardware not define
138#define name_gpioM \
139 gpio_name_to_num(Reserve_GPIOM0) \
140 gpio_name_to_num(Reserve_GPIOM1) \
141 gpio_name_to_num(Reserve_GPIOM2) \
142 gpio_name_to_num(Reserve_GPIOM3) \
143 gpio_name_to_num(Reserve_GPIOM4) \
144 gpio_name_to_num(Reserve_GPIOM5) \
145 gpio_name_to_num(Reserve_GPIOM6) \
146 gpio_name_to_num(Reserve_GPIOM7)
147#define name_gpioN \
148 gpio_name_to_num(Reserve_GPION0) \
149 gpio_name_to_num(Reserve_GPION1) \
150 gpio_name_to_num(Reserve_GPION2) \
151 gpio_name_to_num(Reserve_GPION3) \
152 gpio_name_to_num(FM_P12V_E1S_2_EN) \
153 gpio_name_to_num(FM_P12V_E1S_1_EN) \
154 gpio_name_to_num(IRQ_INA230_E1S_0_ALERT_N) \
155 gpio_name_to_num(FM_CLKBUF_EN)
156#define name_gpioO \
157 gpio_name_to_num(FM_P12V_E1S_3_EN) \
158 gpio_name_to_num(IRQ_INA230_E1S_3_ALERT_N) \
159 gpio_name_to_num(IRQ_INA230_E1S_2_ALERT_N) \
160 gpio_name_to_num(IRQ_INA230_E1S_1_ALERT_N) \
161 gpio_name_to_num(Reserve_GPIOO4) \
162 gpio_name_to_num(Reserve_GPIOO5) \
163 gpio_name_to_num(Reserve_GPIOO6) \
164 gpio_name_to_num(Reserve_GPIOO7)
165#define name_gpioP \
166 gpio_name_to_num(Reserve_GPIOP0) \
167 gpio_name_to_num(Reserve_GPIOP1) \
168 gpio_name_to_num(Reserve_GPIOP2) \
169 gpio_name_to_num(Reserve_GPIOP3) \
170 gpio_name_to_num(Reserve_GPIOP4) \
171 gpio_name_to_num(Reserve_GPIOP5) \
172 gpio_name_to_num(CLKBUF_E1S_3_OE_N) \
173 gpio_name_to_num(CLKBUF_E1S_2_OE_N)
174// GPIOQ5 hardware not define
175#define name_gpioQ \
176 gpio_name_to_num(CLKBUF_E1S_1_OE_N) \
177 gpio_name_to_num(CLKBUF_E1S_0_OE_N) \
178 gpio_name_to_num(FM_P3V3_E1S_3_SW_EN) \
179 gpio_name_to_num(FM_P3V3_E1S_2_SW_EN) \
180 gpio_name_to_num(FM_P3V3_E1S_1_SW_EN) \
181 gpio_name_to_num(Reserve_GPIOQ5) \
182 gpio_name_to_num(Reserve_GPIOQ6) \
183 gpio_name_to_num(Reserve_GPIOQ7)
184#define name_gpioR \
185 gpio_name_to_num(Reserve_GPIOR0) \
186 gpio_name_to_num(Reserve_GPIOR1) \
187 gpio_name_to_num(Reserve_GPIOR2) \
188 gpio_name_to_num(Reserve_GPIOR3) \
189 gpio_name_to_num(Reserve_GPIOR4) \
190 gpio_name_to_num(Reserve_GPIOR5) \
191 gpio_name_to_num(Reserve_GPIOR6) \
192 gpio_name_to_num(Reserve_GPIOR7)
193// GPIOS3, S4, S5, S6, S7 hardware not define
194#define name_gpioS \
195 gpio_name_to_num(Reserve_GPIOS0) \
196 gpio_name_to_num(Reserve_GPIOS1) \
197 gpio_name_to_num(Reserve_GPIOS2) \
198 gpio_name_to_num(Reserve_GPIOS3) \
199 gpio_name_to_num(Reserve_GPIOS4) \
200 gpio_name_to_num(Reserve_GPIOS5) \
201 gpio_name_to_num(Reserve_GPIOS6) \
202 gpio_name_to_num(Reserve_GPIOS7)
203// GPIOT input only
204#define name_gpioT \
205 gpio_name_to_num(Reserve_GPIOT0) \
206 gpio_name_to_num(Reserve_GPIOT1) \
207 gpio_name_to_num(Reserve_GPIOT2) \
208 gpio_name_to_num(Reserve_GPIOT3) \
209 gpio_name_to_num(Reserve_GPIOT4) \
210 gpio_name_to_num(Reserve_GPIOT5) \
211 gpio_name_to_num(Reserve_GPIOT6) \
212 gpio_name_to_num(Reserve_GPIOT7)
213// GPIOU input only
214#define name_gpioU \
215 gpio_name_to_num(Reserve_GPIOU0) \
216 gpio_name_to_num(Reserve_GPIOU1) \
217 gpio_name_to_num(Reserve_GPIOU2) \
218 gpio_name_to_num(Reserve_GPIOU3) \
219 gpio_name_to_num(Reserve_GPIOU4) \
220 gpio_name_to_num(Reserve_GPIOU5) \
221 gpio_name_to_num(Reserve_GPIOU6) \
222 gpio_name_to_num(Reserve_GPIOU7)
223
224// clang-format on
225
226#define gpio_name_to_num(x) x,
232
233extern enum _GPIO_NUMS_ GPIO_NUMS;
234#undef gpio_name_to_num
235
236extern char *gpio_name[];
237
238#endif
char * gpio_name[]
Definition: hal_gpio.c:49
_GPIO_NUMS_
Definition: plat_gpio.h:228
enum _GPIO_NUMS_ GPIO_NUMS
void gpio_int_default()
Definition: plat_gpio.c:33
#define name_gpioO
Definition: plat_gpio.h:156
#define name_gpioK
Definition: plat_gpio.h:119
#define name_gpioH
Definition: plat_gpio.h:92
#define name_gpioF
Definition: plat_gpio.h:74
#define name_gpioQ
Definition: plat_gpio.h:175
#define name_gpioR
Definition: plat_gpio.h:184
#define name_gpioP
Definition: plat_gpio.h:165
#define name_gpioE
Definition: plat_gpio.h:65
#define name_gpioL
Definition: plat_gpio.h:128
#define name_gpioC
Definition: plat_gpio.h:47
#define name_gpioD
Definition: plat_gpio.h:56
#define name_gpioT
Definition: plat_gpio.h:204
#define name_gpioN
Definition: plat_gpio.h:147
#define name_gpioM
Definition: plat_gpio.h:138
#define name_gpioI
Definition: plat_gpio.h:101
#define name_gpioB
Definition: plat_gpio.h:38
#define name_gpioJ
Definition: plat_gpio.h:110
#define name_gpioA
Definition: plat_gpio.h:29
#define name_gpioG
Definition: plat_gpio.h:83
#define name_gpioS
Definition: plat_gpio.h:194
#define name_gpioU
Definition: plat_gpio.h:214