mb/ocp/tiogapass: Fix GPIOs
[coreboot2.git] / src / mainboard / kontron / bsl6 / gpio.c
blobc99a53d4b3d4aa251efebbfd72ae1357c99cba90
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 PAD_CFG_NF(GPP_A0, NONE, PLTRST, NF1),
9 PAD_CFG_NF(GPP_A1, UP_20K, PLTRST, NF1),
10 PAD_CFG_NF(GPP_A2, UP_20K, PLTRST, NF1),
11 PAD_CFG_NF(GPP_A3, UP_20K, PLTRST, NF1),
12 PAD_CFG_NF(GPP_A4, UP_20K, PLTRST, NF1),
13 PAD_CFG_NF(GPP_A5, NONE, PLTRST, NF1),
14 PAD_CFG_NF(GPP_A6, NONE, PLTRST, NF1),
15 PAD_CFG_GPI_INT(GPP_A7, NONE, PLTRST, OFF),
16 PAD_CFG_NF(GPP_A8, NONE, PLTRST, NF1),
17 PAD_CFG_NF(GPP_A9, DN_20K, PLTRST, NF1),
18 PAD_CFG_NF(GPP_A10, DN_20K, PLTRST, NF1),
19 PAD_CFG_GPI_INT(GPP_A11, NONE, PLTRST, OFF),
20 PAD_CFG_GPO(GPP_A12, 1, PLTRST),
21 PAD_CFG_NF(GPP_A13, NONE, DEEP, NF1),
22 PAD_CFG_NF(GPP_A14, NONE, DEEP, NF1),
23 PAD_CFG_NF(GPP_A15, UP_20K, DEEP, NF1),
24 PAD_CFG_GPI_INT(GPP_A16, NONE, PLTRST, OFF),
25 PAD_CFG_GPI_INT(GPP_A17, NONE, PLTRST, OFF),
26 PAD_CFG_GPI_INT(GPP_A18, NONE, PLTRST, OFF),
27 PAD_CFG_GPI_INT(GPP_A19, NONE, PLTRST, OFF),
28 PAD_CFG_GPO(GPP_A20, 1, DEEP),
29 PAD_CFG_GPO(GPP_A21, 1, DEEP),
30 PAD_CFG_GPO(GPP_A22, 1, DEEP),
31 PAD_CFG_GPI_INT(GPP_A23, NONE, PLTRST, OFF),
33 PAD_CFG_GPI_INT(GPP_B0, NONE, PLTRST, OFF),
34 PAD_CFG_GPI_INT(GPP_B1, NONE, PLTRST, OFF),
35 PAD_CFG_GPI_INT(GPP_B2, NONE, PLTRST, OFF),
36 PAD_CFG_GPO(GPP_B3, 1, DEEP),
37 PAD_CFG_NF(GPP_B4, NONE, PLTRST, NF1),
38 PAD_CFG_NF(GPP_B5, NONE, DEEP, NF1),
39 PAD_CFG_GPO(GPP_B6, 1, DEEP),
40 PAD_CFG_GPO(GPP_B7, 1, DEEP),
41 PAD_CFG_GPO(GPP_B8, 1, DEEP),
42 PAD_CFG_GPO(GPP_B9, 1, DEEP),
43 PAD_CFG_GPO(GPP_B10, 1, DEEP),
44 PAD_CFG_GPI_INT(GPP_B11, NONE, PLTRST, OFF),
45 PAD_CFG_NF(GPP_B12, NONE, DEEP, NF1),
46 PAD_CFG_NF(GPP_B13, NONE, DEEP, NF1),
47 PAD_CFG_NF(GPP_B14, DN_20K, PLTRST, NF1),
48 PAD_CFG_GPI_INT(GPP_B15, NONE, PLTRST, OFF),
49 PAD_CFG_GPI_INT(GPP_B16, NONE, PLTRST, OFF),
50 PAD_CFG_GPO(GPP_B17, 1, DEEP),
51 PAD_CFG_GPI_INT(GPP_B18, NONE, PLTRST, OFF),
52 PAD_CFG_GPI_INT(GPP_B19, NONE, PLTRST, OFF),
53 PAD_CFG_GPI_INT(GPP_B20, NONE, PLTRST, OFF),
54 PAD_CFG_GPI_INT(GPP_B21, NONE, PLTRST, OFF),
55 PAD_CFG_GPI_INT(GPP_B22, NONE, PLTRST, OFF),
56 PAD_CFG_TERM_GPO(GPP_B23, 1, UP_20K, DEEP),
58 PAD_CFG_NF(GPP_C0, NONE, DEEP, NF1),
59 PAD_CFG_NF(GPP_C1, NONE, DEEP, NF1),
60 PAD_CFG_GPI_SCI(GPP_C2, NONE, DEEP, EDGE_SINGLE, INVERT),
61 PAD_CFG_NF(GPP_C3, NONE, DEEP, NF1),
62 PAD_CFG_NF(GPP_C4, NONE, DEEP, NF1),
63 PAD_CFG_GPI_INT(GPP_C5, NONE, PLTRST, OFF),
64 /* XXX: C6 not readable */
65 /* XXX: C7 not readable */
66 PAD_CFG_NF(GPP_C8, NONE, PLTRST, NF1),
67 PAD_CFG_NF(GPP_C9, NONE, PLTRST, NF1),
68 PAD_CFG_NF(GPP_C10, NONE, PLTRST, NF1),
69 PAD_CFG_NF(GPP_C11, NONE, PLTRST, NF1),
70 PAD_CFG_NF(GPP_C12, NONE, PLTRST, NF1),
71 PAD_CFG_NF(GPP_C13, NONE, PLTRST, NF1),
72 PAD_CFG_NF(GPP_C14, NONE, PLTRST, NF1),
73 PAD_CFG_NF(GPP_C15, NONE, PLTRST, NF1),
74 PAD_CFG_GPI_INT(GPP_C16, NONE, PLTRST, OFF),
75 PAD_CFG_GPI_INT(GPP_C17, NONE, PLTRST, OFF),
76 PAD_CFG_GPI_INT(GPP_C18, NONE, PLTRST, OFF),
77 PAD_CFG_GPI_INT(GPP_C19, NONE, PLTRST, OFF),
78 PAD_CFG_NF(GPP_C20, NONE, PLTRST, NF1),
79 PAD_CFG_NF(GPP_C21, NONE, PLTRST, NF1),
80 PAD_CFG_NF(GPP_C22, NONE, PLTRST, NF1),
81 PAD_CFG_NF(GPP_C23, NONE, PLTRST, NF1),
83 PAD_CFG_GPO(GPP_D0, 1, DEEP),
84 PAD_CFG_GPI_INT(GPP_D1, NONE, DEEP, OFF),
85 PAD_CFG_GPI_INT(GPP_D2, NONE, DEEP, OFF),
86 PAD_CFG_GPO(GPP_D3, 1, DEEP),
87 PAD_CFG_GPI_INT(GPP_D4, NONE, PLTRST, OFF),
88 PAD_CFG_NF(GPP_D5, NONE, PLTRST, NF1),
89 PAD_CFG_NF(GPP_D6, NONE, PLTRST, NF1),
90 PAD_CFG_NF(GPP_D7, NONE, PLTRST, NF1),
91 PAD_CFG_NF(GPP_D8, NONE, PLTRST, NF1),
92 PAD_CFG_GPO(GPP_D9, 0, DEEP),
93 PAD_CFG_GPO(GPP_D10, 0, DEEP),
94 PAD_CFG_GPI_SCI_HIGH(GPP_D11, NONE, DEEP, LEVEL),
95 PAD_CFG_GPI_SCI_HIGH(GPP_D12, NONE, DEEP, LEVEL),
96 PAD_CFG_GPI_INT(GPP_D13, NONE, PLTRST, OFF),
97 PAD_CFG_GPI_INT(GPP_D14, NONE, PLTRST, OFF),
98 PAD_CFG_GPI_INT(GPP_D15, NONE, PLTRST, OFF),
99 PAD_CFG_GPI_INT(GPP_D16, NONE, PLTRST, OFF),
100 PAD_CFG_GPO(GPP_D17, 0, DEEP),
101 PAD_CFG_GPI_INT(GPP_D18, NONE, DEEP, OFF),
102 PAD_CFG_GPO(GPP_D19, 0, DEEP),
103 PAD_CFG_GPO(GPP_D20, 0, DEEP),
104 PAD_CFG_GPO(GPP_D21, 1, DEEP),
105 PAD_CFG_GPO(GPP_D22, 0, DEEP),
106 PAD_CFG_GPI_INT(GPP_D23, NONE, PLTRST, OFF),
108 PAD_CFG_NF(GPP_E0, UP_20K, PLTRST, NF1),
109 PAD_CFG_NF(GPP_E1, UP_20K, PLTRST, NF1),
110 PAD_CFG_GPI_INT(GPP_E2, NONE, PLTRST, OFF),
111 PAD_CFG_GPI_SCI_HIGH(GPP_E3, NONE, DEEP, LEVEL),
112 PAD_CFG_NF(GPP_E4, NONE, PWROK, NF1),
113 PAD_CFG_GPI_INT(GPP_E5, NONE, PLTRST, OFF),
114 PAD_CFG_GPI_INT(GPP_E6, NONE, PLTRST, OFF),
115 PAD_CFG_GPI_SCI(GPP_E7, NONE, DEEP, EDGE_SINGLE, INVERT),
116 PAD_CFG_NF(GPP_E8, NONE, PLTRST, NF1),
117 PAD_CFG_NF(GPP_E9, NONE, DEEP, NF1),
118 PAD_CFG_NF(GPP_E10, NONE, DEEP, NF1),
119 PAD_CFG_NF(GPP_E11, NONE, DEEP, NF1),
120 PAD_CFG_NF(GPP_E12, NONE, DEEP, NF1),
122 PAD_CFG_GPI_INT(GPP_F0, NONE, PLTRST, OFF),
123 PAD_CFG_NF(GPP_F1, UP_20K, PLTRST, NF1),
124 PAD_CFG_NF(GPP_F2, NONE, PLTRST, NF1),
125 PAD_CFG_NF(GPP_F3, NONE, PLTRST, NF1),
126 PAD_CFG_NF(GPP_F4, NONE, PLTRST, NF1),
127 PAD_CFG_GPI_SCI(GPP_F5, NONE, DEEP, EDGE_SINGLE, NONE),
128 PAD_CFG_NF(GPP_F6, NONE, PWROK, NF1),
129 PAD_CFG_GPI_INT(GPP_F7, NONE, PLTRST, OFF),
130 PAD_CFG_GPI_INT(GPP_F8, NONE, PLTRST, OFF),
131 PAD_CFG_GPI_INT(GPP_F9, NONE, PLTRST, OFF),
132 PAD_CFG_GPI_APIC_HIGH(GPP_F10, NONE, PLTRST),
133 PAD_CFG_GPI_INT(GPP_F11, NONE, PLTRST, OFF),
134 PAD_CFG_GPI_APIC_LOW(GPP_F12, NONE, PLTRST),
135 PAD_CFG_GPI_APIC_HIGH(GPP_F13, NONE, PLTRST),
136 PAD_CFG_GPI_APIC_LOW(GPP_F14, NONE, DEEP),
137 PAD_CFG_NF(GPP_F15, NONE, DEEP, NF1),
138 PAD_CFG_NF(GPP_F16, NONE, DEEP, NF1),
139 PAD_CFG_NF(GPP_F17, NONE, DEEP, NF1),
140 PAD_CFG_GPO(GPP_F18, 1, PLTRST),
141 PAD_CFG_NF(GPP_F19, NONE, DEEP, NF1),
142 PAD_CFG_NF(GPP_F20, NONE, DEEP, NF1),
143 PAD_CFG_NF(GPP_F21, NONE, DEEP, NF1),
144 PAD_CFG_GPO(GPP_F22, 1, PLTRST),
145 PAD_CFG_GPO(GPP_F23, 1, DEEP),
147 PAD_CFG_GPO(GPP_G0, 1, PLTRST),
148 PAD_CFG_GPO(GPP_G1, 1, PLTRST),
149 PAD_CFG_GPI_SCI_LOW(GPP_G2, NONE, PLTRST, LEVEL),
150 PAD_CFG_GPI_SCI_LOW(GPP_G3, NONE, PLTRST, LEVEL),
151 PAD_CFG_GPO(GPP_G4, 1, DEEP),
152 PAD_CFG_GPI_APIC_HIGH(GPP_G5, NONE, PLTRST),
153 PAD_CFG_GPI_SCI(GPP_G6, NONE, PLTRST, EDGE_SINGLE, INVERT),
154 PAD_CFG_GPO(GPP_G7, 1, DEEP),
155 PAD_CFG_GPI_INT(GPP_G8, NONE, PLTRST, OFF),
156 PAD_CFG_GPI_INT(GPP_G9, NONE, PLTRST, OFF),
157 PAD_CFG_GPI_INT(GPP_G10, NONE, PLTRST, OFF),
158 PAD_CFG_GPI_INT(GPP_G11, NONE, PLTRST, OFF),
159 PAD_CFG_GPI_SCI(GPP_G12, DN_20K, PLTRST, EDGE_SINGLE, INVERT),
160 PAD_CFG_GPO(GPP_G13, 1, PLTRST),
161 PAD_CFG_GPI_SCI(GPP_G14, NONE, PLTRST, EDGE_SINGLE, INVERT),
162 PAD_CFG_GPO(GPP_G15, 0, PLTRST),
163 PAD_CFG_TERM_GPO(GPP_G16, 1, DN_20K, PLTRST),
164 PAD_CFG_GPI_INT(GPP_G17, NONE, PLTRST, OFF),
165 PAD_CFG_GPI_APIC_HIGH(GPP_G18, NONE, PLTRST),
166 PAD_CFG_NF(GPP_G19, NONE, PLTRST, NF1),
167 PAD_CFG_GPI_APIC_HIGH(GPP_G20, NONE, PLTRST),
168 PAD_CFG_GPI_SCI(GPP_G21, NONE, DEEP, EDGE_SINGLE, INVERT),
169 PAD_CFG_GPO(GPP_G22, 1, PLTRST),
170 PAD_CFG_GPO(GPP_G23, 1, PLTRST),
172 PAD_CFG_GPO(GPP_H0, 1, DEEP),
173 PAD_CFG_GPO(GPP_H1, 1, DEEP),
174 PAD_CFG_GPO(GPP_H2, 1, DEEP),
175 PAD_CFG_GPO(GPP_H3, 1, DEEP),
176 PAD_CFG_GPO(GPP_H4, 1, DEEP),
177 PAD_CFG_GPO(GPP_H5, 1, DEEP),
178 PAD_CFG_GPO(GPP_H6, 1, DEEP),
179 PAD_CFG_GPO(GPP_H7, 1, DEEP),
180 PAD_CFG_GPO(GPP_H8, 1, DEEP),
181 PAD_CFG_GPO(GPP_H9, 1, DEEP),
182 PAD_CFG_GPI_INT(GPP_H10, NONE, PLTRST, OFF),
183 PAD_CFG_GPI_INT(GPP_H11, NONE, PLTRST, OFF),
184 PAD_CFG_GPI_INT(GPP_H12, NONE, PLTRST, OFF),
185 PAD_CFG_GPI_APIC_HIGH(GPP_H13, NONE, PLTRST),
186 PAD_CFG_GPI_APIC_HIGH(GPP_H14, NONE, PLTRST),
187 PAD_CFG_GPI_APIC_HIGH(GPP_H15, NONE, PLTRST),
188 PAD_CFG_GPI_INT(GPP_H16, NONE, PLTRST, OFF),
189 PAD_CFG_GPO(GPP_H17, 1, PLTRST),
190 PAD_CFG_GPI_INT(GPP_H18, NONE, PLTRST, OFF),
191 PAD_CFG_GPI_INT(GPP_H19, NONE, PLTRST, OFF),
192 PAD_CFG_GPI_INT(GPP_H20, NONE, PLTRST, OFF),
193 PAD_CFG_GPI_INT(GPP_H21, NONE, PLTRST, OFF),
194 PAD_CFG_GPI_INT(GPP_H22, NONE, PLTRST, OFF),
195 PAD_CFG_GPO(GPP_H23, 0, DEEP),
197 PAD_CFG_GPI_INT(GPD0, NONE, PLTRST, OFF),
198 PAD_CFG_GPO(GPD1, 0, PWROK),
199 PAD_CFG_NF(GPD2, NONE, PWROK, NF1),
200 PAD_CFG_NF(GPD3, UP_20K, PWROK, NF1),
201 PAD_CFG_NF(GPD4, NONE, PWROK, NF1),
202 PAD_CFG_NF(GPD5, NONE, PWROK, NF1),
203 PAD_CFG_NF(GPD6, NONE, PWROK, NF1),
204 PAD_CFG_GPO(GPD7, 1, PWROK),
205 PAD_CFG_NF(GPD8, NONE, PWROK, NF1),
206 PAD_CFG_GPO(GPD9, 0, PWROK),
207 PAD_CFG_NF(GPD10, NONE, PWROK, NF1),
208 PAD_CFG_NF(GPD11, NONE, PWROK, NF1),
210 PAD_CFG_NF(GPP_I0, NONE, PLTRST, NF1),
211 PAD_CFG_NF(GPP_I1, NONE, PLTRST, NF1),
212 PAD_CFG_NF(GPP_I2, NONE, PLTRST, NF1),
213 PAD_CFG_NF(GPP_I3, NONE, PLTRST, NF1),
214 PAD_CFG_NF(GPP_I4, NONE, PLTRST, NF1),
215 PAD_CFG_NF(GPP_I5, NONE, PLTRST, NF1),
216 PAD_CFG_NF(GPP_I6, NONE, PLTRST, NF1),
217 PAD_CFG_NF(GPP_I7, NONE, PLTRST, NF1),
218 PAD_CFG_NF(GPP_I8, NONE, PLTRST, NF1),
219 PAD_CFG_NF(GPP_I9, NONE, PLTRST, NF1),
220 PAD_CFG_NF(GPP_I10, NONE, PLTRST, NF1),
223 void mainboard_configure_gpios(void)
225 gpio_configure_pads(gpio_table, ARRAY_SIZE(gpio_table));