Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2008 Advanced Micro Devices, Inc. |
| 5 | * Copyright (C) 2008-2009 coresystems GmbH |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | */ |
| 20 | |
| 21 | #include <console/console.h> |
| 22 | #include <device/device.h> |
| 23 | #include <device/pci.h> |
| 24 | #include <device/pci_ids.h> |
| 25 | #include <device/pci_ops.h> |
| 26 | #include <arch/io.h> |
| 27 | #include <delay.h> |
| 28 | #include "i82801gx.h" |
| 29 | |
| 30 | #define HDA_ICII_REG 0x68 |
| 31 | #define HDA_ICII_BUSY (1 << 0) |
| 32 | #define HDA_ICII_VALID (1 << 1) |
| 33 | |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 34 | typedef struct southbridge_intel_i82801gx_config config_t; |
| 35 | |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 36 | static int set_bits(u8 * port, u32 mask, u32 val) |
| 37 | { |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 38 | u32 reg32; |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 39 | int count; |
| 40 | |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 41 | /* Write (val & mask) to port */ |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 42 | val &= mask; |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 43 | reg32 = readl(port); |
| 44 | reg32 &= ~mask; |
| 45 | reg32 |= val; |
| 46 | writel(reg32, port); |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 47 | |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 48 | /* Wait for readback of register to |
| 49 | * match what was just written to it |
| 50 | */ |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 51 | count = 50; |
| 52 | do { |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 53 | /* Wait 1ms based on BKDG wait time */ |
| 54 | mdelay(1); |
| 55 | reg32 = readl(port); |
| 56 | reg32 &= mask; |
| 57 | } while ((reg32 != val) && --count); |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 58 | |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 59 | /* Timeout occured */ |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 60 | if (!count) |
| 61 | return -1; |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 62 | return 0; |
| 63 | } |
| 64 | |
| 65 | static int codec_detect(u8 * base) |
| 66 | { |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 67 | u32 reg32; |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 68 | |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 69 | /* Set Bit0 to 0 to enter reset state (BAR + 0x8)[0] */ |
| 70 | if (set_bits(base + 0x08, 1, 0) == -1) |
| 71 | goto no_codec; |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 72 | |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 73 | /* Set Bit 0 to 1 to exit reset state (BAR + 0x8)[0] */ |
| 74 | if (set_bits(base + 0x08, 1, 1) == -1) |
| 75 | goto no_codec; |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 76 | |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 77 | /* Read in Codec location (BAR + 0xe)[2..0]*/ |
| 78 | reg32 = readl(base + 0xe); |
| 79 | reg32 &= 0x0f; |
| 80 | if (!reg32) |
| 81 | goto no_codec; |
| 82 | |
| 83 | return reg32; |
| 84 | |
| 85 | no_codec: |
| 86 | /* Codec Not found */ |
| 87 | /* Put HDA back in reset (BAR + 0x8) [0] */ |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 88 | set_bits(base + 0x08, 1, 0); |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 89 | printk_debug("Azalia: No codec!\n"); |
| 90 | return 0; |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 91 | } |
| 92 | |
| 93 | static u32 cim_verb_data[] = { |
| 94 | 0x00172000, |
| 95 | 0x00172100, |
| 96 | 0x001722EC, |
| 97 | 0x00172310, |
| 98 | |
| 99 | /* Pin Complex (NID 0x12) */ |
| 100 | 0x01271CF0, |
| 101 | 0x01271D11, |
| 102 | 0x01271E11, |
| 103 | 0x01271F41, |
| 104 | /* Pin Complex (NID 0x14) */ |
| 105 | 0x01471C10, |
| 106 | 0x01471D01, |
| 107 | 0x01471E13, |
| 108 | 0x01471F99, |
| 109 | /* Pin Complex (NID 0x15) */ |
| 110 | 0x01571C20, |
| 111 | 0x01571D40, |
| 112 | 0x01571E21, |
| 113 | 0x01571F01, |
| 114 | /* Pin Complex (NID 0x16) */ |
| 115 | 0x01671CF0, |
| 116 | 0x01671D11, |
| 117 | 0x01671E11, |
| 118 | 0x01671F41, |
| 119 | /* Pin Complex (NID 0x18) */ |
| 120 | 0x01871C30, |
| 121 | 0x01871D98, |
| 122 | 0x01871EA1, |
| 123 | 0x01871F01, |
| 124 | /* Pin Complex (NID 0x19) */ |
| 125 | 0x01971C31, |
| 126 | 0x01971D09, |
| 127 | 0x01971EA3, |
| 128 | 0x01971F99, |
| 129 | /* Pin Complex (NID 0x1A) */ |
| 130 | 0x01A71C3F, |
| 131 | 0x01A71D98, |
| 132 | 0x01A71EA1, |
| 133 | 0x01A71F02, |
| 134 | /* Pin Complex (NID 0x1B) */ |
| 135 | 0x01B71C1F, |
| 136 | 0x01B71D40, |
| 137 | 0x01B71E21, |
| 138 | 0x01B71F02, |
| 139 | /* Pin Complex (NID 0x1C) */ |
| 140 | 0x01C71CF0, |
| 141 | 0x01C71D11, |
| 142 | 0x01C71E11, |
| 143 | 0x01C71F41, |
| 144 | /* Pin Complex (NID 0x1D) */ |
| 145 | 0x01D71CF0, |
| 146 | 0x01D71D11, |
| 147 | 0x01D71E11, |
| 148 | 0x01D71F41, |
| 149 | /* Pin Complex (NID 0x1E) */ |
| 150 | 0x01E71CF0, |
| 151 | 0x01E71D11, |
| 152 | 0x01E71E11, |
| 153 | 0x01E71F41, |
| 154 | /* Pin Complex (NID 0x1F) */ |
| 155 | 0x01F71CF0, |
| 156 | 0x01F71D11, |
| 157 | 0x01F71E11, |
| 158 | 0x01F71F41, |
| 159 | }; |
| 160 | |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 161 | static unsigned find_verb(struct device *dev, u32 viddid, u32 ** verb) |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 162 | { |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 163 | config_t *config = dev->chip_info; |
| 164 | |
| 165 | if (config == NULL) { |
| 166 | printk_err("\ni82801gx_azalia: Not mentioned in mainboard's Config.lb!\n"); |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 167 | return 0; |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 168 | } |
| 169 | |
| 170 | printk_debug("Azalia: dev=%s\n", dev_path(dev)); |
| 171 | printk_debug("Azalia: Default viddid=%x\n", (u32)config->hda_viddid); |
| 172 | printk_debug("Azalia: Reading viddid=%x\n", viddid); |
| 173 | |
| 174 | if (viddid != config->hda_viddid) |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 175 | return 0; |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 176 | |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 177 | *verb = (u32 *) cim_verb_data; |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 178 | |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 179 | return sizeof(cim_verb_data) / sizeof(u32); |
| 180 | } |
| 181 | |
| 182 | /** |
| 183 | * Wait 50usec for for the codec to indicate it is ready |
| 184 | * no response would imply that the codec is non-operative |
| 185 | */ |
| 186 | |
| 187 | static int wait_for_ready(u8 *base) |
| 188 | { |
| 189 | /* Use a 50 usec timeout - the Linux kernel uses the |
| 190 | * same duration */ |
| 191 | |
| 192 | int timeout = 50; |
| 193 | |
| 194 | while(timeout--) { |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 195 | u32 reg32 = readl(base + HDA_ICII_REG); |
| 196 | if (!(reg32 & HDA_ICII_BUSY)) |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 197 | return 0; |
| 198 | udelay(1); |
| 199 | } |
| 200 | |
| 201 | return -1; |
| 202 | } |
| 203 | |
| 204 | /** |
| 205 | * Wait 50usec for for the codec to indicate that it accepted |
| 206 | * the previous command. No response would imply that the code |
| 207 | * is non-operative |
| 208 | */ |
| 209 | |
| 210 | static int wait_for_valid(u8 *base) |
| 211 | { |
| 212 | /* Use a 50 usec timeout - the Linux kernel uses the |
| 213 | * same duration */ |
| 214 | |
| 215 | int timeout = 50; |
| 216 | while(timeout--) { |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 217 | u32 reg32 = readl(base + HDA_ICII_REG); |
| 218 | if ((reg32 & (HDA_ICII_VALID | HDA_ICII_BUSY)) == |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 219 | HDA_ICII_VALID) |
| 220 | return 0; |
| 221 | udelay(1); |
| 222 | } |
| 223 | |
| 224 | return 1; |
| 225 | } |
| 226 | |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 227 | static void codec_init(struct device *dev, u8 * base, int addr) |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 228 | { |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 229 | u32 reg32; |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 230 | u32 *verb; |
| 231 | u32 verb_size; |
| 232 | int i; |
| 233 | |
| 234 | /* 1 */ |
| 235 | if (wait_for_ready(base) == -1) |
| 236 | return; |
| 237 | |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 238 | reg32 = (addr << 28) | 0x000f0000; |
| 239 | writel(reg32, base + 0x60); |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 240 | |
| 241 | if (wait_for_valid(base) == -1) |
| 242 | return; |
| 243 | |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 244 | reg32 = readl(base + 0x64); |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 245 | |
| 246 | /* 2 */ |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 247 | printk_debug("Azalia: codec viddid: %08x\n", reg32); |
| 248 | verb_size = find_verb(dev, reg32, &verb); |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 249 | |
| 250 | if (!verb_size) { |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 251 | printk_debug("Azalia: No verb!\n"); |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 252 | return; |
| 253 | } |
| 254 | |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 255 | printk_debug("Azalia: verb_size: %d\n", verb_size); |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 256 | /* 3 */ |
| 257 | for (i = 0; i < verb_size; i++) { |
| 258 | if (wait_for_ready(base) == -1) |
| 259 | return; |
| 260 | |
| 261 | writel(verb[i], base + 0x60); |
| 262 | |
| 263 | if (wait_for_valid(base) == -1) |
| 264 | return; |
| 265 | } |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 266 | printk_debug("Azalia: verb loaded.\n"); |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 267 | } |
| 268 | |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 269 | static void codecs_init(struct device *dev, u8 * base, u32 codec_mask) |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 270 | { |
| 271 | int i; |
| 272 | for (i = 2; i >= 0; i--) { |
| 273 | if (codec_mask & (1 << i)) |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 274 | codec_init(dev, base, i); |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 275 | } |
| 276 | } |
| 277 | |
| 278 | static void azalia_init(struct device *dev) |
| 279 | { |
| 280 | u8 *base; |
| 281 | struct resource *res; |
| 282 | u32 codec_mask; |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 283 | u8 reg8; |
| 284 | u32 reg32; |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 285 | |
Stefan Reinauer | 0867062 | 2009-06-30 15:17:49 +0000 | [diff] [blame] | 286 | #if CONFIG_MMCONF_SUPPORT |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 287 | // ESD |
| 288 | reg32 = pci_mmio_read_config32(dev, 0x134); |
| 289 | reg32 &= 0xff00ffff; |
| 290 | reg32 |= (2 << 16); |
| 291 | pci_mmio_write_config32(dev, 0x134, reg32); |
| 292 | |
| 293 | // Link1 description |
| 294 | reg32 = pci_mmio_read_config32(dev, 0x140); |
| 295 | reg32 &= 0xff00ffff; |
| 296 | reg32 |= (2 << 16); |
| 297 | pci_mmio_write_config32(dev, 0x140, reg32); |
| 298 | |
| 299 | // Port VC0 Resource Control Register |
| 300 | reg32 = pci_mmio_read_config32(dev, 0x114); |
| 301 | reg32 &= 0xffffff00; |
| 302 | reg32 |= 1; |
| 303 | pci_mmio_write_config32(dev, 0x114, reg32); |
| 304 | |
| 305 | // VCi traffic class |
| 306 | reg8 = pci_mmio_read_config8(dev, 0x44); |
| 307 | reg8 |= (7 << 0); // TC7 |
| 308 | pci_mmio_write_config8(dev, 0x44, reg8); |
| 309 | |
| 310 | // VCi Resource Control |
| 311 | reg32 = pci_mmio_read_config32(dev, 0x120); |
| 312 | reg32 |= (1 << 31); |
| 313 | reg32 |= (1 << 24); // VCi ID |
| 314 | reg32 |= (0x80 << 0); // VCi map |
| 315 | pci_mmio_write_config32(dev, 0x120, reg32); |
| 316 | #else |
Stefan Reinauer | 0867062 | 2009-06-30 15:17:49 +0000 | [diff] [blame] | 317 | #error ICH7 Azalia required CONFIG_MMCONF_SUPPORT |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 318 | #endif |
| 319 | |
| 320 | /* Set Bus Master */ |
| 321 | reg32 = pci_read_config32(dev, PCI_COMMAND); |
| 322 | pci_write_config32(dev, PCI_COMMAND, reg32 | PCI_COMMAND_MASTER); |
| 323 | |
| 324 | pci_write_config8(dev, 0x3c, 0x0a); // unused? |
| 325 | |
| 326 | // TODO Actually check if we're AC97 or HDA instead of hardcoding this |
| 327 | // here, in Config.lb and/or auto.c. |
| 328 | reg8 = pci_read_config8(dev, 0x40); |
| 329 | reg8 |= (1 << 3); // Clear Clock Detect Bit |
| 330 | pci_write_config8(dev, 0x40, reg8); |
| 331 | reg8 &= ~(1 << 3); // Keep CLKDETCLR from clearing the bit over and over |
| 332 | pci_write_config8(dev, 0x40, reg8); |
| 333 | reg8 |= (1 << 2); // Enable clock detection |
| 334 | pci_write_config8(dev, 0x40, reg8); |
| 335 | mdelay(1); |
| 336 | reg8 = pci_read_config8(dev, 0x40); |
| 337 | printk_debug("Azalia: codec type: %s\n", (reg8 & (1 << 1))?"Azalia":"AC97"); |
| 338 | |
| 339 | // |
| 340 | reg8 = pci_read_config8(dev, 0x40); // Audio Control |
| 341 | reg8 |= 1; // Select Azalia mode. This needs to be controlled via Config.lb |
| 342 | pci_write_config8(dev, 0x40, reg8); |
| 343 | |
| 344 | reg8 = pci_read_config8(dev, 0x4d); // Docking Status |
| 345 | reg8 &= ~(1 << 7); // Docking not supported |
| 346 | pci_write_config8(dev, 0x4d, reg8); |
| 347 | #if 0 |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 348 | /* Set routing pin */ |
| 349 | pci_write_config32(dev, 0xf8, 0x0); |
| 350 | pci_write_config8(dev, 0xfc, 0xAA); |
| 351 | |
| 352 | /* Set INTA */ |
| 353 | pci_write_config8(dev, 0x63, 0x0); |
| 354 | |
| 355 | /* Enable azalia, disable ac97 */ |
| 356 | // pm_iowrite(0x59, 0xB); |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 357 | #endif |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 358 | |
| 359 | res = find_resource(dev, 0x10); |
| 360 | if (!res) |
| 361 | return; |
| 362 | |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 363 | // NOTE this will break as soon as the Azalia get's a bar above |
| 364 | // 4G. Is there anything we can do about it? |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 365 | base = (u8 *) ((u32)res->base); |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 366 | printk_debug("Azalia: base = %08x\n", (u32)base); |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 367 | codec_mask = codec_detect(base); |
| 368 | |
| 369 | if (codec_mask) { |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 370 | printk_debug("Azalia: codec_mask = %02x\n", codec_mask); |
| 371 | codecs_init(dev, base, codec_mask); |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 372 | } |
| 373 | } |
| 374 | |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 375 | static void azalia_set_subsystem(device_t dev, unsigned vendor, unsigned device) |
| 376 | { |
| 377 | if (!vendor || !device) { |
| 378 | pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID, |
| 379 | pci_read_config32(dev, PCI_VENDOR_ID)); |
| 380 | } else { |
| 381 | pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID, |
| 382 | ((device & 0xffff) << 16) | (vendor & 0xffff)); |
| 383 | } |
| 384 | } |
| 385 | |
| 386 | static struct pci_operations azalia_pci_ops = { |
| 387 | .set_subsystem = azalia_set_subsystem, |
| 388 | }; |
| 389 | |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 390 | static struct device_operations azalia_ops = { |
| 391 | .read_resources = pci_dev_read_resources, |
| 392 | .set_resources = pci_dev_set_resources, |
| 393 | .enable_resources = pci_dev_enable_resources, |
| 394 | .init = azalia_init, |
| 395 | .scan_bus = 0, |
| 396 | .enable = i82801gx_enable, |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 397 | .ops_pci = &azalia_pci_ops, |
Stefan Reinauer | 679c9f9 | 2009-01-20 22:54:59 +0000 | [diff] [blame] | 398 | }; |
| 399 | |
| 400 | /* 82801GB/GR/GDH/GBM/GHM (ICH7/ICH7R/ICH7DH/ICH7-M/ICH7-M DH) */ |
| 401 | static const struct pci_driver i82801gx_azalia __pci_driver = { |
| 402 | .ops = &azalia_ops, |
| 403 | .vendor = PCI_VENDOR_ID_INTEL, |
| 404 | .device = 0x27d8, |
| 405 | }; |
| 406 | |