coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
gpio_apl.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 /*
4  * Definitions for the GPIO subsystem on Apollolake
5  *
6  * Placed in a separate file since some of these definitions can be used from
7  * assembly code
8  */
9 
10 #ifndef _SOC_APOLLOLAKE_GPIO_H_
11 #define _SOC_APOLLOLAKE_GPIO_H_
12 
13 /*
14  * Miscellaneous Configuration register(MISCCFG).These are community specific
15  * registers and are meant to house miscellaneous configuration fields per
16  * community. There are 8 GPIO groups: GPP_0 -> GPP_8 (Group 3 is absent)
17  */
18 #define GPIO_MISCCFG 0x10 /* Miscellaneous Configuration offset */
19 #define GPIO_GPE_SW_31_0 0 /* SOUTHWEST GPIO# 0 ~ 31 belong to GROUP0 */
20 #define GPIO_GPE_SW_63_32 1 /* SOUTHWEST GPIO# 32 ~ 42 belong to GROUP1 */
21 #define GPIO_GPE_W_31_0 2 /* WEST GPIO# 0 ~ 25 belong to GROUP2 */
22 #define GPIO_GPE_NW_31_0 4 /* NORTHWEST GPIO# 0 ~ 17 belong to GROUP4 */
23 #define GPIO_GPE_NW_63_32 5 /* NORTHWEST GPIO# 32 ~ 63 belong to GROUP5 */
24 #define GPIO_GPE_NW_95_64 6 /* NORTHWEST GPIO# 64 ~ 76 belong to GROUP6 */
25 #define GPIO_GPE_N_31_0 7 /* NORTH GPIO# 0 ~ 31 belong to GROUP7 */
26 #define GPIO_GPE_N_63_32 8 /* NORTH GPIO# 32 ~ 61 belong to GROUP8 */
27 
28 #define GPIO_MAX_NUM_PER_GROUP 32
29 
30 /* Host Software Pad Ownership Register.
31  * The pins in the community are divided into 3 groups :
32  * GPIO 0 ~ 31, GPIO 32 ~ 63, GPIO 64 ~ 95
33  */
34 #define HOSTSW_OWN_REG_0 0x80
35 
36 #define PAD_CFG_BASE 0x500
37 
38 #define GPI_INT_STS_0 0x100
39 #define GPI_INT_EN_0 0x110
40 
41 #define GPI_SMI_STS_0 0x140
42 #define GPI_SMI_EN_0 0x150
43 
44 #define NUM_N_PADS (PAD_N(SVID0_CLK) + 1)
45 #define NUM_NW_PADS (PAD_NW(GPIO_123) + 1)
46 #define NUM_W_PADS (PAD_W(SUSPWRDNACK) + 1)
47 #define NUM_SW_PADS (PAD_SW(LPC_FRAMEB) + 1)
48 
49 #define NUM_N_GPI_REGS \
50  (ALIGN_UP(NUM_N_PADS, GPIO_MAX_NUM_PER_GROUP) / GPIO_MAX_NUM_PER_GROUP)
51 
52 #define NUM_NW_GPI_REGS \
53  (ALIGN_UP(NUM_NW_PADS, GPIO_MAX_NUM_PER_GROUP) / GPIO_MAX_NUM_PER_GROUP)
54 
55 #define NUM_W_GPI_REGS \
56  (ALIGN_UP(NUM_W_PADS, GPIO_MAX_NUM_PER_GROUP) / GPIO_MAX_NUM_PER_GROUP)
57 
58 #define NUM_SW_GPI_REGS \
59  (ALIGN_UP(NUM_SW_PADS, GPIO_MAX_NUM_PER_GROUP) / GPIO_MAX_NUM_PER_GROUP)
60 
61 #define NUM_GPI_STATUS_REGS (NUM_N_GPI_REGS + NUM_NW_GPI_REGS \
62  + NUM_W_GPI_REGS + NUM_SW_GPI_REGS)
63 
64 /* North community pads */
65 #define GPIO_0 0
66 #define GPIO_1 1
67 #define GPIO_2 2
68 #define GPIO_3 3
69 #define GPIO_4 4
70 #define GPIO_5 5
71 #define GPIO_6 6
72 #define GPIO_7 7
73 #define GPIO_8 8
74 #define GPIO_9 9
75 #define GPIO_10 10
76 #define GPIO_11 11
77 #define GPIO_12 12
78 #define GPIO_13 13
79 #define GPIO_14 14
80 #define GPIO_15 15
81 #define GPIO_16 16
82 #define GPIO_17 17
83 #define GPIO_18 18
84 #define GPIO_19 19
85 #define GPIO_20 20
86 #define GPIO_21 21
87 #define GPIO_22 22
88 #define GPIO_23 23
89 #define GPIO_24 24
90 #define GPIO_25 25
91 #define GPIO_26 26
92 #define GPIO_27 27
93 #define GPIO_28 28
94 #define GPIO_29 29
95 #define GPIO_30 30
96 #define GPIO_31 31
97 #define GPIO_32 32
98 #define GPIO_33 33
99 #define GPIO_34 34
100 #define GPIO_35 35
101 #define GPIO_36 36
102 #define GPIO_37 37
103 #define GPIO_38 38
104 #define GPIO_39 39
105 #define GPIO_40 40
106 #define GPIO_41 41
107 #define GPIO_42 42
108 #define GPIO_43 43
109 #define GPIO_44 44
110 #define GPIO_45 45
111 #define GPIO_46 46
112 #define GPIO_47 47
113 #define GPIO_48 48
114 #define GPIO_49 49
115 #define GPIO_62 50
116 #define GPIO_63 51
117 #define GPIO_64 52
118 #define GPIO_65 53
119 #define GPIO_66 54
120 #define GPIO_67 55
121 #define GPIO_68 56
122 #define GPIO_69 57
123 #define GPIO_70 58
124 #define GPIO_71 59
125 #define GPIO_72 60
126 #define GPIO_73 61
127 #define TCK 62
128 #define TRST_B 63
129 #define TMS 64
130 #define TDI 65
131 #define CX_PMODE 66
132 #define CX_PREQ_B 67
133 #define JTAGX 68
134 #define CX_PRDY_B 69
135 #define TDO 70
136 #define CNV_BRI_DT 71
137 #define CNV_BRI_RSP 72
138 #define CNV_RGI_DT 73
139 #define CNV_RGI_RSP 74
140 #define SVID0_ALERT_B 75
141 #define SVID0_DATA 76
142 #define SVID0_CLK 77
143 
144 /* Northwest community pads */
145 #define GPIO_187 78
146 #define GPIO_188 79
147 #define GPIO_189 80
148 #define GPIO_190 81
149 #define GPIO_191 82
150 #define GPIO_192 83
151 #define GPIO_193 84
152 #define GPIO_194 85
153 #define GPIO_195 86
154 #define GPIO_196 87
155 #define GPIO_197 88
156 #define GPIO_198 89
157 #define GPIO_199 90
158 #define GPIO_200 91
159 #define GPIO_201 92
160 #define GPIO_202 93
161 #define GPIO_203 94
162 #define GPIO_204 95
163 #define PMC_SPI_FS0 96
164 #define PMC_SPI_FS1 97
165 #define PMC_SPI_FS2 98
166 #define PMC_SPI_RXD 99
167 #define PMC_SPI_TXD 100
168 #define PMC_SPI_CLK 101
169 #define PMIC_PWRGOOD 102
170 #define PMIC_RESET_B 103
171 #define GPIO_213 104
172 #define GPIO_214 105
173 #define GPIO_215 106
174 #define PMIC_THERMTRIP_B 107
175 #define PMIC_STDBY 108
176 #define PROCHOT_B 109
177 #define PMIC_I2C_SCL 110
178 #define PMIC_I2C_SDA 111
179 #define GPIO_74 112
180 #define GPIO_75 113
181 #define GPIO_76 114
182 #define GPIO_77 115
183 #define GPIO_78 116
184 #define GPIO_79 117
185 #define GPIO_80 118
186 #define GPIO_81 119
187 #define GPIO_82 120
188 #define GPIO_83 121
189 #define GPIO_84 122
190 #define GPIO_85 123
191 #define GPIO_86 124
192 #define GPIO_87 125
193 #define GPIO_88 126
194 #define GPIO_89 127
195 #define GPIO_90 128
196 #define GPIO_91 129
197 #define GPIO_92 130
198 #define GPIO_97 131
199 #define GPIO_98 132
200 #define GPIO_99 133
201 #define GPIO_100 134
202 #define GPIO_101 135
203 #define GPIO_102 136
204 #define GPIO_103 137
205 #define FST_SPI_CLK_FB 138
206 #define GPIO_104 139
207 #define GPIO_105 140
208 #define GPIO_106 141
209 #define GPIO_109 142
210 #define GPIO_110 143
211 #define GPIO_111 144
212 #define GPIO_112 145
213 #define GPIO_113 146
214 #define GPIO_116 147
215 #define GPIO_117 148
216 #define GPIO_118 149
217 #define GPIO_119 150
218 #define GPIO_120 151
219 #define GPIO_121 152
220 #define GPIO_122 153
221 #define GPIO_123 154
222 
223 /* West community pads */
224 #define GPIO_124 155
225 #define GPIO_125 156
226 #define GPIO_126 157
227 #define GPIO_127 158
228 #define GPIO_128 159
229 #define GPIO_129 160
230 #define GPIO_130 161
231 #define GPIO_131 162
232 #define GPIO_132 163
233 #define GPIO_133 164
234 #define GPIO_134 165
235 #define GPIO_135 166
236 #define GPIO_136 167
237 #define GPIO_137 168
238 #define GPIO_138 169
239 #define GPIO_139 170
240 #define GPIO_146 171
241 #define GPIO_147 172
242 #define GPIO_148 173
243 #define GPIO_149 174
244 #define GPIO_150 175
245 #define GPIO_151 176
246 #define GPIO_152 177
247 #define GPIO_153 178
248 #define GPIO_154 179
249 #define GPIO_155 180
250 #define GPIO_209 181
251 #define GPIO_210 182
252 #define GPIO_211 183
253 #define GPIO_212 184
254 #define OSC_CLK_OUT_0 185
255 #define OSC_CLK_OUT_1 186
256 #define OSC_CLK_OUT_2 187
257 #define OSC_CLK_OUT_3 188
258 #define OSC_CLK_OUT_4 189
259 #define PMU_AC_PRESENT 190
260 #define PMU_BATLOW_B 191
261 #define PMU_PLTRST_B 192
262 #define PMU_PWRBTN_B 193
263 #define PMU_RESETBUTTON_B 194
264 #define PMU_SLP_S0_B 195
265 #define PMU_SLP_S3_B 196
266 #define PMU_SLP_S4_B 197
267 #define PMU_SUSCLK 198
268 #define PMU_WAKE_B 199
269 #define SUS_STAT_B 200
270 #define SUSPWRDNACK 201
271 
272 /* Southwest community pads */
273 #define GPIO_205 202
274 #define GPIO_206 203
275 #define GPIO_207 204
276 #define GPIO_208 205
277 #define GPIO_156 206
278 #define GPIO_157 207
279 #define GPIO_158 208
280 #define GPIO_159 209
281 #define GPIO_160 210
282 #define GPIO_161 211
283 #define GPIO_162 212
284 #define GPIO_163 213
285 #define GPIO_164 214
286 #define GPIO_165 215
287 #define GPIO_166 216
288 #define GPIO_167 217
289 #define GPIO_168 218
290 #define GPIO_169 219
291 #define GPIO_170 220
292 #define GPIO_171 221
293 #define GPIO_172 222
294 #define GPIO_179 223
295 #define GPIO_173 224
296 #define GPIO_174 225
297 #define GPIO_175 226
298 #define GPIO_176 227
299 #define GPIO_177 228
300 #define GPIO_178 229
301 #define GPIO_186 230
302 #define GPIO_182 231
303 #define GPIO_183 232
304 #define SMB_ALERTB 233
305 #define SMB_CLK 234
306 #define SMB_DATA 235
307 #define LPC_ILB_SERIRQ 236
308 #define LPC_CLKOUT0 237
309 #define LPC_CLKOUT1 238
310 #define LPC_AD0 239
311 #define LPC_AD1 240
312 #define LPC_AD2 241
313 #define LPC_AD3 242
314 #define LPC_CLKRUNB 243
315 #define LPC_FRAMEB 244
316 
317 /* PERST_0 not defined */
318 #define GPIO_PRT0_UDEF 0xFF
319 
320 #define TOTAL_PADS 245
321 #define N_OFFSET GPIO_0
322 #define NW_OFFSET GPIO_187
323 #define W_OFFSET GPIO_124
324 #define SW_OFFSET GPIO_205
325 
326 /* Macros for translating a global pad offset to a local offset */
327 #define PAD_N(pad) (pad - N_OFFSET)
328 #define PAD_NW(pad) (pad - NW_OFFSET)
329 #define PAD_W(pad) (pad - W_OFFSET)
330 #define PAD_SW(pad) (pad - SW_OFFSET)
331 
332 /* Linux names of the GPIO devices. */
333 #define GPIO_COMM_N_NAME "INT3452:00"
334 #define GPIO_COMM_NW_NAME "INT3452:01"
335 #define GPIO_COMM_W_NAME "INT3452:02"
336 #define GPIO_COMM_SW_NAME "INT3452:03"
337 
338 /* Following is used in gpio asl */
339 #define GPIO_COMM_NAME "INT3452"
340 #define GPIO_COMM_0_DESC \
341  "General Purpose Input/Output (GPIO) Controller - North"
342 #define GPIO_COMM_1_DESC \
343  "General Purpose Input/Output (GPIO) Controller - Northwest"
344 #define GPIO_COMM_2_DESC \
345  "General Purpose Input/Output (GPIO) Controller - West"
346 #define GPIO_COMM_3_DESC \
347  "General Purpose Input/Output (GPIO) Controller - Southwest"
348 
349 #define GPIO_COMM0_PID PID_GPIO_N
350 #define GPIO_COMM1_PID PID_GPIO_NW
351 #define GPIO_COMM2_PID PID_GPIO_W
352 #define GPIO_COMM3_PID PID_GPIO_SW
353 
354 /*
355  * IOxAPIC IRQs for the GPIOs, overlap is expected as we encourage to use
356  * shared IRQ instead of direct IRQ, in case of overlapping, we can easily
357  * program one of the overlap to shared IRQ to avoid the conflict.
358  */
359 
360 /* NorthWest community pads */
361 #define PMIC_I2C_SDA_IRQ 0x32
362 #define GPIO_74_IRQ 0x33
363 #define GPIO_75_IRQ 0x34
364 #define GPIO_76_IRQ 0x35
365 #define GPIO_77_IRQ 0x36
366 #define GPIO_78_IRQ 0x37
367 #define GPIO_79_IRQ 0x38
368 #define GPIO_80_IRQ 0x39
369 #define GPIO_81_IRQ 0x3A
370 #define GPIO_82_IRQ 0x3B
371 #define GPIO_83_IRQ 0x3C
372 #define GPIO_84_IRQ 0x3D
373 #define GPIO_85_IRQ 0x3E
374 #define GPIO_86_IRQ 0x3F
375 #define GPIO_87_IRQ 0x40
376 #define GPIO_88_IRQ 0x41
377 #define GPIO_89_IRQ 0x42
378 #define GPIO_90_IRQ 0x43
379 #define GPIO_91_IRQ 0x44
380 #define GPIO_97_IRQ 0x49
381 #define GPIO_98_IRQ 0x4A
382 #define GPIO_99_IRQ 0x4B
383 #define GPIO_100_IRQ 0x4C
384 #define GPIO_101_IRQ 0x4D
385 #define GPIO_102_IRQ 0x4E
386 #define GPIO_103_IRQ 0x4F
387 #define GPIO_104_IRQ 0x50
388 #define GPIO_105_IRQ 0x51
389 #define GPIO_106_IRQ 0x52
390 #define GPIO_109_IRQ 0x54
391 #define GPIO_110_IRQ 0x55
392 #define GPIO_111_IRQ 0x56
393 #define GPIO_112_IRQ 0x57
394 #define GPIO_113_IRQ 0x58
395 #define GPIO_116_IRQ 0x5B
396 #define GPIO_117_IRQ 0x5C
397 #define GPIO_118_IRQ 0x5D
398 #define GPIO_119_IRQ 0x5E
399 #define GPIO_120_IRQ 0x5F
400 #define GPIO_121_IRQ 0x60
401 #define GPIO_122_IRQ 0x61
402 #define GPIO_123_IRQ 0x62
403 
404 /* North community pads */
405 #define GPIO_0_IRQ 0x63
406 #define GPIO_1_IRQ 0x64
407 #define GPIO_2_IRQ 0x65
408 #define GPIO_3_IRQ 0x66
409 #define GPIO_4_IRQ 0x67
410 #define GPIO_5_IRQ 0x68
411 #define GPIO_6_IRQ 0x69
412 #define GPIO_7_IRQ 0x6A
413 #define GPIO_8_IRQ 0x6B
414 #define GPIO_9_IRQ 0x6C
415 #define GPIO_10_IRQ 0x6D
416 #define GPIO_11_IRQ 0x6E
417 #define GPIO_12_IRQ 0x6F
418 #define GPIO_13_IRQ 0x70
419 #define GPIO_14_IRQ 0x71
420 #define GPIO_15_IRQ 0x72
421 #define GPIO_16_IRQ 0x73
422 #define GPIO_17_IRQ 0x74
423 #define GPIO_18_IRQ 0x75
424 #define GPIO_19_IRQ 0x76
425 #define GPIO_20_IRQ 0x77
426 #define GPIO_21_IRQ 0x32
427 #define GPIO_22_IRQ 0x33
428 #define GPIO_23_IRQ 0x34
429 #define GPIO_24_IRQ 0x35
430 #define GPIO_25_IRQ 0x36
431 #define GPIO_26_IRQ 0x37
432 #define GPIO_27_IRQ 0x38
433 #define GPIO_28_IRQ 0x39
434 #define GPIO_29_IRQ 0x3A
435 #define GPIO_30_IRQ 0x3B
436 #define GPIO_31_IRQ 0x3C
437 #define GPIO_32_IRQ 0x3D
438 #define GPIO_33_IRQ 0x3E
439 #define GPIO_34_IRQ 0x3F
440 #define GPIO_35_IRQ 0x40
441 #define GPIO_36_IRQ 0x41
442 #define GPIO_37_IRQ 0x42
443 #define GPIO_38_IRQ 0x43
444 #define GPIO_39_IRQ 0x44
445 #define GPIO_40_IRQ 0x45
446 #define GPIO_41_IRQ 0x46
447 #define GPIO_42_IRQ 0x47
448 #define GPIO_43_IRQ 0x48
449 #define GPIO_44_IRQ 0x49
450 #define GPIO_45_IRQ 0x4A
451 #define GPIO_46_IRQ 0x4B
452 #define GPIO_47_IRQ 0x4C
453 #define GPIO_48_IRQ 0x4D
454 #define GPIO_49_IRQ 0x4E
455 #define GPIO_62_IRQ 0x5B
456 #define GPIO_63_IRQ 0x5C
457 #define GPIO_64_IRQ 0x5D
458 #define GPIO_65_IRQ 0x5E
459 #define GPIO_66_IRQ 0x5F
460 #define GPIO_67_IRQ 0x60
461 #define GPIO_68_IRQ 0x61
462 #define GPIO_69_IRQ 0x62
463 #define GPIO_70_IRQ 0x63
464 #define GPIO_71_IRQ 0x64
465 #define GPIO_72_IRQ 0x65
466 #define GPIO_73_IRQ 0x66
467 
468 #define GPIO_NUM_PAD_CFG_REGS 2 /* DW0, DW1 */
469 #endif /* _SOC_APOLLOLAKE_GPIO_H_ */