blob: a91f2e873ba42b5027ec301c57da15914440e1a3 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04
3 * IDE driver for Linux.
4 *
5 * Copyright (c) 2000-2002 Vojtech Pavlik
Bartlomiej Zolnierkiewicz75b1d972007-07-09 23:17:57 +02006 * Copyright (c) 2007 Bartlomiej Zolnierkiewicz
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 *
8 * Based on the work of:
9 * Andre Hedrick
10 */
11
12/*
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License version 2 as published by
15 * the Free Software Foundation.
16 */
17
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#include <linux/module.h>
19#include <linux/kernel.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070020#include <linux/pci.h>
21#include <linux/init.h>
22#include <linux/ide.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +010024enum {
25 AMD_IDE_CONFIG = 0x41,
26 AMD_CABLE_DETECT = 0x42,
27 AMD_DRIVE_TIMING = 0x48,
28 AMD_8BIT_TIMING = 0x4e,
29 AMD_ADDRESS_SETUP = 0x4c,
30 AMD_UDMA_TIMING = 0x50,
Linus Torvalds1da177e2005-04-16 15:20:36 -070031};
32
Linus Torvalds1da177e2005-04-16 15:20:36 -070033static unsigned int amd_80w;
34static unsigned int amd_clock;
35
Bartlomiej Zolnierkiewicz75b1d972007-07-09 23:17:57 +020036static char *amd_dma[] = { "16", "25", "33", "44", "66", "100", "133" };
Linus Torvalds1da177e2005-04-16 15:20:36 -070037static unsigned char amd_cyc2udma[] = { 6, 6, 5, 4, 0, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 7 };
38
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +010039static inline u8 amd_offset(struct pci_dev *dev)
40{
41 return (dev->vendor == PCI_VENDOR_ID_NVIDIA) ? 0x10 : 0;
42}
43
Linus Torvalds1da177e2005-04-16 15:20:36 -070044/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 * amd_set_speed() writes timing values to the chipset registers
46 */
47
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +010048static void amd_set_speed(struct pci_dev *dev, u8 dn, u8 udma_mask,
49 struct ide_timing *timing)
Linus Torvalds1da177e2005-04-16 15:20:36 -070050{
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +010051 u8 t = 0, offset = amd_offset(dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -070052
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +010053 pci_read_config_byte(dev, AMD_ADDRESS_SETUP + offset, &t);
Harvey Harrisond6cddd32008-07-15 21:21:41 +020054 t = (t & ~(3 << ((3 - dn) << 1))) | ((clamp_val(timing->setup, 1, 4) - 1) << ((3 - dn) << 1));
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +010055 pci_write_config_byte(dev, AMD_ADDRESS_SETUP + offset, t);
Linus Torvalds1da177e2005-04-16 15:20:36 -070056
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +010057 pci_write_config_byte(dev, AMD_8BIT_TIMING + offset + (1 - (dn >> 1)),
Harvey Harrisond6cddd32008-07-15 21:21:41 +020058 ((clamp_val(timing->act8b, 1, 16) - 1) << 4) | (clamp_val(timing->rec8b, 1, 16) - 1));
Linus Torvalds1da177e2005-04-16 15:20:36 -070059
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +010060 pci_write_config_byte(dev, AMD_DRIVE_TIMING + offset + (3 - dn),
Harvey Harrisond6cddd32008-07-15 21:21:41 +020061 ((clamp_val(timing->active, 1, 16) - 1) << 4) | (clamp_val(timing->recover, 1, 16) - 1));
Linus Torvalds1da177e2005-04-16 15:20:36 -070062
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +010063 switch (udma_mask) {
Harvey Harrisond6cddd32008-07-15 21:21:41 +020064 case ATA_UDMA2: t = timing->udma ? (0xc0 | (clamp_val(timing->udma, 2, 5) - 2)) : 0x03; break;
65 case ATA_UDMA4: t = timing->udma ? (0xc0 | amd_cyc2udma[clamp_val(timing->udma, 2, 10)]) : 0x03; break;
66 case ATA_UDMA5: t = timing->udma ? (0xc0 | amd_cyc2udma[clamp_val(timing->udma, 1, 10)]) : 0x03; break;
67 case ATA_UDMA6: t = timing->udma ? (0xc0 | amd_cyc2udma[clamp_val(timing->udma, 1, 15)]) : 0x03; break;
Bartlomiej Zolnierkiewicz75b1d972007-07-09 23:17:57 +020068 default: return;
Linus Torvalds1da177e2005-04-16 15:20:36 -070069 }
70
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +010071 pci_write_config_byte(dev, AMD_UDMA_TIMING + offset + (3 - dn), t);
Linus Torvalds1da177e2005-04-16 15:20:36 -070072}
73
74/*
Bartlomiej Zolnierkiewicz88b2b322007-10-13 17:47:51 +020075 * amd_set_drive() computes timing values and configures the chipset
76 * to a desired transfer mode. It also can be called by upper layers.
Linus Torvalds1da177e2005-04-16 15:20:36 -070077 */
78
Bartlomiej Zolnierkiewicz88b2b322007-10-13 17:47:51 +020079static void amd_set_drive(ide_drive_t *drive, const u8 speed)
Linus Torvalds1da177e2005-04-16 15:20:36 -070080{
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +010081 ide_hwif_t *hwif = drive->hwif;
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +010082 struct pci_dev *dev = to_pci_dev(hwif->dev);
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +010083 ide_drive_t *peer = hwif->drives + (~drive->dn & 1);
Linus Torvalds1da177e2005-04-16 15:20:36 -070084 struct ide_timing t, p;
85 int T, UT;
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +010086 u8 udma_mask = hwif->ultra_mask;
Linus Torvalds1da177e2005-04-16 15:20:36 -070087
Linus Torvalds1da177e2005-04-16 15:20:36 -070088 T = 1000000000 / amd_clock;
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +010089 UT = (udma_mask == ATA_UDMA2) ? T : (T / 2);
Linus Torvalds1da177e2005-04-16 15:20:36 -070090
91 ide_timing_compute(drive, speed, &t, T, UT);
92
93 if (peer->present) {
94 ide_timing_compute(peer, peer->current_speed, &p, T, UT);
95 ide_timing_merge(&p, &t, &t, IDE_TIMING_8BIT);
96 }
97
98 if (speed == XFER_UDMA_5 && amd_clock <= 33333) t.udma = 1;
99 if (speed == XFER_UDMA_6 && amd_clock <= 33333) t.udma = 15;
100
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100101 amd_set_speed(dev, drive->dn, udma_mask, &t);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102}
103
104/*
Bartlomiej Zolnierkiewicz26bcb872007-10-11 23:54:00 +0200105 * amd_set_pio_mode() is a callback from upper layers for PIO-only tuning.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106 */
107
Bartlomiej Zolnierkiewicz26bcb872007-10-11 23:54:00 +0200108static void amd_set_pio_mode(ide_drive_t *drive, const u8 pio)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109{
Bartlomiej Zolnierkiewicz26bcb872007-10-11 23:54:00 +0200110 amd_set_drive(drive, XFER_PIO_0 + pio);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111}
112
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100113static void __devinit amd7409_cable_detect(struct pci_dev *dev,
114 const char *name)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115{
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100116 /* no host side cable detection */
117 amd_80w = 0x03;
118}
119
120static void __devinit amd7411_cable_detect(struct pci_dev *dev,
121 const char *name)
122{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123 int i;
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100124 u32 u = 0;
125 u8 t = 0, offset = amd_offset(dev);
126
127 pci_read_config_byte(dev, AMD_CABLE_DETECT + offset, &t);
128 pci_read_config_dword(dev, AMD_UDMA_TIMING + offset, &u);
129 amd_80w = ((t & 0x3) ? 1 : 0) | ((t & 0xc) ? 2 : 0);
130 for (i = 24; i >= 0; i -= 8)
131 if (((u >> i) & 4) && !(amd_80w & (1 << (1 - (i >> 4))))) {
132 printk(KERN_WARNING "%s: BIOS didn't set cable bits "
133 "correctly. Enabling workaround.\n",
134 name);
135 amd_80w |= (1 << (1 - (i >> 4)));
136 }
137}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138
139/*
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100140 * The initialization callback. Initialize drive independent registers.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141 */
142
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100143static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev,
144 const char *name)
145{
146 u8 t = 0, offset = amd_offset(dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147
148/*
149 * Check 80-wire cable presence.
150 */
151
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100152 if (dev->vendor == PCI_VENDOR_ID_AMD &&
153 dev->device == PCI_DEVICE_ID_AMD_COBRA_7401)
154 ; /* no UDMA > 2 */
155 else if (dev->vendor == PCI_VENDOR_ID_AMD &&
156 dev->device == PCI_DEVICE_ID_AMD_VIPER_7409)
157 amd7409_cable_detect(dev, name);
158 else
159 amd7411_cable_detect(dev, name);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160
161/*
162 * Take care of prefetch & postwrite.
163 */
164
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100165 pci_read_config_byte(dev, AMD_IDE_CONFIG + offset, &t);
166 /*
167 * Check for broken FIFO support.
168 */
169 if (dev->vendor == PCI_VENDOR_ID_AMD &&
170 dev->vendor == PCI_DEVICE_ID_AMD_VIPER_7411)
171 t &= 0x0f;
172 else
173 t |= 0xf0;
174 pci_write_config_byte(dev, AMD_IDE_CONFIG + offset, t);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175
Linus Torvalds1da177e2005-04-16 15:20:36 -0700176 return dev->irq;
177}
178
Bartlomiej Zolnierkiewiczbfa14b42008-02-02 19:56:31 +0100179static u8 __devinit amd_cable_detect(ide_hwif_t *hwif)
180{
181 if ((amd_80w >> hwif->channel) & 1)
182 return ATA_CBL_PATA80;
183 else
184 return ATA_CBL_PATA40;
185}
186
Herbert Xue895f922005-07-03 16:15:41 +0200187static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188{
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100189 struct pci_dev *dev = to_pci_dev(hwif->dev);
190
Linus Torvalds1da177e2005-04-16 15:20:36 -0700191 if (hwif->irq == 0) /* 0 is bogus but will do for now */
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100192 hwif->irq = pci_get_legacy_ide_irq(dev, hwif->channel);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700193}
194
Bartlomiej Zolnierkiewiczac95bee2008-04-26 22:25:14 +0200195static const struct ide_port_ops amd_port_ops = {
196 .set_pio_mode = amd_set_pio_mode,
197 .set_dma_mode = amd_set_drive,
198 .cable_detect = amd_cable_detect,
199};
200
Bartlomiej Zolnierkiewiczcaea7602007-10-20 00:32:30 +0200201#define IDE_HFLAGS_AMD \
202 (IDE_HFLAG_PIO_NO_BLACKLIST | \
Bartlomiej Zolnierkiewiczcaea7602007-10-20 00:32:30 +0200203 IDE_HFLAG_POST_SET_MODE | \
204 IDE_HFLAG_IO_32BIT | \
Bartlomiej Zolnierkiewicz5e71d9c2008-04-26 17:36:35 +0200205 IDE_HFLAG_UNMASK_IRQS)
Bartlomiej Zolnierkiewiczcaea7602007-10-20 00:32:30 +0200206
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100207#define DECLARE_AMD_DEV(name_str, swdma, udma) \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208 { \
209 .name = name_str, \
210 .init_chipset = init_chipset_amd74xx, \
211 .init_hwif = init_hwif_amd74xx, \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212 .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \
Bartlomiej Zolnierkiewiczac95bee2008-04-26 22:25:14 +0200213 .port_ops = &amd_port_ops, \
Bartlomiej Zolnierkiewiczcaea7602007-10-20 00:32:30 +0200214 .host_flags = IDE_HFLAGS_AMD, \
Bartlomiej Zolnierkiewicz4099d142007-07-20 01:11:59 +0200215 .pio_mask = ATA_PIO5, \
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100216 .swdma_mask = swdma, \
Bartlomiej Zolnierkiewicz5f8b6c32007-10-19 00:30:07 +0200217 .mwdma_mask = ATA_MWDMA2, \
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100218 .udma_mask = udma, \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700219 }
220
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100221#define DECLARE_NV_DEV(name_str, udma) \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222 { \
223 .name = name_str, \
224 .init_chipset = init_chipset_amd74xx, \
225 .init_hwif = init_hwif_amd74xx, \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700226 .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, \
Bartlomiej Zolnierkiewiczac95bee2008-04-26 22:25:14 +0200227 .port_ops = &amd_port_ops, \
Bartlomiej Zolnierkiewiczcaea7602007-10-20 00:32:30 +0200228 .host_flags = IDE_HFLAGS_AMD, \
Bartlomiej Zolnierkiewicz4099d142007-07-20 01:11:59 +0200229 .pio_mask = ATA_PIO5, \
Bartlomiej Zolnierkiewicz5f8b6c32007-10-19 00:30:07 +0200230 .swdma_mask = ATA_SWDMA2, \
231 .mwdma_mask = ATA_MWDMA2, \
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100232 .udma_mask = udma, \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233 }
234
Bartlomiej Zolnierkiewicz85620432007-10-20 00:32:34 +0200235static const struct ide_port_info amd74xx_chipsets[] __devinitdata = {
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100236 /* 0 */ DECLARE_AMD_DEV("AMD7401", 0x00, ATA_UDMA2),
237 /* 1 */ DECLARE_AMD_DEV("AMD7409", ATA_SWDMA2, ATA_UDMA4),
238 /* 2 */ DECLARE_AMD_DEV("AMD7411", ATA_SWDMA2, ATA_UDMA5),
239 /* 3 */ DECLARE_AMD_DEV("AMD7441", ATA_SWDMA2, ATA_UDMA5),
240 /* 4 */ DECLARE_AMD_DEV("AMD8111", ATA_SWDMA2, ATA_UDMA6),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700241
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100242 /* 5 */ DECLARE_NV_DEV("NFORCE", ATA_UDMA5),
243 /* 6 */ DECLARE_NV_DEV("NFORCE2", ATA_UDMA6),
244 /* 7 */ DECLARE_NV_DEV("NFORCE2-U400R", ATA_UDMA6),
245 /* 8 */ DECLARE_NV_DEV("NFORCE2-U400R-SATA", ATA_UDMA6),
246 /* 9 */ DECLARE_NV_DEV("NFORCE3-150", ATA_UDMA6),
247 /* 10 */ DECLARE_NV_DEV("NFORCE3-250", ATA_UDMA6),
248 /* 11 */ DECLARE_NV_DEV("NFORCE3-250-SATA", ATA_UDMA6),
249 /* 12 */ DECLARE_NV_DEV("NFORCE3-250-SATA2", ATA_UDMA6),
250 /* 13 */ DECLARE_NV_DEV("NFORCE-CK804", ATA_UDMA6),
251 /* 14 */ DECLARE_NV_DEV("NFORCE-MCP04", ATA_UDMA6),
252 /* 15 */ DECLARE_NV_DEV("NFORCE-MCP51", ATA_UDMA6),
253 /* 16 */ DECLARE_NV_DEV("NFORCE-MCP55", ATA_UDMA6),
254 /* 17 */ DECLARE_NV_DEV("NFORCE-MCP61", ATA_UDMA6),
255 /* 18 */ DECLARE_NV_DEV("NFORCE-MCP65", ATA_UDMA6),
256 /* 19 */ DECLARE_NV_DEV("NFORCE-MCP67", ATA_UDMA6),
257 /* 20 */ DECLARE_NV_DEV("NFORCE-MCP73", ATA_UDMA6),
258 /* 21 */ DECLARE_NV_DEV("NFORCE-MCP77", ATA_UDMA6),
259
260 /* 22 */ DECLARE_AMD_DEV("AMD5536", ATA_SWDMA2, ATA_UDMA5),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700261};
262
263static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id)
264{
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100265 struct ide_port_info d;
266 u8 idx = id->driver_data;
267
268 d = amd74xx_chipsets[idx];
269
270 /*
271 * Check for bad SWDMA and incorrectly wired Serenade mainboards.
272 */
273 if (idx == 1) {
274 if (dev->revision <= 7)
275 d.swdma_mask = 0;
Bartlomiej Zolnierkiewicz8ac2b42a2008-02-01 23:09:30 +0100276 d.host_flags |= IDE_HFLAG_CLEAR_SIMPLEX;
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100277 } else if (idx == 4) {
278 if (dev->subsystem_vendor == PCI_VENDOR_ID_AMD &&
279 dev->subsystem_device == PCI_DEVICE_ID_AMD_SERENADE)
280 d.udma_mask = ATA_UDMA5;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700281 }
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100282
283 printk(KERN_INFO "%s: %s (rev %02x) UDMA%s controller\n",
284 d.name, pci_name(dev), dev->revision,
285 amd_dma[fls(d.udma_mask) - 1]);
286
Bartlomiej Zolnierkiewiczd51f19c2008-07-24 22:53:17 +0200287 /*
288 * Determine the system bus clock.
289 */
290 amd_clock = (ide_pci_clk ? ide_pci_clk : 33) * 1000;
291
292 switch (amd_clock) {
293 case 33000: amd_clock = 33333; break;
294 case 37000: amd_clock = 37500; break;
295 case 41000: amd_clock = 41666; break;
296 }
297
298 if (amd_clock < 20000 || amd_clock > 50000) {
299 printk(KERN_WARNING "%s: User given PCI clock speed impossible"
300 " (%d), using 33 MHz instead.\n",
301 d.name, amd_clock);
302 amd_clock = 33333;
303 }
304
Bartlomiej Zolnierkiewicz6cdf6eb2008-07-24 22:53:14 +0200305 return ide_pci_init_one(dev, &d, NULL);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700306}
307
Bartlomiej Zolnierkiewicz9cbcc5e2007-10-16 22:29:56 +0200308static const struct pci_device_id amd74xx_pci_tbl[] = {
309 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_COBRA_7401), 0 },
310 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_VIPER_7409), 1 },
311 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_VIPER_7411), 2 },
312 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_OPUS_7441), 3 },
313 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_8111_IDE), 4 },
314 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_IDE), 5 },
315 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE), 6 },
316 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE), 7 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700317#ifdef CONFIG_BLK_DEV_IDE_SATA
Bartlomiej Zolnierkiewicz9cbcc5e2007-10-16 22:29:56 +0200318 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA), 8 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700319#endif
Bartlomiej Zolnierkiewicz9cbcc5e2007-10-16 22:29:56 +0200320 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE), 9 },
321 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE), 10 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700322#ifdef CONFIG_BLK_DEV_IDE_SATA
Bartlomiej Zolnierkiewicz9cbcc5e2007-10-16 22:29:56 +0200323 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA), 11 },
324 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2), 12 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700325#endif
Bartlomiej Zolnierkiewicz9cbcc5e2007-10-16 22:29:56 +0200326 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE), 13 },
327 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE), 14 },
328 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE), 15 },
329 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE), 16 },
330 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE), 17 },
331 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE), 18 },
332 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE), 19 },
333 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE), 20 },
334 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE), 21 },
335 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CS5536_IDE), 22 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700336 { 0, },
337};
338MODULE_DEVICE_TABLE(pci, amd74xx_pci_tbl);
339
340static struct pci_driver driver = {
341 .name = "AMD_IDE",
342 .id_table = amd74xx_pci_tbl,
343 .probe = amd74xx_probe,
Bartlomiej Zolnierkiewiczb2509ac2008-07-24 22:53:19 +0200344 .remove = ide_pci_remove,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700345};
346
Bartlomiej Zolnierkiewicz82ab1ee2007-01-27 13:46:56 +0100347static int __init amd74xx_ide_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700348{
349 return ide_pci_register_driver(&driver);
350}
351
Bartlomiej Zolnierkiewiczb2509ac2008-07-24 22:53:19 +0200352static void __exit amd74xx_ide_exit(void)
353{
354 pci_unregister_driver(&driver);
355}
356
Linus Torvalds1da177e2005-04-16 15:20:36 -0700357module_init(amd74xx_ide_init);
Bartlomiej Zolnierkiewiczb2509ac2008-07-24 22:53:19 +0200358module_exit(amd74xx_ide_exit);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700359
360MODULE_AUTHOR("Vojtech Pavlik");
361MODULE_DESCRIPTION("AMD PCI IDE driver");
362MODULE_LICENSE("GPL");