blob: 7340597a373e387b462d379e2fcc9b3e6f8d7043 [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001// SPDX-License-Identifier: GPL-2.0-only
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04
4 * IDE driver for Linux.
5 *
6 * Copyright (c) 2000-2002 Vojtech Pavlik
Bartlomiej Zolnierkiewicz31bbb662010-01-18 07:18:17 +00007 * Copyright (c) 2007-2010 Bartlomiej Zolnierkiewicz
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 *
9 * Based on the work of:
10 * Andre Hedrick
11 */
12
Linus Torvalds1da177e2005-04-16 15:20:36 -070013
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#include <linux/module.h>
15#include <linux/kernel.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016#include <linux/pci.h>
17#include <linux/init.h>
18#include <linux/ide.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019
Bartlomiej Zolnierkiewiczced3ec82008-07-24 22:53:32 +020020#define DRV_NAME "amd74xx"
21
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +010022enum {
23 AMD_IDE_CONFIG = 0x41,
24 AMD_CABLE_DETECT = 0x42,
25 AMD_DRIVE_TIMING = 0x48,
26 AMD_8BIT_TIMING = 0x4e,
27 AMD_ADDRESS_SETUP = 0x4c,
28 AMD_UDMA_TIMING = 0x50,
Linus Torvalds1da177e2005-04-16 15:20:36 -070029};
30
Linus Torvalds1da177e2005-04-16 15:20:36 -070031static unsigned int amd_80w;
32static unsigned int amd_clock;
33
Bartlomiej Zolnierkiewicz75b1d972007-07-09 23:17:57 +020034static char *amd_dma[] = { "16", "25", "33", "44", "66", "100", "133" };
Linus Torvalds1da177e2005-04-16 15:20:36 -070035static unsigned char amd_cyc2udma[] = { 6, 6, 5, 4, 0, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 7 };
36
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +010037static inline u8 amd_offset(struct pci_dev *dev)
38{
39 return (dev->vendor == PCI_VENDOR_ID_NVIDIA) ? 0x10 : 0;
40}
41
Linus Torvalds1da177e2005-04-16 15:20:36 -070042/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070043 * amd_set_speed() writes timing values to the chipset registers
44 */
45
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +010046static void amd_set_speed(struct pci_dev *dev, u8 dn, u8 udma_mask,
47 struct ide_timing *timing)
Linus Torvalds1da177e2005-04-16 15:20:36 -070048{
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +010049 u8 t = 0, offset = amd_offset(dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -070050
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +010051 pci_read_config_byte(dev, AMD_ADDRESS_SETUP + offset, &t);
Harvey Harrisond6cddd32008-07-15 21:21:41 +020052 t = (t & ~(3 << ((3 - dn) << 1))) | ((clamp_val(timing->setup, 1, 4) - 1) << ((3 - dn) << 1));
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +010053 pci_write_config_byte(dev, AMD_ADDRESS_SETUP + offset, t);
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +010055 pci_write_config_byte(dev, AMD_8BIT_TIMING + offset + (1 - (dn >> 1)),
Harvey Harrisond6cddd32008-07-15 21:21:41 +020056 ((clamp_val(timing->act8b, 1, 16) - 1) << 4) | (clamp_val(timing->rec8b, 1, 16) - 1));
Linus Torvalds1da177e2005-04-16 15:20:36 -070057
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +010058 pci_write_config_byte(dev, AMD_DRIVE_TIMING + offset + (3 - dn),
Harvey Harrisond6cddd32008-07-15 21:21:41 +020059 ((clamp_val(timing->active, 1, 16) - 1) << 4) | (clamp_val(timing->recover, 1, 16) - 1));
Linus Torvalds1da177e2005-04-16 15:20:36 -070060
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +010061 switch (udma_mask) {
Harvey Harrisond6cddd32008-07-15 21:21:41 +020062 case ATA_UDMA2: t = timing->udma ? (0xc0 | (clamp_val(timing->udma, 2, 5) - 2)) : 0x03; break;
63 case ATA_UDMA4: t = timing->udma ? (0xc0 | amd_cyc2udma[clamp_val(timing->udma, 2, 10)]) : 0x03; break;
64 case ATA_UDMA5: t = timing->udma ? (0xc0 | amd_cyc2udma[clamp_val(timing->udma, 1, 10)]) : 0x03; break;
65 case ATA_UDMA6: t = timing->udma ? (0xc0 | amd_cyc2udma[clamp_val(timing->udma, 1, 15)]) : 0x03; break;
Bartlomiej Zolnierkiewicz75b1d972007-07-09 23:17:57 +020066 default: return;
Linus Torvalds1da177e2005-04-16 15:20:36 -070067 }
68
Bartlomiej Zolnierkiewicz31bbb662010-01-18 07:18:17 +000069 if (timing->udma)
70 pci_write_config_byte(dev, AMD_UDMA_TIMING + offset + 3 - dn, t);
Linus Torvalds1da177e2005-04-16 15:20:36 -070071}
72
73/*
Bartlomiej Zolnierkiewicz88b2b322007-10-13 17:47:51 +020074 * amd_set_drive() computes timing values and configures the chipset
75 * to a desired transfer mode. It also can be called by upper layers.
Linus Torvalds1da177e2005-04-16 15:20:36 -070076 */
77
Bartlomiej Zolnierkiewicz87761682010-01-19 01:45:29 -080078static void amd_set_drive(ide_hwif_t *hwif, ide_drive_t *drive)
Linus Torvalds1da177e2005-04-16 15:20:36 -070079{
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +010080 struct pci_dev *dev = to_pci_dev(hwif->dev);
Bartlomiej Zolnierkiewiczbca4ff12009-01-06 17:20:54 +010081 ide_drive_t *peer = ide_get_pair_dev(drive);
Linus Torvalds1da177e2005-04-16 15:20:36 -070082 struct ide_timing t, p;
83 int T, UT;
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +010084 u8 udma_mask = hwif->ultra_mask;
Bartlomiej Zolnierkiewicz87761682010-01-19 01:45:29 -080085 const u8 speed = drive->dma_mode;
Linus Torvalds1da177e2005-04-16 15:20:36 -070086
Linus Torvalds1da177e2005-04-16 15:20:36 -070087 T = 1000000000 / amd_clock;
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +010088 UT = (udma_mask == ATA_UDMA2) ? T : (T / 2);
Linus Torvalds1da177e2005-04-16 15:20:36 -070089
90 ide_timing_compute(drive, speed, &t, T, UT);
91
Bartlomiej Zolnierkiewiczbca4ff12009-01-06 17:20:54 +010092 if (peer) {
Bartlomiej Zolnierkiewiczf6d23c22010-01-18 07:21:33 +000093 ide_timing_compute(peer, peer->pio_mode, &p, T, UT);
Linus Torvalds1da177e2005-04-16 15:20:36 -070094 ide_timing_merge(&p, &t, &t, IDE_TIMING_8BIT);
95 }
96
97 if (speed == XFER_UDMA_5 && amd_clock <= 33333) t.udma = 1;
98 if (speed == XFER_UDMA_6 && amd_clock <= 33333) t.udma = 15;
99
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100100 amd_set_speed(dev, drive->dn, udma_mask, &t);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101}
102
103/*
Bartlomiej Zolnierkiewicz26bcb872007-10-11 23:54:00 +0200104 * amd_set_pio_mode() is a callback from upper layers for PIO-only tuning.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105 */
106
Bartlomiej Zolnierkiewicze085b3c2010-01-19 01:44:41 -0800107static void amd_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108{
Bartlomiej Zolnierkiewicz87761682010-01-19 01:45:29 -0800109 drive->dma_mode = drive->pio_mode;
110 amd_set_drive(hwif, drive);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111}
112
Bartlomiej Zolnierkiewiczfeb22b72008-10-10 22:39:32 +0200113static void amd7409_cable_detect(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114{
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100115 /* no host side cable detection */
116 amd_80w = 0x03;
117}
118
Bartlomiej Zolnierkiewiczfeb22b72008-10-10 22:39:32 +0200119static void amd7411_cable_detect(struct pci_dev *dev)
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100120{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121 int i;
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100122 u32 u = 0;
123 u8 t = 0, offset = amd_offset(dev);
124
125 pci_read_config_byte(dev, AMD_CABLE_DETECT + offset, &t);
126 pci_read_config_dword(dev, AMD_UDMA_TIMING + offset, &u);
127 amd_80w = ((t & 0x3) ? 1 : 0) | ((t & 0xc) ? 2 : 0);
128 for (i = 24; i >= 0; i -= 8)
129 if (((u >> i) & 4) && !(amd_80w & (1 << (1 - (i >> 4))))) {
Bartlomiej Zolnierkiewicza326b022008-07-24 22:53:33 +0200130 printk(KERN_WARNING DRV_NAME " %s: BIOS didn't set "
131 "cable bits correctly. Enabling workaround.\n",
132 pci_name(dev));
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100133 amd_80w |= (1 << (1 - (i >> 4)));
134 }
135}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700136
137/*
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100138 * The initialization callback. Initialize drive independent registers.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139 */
140
Bartlomiej Zolnierkiewicz2ed0ef52009-03-24 23:22:53 +0100141static int init_chipset_amd74xx(struct pci_dev *dev)
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100142{
143 u8 t = 0, offset = amd_offset(dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144
145/*
146 * Check 80-wire cable presence.
147 */
148
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100149 if (dev->vendor == PCI_VENDOR_ID_AMD &&
150 dev->device == PCI_DEVICE_ID_AMD_COBRA_7401)
151 ; /* no UDMA > 2 */
152 else if (dev->vendor == PCI_VENDOR_ID_AMD &&
153 dev->device == PCI_DEVICE_ID_AMD_VIPER_7409)
Bartlomiej Zolnierkiewicza326b022008-07-24 22:53:33 +0200154 amd7409_cable_detect(dev);
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100155 else
Bartlomiej Zolnierkiewicza326b022008-07-24 22:53:33 +0200156 amd7411_cable_detect(dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157
158/*
159 * Take care of prefetch & postwrite.
160 */
161
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100162 pci_read_config_byte(dev, AMD_IDE_CONFIG + offset, &t);
163 /*
164 * Check for broken FIFO support.
165 */
166 if (dev->vendor == PCI_VENDOR_ID_AMD &&
Roel Kluin43a12212009-02-25 20:28:22 +0100167 dev->device == PCI_DEVICE_ID_AMD_VIPER_7411)
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100168 t &= 0x0f;
169 else
170 t |= 0xf0;
171 pci_write_config_byte(dev, AMD_IDE_CONFIG + offset, t);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172
Bartlomiej Zolnierkiewicz2ed0ef52009-03-24 23:22:53 +0100173 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700174}
175
Bartlomiej Zolnierkiewiczf454cbe2008-08-05 18:17:04 +0200176static u8 amd_cable_detect(ide_hwif_t *hwif)
Bartlomiej Zolnierkiewiczbfa14b42008-02-02 19:56:31 +0100177{
178 if ((amd_80w >> hwif->channel) & 1)
179 return ATA_CBL_PATA80;
180 else
181 return ATA_CBL_PATA40;
182}
183
Bartlomiej Zolnierkiewiczac95bee2008-04-26 22:25:14 +0200184static const struct ide_port_ops amd_port_ops = {
185 .set_pio_mode = amd_set_pio_mode,
186 .set_dma_mode = amd_set_drive,
187 .cable_detect = amd_cable_detect,
188};
189
Bartlomiej Zolnierkiewiczcaea7602007-10-20 00:32:30 +0200190#define IDE_HFLAGS_AMD \
191 (IDE_HFLAG_PIO_NO_BLACKLIST | \
Bartlomiej Zolnierkiewiczcaea7602007-10-20 00:32:30 +0200192 IDE_HFLAG_POST_SET_MODE | \
193 IDE_HFLAG_IO_32BIT | \
Bartlomiej Zolnierkiewicz5e71d9c2008-04-26 17:36:35 +0200194 IDE_HFLAG_UNMASK_IRQS)
Bartlomiej Zolnierkiewiczcaea7602007-10-20 00:32:30 +0200195
Bartlomiej Zolnierkiewiczced3ec82008-07-24 22:53:32 +0200196#define DECLARE_AMD_DEV(swdma, udma) \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700197 { \
Bartlomiej Zolnierkiewiczced3ec82008-07-24 22:53:32 +0200198 .name = DRV_NAME, \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700199 .init_chipset = init_chipset_amd74xx, \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700200 .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \
Bartlomiej Zolnierkiewiczac95bee2008-04-26 22:25:14 +0200201 .port_ops = &amd_port_ops, \
Bartlomiej Zolnierkiewiczcaea7602007-10-20 00:32:30 +0200202 .host_flags = IDE_HFLAGS_AMD, \
Bartlomiej Zolnierkiewicz4099d142007-07-20 01:11:59 +0200203 .pio_mask = ATA_PIO5, \
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100204 .swdma_mask = swdma, \
Bartlomiej Zolnierkiewicz5f8b6c32007-10-19 00:30:07 +0200205 .mwdma_mask = ATA_MWDMA2, \
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100206 .udma_mask = udma, \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700207 }
208
Bartlomiej Zolnierkiewiczced3ec82008-07-24 22:53:32 +0200209#define DECLARE_NV_DEV(udma) \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210 { \
Bartlomiej Zolnierkiewiczced3ec82008-07-24 22:53:32 +0200211 .name = DRV_NAME, \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212 .init_chipset = init_chipset_amd74xx, \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700213 .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, \
Bartlomiej Zolnierkiewiczac95bee2008-04-26 22:25:14 +0200214 .port_ops = &amd_port_ops, \
Bartlomiej Zolnierkiewiczcaea7602007-10-20 00:32:30 +0200215 .host_flags = IDE_HFLAGS_AMD, \
Bartlomiej Zolnierkiewicz4099d142007-07-20 01:11:59 +0200216 .pio_mask = ATA_PIO5, \
Bartlomiej Zolnierkiewicz5f8b6c32007-10-19 00:30:07 +0200217 .swdma_mask = ATA_SWDMA2, \
218 .mwdma_mask = ATA_MWDMA2, \
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100219 .udma_mask = udma, \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700220 }
221
Greg Kroah-Hartmanfe31edc2012-12-21 13:21:03 -0800222static const struct ide_port_info amd74xx_chipsets[] = {
Bartlomiej Zolnierkiewiczced3ec82008-07-24 22:53:32 +0200223 /* 0: AMD7401 */ DECLARE_AMD_DEV(0x00, ATA_UDMA2),
224 /* 1: AMD7409 */ DECLARE_AMD_DEV(ATA_SWDMA2, ATA_UDMA4),
225 /* 2: AMD7411/7441 */ DECLARE_AMD_DEV(ATA_SWDMA2, ATA_UDMA5),
226 /* 3: AMD8111 */ DECLARE_AMD_DEV(ATA_SWDMA2, ATA_UDMA6),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700227
Bartlomiej Zolnierkiewiczced3ec82008-07-24 22:53:32 +0200228 /* 4: NFORCE */ DECLARE_NV_DEV(ATA_UDMA5),
229 /* 5: >= NFORCE2 */ DECLARE_NV_DEV(ATA_UDMA6),
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100230
Bartlomiej Zolnierkiewiczced3ec82008-07-24 22:53:32 +0200231 /* 6: AMD5536 */ DECLARE_AMD_DEV(ATA_SWDMA2, ATA_UDMA5),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700232};
233
Greg Kroah-Hartmanfe31edc2012-12-21 13:21:03 -0800234static int amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700235{
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100236 struct ide_port_info d;
237 u8 idx = id->driver_data;
238
239 d = amd74xx_chipsets[idx];
240
241 /*
242 * Check for bad SWDMA and incorrectly wired Serenade mainboards.
243 */
244 if (idx == 1) {
245 if (dev->revision <= 7)
246 d.swdma_mask = 0;
Bartlomiej Zolnierkiewicz8ac2b42a2008-02-01 23:09:30 +0100247 d.host_flags |= IDE_HFLAG_CLEAR_SIMPLEX;
Bartlomiej Zolnierkiewiczced3ec82008-07-24 22:53:32 +0200248 } else if (idx == 3) {
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100249 if (dev->subsystem_vendor == PCI_VENDOR_ID_AMD &&
250 dev->subsystem_device == PCI_DEVICE_ID_AMD_SERENADE)
251 d.udma_mask = ATA_UDMA5;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252 }
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100253
Bartlomiej Zolnierkiewicz66364872008-12-02 20:40:03 +0100254 /*
255 * It seems that on some nVidia controllers using AltStatus
256 * register can be unreliable so default to Status register
257 * if the device is in Compatibility Mode.
258 */
259 if (dev->vendor == PCI_VENDOR_ID_NVIDIA &&
260 ide_pci_is_in_compatibility_mode(dev))
261 d.host_flags |= IDE_HFLAG_BROKEN_ALTSTATUS;
262
Bartlomiej Zolnierkiewicz28cfd8a2008-07-24 22:53:31 +0200263 printk(KERN_INFO "%s %s: UDMA%s controller\n",
264 d.name, pci_name(dev), amd_dma[fls(d.udma_mask) - 1]);
Bartlomiej Zolnierkiewicz993da8f2008-02-01 23:09:30 +0100265
Bartlomiej Zolnierkiewiczd51f19c2008-07-24 22:53:17 +0200266 /*
267 * Determine the system bus clock.
268 */
269 amd_clock = (ide_pci_clk ? ide_pci_clk : 33) * 1000;
270
271 switch (amd_clock) {
272 case 33000: amd_clock = 33333; break;
273 case 37000: amd_clock = 37500; break;
274 case 41000: amd_clock = 41666; break;
275 }
276
277 if (amd_clock < 20000 || amd_clock > 50000) {
278 printk(KERN_WARNING "%s: User given PCI clock speed impossible"
279 " (%d), using 33 MHz instead.\n",
280 d.name, amd_clock);
281 amd_clock = 33333;
282 }
283
Bartlomiej Zolnierkiewicz6cdf6eb2008-07-24 22:53:14 +0200284 return ide_pci_init_one(dev, &d, NULL);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700285}
286
Bartlomiej Zolnierkiewicz9cbcc5e2007-10-16 22:29:56 +0200287static const struct pci_device_id amd74xx_pci_tbl[] = {
288 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_COBRA_7401), 0 },
289 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_VIPER_7409), 1 },
290 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_VIPER_7411), 2 },
Bartlomiej Zolnierkiewiczced3ec82008-07-24 22:53:32 +0200291 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_OPUS_7441), 2 },
292 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_8111_IDE), 3 },
293 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_IDE), 4 },
294 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE), 5 },
295 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE), 5 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700296#ifdef CONFIG_BLK_DEV_IDE_SATA
Bartlomiej Zolnierkiewiczced3ec82008-07-24 22:53:32 +0200297 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA), 5 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700298#endif
Bartlomiej Zolnierkiewiczced3ec82008-07-24 22:53:32 +0200299 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE), 5 },
300 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE), 5 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700301#ifdef CONFIG_BLK_DEV_IDE_SATA
Bartlomiej Zolnierkiewiczced3ec82008-07-24 22:53:32 +0200302 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA), 5 },
303 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2), 5 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700304#endif
Bartlomiej Zolnierkiewiczced3ec82008-07-24 22:53:32 +0200305 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE), 5 },
306 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE), 5 },
307 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE), 5 },
308 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE), 5 },
309 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE), 5 },
310 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE), 5 },
311 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE), 5 },
312 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE), 5 },
313 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE), 5 },
314 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CS5536_IDE), 6 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700315 { 0, },
316};
317MODULE_DEVICE_TABLE(pci, amd74xx_pci_tbl);
318
Bartlomiej Zolnierkiewicza9ab09e22008-10-13 21:39:41 +0200319static struct pci_driver amd74xx_pci_driver = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700320 .name = "AMD_IDE",
321 .id_table = amd74xx_pci_tbl,
322 .probe = amd74xx_probe,
Bartlomiej Zolnierkiewiczb2509ac2008-07-24 22:53:19 +0200323 .remove = ide_pci_remove,
Bartlomiej Zolnierkiewiczfeb22b72008-10-10 22:39:32 +0200324 .suspend = ide_pci_suspend,
325 .resume = ide_pci_resume,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700326};
327
Bartlomiej Zolnierkiewicz82ab1ee2007-01-27 13:46:56 +0100328static int __init amd74xx_ide_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700329{
Bartlomiej Zolnierkiewicza9ab09e22008-10-13 21:39:41 +0200330 return ide_pci_register_driver(&amd74xx_pci_driver);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700331}
332
Bartlomiej Zolnierkiewiczb2509ac2008-07-24 22:53:19 +0200333static void __exit amd74xx_ide_exit(void)
334{
Bartlomiej Zolnierkiewicza9ab09e22008-10-13 21:39:41 +0200335 pci_unregister_driver(&amd74xx_pci_driver);
Bartlomiej Zolnierkiewiczb2509ac2008-07-24 22:53:19 +0200336}
337
Linus Torvalds1da177e2005-04-16 15:20:36 -0700338module_init(amd74xx_ide_init);
Bartlomiej Zolnierkiewiczb2509ac2008-07-24 22:53:19 +0200339module_exit(amd74xx_ide_exit);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700340
Bartlomiej Zolnierkiewicz31bbb662010-01-18 07:18:17 +0000341MODULE_AUTHOR("Vojtech Pavlik, Bartlomiej Zolnierkiewicz");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700342MODULE_DESCRIPTION("AMD PCI IDE driver");
343MODULE_LICENSE("GPL");