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