blob: 97dc5e550f25a54d09cfc658b3b785f99ccf0fb9 [file] [log] [blame]
Stefan Reinauer23190272008-08-20 13:41:24 +00001/*
2 * inteltool - dump all registers on an Intel CPU + chipset based system.
3 *
Stefan Reinauer14e22772010-04-27 06:56:47 +00004 * Copyright (C) 2008 by coresystems GmbH
5 *
Stefan Reinauer23190272008-08-20 13:41:24 +00006 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20#include <stdio.h>
Stefan Reinauer23190272008-08-20 13:41:24 +000021#include "inteltool.h"
22
Nico Huber09dcbf02013-04-01 15:08:04 +020023typedef struct { uint16_t addr; uint32_t def; } gpio_default_t;
24
Stefan Reinauer23190272008-08-20 13:41:24 +000025static const io_register_t ich0_gpio_registers[] = {
26 { 0x00, 4, "GPIO_USE_SEL" },
27 { 0x04, 4, "GP_IO_SEL" },
28 { 0x08, 4, "RESERVED" },
29 { 0x0c, 4, "GP_LVL" },
30 { 0x10, 4, "RESERVED" },
31 { 0x14, 4, "GPO_TTL" },
32 { 0x18, 4, "GPO_BLINK" },
33 { 0x1c, 4, "RESERVED" },
34 { 0x20, 4, "RESERVED" },
35 { 0x24, 4, "RESERVED" },
36 { 0x28, 4, "RESERVED" },
37 { 0x2c, 4, "GPI_INV" },
38 { 0x30, 4, "RESERVED" },
39 { 0x34, 4, "RESERVED" },
40 { 0x38, 4, "RESERVED" },
41 { 0x3C, 4, "RESERVED" }
42};
43
Joseph Smithe10757e2010-06-16 22:21:19 +000044static const io_register_t ich2_gpio_registers[] = {
45 { 0x00, 4, "GPIO_USE_SEL" },
46 { 0x04, 4, "GP_IO_SEL" },
47 { 0x08, 4, "RESERVED" },
48 { 0x0c, 4, "GP_LVL" },
49 { 0x10, 4, "RESERVED" },
50 { 0x14, 4, "GPO_TTL" },
51 { 0x18, 4, "GPO_BLINK" },
52 { 0x1c, 4, "RESERVED" },
53 { 0x20, 4, "RESERVED" },
54 { 0x24, 4, "RESERVED" },
55 { 0x28, 4, "RESERVED" },
56 { 0x2c, 4, "GPI_INV" },
57 { 0x30, 4, "RESERVED" },
58 { 0x34, 4, "RESERVED" },
59 { 0x38, 4, "RESERVED" },
60 { 0x3C, 4, "RESERVED" }
61};
62
Stefan Reinauer23190272008-08-20 13:41:24 +000063static const io_register_t ich4_gpio_registers[] = {
64 { 0x00, 4, "GPIO_USE_SEL" },
65 { 0x04, 4, "GP_IO_SEL" },
66 { 0x08, 4, "RESERVED" },
67 { 0x0c, 4, "GP_LVL" },
68 { 0x10, 4, "RESERVED" },
69 { 0x14, 4, "GPO_TTL" },
70 { 0x18, 4, "GPO_BLINK" },
71 { 0x1c, 4, "RESERVED" },
72 { 0x20, 4, "RESERVED" },
73 { 0x24, 4, "RESERVED" },
74 { 0x28, 4, "RESERVED" },
75 { 0x2c, 4, "GPI_INV" },
76 { 0x30, 4, "GPIO_USE_SEL2" },
77 { 0x34, 4, "GP_IO_SEL2" },
78 { 0x38, 4, "GP_LVL2" },
79 { 0x3C, 4, "RESERVED" }
80};
81
Idwer Vollering312fc962010-12-17 22:34:58 +000082static const io_register_t ich5_gpio_registers[] = {
83 { 0x00, 4, "GPIO_USE_SEL" },
84 { 0x04, 4, "GP_IO_SEL" },
85 { 0x08, 4, "RESERVED" },
86 { 0x0c, 4, "GP_LVL" },
87 { 0x10, 4, "RESERVED" },
88 { 0x14, 4, "GPO_TTL"},
89 { 0x18, 4, "GPO_BLINK"},
90 { 0x1c, 4, "RESERVED" },
91 { 0x20, 4, "RESERVED" },
92 { 0x2c, 4, "GPI_INV" },
93 { 0x30, 4, "GPIO_USE_SEL2" },
94 { 0x34, 4, "GP_IO_SEL2" },
95 { 0x38, 4, "GP_LVL2" },
96};
97
Pat Erleyca3548e2010-04-21 06:23:19 +000098static const io_register_t ich6_gpio_registers[] = {
99 { 0x00, 4, "GPIO_USE_SEL" },
100 { 0x08, 4, "RESERVED" },
101 { 0x0c, 4, "GP_LVL" },
102 { 0x10, 4, "RESERVED" },
103 { 0x14, 4, "RESERVED" },
104 { 0x18, 4, "GPO_BLINK" },
105 { 0x1c, 4, "RESERVED" },
106 { 0x20, 4, "RESERVED" },
107 { 0x24, 4, "RESERVED" },
108 { 0x28, 4, "RESERVED" },
109 { 0x2c, 4, "GPI_INV" },
110 { 0x30, 4, "GPIO_USE_SEL2" },
111 { 0x34, 4, "GP_IO_SEL2" },
112 { 0x38, 4, "GP_LVL2" },
113 { 0x04, 4, "GP_IO_SEL" },
114};
115
Stefan Reinauer23190272008-08-20 13:41:24 +0000116static const io_register_t ich7_gpio_registers[] = {
117 { 0x00, 4, "GPIO_USE_SEL" },
118 { 0x04, 4, "GP_IO_SEL" },
119 { 0x08, 4, "RESERVED" },
120 { 0x0c, 4, "GP_LVL" },
121 { 0x10, 4, "RESERVED" },
122 { 0x14, 4, "RESERVED" },
123 { 0x18, 4, "GPO_BLINK" },
124 { 0x1c, 4, "RESERVED" },
125 { 0x20, 4, "RESERVED" },
126 { 0x24, 4, "RESERVED" },
127 { 0x28, 4, "RESERVED" },
128 { 0x2c, 4, "GPI_INV" },
129 { 0x30, 4, "GPIO_USE_SEL2" },
130 { 0x34, 4, "GP_IO_SEL2" },
131 { 0x38, 4, "GP_LVL2" },
132 { 0x3C, 4, "RESERVED" }
133};
134
Stefan Reinauer1162f252008-12-04 15:18:20 +0000135static const io_register_t ich8_gpio_registers[] = {
136 { 0x00, 4, "GPIO_USE_SEL" },
137 { 0x04, 4, "GP_IO_SEL" },
138 { 0x08, 4, "RESERVED" },
139 { 0x0c, 4, "GP_LVL" },
140 { 0x10, 4, "GPIO_USE_SEL Override (LOW)" },
141 { 0x14, 4, "RESERVED" },
142 { 0x18, 4, "GPO_BLINK" },
143 { 0x1c, 4, "GP_SER_BLINK" },
144 { 0x20, 4, "GP_SB_CMDSTS" },
145 { 0x24, 4, "GP_SB_DATA" },
146 { 0x28, 4, "RESERVED" },
147 { 0x2c, 4, "GPI_INV" },
148 { 0x30, 4, "GPIO_USE_SEL2" },
149 { 0x34, 4, "GP_IO_SEL2" },
150 { 0x38, 4, "GP_LVL2" },
151 { 0x3C, 4, "GPIO_USE_SEL Override (HIGH)" }
152};
153
Anton Kochkovda0b4562010-05-30 12:33:12 +0000154static const io_register_t ich9_gpio_registers[] = {
155 { 0x00, 4, "GPIO_USE_SEL" },
156 { 0x04, 4, "GP_IO_SEL" },
157 { 0x08, 4, "RESERVED" },
158 { 0x0c, 4, "GP_LVL" },
159 { 0x10, 4, "RESERVED" },
160 { 0x14, 4, "RESERVED" },
161 { 0x18, 4, "GPO_BLINK" },
162 { 0x1c, 4, "GP_SER_BLINK" },
163 { 0x20, 4, "GP_SB_CMDSTS" },
164 { 0x24, 4, "GP_SB_DATA" },
165 { 0x28, 4, "RESERVED" },
166 { 0x2c, 4, "GPI_INV" },
167 { 0x30, 4, "GPIO_USE_SEL2" },
168 { 0x34, 4, "GP_IO_SEL2" },
169 { 0x38, 4, "GP_LVL2" },
170 { 0x3C, 4, "RESERVED" }
171};
Stefan Reinauer1162f252008-12-04 15:18:20 +0000172
Warren Turkala7f2b0e2010-09-01 03:40:57 +0000173static const io_register_t ich10_gpio_registers[] = {
174 { 0x00, 4, "GPIO_USE_SEL" },
175 { 0x04, 4, "GP_IO_SEL" },
176 { 0x08, 4, "RESERVED" },
177 { 0x0c, 4, "GP_LVL" },
178 { 0x10, 4, "RESERVED" },
179 { 0x14, 4, "RESERVED" },
180 { 0x18, 4, "GPO_BLINK" },
181 { 0x1c, 4, "GP_SER_BLINK" },
182 { 0x20, 4, "GP_SB_CMDSTS" },
183 { 0x24, 4, "GP_SB_DATA" },
184 { 0x28, 4, "RESERVED" },
185 { 0x2c, 4, "GPI_INV" },
186 { 0x30, 4, "GPIO_USE_SEL2" },
187 { 0x34, 4, "GP_IO_SEL2" },
188 { 0x38, 4, "GP_LVL2" },
189 { 0x3C, 4, "RESERVED" },
190 { 0x40, 4, "GPIO_USE_SEL3" },
Edward O'Callaghanef3a17b2014-08-02 10:15:44 +1000191 { 0x44, 4, "GP_IO_SEL3" },
Warren Turkala7f2b0e2010-09-01 03:40:57 +0000192 { 0x48, 4, "GPIO_LVL3" },
193 { 0x4c, 4, "RESERVED" },
194 { 0x50, 4, "RESERVED" },
195 { 0x54, 4, "RESERVED" },
196 { 0x58, 4, "RESERVED" },
197 { 0x5c, 4, "RESERVED" },
198 { 0x60, 4, "GP_RST_SEL" },
199 { 0x64, 4, "RESERVED" },
200 { 0x68, 4, "RESERVED" },
201 { 0x6c, 4, "RESERVED" },
202 { 0x70, 4, "RESERVED" },
203 { 0x74, 4, "RESERVED" },
204 { 0x78, 4, "RESERVED" },
205 { 0x7c, 4, "RESERVED" },
206};
207
Sven Schnelle54a5aed2011-10-30 13:30:36 +0100208static const io_register_t i631x_gpio_registers[] = {
209 { 0x00, 4, "GPIO_USE_SEL" },
210 { 0x04, 4, "GP_IO_SEL" },
211 { 0x08, 4, "RESERVED" },
212 { 0x0c, 4, "GP_LVL" },
213 { 0x10, 4, "RESERVED" },
214 { 0x14, 4, "RESERVED" },
215 { 0x18, 4, "GPO_BLINK" },
216 { 0x1c, 4, "RESERVED" },
217 { 0x20, 4, "RESERVED" },
218 { 0x24, 4, "RESERVED" },
219 { 0x28, 4, "RESERVED" },
220 { 0x2c, 4, "GPI_INV" },
221 { 0x30, 4, "GPIO_USE_SEL2" },
222 { 0x34, 4, "GP_IO_SEL2" },
223 { 0x38, 4, "GP_LVL2" },
224};
225
Nico Huber6983a682013-03-29 18:08:13 +0100226static const io_register_t pch_gpio_registers[] = {
227 { 0x00, 4, "GPIO_USE_SEL" },
228 { 0x04, 4, "GP_IO_SEL" },
229 { 0x08, 4, "RESERVED" },
230 { 0x0c, 4, "GP_LVL" },
231 { 0x10, 4, "RESERVED" },
232 { 0x14, 4, "RESERVED" },
233 { 0x18, 4, "GPO_BLINK" },
234 { 0x1c, 4, "GP_SER_BLINK" },
235 { 0x20, 4, "GP_SB_CMDSTS" },
236 { 0x24, 4, "GP_SB_DATA" },
237 { 0x28, 2, "GPI_NMI_EN" },
238 { 0x2a, 2, "GPI_NMI_STS" },
239 { 0x2c, 4, "GPI_INV" },
240 { 0x30, 4, "GPIO_USE_SEL2" },
241 { 0x34, 4, "GP_IO_SEL2" },
242 { 0x38, 4, "GP_LVL2" },
243 { 0x3c, 4, "RESERVED" },
244 { 0x40, 4, "GPIO_USE_SEL3" },
Edward O'Callaghanef3a17b2014-08-02 10:15:44 +1000245 { 0x44, 4, "GP_IO_SEL3" },
Nico Huber6983a682013-03-29 18:08:13 +0100246 { 0x48, 4, "GPIO_LVL3" },
247 { 0x4c, 4, "RESERVED" },
248 { 0x50, 4, "RESERVED" },
249 { 0x54, 4, "RESERVED" },
250 { 0x58, 4, "RESERVED" },
251 { 0x5c, 4, "RESERVED" },
252 { 0x60, 4, "GP_RST_SEL1" },
253 { 0x64, 4, "GP_RST_SEL2" },
254 { 0x68, 4, "GP_RST_SEL3" },
255 { 0x6c, 4, "RESERVED" },
256 { 0x70, 4, "RESERVED" },
257 { 0x74, 4, "RESERVED" },
258 { 0x78, 4, "RESERVED" },
259 { 0x7c, 4, "RESERVED" },
260};
Stefan Taunerb75a39a2014-11-01 17:12:37 +0100261/* Default values for Ibex Peak desktop chipsets */
262static const gpio_default_t ip_pch_desktop_defaults[] = {
263 { 0x00, 0xf96ba1ff }, /* GPIO_USE_SEL */
264 { 0x04, 0xf6ff6eff }, /* GP_IO_SEL */
265 { 0x0c, 0x02fe0100 }, /* GP_LVL */
266 { 0x18, 0x00040000 }, /* GPO_BLINK */
267 { 0x1c, 0x00000000 }, /* GP_SER_BLINK */
268 { 0x28, 0x00000000 }, /* GP_NMI_EN + GPI_NMI_STS */
269 { 0x2c, 0x00000000 }, /* GP_INV */
270 { 0x30, 0x020300ff }, /* GPIO_USE_SEL2 */
271 { 0x34, 0x1f57fff4 }, /* GP_IO_SEL2 */
272 { 0x38, 0xa4aa0003 }, /* GP_LVL2 */
273 { 0x40, 0x00000100 }, /* GPIO_USE_SEL3 */
274 { 0x44, 0x00000f00 }, /* GP_IO_SEL3 */
275 { 0x48, 0x00000000 }, /* GP_LVL3 */
276 { 0x60, 0x01000000 }, /* GP_RST_SEL1 */
277 { 0x64, 0x00000000 }, /* GP_RST_SEL2 */
278 { 0x68, 0x00000000 }, /* GP_RST_SEL3 */
279};
280/* Default values for Ibex Peak mobile chipsets */
281static const gpio_default_t ip_pch_mobile_defaults[] = {
282 { 0x00, 0xf96ba1ff }, /* GPIO_USE_SEL */
283 { 0x04, 0xf6ff6eff }, /* GP_IO_SEL */
284 { 0x0c, 0x02fe0100 }, /* GP_LVL */
285 { 0x18, 0x00040000 }, /* GPO_BLINK */
286 { 0x1c, 0x00000000 }, /* GP_SER_BLINK */
287 { 0x28, 0x00000000 }, /* GP_NMI_EN + GPI_NMI_STS */
288 { 0x2c, 0x00000000 }, /* GP_INV */
289 { 0x30, 0x020300fe }, /* GPIO_USE_SEL2 */
290 { 0x34, 0x1f57fff4 }, /* GP_IO_SEL2 */
291 { 0x38, 0xa4aa0003 }, /* GP_LVL2 */
292 { 0x40, 0x00000000 }, /* GPIO_USE_SEL3 */
293 { 0x44, 0x00000f00 }, /* GP_IO_SEL3 */
294 { 0x48, 0x00000000 }, /* GP_LVL3 */
295 { 0x60, 0x01000000 }, /* GP_RST_SEL1 */
296 { 0x64, 0x00000000 }, /* GP_RST_SEL2 */
297 { 0x68, 0x00000000 }, /* GP_RST_SEL3 */
298};
Dennis Wassenbergae6685f2014-10-30 10:30:40 +0100299
300static const io_register_t lynxpoint_lp_gpio_registers[] = {
301 { 0x00, 4, "GPIO_OWN1" }, // GPIO Ownership
302 { 0x04, 4, "GPIO_OWN2" }, // GPIO Ownership
303 { 0x08, 4, "GPIO_OWN3" }, // GPIO Ownership
304 { 0x0c, 4, "RESERVED" }, // Reserved
305 { 0x10, 2, "GPIPRIOQ2IOXAPIC" }, // GPI PIRQ[X:I] to IOxAPIC[39:24] Enable
306 { 0x12, 2, "RESERVED" }, // Reserved
307 { 0x14, 4, "RESERVED" }, // Reserved
308 { 0x18, 4, "GPO_BLINK" }, // GPIO Blink Enable
309 { 0x1c, 4, "GP_SER_BLINK" }, // GP Serial Blink
310 { 0x20, 4, "GP_SB_CMDSTS" }, // GP Serial Blink Command Status
311 { 0x24, 4, "GP_SB_DATA" }, // GP Serial Blink Data
312 { 0x28, 2, "GPI_NMI_EN" }, // GPI NMI Enable
313 { 0x2a, 2, "GPI_NMI_STS" }, // GPI NMI Status
314 { 0x2c, 4, "RESERVED" }, // Reserved
315 { 0x30, 4, "GPI_ROUT" }, // GPI Interrupt Input Route
316 { 0x34, 4, "RESERVED" }, // Reserved
317 { 0x38, 4, "RESERVED" }, // Reserved
318 { 0x3C, 4, "RESERVED" }, // Reserved
319 { 0x40, 4, "RESERVED" }, // Reserved
320 { 0x44, 4, "RESERVED" }, // Reserved
321 { 0x48, 4, "RESERVED" }, // Reserved
322 { 0x4C, 4, "RESERVED" }, // Reserved
323 { 0x50, 4, "ALT_GPI_SMI_STS" }, // Alternate GPI SMI Status
324 { 0x54, 4, "ALT_GPI_SMI_EN" }, // Alternate GPI SMI Enable
325 { 0x58, 4, "RESERVED" }, // Reserved
326 { 0x5C, 4, "RESERVED" }, // Reserved
327 { 0x60, 4, "GP_RST_SEL1" }, // GPIO Reset Select 1
328 { 0x64, 4, "GP_RST_SEL2" }, // GPIO Reset Select 2
329 { 0x68, 4, "GP_RST_SEL3" }, // GPIO Reset Select 3
330 { 0x6c, 4, "RESERVED" }, // Reserved
331 { 0x70, 4, "RESERVED" }, // Reserved
332 { 0x74, 4, "RESERVED" }, // Reserved
333 { 0x78, 4, "RESERVED" }, // Reserved
334 { 0x7c, 4, "GPIO_GC" }, // GPIO Global Configuration
335 { 0x80, 4, "GPI_IS[31:0]" }, // GPI Interrupt Status [31:0]
336 { 0x84, 4, "GPI_IS[63:32]" }, // GPI Interrupt Status [63:32]
337 { 0x88, 4, "GPI_IS[94:64]" }, // GPI Interrupt Status [94:64]
338 { 0x8C, 4, "RESERVED" }, // Reserved
339 { 0x90, 4, "GPI_IE[31:0]" }, // GPI Interrupt Enable [31:0]
340 { 0x94, 4, "GPI_IE[63:32]" }, // GPI Interrupt Enable [63:32]
341 { 0x98, 4, "GPI_IE[94:64]" }, // GPI Interrupt Enable [94:64]
342 { 0x9C, 4, "RESERVED" }, // Reserved
343/* { 0x100, 4, "GPnCONFIGA" }, // GPIO Configuration A Register (n = 0) */
344/* { 0x104, 4, "GPnCONFIGB" }, // GPIO Configuration B Register (n = 0) */
345/* { ... } GPIO size = 95 */
346/* { 0x3f0, 4, "GPnCONFIGA" }, // GPIO Configuration A Register (n = 94) */
347/* { 0x3f4, 4, "GPnCONFIGB" }, // GPIO Configuration B Register (n = 94) */
348
349};
350
Nico Huber42c55012013-04-01 15:38:44 +0200351/* Default values for Cougar Point desktop chipsets */
352static const gpio_default_t cp_pch_desktop_defaults[] = {
353 { 0x00, 0xb96ba1ff },
354 { 0x04, 0xf6ff6eff },
355 { 0x0c, 0x02fe0100 },
356 { 0x18, 0x00040000 },
357 { 0x28, 0x00000000 },
358 { 0x2c, 0x00000000 },
359 { 0x30, 0x020300ff },
360 { 0x34, 0x1f57fff4 },
361 { 0x38, 0xa4aa0007 },
362 { 0x40, 0x00000130 },
363 { 0x44, 0x00000ff0 },
364 { 0x48, 0x000000c0 },
365 { 0x60, 0x01000000 },
366 { 0x64, 0x00000000 },
367 { 0x68, 0x00000000 },
368};
369/* Default values for Cougar Point mobile chipsets */
370static const gpio_default_t cp_pch_mobile_defaults[] = {
371 { 0x00, 0xb96ba1ff },
372 { 0x04, 0xf6ff6eff },
373 { 0x0c, 0x02fe0100 },
374 { 0x18, 0x00040000 },
375 { 0x28, 0x00000000 },
376 { 0x2c, 0x00000000 },
377 { 0x30, 0x020300fe },
378 { 0x34, 0x1f57fff4 },
379 { 0x38, 0xa4aa0007 },
380 { 0x40, 0x00000030 },
381 { 0x44, 0x00000ff0 },
382 { 0x48, 0x000000c0 },
383 { 0x60, 0x01000000 },
384 { 0x64, 0x00000000 },
385 { 0x68, 0x00000000 },
386};
387/* Default values for Panther Point desktop chipsets */
388static const gpio_default_t pp_pch_desktop_defaults[] = {
389 { 0x00, 0xb96ba1ff },
390 { 0x04, 0xeeff6eff },
391 { 0x0c, 0x02fe0100 },
392 { 0x18, 0x00040000 },
393 { 0x28, 0x00000000 },
394 { 0x2c, 0x00000000 },
395 { 0x30, 0x020300ff },
396 { 0x34, 0x1f57fff4 },
397 { 0x38, 0xa4aa0007 },
398 { 0x40, 0x00000130 },
399 { 0x44, 0x00000ff0 },
400 { 0x48, 0x000000c0 },
401 { 0x60, 0x01000000 },
402 { 0x64, 0x00000000 },
403 { 0x68, 0x00000000 },
404};
405/* Default values for Panther Point mobile chipsets */
406static const gpio_default_t pp_pch_mobile_defaults[] = {
407 { 0x00, 0xb96ba1ff },
408 { 0x04, 0xeeff6eff },
409 { 0x0c, 0x02fe0100 },
410 { 0x18, 0x00040000 },
411 { 0x28, 0x00000000 },
412 { 0x2c, 0x00000000 },
413 { 0x30, 0x020300fe },
414 { 0x34, 0x1f57fff4 },
415 { 0x38, 0xa4aa0007 },
416 { 0x40, 0x00000030 },
417 { 0x44, 0x00000ff0 },
418 { 0x48, 0x000000c0 },
419 { 0x60, 0x01000000 },
420 { 0x64, 0x00000000 },
421 { 0x68, 0x00000000 },
422};
423
Martin Roth51dde6f2014-12-07 22:11:54 -0700424/* Baytrail */
425static const io_register_t baytrail_score_ssus_gpio_registers[] = {
426 { 0x00, 4, "SC_USE_SEL_31_0_" },
427 { 0x04, 4, "SC_IO_SEL_31_0_" },
428 { 0x08, 4, "SC_GP_LVL_31_0_)" },
429 { 0x0C, 4, "SC_TPE_31_0_" },
430 { 0x10, 4, "SC_TNE_31_0_" },
431 { 0x14, 4, "SC_TS_31_0_" },
432 { 0x20, 4, "SC_USE_SEL_63_32_" },
433 { 0x24, 4, "SC_IO_SEL_63_32_" },
434 { 0x28, 4, "SC_GP_LVL_63_32_" },
435 { 0x2C, 4, "SC_TPE_63_32_" },
436 { 0x30, 4, "SC_TNE_63_32_" },
437 { 0x34, 4, "SC_TS_63_32_" },
438 { 0x40, 4, "SC_USE_SEL_95_64_" },
439 { 0x44, 4, "SC_IO_SEL_95_64_" },
440 { 0x48, 4, "SC_GP_LVL_95_64_" },
441 { 0x4C, 4, "SC_TPE_95_64_" },
442 { 0x50, 4, "SC_TNE_95_64_" },
443 { 0x54, 4, "SC_TS_95_64_" },
444 { 0x58, 4, "SC_USE_SEL_127_96_" },
445 { 0x64, 4, "SC_IO_SEL_127_96_" },
446 { 0x68, 4, "SC_GP_LVL_127_96_" },
447 { 0x6C, 4, "SC_TPE_127_96_" },
448 { 0x70, 4, "SC_TNE_127_96_" },
449 { 0x74, 4, "SC_TS_127_96_" },
450
451 { 0x80 + 0x00, 4, "SUS_USE_SEL_31_0_" },
452 { 0x80 + 0x04, 4, "SUS_IO_SEL_31_0_" },
453 { 0x80 + 0x08, 4, "SUS_GP_LVL_31_0_" },
454 { 0x80 + 0x0c, 4, "SUS_TPE_31_0_" },
455 { 0x80 + 0x10, 4, "SUS_TNE_31_0_" },
456 { 0x80 + 0x14, 4, "SUS_TS_31_0_" },
457 { 0x80 + 0x18, 4, "SUS_WAKE_EN_31_0_" },
458 { 0x80 + 0x20, 4, "SUS_USE_SEL_43_32_" },
459 { 0x80 + 0x24, 4, "SUS_IO_SEL_43_32_" },
460 { 0x80 + 0x28, 4, "SUS_GP_LVL_43_32_" },
461 { 0x80 + 0x2c, 4, "SUS_TPE_43_32_" },
462 { 0x80 + 0x30, 4, "SUS_TNE_43_32_" },
463 { 0x80 + 0x34, 4, "SUS_TS_43_32_" },
464 { 0x80 + 0x38, 4, "SUS_WAKE_EN_43_32_" }
465};
466
467/* Description of GPIO 'bank' ex. {ncore, score. ssus} */
468struct gpio_bank {
469 const uint32_t gpio_count;
470 const u8* gpio_to_pad;
471 const unsigned long pad_base_offset;
472 const char* gpio_name;
473 const char ** func_names;
474};
475
476/* Number of GPIOs in each bank */
477#define BANK_COUNT 3
478#define GPNCORE_COUNT 27
479#define GPSCORE_COUNT 102
480#define GPSSUS_COUNT 44
481
482/* IO Memory offsets */
483#define IO_BASE_OFFSET_GPNCORE 0x1000
484#define IO_BASE_OFFSET_GPSCORE 0x0000
485#define IO_BASE_OFFSET_GPSSUS 0x2000
486
487static const char *ncore_func_names[GPNCORE_COUNT * 8] = {
488"GPIO_S0_NC[00]", "RESERVED", "DDI0_HPD", "-", "-", "-", "-", "-",
489"GPIO_S0_NC[01]", "-", "DDI0_DDCDATA", "-", "-", "-", "-", "-",
490"GPIO_S0_NC[02]", "-", "DDI0_DDCCLK", "-", "-", "-", "-", "-",
491"GPIO_S0_NC[03]", "-", "DDI0_VDDEN", "-", "-", "-", "-", "-",
492"GPIO_S0_NC[04]", "-", "DDI0_BKLTEN", "-", "-", "-", "-", "-",
493"GPIO_S0_NC[05]", "-", "DDI0_BKLTCTL", "-", "-", "-", "-", "-",
494"GPIO_S0_NC[06]", "RESERVED", "DDI1_HPD", "-", "-", "-", "-", "-",
495"GPIO_S0_NC[07]", "-", "DDI1_DDCDATA", "-", "-", "-", "-", "-",
496"GPIO_S0_NC[08]", "-", "DDI1_DDCCLK", "-", "-", "-", "-", "-",
497"GPIO_S0_NC[09]", "RESERVED", "DDI1_VDDEN", "-", "-", "-", "-", "-",
498"GPIO_S0_NC[10]", "RESERVED", "DDI1_BKLTEN", "-", "-", "-", "-", "-",
499"GPIO_S0_NC[11]", "RESERVED", "DDI1_BKLTCTL", "-", "-", "-", "-", "-",
500"GPIO_S0_NC[12]", "RESERVED", "-", "-", "-", "-", "-", "-",
501"GPIO_S0_NC[13]", "RESERVED", "-", "-", "-", "-", "-", "-",
502"GPIO_S0_NC[14]", "RESERVED", "-", "-", "-", "-", "-", "-",
503"GPIO_S0_NC[15]", "RESERVED", "RESERVED", "-", "-", "-", "-", "-",
504"GPIO_S0_NC[16]", "RESERVED", "RESERVED", "-", "-", "-", "-", "-",
505"GPIO_S0_NC[17]", "RESERVED", "RESERVED", "-", "-", "-", "-", "-",
506"GPIO_S0_NC[18]", "RESERVED", "RESERVED", "-", "-", "-", "-", "-",
507"GPIO_S0_NC[19]", "RESERVED", "RESERVED", "-", "-", "-", "-", "-",
508"GPIO_S0_NC[20]", "RESERVED", "RESERVED", "-", "-", "-", "-", "-",
509"GPIO_S0_NC[21]", "RESERVED", "RESERVED", "-", "-", "-", "-", "-",
510"GPIO_S0_NC[22]", "RESERVED", "RESERVED", "-", "-", "-", "-", "-",
511"GPIO_S0_NC[23]", "RESERVED", "RESERVED", "-", "-", "-", "-", "-",
512"GPIO_S0_NC[24]", "RESERVED", "-", "-", "-", "-", "-", "-",
513"GPIO_S0_NC[25]", "RESERVED", "-", "-", "-", "-", "-", "-",
514"GPIO_S0_NC[26]", "RESERVED", "-", "-", "-", "-", "-", "-",
515};
516
517static const char *score_func_names[GPSCORE_COUNT * 8] = {
518"GPIO_S0_SC[000]", "SATA_GP[0]", "-", "-", "-", "-", "-", "-",
519"GPIO_S0_SC[001]", "SATA_GP[1]", "SATA_DEVSLP[0]", "-", "-", "-", "-", "-",
520"GPIO_S0_SC[002]", "SATA_LED#", "-", "-", "-", "-", "-", "-",
521"GPIO_S0_SC[003]", "PCIE_CLKREQ[0]#", "-", "-", "-", "-", "-", "-",
522"GPIO_S0_SC[004]", "PCIE_CLKREQ[1]#", "-", "-", "-", "-", "-", "-",
523"GPIO_S0_SC[005]", "PCIE_CLKREQ[2]#", "-", "-", "-", "-", "-", "-",
524"GPIO_S0_SC[006]", "PCIE_CLKREQ[3]#", "-", "-", "-", "-", "-", "-",
525"GPIO_S0_SC[007]", "RESERVED", "SD3_WP", "-", "-", "-", "-", "-",
526"GPIO_S0_SC[008]", "I2S0_CLK", "HDA_RST#", "-", "-", "-", "-", "-",
527"GPIO_S0_SC[009]", "I2S0_FRM", "HDA_SYNC", "-", "-", "-", "-", "-",
528"GPIO_S0_SC[010]", "I2S0_DATAOUT", "HDA_CLK", "-", "-", "-", "-", "-",
529"GPIO_S0_SC[011]", "I2S0_DATAIN", "HDA_SDO", "-", "-", "-", "-", "-",
530"GPIO_S0_SC[012]", "I2S1_CLK", "HDA_SDI[0]", "-", "-", "-", "-", "-",
531"GPIO_S0_SC[013]", "I2S1_FRM", "HDA_SDI[1]", "-", "-", "-", "-", "-",
532"GPIO_S0_SC[014]", "I2S1_DATAOUT", "RESERVED", "-", "-", "-", "-", "-",
533"GPIO_S0_SC[015]", "I2S1_DATAIN", "RESERVED", "-", "-", "-", "-", "-",
534"GPIO_S0_SC[016]", "MMC1_CLK", "-", "MMC1_45_CLK", "-", "-", "-", "-",
535"GPIO_S0_SC[017]", "MMC1_D[0]", "-", "MMC1_45_D[0]", "-", "-", "-", "-",
536"GPIO_S0_SC[018]", "MMC1_D[1]", "-", "MMC1_45_D[1]", "-", "-", "-", "-",
537"GPIO_S0_SC[019]", "MMC1_D[2]", "-", "MMC1_45_D[2]", "-", "-", "-", "-",
538"GPIO_S0_SC[020]", "MMC1_D[3]", "-", "MMC1_45_D[3]", "-", "-", "-", "-",
539"GPIO_S0_SC[021]", "MMC1_D[4]", "-", "MMC1_45_D[4]", "-", "-", "-", "-",
540"GPIO_S0_SC[022]", "MMC1_D[5]", "-", "MMC1_45_D[5]", "-", "-", "-", "-",
541"GPIO_S0_SC[023]", "MMC1_D[6]", "-", "MMC1_45_D[6]", "-", "-", "-", "-",
542"GPIO_S0_SC[024]", "MMC1_D[7]", "-", "MMC1_45_D[7]", "-", "-", "-", "-",
543"GPIO_S0_SC[025]", "MMC1_CMD", "-", "MMC1_45_CMD", "-", "-", "-", "-",
544"GPIO_S0_SC[026]", "MMC1_RST#", "SATA_DEVSLP[0]", "MMC1_45_RST#", "-", "-", "-", "-",
545"GPIO_S0_SC[027]", "SD2_CLK", "-", "-", "-", "-", "-", "-",
546"GPIO_S0_SC[028]", "SD2_D[0]", "-", "-", "-", "-", "-", "-",
547"GPIO_S0_SC[029]", "SD2_D[1]", "-", "-", "-", "-", "-", "-",
548"GPIO_S0_SC[030]", "SD2_D[2]", "-", "-", "-", "-", "-", "-",
549"GPIO_S0_SC[031]", "SD2_D[3]_CD#", "-", "-", "-", "-", "-", "-",
550"GPIO_S0_SC[032]", "SD2_CMD", "-", "-", "-", "-", "-", "-",
551"GPIO_S0_SC[033]", "SD3_CLK", "-", "-", "-", "-", "-", "-",
552"GPIO_S0_SC[034]", "SD3_D[0]", "-", "-", "-", "-", "-", "-",
553"GPIO_S0_SC[035]", "SD3_D[1]", "-", "-", "-", "-", "-", "-",
554"GPIO_S0_SC[036]", "SD3_D[2]", "-", "-", "-", "-", "-", "-",
555"GPIO_S0_SC[037]", "SD3_D[3]", "-", "-", "-", "-", "-", "-",
556"GPIO_S0_SC[038]", "SD3_CD#", "-", "-", "-", "-", "-", "-",
557"GPIO_S0_SC[039]", "SD3_CMD", "-", "-", "-", "-", "-", "-",
558"GPIO_S0_SC[040]", "SD3_1P8EN", "-", "-", "-", "-", "-", "-",
559"GPIO_S0_SC[041]", "SD3_PWREN#", "-", "-", "-", "-", "-", "-",
560"GPIO_S0_SC[042]", "ILB_LPC_AD[0]", "-", "-", "-", "-", "-", "-",
561"GPIO_S0_SC[043]", "ILB_LPC_AD[1]", "-", "-", "-", "-", "-", "-",
562"GPIO_S0_SC[044]", "ILB_LPC_AD[2]", "-", "-", "-", "-", "-", "-",
563"GPIO_S0_SC[045]", "ILB_LPC_AD[3]", "-", "-", "-", "-", "-", "-",
564"GPIO_S0_SC[046]", "ILB_LPC_FRAME#", "-", "-", "-", "-", "-", "-",
565"GPIO_S0_SC[047]", "ILB_LPC_CLK[0]", "-", "-", "-", "-", "-", "-",
566"GPIO_S0_SC[048]", "ILB_LPC_CLK[1]", "-", "-", "-", "-", "-", "-",
567"GPIO_S0_SC[049]", "ILB_LPC_CLKRUN#", "-", "-", "-", "-", "-", "-",
568"GPIO_S0_SC[050]", "ILB_LPC_SERIRQ", "-", "-", "-", "-", "-", "-",
569"GPIO_S0_SC[051]", "PCU_SMB_DATA", "-", "-", "-", "-", "-", "-",
570"GPIO_S0_SC[052]", "PCU_SMB_CLK", "-", "-", "-", "-", "-", "-",
571"GPIO_S0_SC[053]", "PCU_SMB_ALERT#", "-", "-", "-", "-", "-", "-",
572"GPIO_S0_SC[054]", "ILB_8254_SPKR", "RESERVED", "-", "-", "-", "-", "-",
573"GPIO_S0_SC[055]", "RESERVED", "-", "-", "-", "-", "-", "-",
574"GPIO_S0_SC[056]", "RESERVED", "-", "-", "-", "-", "-", "-",
575"GPIO_S0_SC[057]", "PCU_UART_TXD", "-", "-", "-", "-", "-", "-",
576"GPIO_S0_SC[058]", "RESERVED", "-", "-", "-", "-", "-", "-",
577"GPIO_S0_SC[059]", "RESERVED", "-", "-", "-", "-", "-", "-",
578"GPIO_S0_SC[060]", "RESERVED", "-", "-", "-", "-", "-", "-",
579"GPIO_S0_SC[061]", "PCU_UART_RXD", "-", "-", "-", "-", "-", "-",
580"GPIO_S0_SC[062]", "LPE_I2S2_CLK", "SATA_DEVSLP[1]", "RESERVED", "-", "-", "-", "-",
581"GPIO_S0_SC[063]", "LPE_I2S2_FRM", "RESERVED", "-", "-", "-", "-", "-",
582"GPIO_S0_SC[064]", "LPE_I2S2_DATAIN", "-", "-", "-", "-", "-", "-",
583"GPIO_S0_SC[065]", "LPE_I2S2_DATAOUT", "-", "-", "-", "-", "-", "-",
584"GPIO_S0_SC[066]", "SIO_SPI_CS#", "-", "-", "-", "-", "-", "-",
585"GPIO_S0_SC[067]", "SIO_SPI_MISO", "-", "-", "-", "-", "-", "-",
586"GPIO_S0_SC[068]", "SIO_SPI_MOSI", "-", "-", "-", "-", "-", "-",
587"GPIO_S0_SC[069]", "SIO_SPI_CLK", "-", "-", "-", "-", "-", "-",
588"GPIO_S0_SC[070]", "SIO_UART1_RXD", "RESERVED", "-", "-", "-", "-", "-",
589"GPIO_S0_SC[071]", "SIO_UART1_TXD", "RESERVED", "-", "-", "-", "-", "-",
590"GPIO_S0_SC[072]", "SIO_UART1_RTS#", "-", "-", "-", "-", "-", "-",
591"GPIO_S0_SC[073]", "SIO_UART1_CTS#", "-", "-", "-", "-", "-", "-",
592"GPIO_S0_SC[074]", "SIO_UART2_RXD", "-", "-", "-", "-", "-", "-",
593"GPIO_S0_SC[075]", "SIO_UART2_TXD", "-", "-", "-", "-", "-", "-",
594"GPIO_S0_SC[076]", "SIO_UART2_RTS#", "-", "-", "-", "-", "-", "-",
595"GPIO_S0_SC[077]", "SIO_UART2_CTS#", "-", "-", "-", "-", "-", "-",
596"GPIO_S0_SC[078]", "SIO_I2C0_DATA", "-", "-", "-", "-", "-", "-",
597"GPIO_S0_SC[079]", "SIO_I2C0_CLK", "-", "-", "-", "-", "-", "-",
598"GPIO_S0_SC[080]", "SIO_I2C1_DATA", "-", "-", "-", "-", "-", "-",
599"GPIO_S0_SC[081]", "SIO_I2C1_CLK", "RESERVED", "-", "-", "-", "-", "-",
600"GPIO_S0_SC[082]", "SIO_I2C2_DATA", "-", "-", "-", "-", "-", "-",
601"GPIO_S0_SC[083]", "SIO_I2C2_CLK", "-", "-", "-", "-", "-", "-",
602"GPIO_S0_SC[084]", "SIO_I2C3_DATA", "-", "-", "-", "-", "-", "-",
603"GPIO_S0_SC[085]", "SIO_I2C3_CLK", "-", "-", "-", "-", "-", "-",
604"GPIO_S0_SC[086]", "SIO_I2C4_DATA", "-", "-", "-", "-", "-", "-",
605"GPIO_S0_SC[087]", "SIO_I2C4_CLK", "-", "-", "-", "-", "-", "-",
606"GPIO_S0_SC[088]", "SIO_I2C5_DATA", "-", "-", "-", "-", "-", "-",
607"GPIO_S0_SC[089]", "SIO_I2C5_CLK", "-", "-", "-", "-", "-", "-",
608"GPIO_S0_SC[090]", "SIO_I2C6_DATA", "ILB_NMI", "-", "-", "-", "-", "-",
609"GPIO_S0_SC[091]", "SIO_I2C6_CLK", "SD3_WP", "-", "-", "-", "-", "-",
610"RESERVED", "GPIO_S0_SC[092]", "-", "-", "-", "-", "-", "-",
611"RESERVED", "GPIO_S0_SC[093]", "-", "-", "-", "-", "-", "-",
612"GPIO_S0_SC[094]", "SIO_PWM[0]", "-", "-", "-", "-", "-", "-",
613"GPIO_S0_SC[095]", "SIO_PWM[1]", "-", "-", "-", "-", "-", "-",
614"GPIO_S0_SC[096]", "PMC_PLT_CLK[0]", "-", "-", "-", "-", "-", "-",
615"GPIO_S0_SC[097]", "PMC_PLT_CLK[1]", "-", "-", "-", "-", "-", "-",
616"GPIO_S0_SC[098]", "PMC_PLT_CLK[2]", "-", "-", "-", "-", "-", "-",
617"GPIO_S0_SC[099]", "PMC_PLT_CLK[3]", "-", "-", "-", "-", "-", "-",
618"GPIO_S0_SC[100]", "PMC_PLT_CLK[4]", "-", "-", "-", "-", "-", "-",
619"GPIO_S0_SC[101]", "PMC_PLT_CLK[5]", "-", "-", "-", "-", "-", "-",
620};
621
622static const char *ssus_func_names[GPSSUS_COUNT * 8] = {
623"GPIO_S5[00]", "RESERVED", "-", "-", "-", "-", "-", "-",
624"GPIO_S5[01]", "RESERVED", "RESERVED", "RESERVED", "-", "-", "PMC_WAKE_PCIE[1]#", "-",
625"GPIO_S5[02]", "RESERVED", "RESERVED", "RESERVED", "-", "-", "PMC_WAKE_PCIE[2]#", "-",
626"GPIO_S5[03]", "RESERVED", "RESERVED", "RESERVED", "-", "-", "PMC_WAKE_PCIE[3]#", "-",
627"GPIO_S5[04]", "RESERVED", "RESERVED", "RESERVED", "-", "-", "RESERVED", "-",
628"GPIO_S5[05]", "PMC_SUSCLK[1]", "RESERVED", "RESERVED", "-", "-", "RESERVED", "-",
629"GPIO_S5[06]", "PMC_SUSCLK[2]", "RESERVED", "RESERVED", "-", "-", "RESERVED", "-",
630"GPIO_S5[07]", "PMC_SUSCLK[3]", "RESERVED", "RESERVED", "-", "-", "RESERVED", "-",
631"GPIO_S5[08]", "RESERVED", "RESERVED", "RESERVED", "-", "-", "RESERVED", "-",
632"GPIO_S5[09]", "RESERVED", "RESERVED", "RESERVED", "-", "-", "RESERVED", "-",
633"GPIO_S5[10]", "RESERVED", "RESERVED", "RESERVED", "-", "-", "-", "-",
634"PMC_SUSPWRDNACK", "GPIO_S5[11]", "-", "-", "-", "-", "-", "-",
635"PMC_SUSCLK[0]", "GPIO_S5[12]", "-", "-", "-", "-", "-", "-",
636"RESERVED", "GPIO_S5[13]", "-", "-", "-", "-", "-", "-",
637"RESERVED", "GPIO_S5[14]", "USB_ULPI_RST#","-", "-", "-", "-", "-",
638"PMC_WAKE_PCIE[0]#", "GPIO_S5[15]", "-", "-", "-", "-", "-", "-",
639"PMC_PWRBTN#", "GPIO_S5[16]", "-", "-", "-", "-", "-", "-",
640"RESERVED", "GPIO_S5[17]", "-", "-", "-", "-", "-", "-",
641"PMC_SUS_STAT#", "GPIO_S5[18]", "-", "-", "-", "-", "-", "-",
642"USB_OC[0]#", "GPIO_S5[19]", "-", "-", "-", "-", "-", "-",
643"USB_OC[1]#", "GPIO_S5[20]", "-", "-", "-", "-", "-", "-",
644"PCU_SPI_CS[1]#", "GPIO_S5[21]", "-", "-", "-", "-", "-", "-",
645"GPIO_S5[22]", "RESERVED", "RESERVED", "RESERVED", "-", "-", "RESERVED", "-",
646"GPIO_S5[23]", "RESERVED", "RESERVED", "RESERVED", "-", "-", "RESERVED", "-",
647"GPIO_S5[24]", "RESERVED", "RESERVED", "RESERVED", "-", "-", "RESERVED", "-",
648"GPIO_S5[25]", "RESERVED", "RESERVED", "RESERVED", "-", "-", "RESERVED", "-",
649"GPIO_S5[26]", "RESERVED", "RESERVED", "RESERVED", "-", "-", "RESERVED", "-",
650"GPIO_S5[27]", "RESERVED", "RESERVED", "RESERVED", "-", "-", "RESERVED", "-",
651"GPIO_S5[28]", "RESERVED", "RESERVED", "RESERVED", "-", "-", "RESERVED", "-",
652"GPIO_S5[29]", "RESERVED", "RESERVED", "RESERVED", "-", "-", "RESERVED", "-",
653"GPIO_S5[30]", "RESERVED", "RESERVED", "RESERVED", "-", "-", "RESERVED", "-",
654"GPIO_S5[31]", "USB_ULPI_CLK", "RESERVED", "RESERVED", "-", "-", "-", "-",
655"GPIO_S5[32]", "USB_ULPI_DATA[0]", "RESERVED", "RESERVED", "-", "-", "-", "-",
656"GPIO_S5[33]", "USB_ULPI_DATA[1]", "RESERVED", "RESERVED", "-", "-", "-", "-",
657"GPIO_S5[34]", "USB_ULPI_DATA[2]", "RESERVED", "RESERVED", "-", "-", "-", "-",
658"GPIO_S5[35]", "USB_ULPI_DATA[3]", "RESERVED", "RESERVED", "-", "-", "-", "-",
659"GPIO_S5[36]", "USB_ULPI_DATA[4]", "RESERVED", "RESERVED", "-", "-", "-", "-",
660"GPIO_S5[37]", "USB_ULPI_DATA[5]", "RESERVED", "RESERVED", "-", "-", "-", "-",
661"GPIO_S5[38]", "USB_ULPI_DATA[6]", "RESERVED", "RESERVED", "-", "-", "-", "-",
662"GPIO_S5[39]", "USB_ULPI_DATA[7]", "RESERVED", "RESERVED", "-", "-", "-", "-",
663"GPIO_S5[40]", "USB_ULPI_DIR", "RESERVED", "RESERVED", "-", "-", "-", "-",
664"GPIO_S5[41]", "USB_ULPI_NXT", "RESERVED", "RESERVED", "-", "-", "-", "-",
665"GPIO_S5[42]", "USB_ULPI_STP", "RESERVED", "RESERVED", "-", "-", "-", "-",
666"GPIO_S5[43]", "USB_ULPI_REFCLK", "RESERVED", "RESERVED", "-", "-", "-", "-",
667};
668
669/* GPIO-to-Pad LUTs - Translate the GPIO number to the pad register */
670static const u8 gpncore_gpio_to_pad[GPNCORE_COUNT] =
671 { 19, 18, 17, 20, 21, 22, 24, 25, /* [ 0: 7] */
672 23, 16, 14, 15, 12, 26, 27, 1, /* [ 8:15] */
673 4, 8, 11, 0, 3, 6, 10, 13, /* [16:23] */
674 2, 5, 9 }; /* [24:26] */
675
676static const u8 gpscore_gpio_to_pad[GPSCORE_COUNT] =
677 { 85, 89, 93, 96, 99, 102, 98, 101, /* [ 0: 7] */
678 34, 37, 36, 38, 39, 35, 40, 84, /* [ 8: 15] */
679 62, 61, 64, 59, 54, 56, 60, 55, /* [16: 23] */
680 63, 57, 51, 50, 53, 47, 52, 49, /* [24: 31] */
681 48, 43, 46, 41, 45, 42, 58, 44, /* [32: 39] */
682 95, 105, 70, 68, 67, 66, 69, 71, /* [40: 47] */
683 65, 72, 86, 90, 88, 92, 103, 77, /* [48: 55] */
684 79, 83, 78, 81, 80, 82, 13, 12, /* [56: 63] */
685 15, 14, 17, 18, 19, 16, 2, 1, /* [64: 71] */
686 0, 4, 6, 7, 9, 8, 33, 32, /* [72: 79] */
687 31, 30, 29, 27, 25, 28, 26, 23, /* [80: 87] */
688 21, 20, 24, 22, 5, 3, 10, 11, /* [88: 95] */
689 106, 87, 91, 104, 97, 100 }; /* [96:101] */
690
691static const u8 gpssus_gpio_to_pad[GPSSUS_COUNT] =
692 { 29, 33, 30, 31, 32, 34, 36, 35, /* [ 0: 7] */
693 38, 37, 18, 7, 11, 20, 17, 1, /* [ 8:15] */
694 8, 10, 19, 12, 0, 2, 23, 39, /* [16:23] */
695 28, 27, 22, 21, 24, 25, 26, 51, /* [24:31] */
696 56, 54, 49, 55, 48, 57, 50, 58, /* [32:39] */
697 52, 53, 59, 40 }; /* [40:43] */
698
699static const struct gpio_bank gpio_banks[] = {
700 {
701 .gpio_count = GPNCORE_COUNT,
702 .gpio_to_pad = gpncore_gpio_to_pad,
703 .pad_base_offset = IO_BASE_OFFSET_GPNCORE,
704 .gpio_name = "NCORE GPIOs",
705 .func_names = ncore_func_names,
706 },
707 {
708 .gpio_count = GPSCORE_COUNT,
709 .gpio_to_pad = gpscore_gpio_to_pad,
710 .pad_base_offset = IO_BASE_OFFSET_GPSCORE,
711 .gpio_name = "SCORE GPIOs (GPIO_S0_SC_XX)",
712 .func_names = score_func_names,
713 },
714 {
715 .gpio_count = GPSSUS_COUNT,
716 .gpio_to_pad = gpssus_gpio_to_pad,
717 .pad_base_offset = IO_BASE_OFFSET_GPSSUS,
718 .gpio_name = "SSUS GPIOs (GPIO_S5)",
719 .func_names = ssus_func_names,
720 },
721};
722
723const char *pull_assignment[] = {"None","Up ","Down","Res "};
724const char *pull_strength[] = {"2k", "10k", "20k", "40k"};
725
726static int show_baytrail_pad_reg(struct pci_dev *sb){
727
728 uint64_t iobase = (uint64_t)pci_read_long(sb, 0x4c) & 0xffffc000;
729 uint32_t val, bank, gpio, offset, size = 0x3000;
730 volatile uint32_t *reg;
731
732 reg = map_physical(iobase, size);
733
734 if (reg == NULL) {
735 perror("Error mapping IOBASE");
736 return 1;
737 }
738
739 printf("\nIOBASE: 0x%08lx\n",(long int)iobase);
740
741 /* Display function values */
742 for (bank = 0; bank < BANK_COUNT; bank++) {
743 printf("\n========== Bay Trail %s ===========\n\n",
744 gpio_banks[bank].gpio_name);
745
746 printf("Address | GPIO # | reg value | "
747 "Pull Dir & Str | Func #: Func Name |"
748 " I/O | Current Val\n");
749
750 for (gpio=0; gpio < gpio_banks[bank].gpio_count; gpio++) {
751 offset = gpio_banks[bank].pad_base_offset +
752 (16 * gpio_banks[bank].gpio_to_pad[gpio]);
753
754 /* Read Pad Configuration 0 Register */
755 val = *(reg + offset / 4);
756 printf("iobase + 0x%04x | GPIO %3d | ",offset, gpio);
757 printf("0x%08x | ", val);
758 printf("Pull: %4s %3s | ",pull_assignment[(val >> 7) & 3],
759 ((val >> 7) & 3) ?
760 pull_strength[(val >> 9) & 3] :
761 "");
762 printf("Func %d",val & 0x07);
763 if (gpio_banks[bank].func_names != NULL)
764 printf(": %-20s | ", gpio_banks[bank].func_names[(gpio * 8) + (val & 0x07)] );
765
766 /* Read the Pad Value Register */
767 val = *(reg + offset / 4 + 2);
768 printf("%6s%3s%5s | %-4s",
769 (val & 0x02) ? "" : "Output",
770 (val & 0x06) ? "" : " / ",
771 (val & 0x04) ? "" : "Input",
772 (val & 0x01) ? "High" : "Low");
773 printf("\n");
774 }
775 }
776
777 unmap_physical((void *)reg, size);
778 return 0;
779}
780
Nico Huber09dcbf02013-04-01 15:08:04 +0200781static uint16_t gpiobase;
Nico Huber6983a682013-03-29 18:08:13 +0100782
Nico Huber09dcbf02013-04-01 15:08:04 +0200783static void print_reg(const io_register_t *const reg)
Stefan Reinauer23190272008-08-20 13:41:24 +0000784{
Nico Huber09dcbf02013-04-01 15:08:04 +0200785 switch (reg->size) {
786 case 4:
787 printf("gpiobase+0x%04x: 0x%08x (%s)\n",
788 reg->addr, inl(gpiobase+reg->addr), reg->name);
789 break;
790 case 2:
791 printf("gpiobase+0x%04x: 0x%04x (%s)\n",
792 reg->addr, inw(gpiobase+reg->addr), reg->name);
793 break;
794 case 1:
795 printf("gpiobase+0x%04x: 0x%02x (%s)\n",
796 reg->addr, inb(gpiobase+reg->addr), reg->name);
797 break;
798 }
799}
Stefan Reinauer23190272008-08-20 13:41:24 +0000800
Nico Huber09dcbf02013-04-01 15:08:04 +0200801static uint32_t get_diff(const io_register_t *const reg, const uint32_t def)
802{
803 uint32_t gpio_diff = 0;
804 switch (reg->size) {
805 case 4:
806 gpio_diff = def ^ inl(gpiobase+reg->addr);
807 break;
808 case 2:
809 gpio_diff = (uint16_t)def ^ inw(gpiobase+reg->addr);
810 break;
811 case 1:
812 gpio_diff = (uint8_t)def ^ inb(gpiobase+reg->addr);
813 break;
814 }
815 return gpio_diff;
816}
817
818static void print_diff(const io_register_t *const reg,
819 const uint32_t def, const uint32_t diff)
820{
821 switch (reg->size) {
822 case 4:
823 printf("gpiobase+0x%04x: 0x%08x (%s) DEFAULT\n",
824 reg->addr, def, reg->name);
825 printf("gpiobase+0x%04x: 0x%08x (%s) DIFF\n",
826 reg->addr, diff, reg->name);
827 break;
828 case 2:
829 printf("gpiobase+0x%04x: 0x%04x (%s) DEFAULT\n",
830 reg->addr, def, reg->name);
831 printf("gpiobase+0x%04x: 0x%04x (%s) DIFF\n",
832 reg->addr, diff, reg->name);
833 break;
834 case 1:
835 printf("gpiobase+0x%04x: 0x%02x (%s) DEFAULT\n",
836 reg->addr, def, reg->name);
837 printf("gpiobase+0x%04x: 0x%02x (%s) DIFF\n",
838 reg->addr, diff, reg->name);
839 break;
840 }
841}
842
843int print_gpios(struct pci_dev *sb, int show_all, int show_diffs)
844{
845 int i, j, size, defaults_size = 0;
846 const io_register_t *gpio_registers;
Nico Huber42c55012013-04-01 15:38:44 +0200847 const gpio_default_t *gpio_defaults = NULL;
Nico Huber09dcbf02013-04-01 15:08:04 +0200848 uint32_t gpio_diff;
849
850 if (show_diffs && !show_all)
851 printf("\n========== GPIO DIFFS ===========\n\n");
852 else
853 printf("\n============= GPIOS =============\n\n");
Stefan Reinauer23190272008-08-20 13:41:24 +0000854
855 switch (sb->device_id) {
Dennis Wassenbergae6685f2014-10-30 10:30:40 +0100856 case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_FULL:
857 case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_PREM:
858 case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_BASE:
859 gpiobase = pci_read_word(sb, 0x48) & 0xfffc;
860 gpio_registers = lynxpoint_lp_gpio_registers;
861 size = ARRAY_SIZE(lynxpoint_lp_gpio_registers);
862 break;
Stefan Taunerb75a39a2014-11-01 17:12:37 +0100863 case PCI_DEVICE_ID_INTEL_3400:
864 case PCI_DEVICE_ID_INTEL_3420:
865 case PCI_DEVICE_ID_INTEL_3450:
866 case PCI_DEVICE_ID_INTEL_3400_DESKTOP:
867 case PCI_DEVICE_ID_INTEL_B55_A:
868 case PCI_DEVICE_ID_INTEL_B55_B:
869 case PCI_DEVICE_ID_INTEL_H55:
870 case PCI_DEVICE_ID_INTEL_H57:
871 case PCI_DEVICE_ID_INTEL_P55:
872 case PCI_DEVICE_ID_INTEL_Q57:
873 gpiobase = pci_read_word(sb, 0x48) & 0xff80;
874 gpio_registers = pch_gpio_registers;
875 size = ARRAY_SIZE(pch_gpio_registers);
876 gpio_defaults = ip_pch_desktop_defaults;
877 defaults_size = ARRAY_SIZE(ip_pch_desktop_defaults);
878 break;
879 case PCI_DEVICE_ID_INTEL_3400_MOBILE:
880 case PCI_DEVICE_ID_INTEL_3400_MOBILE_SFF:
881 case PCI_DEVICE_ID_INTEL_HM55:
882 case PCI_DEVICE_ID_INTEL_HM57:
883 case PCI_DEVICE_ID_INTEL_PM55:
884 case PCI_DEVICE_ID_INTEL_QM57:
885 case PCI_DEVICE_ID_INTEL_QS57:
886 gpiobase = pci_read_word(sb, 0x48) & 0xff80;
887 gpio_registers = pch_gpio_registers;
888 size = ARRAY_SIZE(pch_gpio_registers);
889 gpio_defaults = ip_pch_mobile_defaults;
890 defaults_size = ARRAY_SIZE(ip_pch_mobile_defaults);
891 break;
Nico Huber6983a682013-03-29 18:08:13 +0100892 case PCI_DEVICE_ID_INTEL_Z68:
893 case PCI_DEVICE_ID_INTEL_P67:
Nico Huber6983a682013-03-29 18:08:13 +0100894 case PCI_DEVICE_ID_INTEL_H67:
Nico Huber6983a682013-03-29 18:08:13 +0100895 case PCI_DEVICE_ID_INTEL_Q65:
896 case PCI_DEVICE_ID_INTEL_QS67:
897 case PCI_DEVICE_ID_INTEL_Q67:
Nico Huber6983a682013-03-29 18:08:13 +0100898 case PCI_DEVICE_ID_INTEL_B65:
899 case PCI_DEVICE_ID_INTEL_C202:
900 case PCI_DEVICE_ID_INTEL_C204:
901 case PCI_DEVICE_ID_INTEL_C206:
902 case PCI_DEVICE_ID_INTEL_H61:
Nico Huber42c55012013-04-01 15:38:44 +0200903 gpiobase = pci_read_word(sb, 0x48) & 0xfffc;
904 gpio_registers = pch_gpio_registers;
905 size = ARRAY_SIZE(pch_gpio_registers);
906 gpio_defaults = cp_pch_desktop_defaults;
907 defaults_size = ARRAY_SIZE(cp_pch_desktop_defaults);
908 break;
909 case PCI_DEVICE_ID_INTEL_UM67:
910 case PCI_DEVICE_ID_INTEL_HM65:
911 case PCI_DEVICE_ID_INTEL_HM67:
912 case PCI_DEVICE_ID_INTEL_QM67:
913 gpiobase = pci_read_word(sb, 0x48) & 0xfffc;
914 gpio_registers = pch_gpio_registers;
915 size = ARRAY_SIZE(pch_gpio_registers);
916 gpio_defaults = cp_pch_mobile_defaults;
917 defaults_size = ARRAY_SIZE(cp_pch_mobile_defaults);
918 break;
Nico Huber6983a682013-03-29 18:08:13 +0100919 case PCI_DEVICE_ID_INTEL_Z77:
920 case PCI_DEVICE_ID_INTEL_Z75:
921 case PCI_DEVICE_ID_INTEL_Q77:
922 case PCI_DEVICE_ID_INTEL_Q75:
923 case PCI_DEVICE_ID_INTEL_B75:
924 case PCI_DEVICE_ID_INTEL_H77:
925 case PCI_DEVICE_ID_INTEL_C216:
Nico Huber42c55012013-04-01 15:38:44 +0200926 gpiobase = pci_read_word(sb, 0x48) & 0xfffc;
927 gpio_registers = pch_gpio_registers;
928 size = ARRAY_SIZE(pch_gpio_registers);
929 gpio_defaults = pp_pch_desktop_defaults;
930 defaults_size = ARRAY_SIZE(pp_pch_desktop_defaults);
931 break;
Nico Huber6983a682013-03-29 18:08:13 +0100932 case PCI_DEVICE_ID_INTEL_QM77:
933 case PCI_DEVICE_ID_INTEL_QS77:
934 case PCI_DEVICE_ID_INTEL_HM77:
935 case PCI_DEVICE_ID_INTEL_UM77:
936 case PCI_DEVICE_ID_INTEL_HM76:
937 case PCI_DEVICE_ID_INTEL_HM75:
938 case PCI_DEVICE_ID_INTEL_HM70:
939 gpiobase = pci_read_word(sb, 0x48) & 0xfffc;
940 gpio_registers = pch_gpio_registers;
941 size = ARRAY_SIZE(pch_gpio_registers);
Nico Huber42c55012013-04-01 15:38:44 +0200942 gpio_defaults = pp_pch_mobile_defaults;
943 defaults_size = ARRAY_SIZE(pp_pch_mobile_defaults);
Nico Huber6983a682013-03-29 18:08:13 +0100944 break;
Warren Turkala7f2b0e2010-09-01 03:40:57 +0000945 case PCI_DEVICE_ID_INTEL_ICH10R:
946 gpiobase = pci_read_word(sb, 0x48) & 0xfffc;
947 gpio_registers = ich10_gpio_registers;
948 size = ARRAY_SIZE(ich10_gpio_registers);
949 break;
Anton Kochkovda0b4562010-05-30 12:33:12 +0000950 case PCI_DEVICE_ID_INTEL_ICH9DH:
951 case PCI_DEVICE_ID_INTEL_ICH9DO:
952 case PCI_DEVICE_ID_INTEL_ICH9R:
953 case PCI_DEVICE_ID_INTEL_ICH9:
954 case PCI_DEVICE_ID_INTEL_ICH9M:
955 case PCI_DEVICE_ID_INTEL_ICH9ME:
956 gpiobase = pci_read_word(sb, 0x48) & 0xfffc;
957 gpio_registers = ich9_gpio_registers;
958 size = ARRAY_SIZE(ich9_gpio_registers);
959 break;
Corey Osgoodf366ce02010-08-17 08:33:44 +0000960 case PCI_DEVICE_ID_INTEL_ICH8:
Stefan Reinauer1162f252008-12-04 15:18:20 +0000961 case PCI_DEVICE_ID_INTEL_ICH8M:
962 gpiobase = pci_read_word(sb, 0x48) & 0xfffc;
963 gpio_registers = ich8_gpio_registers;
964 size = ARRAY_SIZE(ich8_gpio_registers);
965 break;
Stefan Reinauer23190272008-08-20 13:41:24 +0000966 case PCI_DEVICE_ID_INTEL_ICH7:
967 case PCI_DEVICE_ID_INTEL_ICH7M:
968 case PCI_DEVICE_ID_INTEL_ICH7DH:
969 case PCI_DEVICE_ID_INTEL_ICH7MDH:
Corey Osgoodf366ce02010-08-17 08:33:44 +0000970 case PCI_DEVICE_ID_INTEL_NM10:
Stefan Reinauer23190272008-08-20 13:41:24 +0000971 gpiobase = pci_read_word(sb, 0x48) & 0xfffc;
972 gpio_registers = ich7_gpio_registers;
973 size = ARRAY_SIZE(ich7_gpio_registers);
974 break;
Pat Erleyca3548e2010-04-21 06:23:19 +0000975 case PCI_DEVICE_ID_INTEL_ICH6:
976 gpiobase = pci_read_word(sb, 0x48) & 0xfffc;
977 gpio_registers = ich6_gpio_registers;
978 size = ARRAY_SIZE(ich6_gpio_registers);
979 break;
Idwer Vollering312fc962010-12-17 22:34:58 +0000980 case PCI_DEVICE_ID_INTEL_ICH5:
981 gpiobase = pci_read_word(sb, 0x58) & 0xfffc;
982 gpio_registers = ich5_gpio_registers;
983 size = ARRAY_SIZE(ich5_gpio_registers);
984 break;
Stefan Reinauer23190272008-08-20 13:41:24 +0000985 case PCI_DEVICE_ID_INTEL_ICH4:
986 case PCI_DEVICE_ID_INTEL_ICH4M:
987 gpiobase = pci_read_word(sb, 0x58) & 0xfffc;
988 gpio_registers = ich4_gpio_registers;
989 size = ARRAY_SIZE(ich4_gpio_registers);
990 break;
Joseph Smithe10757e2010-06-16 22:21:19 +0000991 case PCI_DEVICE_ID_INTEL_ICH2:
992 gpiobase = pci_read_word(sb, 0x58) & 0xfffc;
993 gpio_registers = ich2_gpio_registers;
994 size = ARRAY_SIZE(ich2_gpio_registers);
995 break;
Stefan Reinauer23190272008-08-20 13:41:24 +0000996 case PCI_DEVICE_ID_INTEL_ICH:
997 case PCI_DEVICE_ID_INTEL_ICH0:
998 gpiobase = pci_read_word(sb, 0x58) & 0xfffc;
999 gpio_registers = ich0_gpio_registers;
1000 size = ARRAY_SIZE(ich0_gpio_registers);
1001 break;
Sven Schnelle54a5aed2011-10-30 13:30:36 +01001002
1003 case PCI_DEVICE_ID_INTEL_I63XX:
1004 gpiobase = pci_read_word(sb, 0x48) & 0xfffc;
1005 gpio_registers = i631x_gpio_registers;
1006 size = ARRAY_SIZE(i631x_gpio_registers);
1007 break;
Martin Roth51dde6f2014-12-07 22:11:54 -07001008 case PCI_DEVICE_ID_INTEL_BAYTRAIL_LPC:
1009 gpiobase = pci_read_word(sb, 0x48) & 0xfffc;
1010 gpio_registers = baytrail_score_ssus_gpio_registers;
1011 size = ARRAY_SIZE(baytrail_score_ssus_gpio_registers);
1012 break;
Maciej Pijanka90d17402009-09-30 17:05:46 +00001013 case PCI_DEVICE_ID_INTEL_82371XX:
1014 printf("This southbridge has GPIOs in the PM unit.\n");
1015 return 1;
Stefan Reinauer23190272008-08-20 13:41:24 +00001016 case 0x1234: // Dummy for non-existent functionality
1017 printf("This southbridge does not have GPIOBASE.\n");
1018 return 1;
1019 default:
1020 printf("Error: Dumping GPIOs on this southbridge is not (yet) supported.\n");
1021 return 1;
1022 }
1023
1024 printf("GPIOBASE = 0x%04x (IO)\n\n", gpiobase);
1025
Nico Huber09dcbf02013-04-01 15:08:04 +02001026 j = 0;
Stefan Reinauer23190272008-08-20 13:41:24 +00001027 for (i = 0; i < size; i++) {
Nico Huber09dcbf02013-04-01 15:08:04 +02001028 if (show_all)
1029 print_reg(&gpio_registers[i]);
1030
1031 if (show_diffs &&
1032 (j < defaults_size) &&
1033 (gpio_defaults[j].addr == gpio_registers[i].addr)) {
1034 gpio_diff = get_diff(&gpio_registers[i],
1035 gpio_defaults[j].def);
1036 if (gpio_diff) {
1037 if (!show_all)
1038 print_reg(&gpio_registers[i]);
1039 print_diff(&gpio_registers[i],
1040 gpio_defaults[j].def, gpio_diff);
1041 if (!show_all)
1042 printf("\n");
1043 }
1044 j++;
Stefan Reinauer23190272008-08-20 13:41:24 +00001045 }
1046 }
1047
Dennis Wassenbergae6685f2014-10-30 10:30:40 +01001048 switch (sb->device_id) {
1049 case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_FULL:
1050 case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_PREM:
1051 case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_BASE:
1052 for (i = 0; i < 95; i++) {
1053 io_register_t tmp_gpio;
1054 char gpio_name[32];
1055 uint16_t tmp_addr = 0x100 + (4 * i * 2);
1056
1057 snprintf(gpio_name, sizeof(gpio_name), "GP%dCONFIGA", i);
1058 tmp_gpio.addr = tmp_addr;
1059 tmp_gpio.name = gpio_name;
1060 tmp_gpio.size = 4;
1061
1062 if (show_all)
1063 print_reg(&tmp_gpio);
1064
1065 snprintf(gpio_name, 32, "GP%dCONFIGB", i);
1066 tmp_gpio.addr = tmp_addr + 4;
1067 tmp_gpio.name = gpio_name;
1068 tmp_gpio.size = 4;
1069
1070 if (show_all)
1071 print_reg(&tmp_gpio);
1072 }
1073 break;
Martin Roth51dde6f2014-12-07 22:11:54 -07001074 case PCI_DEVICE_ID_INTEL_BAYTRAIL_LPC:
1075 show_baytrail_pad_reg(sb);
1076 break;
Dennis Wassenbergae6685f2014-10-30 10:30:40 +01001077 default:
1078 break;
1079 }
1080
Stefan Reinauer23190272008-08-20 13:41:24 +00001081 return 0;
1082}