Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 1 | /* |
| 2 | * inteltool - dump all registers on an Intel CPU + chipset based system. |
| 3 | * |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 4 | * Copyright (C) 2008 by coresystems GmbH |
| 5 | * |
Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 6 | * 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 Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #include <stdio.h> |
Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 17 | #include "inteltool.h" |
| 18 | |
Nico Huber | 09dcbf0 | 2013-04-01 15:08:04 +0200 | [diff] [blame] | 19 | typedef struct { uint16_t addr; uint32_t def; } gpio_default_t; |
| 20 | |
Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 21 | static 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 Smith | e10757e | 2010-06-16 22:21:19 +0000 | [diff] [blame] | 40 | static 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 Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 59 | static 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 Vollering | 312fc96 | 2010-12-17 22:34:58 +0000 | [diff] [blame] | 78 | static 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 Erley | ca3548e | 2010-04-21 06:23:19 +0000 | [diff] [blame] | 94 | static 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 Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 112 | static 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 Reinauer | 1162f25 | 2008-12-04 15:18:20 +0000 | [diff] [blame] | 131 | static 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 Kochkov | da0b456 | 2010-05-30 12:33:12 +0000 | [diff] [blame] | 150 | static 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 Reinauer | 1162f25 | 2008-12-04 15:18:20 +0000 | [diff] [blame] | 168 | |
Warren Turkal | a7f2b0e | 2010-09-01 03:40:57 +0000 | [diff] [blame] | 169 | static 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'Callaghan | ef3a17b | 2014-08-02 10:15:44 +1000 | [diff] [blame] | 187 | { 0x44, 4, "GP_IO_SEL3" }, |
Warren Turkal | a7f2b0e | 2010-09-01 03:40:57 +0000 | [diff] [blame] | 188 | { 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 Schnelle | 54a5aed | 2011-10-30 13:30:36 +0100 | [diff] [blame] | 204 | static 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 Huber | 6983a68 | 2013-03-29 18:08:13 +0100 | [diff] [blame] | 222 | static 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'Callaghan | ef3a17b | 2014-08-02 10:15:44 +1000 | [diff] [blame] | 241 | { 0x44, 4, "GP_IO_SEL3" }, |
Nico Huber | 6983a68 | 2013-03-29 18:08:13 +0100 | [diff] [blame] | 242 | { 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 Tauner | b75a39a | 2014-11-01 17:12:37 +0100 | [diff] [blame] | 257 | /* Default values for Ibex Peak desktop chipsets */ |
| 258 | static 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 */ |
| 277 | static 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 Wassenberg | ae6685f | 2014-10-30 10:30:40 +0100 | [diff] [blame] | 295 | |
| 296 | static 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 Huber | 42c5501 | 2013-04-01 15:38:44 +0200 | [diff] [blame] | 347 | /* Default values for Cougar Point desktop chipsets */ |
| 348 | static 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 */ |
| 366 | static 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 */ |
| 384 | static 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 */ |
| 402 | static 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 Roth | 51dde6f | 2014-12-07 22:11:54 -0700 | [diff] [blame] | 420 | /* Baytrail */ |
| 421 | static 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} */ |
| 464 | struct 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 | |
| 483 | static 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 | |
| 513 | static 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 | |
| 618 | static 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 */ |
| 666 | static 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 | |
| 672 | static 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 | |
| 687 | static 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 | |
| 695 | static 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 | |
| 719 | const char *pull_assignment[] = {"None","Up ","Down","Res "}; |
| 720 | const char *pull_strength[] = {"2k", "10k", "20k", "40k"}; |
| 721 | |
| 722 | static 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 Huber | 09dcbf0 | 2013-04-01 15:08:04 +0200 | [diff] [blame] | 777 | static uint16_t gpiobase; |
Nico Huber | 6983a68 | 2013-03-29 18:08:13 +0100 | [diff] [blame] | 778 | |
Nico Huber | 09dcbf0 | 2013-04-01 15:08:04 +0200 | [diff] [blame] | 779 | static void print_reg(const io_register_t *const reg) |
Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 780 | { |
Nico Huber | 09dcbf0 | 2013-04-01 15:08:04 +0200 | [diff] [blame] | 781 | 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 Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 796 | |
Nico Huber | 09dcbf0 | 2013-04-01 15:08:04 +0200 | [diff] [blame] | 797 | static 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 | |
| 814 | static 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 | |
| 839 | int 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 Huber | 42c5501 | 2013-04-01 15:38:44 +0200 | [diff] [blame] | 843 | const gpio_default_t *gpio_defaults = NULL; |
Nico Huber | 09dcbf0 | 2013-04-01 15:08:04 +0200 | [diff] [blame] | 844 | uint32_t gpio_diff; |
| 845 | |
Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 846 | switch (sb->device_id) { |
Dennis Wassenberg | ae6685f | 2014-10-30 10:30:40 +0100 | [diff] [blame] | 847 | case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_FULL: |
| 848 | case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_PREM: |
| 849 | case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_BASE: |
Youness Alaoui | 1244a51 | 2017-04-13 13:22:33 -0400 | [diff] [blame] | 850 | case PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP_PREM: |
Matt DeVillier | 5b667df | 2015-05-14 21:58:33 -0500 | [diff] [blame] | 851 | case PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP: |
Dennis Wassenberg | ae6685f | 2014-10-30 10:30:40 +0100 | [diff] [blame] | 852 | gpiobase = pci_read_word(sb, 0x48) & 0xfffc; |
| 853 | gpio_registers = lynxpoint_lp_gpio_registers; |
| 854 | size = ARRAY_SIZE(lynxpoint_lp_gpio_registers); |
qeed | b775a62 | 2018-06-19 19:52:19 -0400 | [diff] [blame] | 855 | break; |
| 856 | case PCI_DEVICE_ID_INTEL_C8_MOBILE: |
| 857 | case PCI_DEVICE_ID_INTEL_C8_DESKTOP: |
| 858 | case PCI_DEVICE_ID_INTEL_Z87: |
| 859 | case PCI_DEVICE_ID_INTEL_Z85: |
| 860 | case PCI_DEVICE_ID_INTEL_HM86: |
| 861 | case PCI_DEVICE_ID_INTEL_H87: |
| 862 | case PCI_DEVICE_ID_INTEL_HM87: |
| 863 | case PCI_DEVICE_ID_INTEL_Q85: |
| 864 | case PCI_DEVICE_ID_INTEL_Q87: |
| 865 | case PCI_DEVICE_ID_INTEL_QM87: |
| 866 | case PCI_DEVICE_ID_INTEL_B85: |
| 867 | case PCI_DEVICE_ID_INTEL_C222: |
| 868 | case PCI_DEVICE_ID_INTEL_C224: |
| 869 | case PCI_DEVICE_ID_INTEL_C226: |
| 870 | case PCI_DEVICE_ID_INTEL_H81: |
| 871 | gpiobase = pci_read_word(sb, 0x48) & 0xfffc; |
Fehér Roland Ádám | d5a8155 | 2018-10-17 18:41:49 +0200 | [diff] [blame] | 872 | gpio_registers = pch_gpio_registers; |
| 873 | size = ARRAY_SIZE(pch_gpio_registers); |
qeed | b775a62 | 2018-06-19 19:52:19 -0400 | [diff] [blame] | 874 | break; |
Stefan Tauner | b75a39a | 2014-11-01 17:12:37 +0100 | [diff] [blame] | 875 | case PCI_DEVICE_ID_INTEL_3400: |
| 876 | case PCI_DEVICE_ID_INTEL_3420: |
| 877 | case PCI_DEVICE_ID_INTEL_3450: |
| 878 | case PCI_DEVICE_ID_INTEL_3400_DESKTOP: |
| 879 | case PCI_DEVICE_ID_INTEL_B55_A: |
| 880 | case PCI_DEVICE_ID_INTEL_B55_B: |
| 881 | case PCI_DEVICE_ID_INTEL_H55: |
| 882 | case PCI_DEVICE_ID_INTEL_H57: |
| 883 | case PCI_DEVICE_ID_INTEL_P55: |
| 884 | case PCI_DEVICE_ID_INTEL_Q57: |
| 885 | gpiobase = pci_read_word(sb, 0x48) & 0xff80; |
| 886 | gpio_registers = pch_gpio_registers; |
| 887 | size = ARRAY_SIZE(pch_gpio_registers); |
| 888 | gpio_defaults = ip_pch_desktop_defaults; |
| 889 | defaults_size = ARRAY_SIZE(ip_pch_desktop_defaults); |
| 890 | break; |
| 891 | case PCI_DEVICE_ID_INTEL_3400_MOBILE: |
| 892 | case PCI_DEVICE_ID_INTEL_3400_MOBILE_SFF: |
| 893 | case PCI_DEVICE_ID_INTEL_HM55: |
| 894 | case PCI_DEVICE_ID_INTEL_HM57: |
| 895 | case PCI_DEVICE_ID_INTEL_PM55: |
| 896 | case PCI_DEVICE_ID_INTEL_QM57: |
| 897 | case PCI_DEVICE_ID_INTEL_QS57: |
| 898 | gpiobase = pci_read_word(sb, 0x48) & 0xff80; |
| 899 | gpio_registers = pch_gpio_registers; |
| 900 | size = ARRAY_SIZE(pch_gpio_registers); |
| 901 | gpio_defaults = ip_pch_mobile_defaults; |
| 902 | defaults_size = ARRAY_SIZE(ip_pch_mobile_defaults); |
| 903 | break; |
Nico Huber | 6983a68 | 2013-03-29 18:08:13 +0100 | [diff] [blame] | 904 | case PCI_DEVICE_ID_INTEL_Z68: |
| 905 | case PCI_DEVICE_ID_INTEL_P67: |
Nico Huber | 6983a68 | 2013-03-29 18:08:13 +0100 | [diff] [blame] | 906 | case PCI_DEVICE_ID_INTEL_H67: |
Nico Huber | 6983a68 | 2013-03-29 18:08:13 +0100 | [diff] [blame] | 907 | case PCI_DEVICE_ID_INTEL_Q65: |
| 908 | case PCI_DEVICE_ID_INTEL_QS67: |
| 909 | case PCI_DEVICE_ID_INTEL_Q67: |
Nico Huber | 6983a68 | 2013-03-29 18:08:13 +0100 | [diff] [blame] | 910 | case PCI_DEVICE_ID_INTEL_B65: |
| 911 | case PCI_DEVICE_ID_INTEL_C202: |
| 912 | case PCI_DEVICE_ID_INTEL_C204: |
| 913 | case PCI_DEVICE_ID_INTEL_C206: |
| 914 | case PCI_DEVICE_ID_INTEL_H61: |
Nico Huber | 42c5501 | 2013-04-01 15:38:44 +0200 | [diff] [blame] | 915 | gpiobase = pci_read_word(sb, 0x48) & 0xfffc; |
| 916 | gpio_registers = pch_gpio_registers; |
| 917 | size = ARRAY_SIZE(pch_gpio_registers); |
| 918 | gpio_defaults = cp_pch_desktop_defaults; |
| 919 | defaults_size = ARRAY_SIZE(cp_pch_desktop_defaults); |
| 920 | break; |
| 921 | case PCI_DEVICE_ID_INTEL_UM67: |
| 922 | case PCI_DEVICE_ID_INTEL_HM65: |
| 923 | case PCI_DEVICE_ID_INTEL_HM67: |
| 924 | case PCI_DEVICE_ID_INTEL_QM67: |
| 925 | gpiobase = pci_read_word(sb, 0x48) & 0xfffc; |
| 926 | gpio_registers = pch_gpio_registers; |
| 927 | size = ARRAY_SIZE(pch_gpio_registers); |
| 928 | gpio_defaults = cp_pch_mobile_defaults; |
| 929 | defaults_size = ARRAY_SIZE(cp_pch_mobile_defaults); |
| 930 | break; |
Nico Huber | 6983a68 | 2013-03-29 18:08:13 +0100 | [diff] [blame] | 931 | case PCI_DEVICE_ID_INTEL_Z77: |
| 932 | case PCI_DEVICE_ID_INTEL_Z75: |
| 933 | case PCI_DEVICE_ID_INTEL_Q77: |
| 934 | case PCI_DEVICE_ID_INTEL_Q75: |
| 935 | case PCI_DEVICE_ID_INTEL_B75: |
| 936 | case PCI_DEVICE_ID_INTEL_H77: |
| 937 | case PCI_DEVICE_ID_INTEL_C216: |
Nico Huber | 42c5501 | 2013-04-01 15:38:44 +0200 | [diff] [blame] | 938 | gpiobase = pci_read_word(sb, 0x48) & 0xfffc; |
| 939 | gpio_registers = pch_gpio_registers; |
| 940 | size = ARRAY_SIZE(pch_gpio_registers); |
| 941 | gpio_defaults = pp_pch_desktop_defaults; |
| 942 | defaults_size = ARRAY_SIZE(pp_pch_desktop_defaults); |
| 943 | break; |
Nico Huber | 6983a68 | 2013-03-29 18:08:13 +0100 | [diff] [blame] | 944 | case PCI_DEVICE_ID_INTEL_QM77: |
| 945 | case PCI_DEVICE_ID_INTEL_QS77: |
| 946 | case PCI_DEVICE_ID_INTEL_HM77: |
| 947 | case PCI_DEVICE_ID_INTEL_UM77: |
| 948 | case PCI_DEVICE_ID_INTEL_HM76: |
| 949 | case PCI_DEVICE_ID_INTEL_HM75: |
| 950 | case PCI_DEVICE_ID_INTEL_HM70: |
| 951 | gpiobase = pci_read_word(sb, 0x48) & 0xfffc; |
| 952 | gpio_registers = pch_gpio_registers; |
| 953 | size = ARRAY_SIZE(pch_gpio_registers); |
Nico Huber | 42c5501 | 2013-04-01 15:38:44 +0200 | [diff] [blame] | 954 | gpio_defaults = pp_pch_mobile_defaults; |
| 955 | defaults_size = ARRAY_SIZE(pp_pch_mobile_defaults); |
Nico Huber | 6983a68 | 2013-03-29 18:08:13 +0100 | [diff] [blame] | 956 | break; |
Arthur Heymans | 026f7df | 2017-04-10 22:26:13 +0200 | [diff] [blame] | 957 | case PCI_DEVICE_ID_INTEL_ICH10: |
Warren Turkal | a7f2b0e | 2010-09-01 03:40:57 +0000 | [diff] [blame] | 958 | case PCI_DEVICE_ID_INTEL_ICH10R: |
| 959 | gpiobase = pci_read_word(sb, 0x48) & 0xfffc; |
| 960 | gpio_registers = ich10_gpio_registers; |
| 961 | size = ARRAY_SIZE(ich10_gpio_registers); |
| 962 | break; |
Anton Kochkov | da0b456 | 2010-05-30 12:33:12 +0000 | [diff] [blame] | 963 | case PCI_DEVICE_ID_INTEL_ICH9DH: |
| 964 | case PCI_DEVICE_ID_INTEL_ICH9DO: |
| 965 | case PCI_DEVICE_ID_INTEL_ICH9R: |
| 966 | case PCI_DEVICE_ID_INTEL_ICH9: |
| 967 | case PCI_DEVICE_ID_INTEL_ICH9M: |
| 968 | case PCI_DEVICE_ID_INTEL_ICH9ME: |
| 969 | gpiobase = pci_read_word(sb, 0x48) & 0xfffc; |
| 970 | gpio_registers = ich9_gpio_registers; |
| 971 | size = ARRAY_SIZE(ich9_gpio_registers); |
| 972 | break; |
Corey Osgood | f366ce0 | 2010-08-17 08:33:44 +0000 | [diff] [blame] | 973 | case PCI_DEVICE_ID_INTEL_ICH8: |
Stefan Reinauer | 1162f25 | 2008-12-04 15:18:20 +0000 | [diff] [blame] | 974 | case PCI_DEVICE_ID_INTEL_ICH8M: |
Lubomir Rintel | 2a13bad | 2015-03-01 10:14:15 +0100 | [diff] [blame] | 975 | case PCI_DEVICE_ID_INTEL_ICH8ME: |
Stefan Reinauer | 1162f25 | 2008-12-04 15:18:20 +0000 | [diff] [blame] | 976 | gpiobase = pci_read_word(sb, 0x48) & 0xfffc; |
| 977 | gpio_registers = ich8_gpio_registers; |
| 978 | size = ARRAY_SIZE(ich8_gpio_registers); |
| 979 | break; |
Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 980 | case PCI_DEVICE_ID_INTEL_ICH7: |
| 981 | case PCI_DEVICE_ID_INTEL_ICH7M: |
| 982 | case PCI_DEVICE_ID_INTEL_ICH7DH: |
| 983 | case PCI_DEVICE_ID_INTEL_ICH7MDH: |
Corey Osgood | f366ce0 | 2010-08-17 08:33:44 +0000 | [diff] [blame] | 984 | case PCI_DEVICE_ID_INTEL_NM10: |
Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 985 | gpiobase = pci_read_word(sb, 0x48) & 0xfffc; |
| 986 | gpio_registers = ich7_gpio_registers; |
| 987 | size = ARRAY_SIZE(ich7_gpio_registers); |
| 988 | break; |
Pat Erley | ca3548e | 2010-04-21 06:23:19 +0000 | [diff] [blame] | 989 | case PCI_DEVICE_ID_INTEL_ICH6: |
| 990 | gpiobase = pci_read_word(sb, 0x48) & 0xfffc; |
| 991 | gpio_registers = ich6_gpio_registers; |
| 992 | size = ARRAY_SIZE(ich6_gpio_registers); |
| 993 | break; |
Idwer Vollering | 312fc96 | 2010-12-17 22:34:58 +0000 | [diff] [blame] | 994 | case PCI_DEVICE_ID_INTEL_ICH5: |
| 995 | gpiobase = pci_read_word(sb, 0x58) & 0xfffc; |
| 996 | gpio_registers = ich5_gpio_registers; |
| 997 | size = ARRAY_SIZE(ich5_gpio_registers); |
| 998 | break; |
Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 999 | case PCI_DEVICE_ID_INTEL_ICH4: |
| 1000 | case PCI_DEVICE_ID_INTEL_ICH4M: |
| 1001 | gpiobase = pci_read_word(sb, 0x58) & 0xfffc; |
| 1002 | gpio_registers = ich4_gpio_registers; |
| 1003 | size = ARRAY_SIZE(ich4_gpio_registers); |
| 1004 | break; |
Joseph Smith | e10757e | 2010-06-16 22:21:19 +0000 | [diff] [blame] | 1005 | case PCI_DEVICE_ID_INTEL_ICH2: |
| 1006 | gpiobase = pci_read_word(sb, 0x58) & 0xfffc; |
| 1007 | gpio_registers = ich2_gpio_registers; |
| 1008 | size = ARRAY_SIZE(ich2_gpio_registers); |
| 1009 | break; |
Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 1010 | case PCI_DEVICE_ID_INTEL_ICH: |
| 1011 | case PCI_DEVICE_ID_INTEL_ICH0: |
| 1012 | gpiobase = pci_read_word(sb, 0x58) & 0xfffc; |
| 1013 | gpio_registers = ich0_gpio_registers; |
| 1014 | size = ARRAY_SIZE(ich0_gpio_registers); |
| 1015 | break; |
Sven Schnelle | 54a5aed | 2011-10-30 13:30:36 +0100 | [diff] [blame] | 1016 | |
| 1017 | case PCI_DEVICE_ID_INTEL_I63XX: |
| 1018 | gpiobase = pci_read_word(sb, 0x48) & 0xfffc; |
| 1019 | gpio_registers = i631x_gpio_registers; |
| 1020 | size = ARRAY_SIZE(i631x_gpio_registers); |
| 1021 | break; |
Martin Roth | 51dde6f | 2014-12-07 22:11:54 -0700 | [diff] [blame] | 1022 | case PCI_DEVICE_ID_INTEL_BAYTRAIL_LPC: |
| 1023 | gpiobase = pci_read_word(sb, 0x48) & 0xfffc; |
| 1024 | gpio_registers = baytrail_score_ssus_gpio_registers; |
| 1025 | size = ARRAY_SIZE(baytrail_score_ssus_gpio_registers); |
| 1026 | break; |
Pavel Sayekat | 9429b70 | 2019-07-28 23:09:08 +0600 | [diff] [blame] | 1027 | case PCI_DEVICE_ID_INTEL_H110: |
Felix Singer | f98dc48 | 2019-07-29 21:53:14 +0200 | [diff] [blame] | 1028 | case PCI_DEVICE_ID_INTEL_H170: |
| 1029 | case PCI_DEVICE_ID_INTEL_Z170: |
| 1030 | case PCI_DEVICE_ID_INTEL_Q170: |
| 1031 | case PCI_DEVICE_ID_INTEL_Q150: |
Nico Huber | 54fe32f | 2017-10-03 16:03:07 +0200 | [diff] [blame] | 1032 | case PCI_DEVICE_ID_INTEL_B150: |
Christian Walter | 9a8c5e7 | 2019-05-06 17:50:57 +0200 | [diff] [blame] | 1033 | case PCI_DEVICE_ID_INTEL_C236: |
Felix Singer | f98dc48 | 2019-07-29 21:53:14 +0200 | [diff] [blame] | 1034 | case PCI_DEVICE_ID_INTEL_C232: |
| 1035 | case PCI_DEVICE_ID_INTEL_QM170: |
| 1036 | case PCI_DEVICE_ID_INTEL_HM170: |
| 1037 | case PCI_DEVICE_ID_INTEL_CM236: |
Nico Huber | 8a95c6c | 2018-11-27 12:27:22 +0100 | [diff] [blame] | 1038 | case PCI_DEVICE_ID_INTEL_APL_LPC: |
Thomas Heijligen | da02719 | 2019-01-12 19:20:50 +0100 | [diff] [blame] | 1039 | case PCI_DEVICE_ID_INTEL_DNV_LPC: |
Felix Singer | 0a7543d | 2019-02-19 23:49:11 +0100 | [diff] [blame] | 1040 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_PRE: |
| 1041 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_BASE_SKL: |
| 1042 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_PREM_SKL: |
| 1043 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_PREM_SKL: |
| 1044 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_BASE_KBL: |
| 1045 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_PREM_KBL: |
| 1046 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_PREM_KBL: |
Matthew Garrett | 2bf28e5 | 2018-07-23 21:09:47 -0700 | [diff] [blame] | 1047 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_IHDCP_BASE: |
| 1048 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_IHDCP_PREM: |
| 1049 | case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_IHDCP_PREM: |
Matt DeVillier | 3c78445 | 2019-06-11 23:23:46 -0500 | [diff] [blame] | 1050 | case PCI_DEVICE_ID_INTEL_CANNONPOINT_LP_U_PREM: |
Maxim Polyakov | b89ce2e | 2019-08-17 14:54:02 +0300 | [diff] [blame] | 1051 | case PCI_DEVICE_ID_INTEL_C621: |
| 1052 | case PCI_DEVICE_ID_INTEL_C622: |
| 1053 | case PCI_DEVICE_ID_INTEL_C624: |
| 1054 | case PCI_DEVICE_ID_INTEL_C625: |
| 1055 | case PCI_DEVICE_ID_INTEL_C626: |
| 1056 | case PCI_DEVICE_ID_INTEL_C627: |
| 1057 | case PCI_DEVICE_ID_INTEL_C628: |
| 1058 | case PCI_DEVICE_ID_INTEL_C629: |
| 1059 | case PCI_DEVICE_ID_INTEL_C624_SUPER: |
| 1060 | case PCI_DEVICE_ID_INTEL_C627_SUPER_1: |
| 1061 | case PCI_DEVICE_ID_INTEL_C621_SUPER: |
| 1062 | case PCI_DEVICE_ID_INTEL_C627_SUPER_2: |
| 1063 | case PCI_DEVICE_ID_INTEL_C628_SUPER: |
Thomas Heijligen | 725369f | 2019-02-19 10:51:34 +0000 | [diff] [blame] | 1064 | case PCI_DEVICE_ID_INTEL_H310: |
| 1065 | case PCI_DEVICE_ID_INTEL_H370: |
| 1066 | case PCI_DEVICE_ID_INTEL_Z390: |
| 1067 | case PCI_DEVICE_ID_INTEL_Q370: |
| 1068 | case PCI_DEVICE_ID_INTEL_B360: |
| 1069 | case PCI_DEVICE_ID_INTEL_C246: |
| 1070 | case PCI_DEVICE_ID_INTEL_C242: |
| 1071 | case PCI_DEVICE_ID_INTEL_QM370: |
| 1072 | case PCI_DEVICE_ID_INTEL_HM370: |
| 1073 | case PCI_DEVICE_ID_INTEL_CM246: |
Johanna Schander | 0174ea7 | 2020-01-04 15:14:59 +0100 | [diff] [blame] | 1074 | case PCI_DEVICE_ID_INTEL_ICELAKE_LP_U: |
Nico Huber | 1898023 | 2017-04-07 12:26:07 +0200 | [diff] [blame] | 1075 | print_gpio_groups(sb); |
| 1076 | return 0; |
Maciej Pijanka | 90d1740 | 2009-09-30 17:05:46 +0000 | [diff] [blame] | 1077 | case PCI_DEVICE_ID_INTEL_82371XX: |
| 1078 | printf("This southbridge has GPIOs in the PM unit.\n"); |
| 1079 | return 1; |
Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 1080 | default: |
| 1081 | printf("Error: Dumping GPIOs on this southbridge is not (yet) supported.\n"); |
| 1082 | return 1; |
| 1083 | } |
| 1084 | |
Nico Huber | 1898023 | 2017-04-07 12:26:07 +0200 | [diff] [blame] | 1085 | if (show_diffs && !show_all) |
| 1086 | printf("\n========== GPIO DIFFS ===========\n\n"); |
| 1087 | else |
| 1088 | printf("\n============= GPIOS =============\n\n"); |
| 1089 | |
Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 1090 | printf("GPIOBASE = 0x%04x (IO)\n\n", gpiobase); |
| 1091 | |
Nico Huber | 09dcbf0 | 2013-04-01 15:08:04 +0200 | [diff] [blame] | 1092 | j = 0; |
Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 1093 | for (i = 0; i < size; i++) { |
Nico Huber | 09dcbf0 | 2013-04-01 15:08:04 +0200 | [diff] [blame] | 1094 | if (show_all) |
| 1095 | print_reg(&gpio_registers[i]); |
| 1096 | |
| 1097 | if (show_diffs && |
| 1098 | (j < defaults_size) && |
| 1099 | (gpio_defaults[j].addr == gpio_registers[i].addr)) { |
| 1100 | gpio_diff = get_diff(&gpio_registers[i], |
| 1101 | gpio_defaults[j].def); |
| 1102 | if (gpio_diff) { |
| 1103 | if (!show_all) |
| 1104 | print_reg(&gpio_registers[i]); |
| 1105 | print_diff(&gpio_registers[i], |
| 1106 | gpio_defaults[j].def, gpio_diff); |
| 1107 | if (!show_all) |
| 1108 | printf("\n"); |
| 1109 | } |
| 1110 | j++; |
Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 1111 | } |
| 1112 | } |
| 1113 | |
Dennis Wassenberg | ae6685f | 2014-10-30 10:30:40 +0100 | [diff] [blame] | 1114 | switch (sb->device_id) { |
| 1115 | case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_FULL: |
| 1116 | case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_PREM: |
| 1117 | case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_BASE: |
Youness Alaoui | 1244a51 | 2017-04-13 13:22:33 -0400 | [diff] [blame] | 1118 | case PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP_PREM: |
Matt DeVillier | 5b667df | 2015-05-14 21:58:33 -0500 | [diff] [blame] | 1119 | case PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP: |
Dennis Wassenberg | ae6685f | 2014-10-30 10:30:40 +0100 | [diff] [blame] | 1120 | for (i = 0; i < 95; i++) { |
| 1121 | io_register_t tmp_gpio; |
| 1122 | char gpio_name[32]; |
| 1123 | uint16_t tmp_addr = 0x100 + (4 * i * 2); |
| 1124 | |
| 1125 | snprintf(gpio_name, sizeof(gpio_name), "GP%dCONFIGA", i); |
| 1126 | tmp_gpio.addr = tmp_addr; |
| 1127 | tmp_gpio.name = gpio_name; |
| 1128 | tmp_gpio.size = 4; |
| 1129 | |
| 1130 | if (show_all) |
| 1131 | print_reg(&tmp_gpio); |
| 1132 | |
| 1133 | snprintf(gpio_name, 32, "GP%dCONFIGB", i); |
| 1134 | tmp_gpio.addr = tmp_addr + 4; |
| 1135 | tmp_gpio.name = gpio_name; |
| 1136 | tmp_gpio.size = 4; |
| 1137 | |
| 1138 | if (show_all) |
| 1139 | print_reg(&tmp_gpio); |
| 1140 | } |
| 1141 | break; |
Martin Roth | 51dde6f | 2014-12-07 22:11:54 -0700 | [diff] [blame] | 1142 | case PCI_DEVICE_ID_INTEL_BAYTRAIL_LPC: |
| 1143 | show_baytrail_pad_reg(sb); |
| 1144 | break; |
Dennis Wassenberg | ae6685f | 2014-10-30 10:30:40 +0100 | [diff] [blame] | 1145 | default: |
| 1146 | break; |
| 1147 | } |
| 1148 | |
Stefan Reinauer | 2319027 | 2008-08-20 13:41:24 +0000 | [diff] [blame] | 1149 | return 0; |
| 1150 | } |