blob: 4877bc8cd599cd27feea2c0108fe5f781e99d685 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org>
3 * Copyright (C) 2003 Red Hat <alan@redhat.com>
Sergei Shtylyov075cb652007-02-17 02:40:22 +01004 * Copyright (C) 2007 MontaVista Software, Inc.
Bartlomiej Zolnierkiewicz328dcbb2007-07-20 01:11:54 +02005 * Copyright (C) 2007 Bartlomiej Zolnierkiewicz
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 *
7 * May be copied or modified under the terms of the GNU General Public License
8 *
Jeff Garzikbf4c7962005-11-18 22:55:47 +01009 * Documentation for CMD680:
10 * http://gkernel.sourceforge.net/specs/sii/sii-0680a-v1.31.pdf.bz2
11 *
12 * Documentation for SiI 3112:
13 * http://gkernel.sourceforge.net/specs/sii/3112A_SiI-DS-0095-B2.pdf.bz2
14 *
15 * Errata and other documentation only available under NDA.
Linus Torvalds1da177e2005-04-16 15:20:36 -070016 *
17 *
18 * FAQ Items:
19 * If you are using Marvell SATA-IDE adapters with Maxtor drives
20 * ensure the system is set up for ATA100/UDMA5 not UDMA6.
21 *
22 * If you are using WD drives with SATA bridges you must set the
23 * drive to "Single". "Master" will hang
24 *
25 * If you have strange problems with nVidia chipset systems please
26 * see the SI support documentation and update your system BIOS
Robert P. J. Day3a4fa0a2007-10-19 23:10:43 +020027 * if necessary
Alan Cox8693d3e2007-03-03 17:48:54 +010028 *
29 * The Dell DRAC4 has some interesting features including effectively hot
30 * unplugging/replugging the virtual CD interface when the DRAC is reset.
31 * This often causes drivers/ide/siimage to panic but is ok with the rather
32 * smarter code in libata.
Bartlomiej Zolnierkiewicz328dcbb2007-07-20 01:11:54 +020033 *
34 * TODO:
35 * - IORDY fixes
36 * - VDMA support
Linus Torvalds1da177e2005-04-16 15:20:36 -070037 */
38
Linus Torvalds1da177e2005-04-16 15:20:36 -070039#include <linux/types.h>
40#include <linux/module.h>
41#include <linux/pci.h>
42#include <linux/delay.h>
43#include <linux/hdreg.h>
44#include <linux/ide.h>
45#include <linux/init.h>
46
47#include <asm/io.h>
48
Linus Torvalds1da177e2005-04-16 15:20:36 -070049/**
50 * pdev_is_sata - check if device is SATA
51 * @pdev: PCI device to check
52 *
53 * Returns true if this is a SATA controller
54 */
55
56static int pdev_is_sata(struct pci_dev *pdev)
57{
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +020058#ifdef CONFIG_BLK_DEV_IDE_SATA
59 switch(pdev->device) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070060 case PCI_DEVICE_ID_SII_3112:
61 case PCI_DEVICE_ID_SII_1210SA:
62 return 1;
63 case PCI_DEVICE_ID_SII_680:
64 return 0;
65 }
66 BUG();
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +020067#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070068 return 0;
69}
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +020070
Linus Torvalds1da177e2005-04-16 15:20:36 -070071/**
72 * is_sata - check if hwif is SATA
73 * @hwif: interface to check
74 *
75 * Returns true if this is a SATA controller
76 */
77
78static inline int is_sata(ide_hwif_t *hwif)
79{
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +010080 return pdev_is_sata(to_pci_dev(hwif->dev));
Linus Torvalds1da177e2005-04-16 15:20:36 -070081}
82
83/**
84 * siimage_selreg - return register base
85 * @hwif: interface
86 * @r: config offset
87 *
88 * Turn a config register offset into the right address in either
89 * PCI space or MMIO space to access the control register in question
90 * Thankfully this is a configuration operation so isnt performance
91 * criticial.
92 */
93
94static unsigned long siimage_selreg(ide_hwif_t *hwif, int r)
95{
96 unsigned long base = (unsigned long)hwif->hwif_data;
97 base += 0xA0 + r;
98 if(hwif->mmio)
99 base += (hwif->channel << 6);
100 else
101 base += (hwif->channel << 4);
102 return base;
103}
104
105/**
106 * siimage_seldev - return register base
107 * @hwif: interface
108 * @r: config offset
109 *
110 * Turn a config register offset into the right address in either
111 * PCI space or MMIO space to access the control register in question
112 * including accounting for the unit shift.
113 */
114
115static inline unsigned long siimage_seldev(ide_drive_t *drive, int r)
116{
117 ide_hwif_t *hwif = HWIF(drive);
118 unsigned long base = (unsigned long)hwif->hwif_data;
119 base += 0xA0 + r;
120 if(hwif->mmio)
121 base += (hwif->channel << 6);
122 else
123 base += (hwif->channel << 4);
124 base |= drive->select.b.unit << drive->select.b.unit;
125 return base;
126}
127
128/**
Bartlomiej Zolnierkiewicz2d5eaa62007-05-10 00:01:08 +0200129 * sil_udma_filter - compute UDMA mask
130 * @drive: IDE device
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131 *
Bartlomiej Zolnierkiewicz2d5eaa62007-05-10 00:01:08 +0200132 * Compute the available UDMA speeds for the device on the interface.
133 *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700134 * For the CMD680 this depends on the clocking mode (scsc), for the
Bartlomiej Zolnierkiewicz2d5eaa62007-05-10 00:01:08 +0200135 * SI3112 SATA controller life is a bit simpler.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700136 */
Bartlomiej Zolnierkiewicz2d5eaa62007-05-10 00:01:08 +0200137
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200138static u8 sil_pata_udma_filter(ide_drive_t *drive)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139{
Bartlomiej Zolnierkiewicz2d5eaa62007-05-10 00:01:08 +0200140 ide_hwif_t *hwif = drive->hwif;
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100141 struct pci_dev *dev = to_pci_dev(hwif->dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142 unsigned long base = (unsigned long) hwif->hwif_data;
Bartlomiej Zolnierkiewicz2d5eaa62007-05-10 00:01:08 +0200143 u8 mask = 0, scsc = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144
145 if (hwif->mmio)
146 scsc = hwif->INB(base + 0x4A);
147 else
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100148 pci_read_config_byte(dev, 0x8A, &scsc);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150 if ((scsc & 0x30) == 0x10) /* 133 */
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200151 mask = ATA_UDMA6;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152 else if ((scsc & 0x30) == 0x20) /* 2xPCI */
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200153 mask = ATA_UDMA6;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154 else if ((scsc & 0x30) == 0x00) /* 100 */
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200155 mask = ATA_UDMA5;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156 else /* Disabled ? */
157 BUG();
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200158
Bartlomiej Zolnierkiewicz2d5eaa62007-05-10 00:01:08 +0200159 return mask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160}
161
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200162static u8 sil_sata_udma_filter(ide_drive_t *drive)
163{
164 return strstr(drive->id->model, "Maxtor") ? ATA_UDMA5 : ATA_UDMA6;
165}
166
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167/**
Bartlomiej Zolnierkiewicz88b2b322007-10-13 17:47:51 +0200168 * sil_set_pio_mode - set host controller for PIO mode
169 * @drive: drive
170 * @pio: PIO mode number
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171 *
172 * Load the timing settings for this device mode into the
173 * controller. If we are in PIO mode 3 or 4 turn on IORDY
174 * monitoring (bit 9). The TF timing is bits 31:16
175 */
Bartlomiej Zolnierkiewicz328dcbb2007-07-20 01:11:54 +0200176
Bartlomiej Zolnierkiewicz88b2b322007-10-13 17:47:51 +0200177static void sil_set_pio_mode(ide_drive_t *drive, u8 pio)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700178{
Bartlomiej Zolnierkiewicz328dcbb2007-07-20 01:11:54 +0200179 const u16 tf_speed[] = { 0x328a, 0x2283, 0x1281, 0x10c3, 0x10c1 };
180 const u16 data_speed[] = { 0x328a, 0x2283, 0x1104, 0x10c3, 0x10c1 };
181
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182 ide_hwif_t *hwif = HWIF(drive);
Benjamin Herrenschmidta87a87c2007-10-19 00:30:05 +0200183 ide_drive_t *pair = ide_get_paired_drive(drive);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184 u32 speedt = 0;
185 u16 speedp = 0;
186 unsigned long addr = siimage_seldev(drive, 0x04);
187 unsigned long tfaddr = siimage_selreg(hwif, 0x02);
Bartlomiej Zolnierkiewiczffe54152007-10-11 23:54:01 +0200188 unsigned long base = (unsigned long)hwif->hwif_data;
Bartlomiej Zolnierkiewicz328dcbb2007-07-20 01:11:54 +0200189 u8 tf_pio = pio;
Bartlomiej Zolnierkiewiczffe54152007-10-11 23:54:01 +0200190 u8 addr_mask = hwif->channel ? (hwif->mmio ? 0xF4 : 0x84)
191 : (hwif->mmio ? 0xB4 : 0x80);
192 u8 mode = 0;
193 u8 unit = drive->select.b.unit;
Bartlomiej Zolnierkiewicz328dcbb2007-07-20 01:11:54 +0200194
195 /* trim *taskfile* PIO to the slowest of the master/slave */
196 if (pair->present) {
Bartlomiej Zolnierkiewicz21347582007-07-20 01:11:58 +0200197 u8 pair_pio = ide_get_best_pio_mode(pair, 255, 4);
Bartlomiej Zolnierkiewicz328dcbb2007-07-20 01:11:54 +0200198
199 if (pair_pio < tf_pio)
200 tf_pio = pair_pio;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201 }
Sergei Shtylyov075cb652007-02-17 02:40:22 +0100202
Bartlomiej Zolnierkiewicz328dcbb2007-07-20 01:11:54 +0200203 /* cheat for now and use the docs */
204 speedp = data_speed[pio];
205 speedt = tf_speed[tf_pio];
206
Sergei Shtylyov075cb652007-02-17 02:40:22 +0100207 if (hwif->mmio) {
208 hwif->OUTW(speedp, addr);
209 hwif->OUTW(speedt, tfaddr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210 /* Now set up IORDY */
Bartlomiej Zolnierkiewicz328dcbb2007-07-20 01:11:54 +0200211 if (pio > 2)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212 hwif->OUTW(hwif->INW(tfaddr-2)|0x200, tfaddr-2);
213 else
214 hwif->OUTW(hwif->INW(tfaddr-2)&~0x200, tfaddr-2);
Bartlomiej Zolnierkiewiczffe54152007-10-11 23:54:01 +0200215
216 mode = hwif->INB(base + addr_mask);
217 mode &= ~(unit ? 0x30 : 0x03);
218 mode |= (unit ? 0x10 : 0x01);
219 hwif->OUTB(mode, base + addr_mask);
Sergei Shtylyov075cb652007-02-17 02:40:22 +0100220 } else {
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100221 struct pci_dev *dev = to_pci_dev(hwif->dev);
222
223 pci_write_config_word(dev, addr, speedp);
224 pci_write_config_word(dev, tfaddr, speedt);
225 pci_read_config_word(dev, tfaddr - 2, &speedp);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700226 speedp &= ~0x200;
227 /* Set IORDY for mode 3 or 4 */
Bartlomiej Zolnierkiewicz328dcbb2007-07-20 01:11:54 +0200228 if (pio > 2)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229 speedp |= 0x200;
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100230 pci_write_config_word(dev, tfaddr - 2, speedp);
Bartlomiej Zolnierkiewiczffe54152007-10-11 23:54:01 +0200231
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100232 pci_read_config_byte(dev, addr_mask, &mode);
Bartlomiej Zolnierkiewiczffe54152007-10-11 23:54:01 +0200233 mode &= ~(unit ? 0x30 : 0x03);
234 mode |= (unit ? 0x10 : 0x01);
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100235 pci_write_config_byte(dev, addr_mask, mode);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700236 }
237}
238
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239/**
Bartlomiej Zolnierkiewicz88b2b322007-10-13 17:47:51 +0200240 * sil_set_dma_mode - set host controller for DMA mode
241 * @drive: drive
242 * @speed: DMA mode
Linus Torvalds1da177e2005-04-16 15:20:36 -0700243 *
Bartlomiej Zolnierkiewicz88b2b322007-10-13 17:47:51 +0200244 * Tune the SiI chipset for the desired DMA mode.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700245 */
Bartlomiej Zolnierkiewiczf212ff22007-10-11 23:53:59 +0200246
Bartlomiej Zolnierkiewicz88b2b322007-10-13 17:47:51 +0200247static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700248{
249 u8 ultra6[] = { 0x0F, 0x0B, 0x07, 0x05, 0x03, 0x02, 0x01 };
250 u8 ultra5[] = { 0x0C, 0x07, 0x05, 0x04, 0x02, 0x01 };
251 u16 dma[] = { 0x2208, 0x10C2, 0x10C1 };
252
253 ide_hwif_t *hwif = HWIF(drive);
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100254 struct pci_dev *dev = to_pci_dev(hwif->dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700255 u16 ultra = 0, multi = 0;
256 u8 mode = 0, unit = drive->select.b.unit;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700257 unsigned long base = (unsigned long)hwif->hwif_data;
258 u8 scsc = 0, addr_mask = ((hwif->channel) ?
259 ((hwif->mmio) ? 0xF4 : 0x84) :
260 ((hwif->mmio) ? 0xB4 : 0x80));
261
262 unsigned long ma = siimage_seldev(drive, 0x08);
263 unsigned long ua = siimage_seldev(drive, 0x0C);
264
265 if (hwif->mmio) {
266 scsc = hwif->INB(base + 0x4A);
267 mode = hwif->INB(base + addr_mask);
268 multi = hwif->INW(ma);
269 ultra = hwif->INW(ua);
270 } else {
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100271 pci_read_config_byte(dev, 0x8A, &scsc);
272 pci_read_config_byte(dev, addr_mask, &mode);
273 pci_read_config_word(dev, ma, &multi);
274 pci_read_config_word(dev, ua, &ultra);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700275 }
276
277 mode &= ~((unit) ? 0x30 : 0x03);
278 ultra &= ~0x3F;
279 scsc = ((scsc & 0x30) == 0x00) ? 0 : 1;
280
281 scsc = is_sata(hwif) ? 1 : scsc;
282
Bartlomiej Zolnierkiewicz4db90a12008-01-25 22:17:18 +0100283 if (speed >= XFER_UDMA_0) {
284 multi = dma[2];
285 ultra |= (scsc ? ultra6[speed - XFER_UDMA_0] :
286 ultra5[speed - XFER_UDMA_0]);
287 mode |= (unit ? 0x30 : 0x03);
288 } else {
289 multi = dma[speed - XFER_MW_DMA_0];
290 mode |= (unit ? 0x20 : 0x02);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700291 }
292
293 if (hwif->mmio) {
294 hwif->OUTB(mode, base + addr_mask);
295 hwif->OUTW(multi, ma);
296 hwif->OUTW(ultra, ua);
297 } else {
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100298 pci_write_config_byte(dev, addr_mask, mode);
299 pci_write_config_word(dev, ma, multi);
300 pci_write_config_word(dev, ua, ultra);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700301 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700302}
303
Linus Torvalds1da177e2005-04-16 15:20:36 -0700304/* returns 1 if dma irq issued, 0 otherwise */
305static int siimage_io_ide_dma_test_irq (ide_drive_t *drive)
306{
307 ide_hwif_t *hwif = HWIF(drive);
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100308 struct pci_dev *dev = to_pci_dev(hwif->dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700309 u8 dma_altstat = 0;
310 unsigned long addr = siimage_selreg(hwif, 1);
311
312 /* return 1 if INTR asserted */
313 if ((hwif->INB(hwif->dma_status) & 4) == 4)
314 return 1;
315
316 /* return 1 if Device INTR asserted */
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100317 pci_read_config_byte(dev, addr, &dma_altstat);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700318 if (dma_altstat & 8)
319 return 0; //return 1;
320 return 0;
321}
322
Linus Torvalds1da177e2005-04-16 15:20:36 -0700323/**
324 * siimage_mmio_ide_dma_test_irq - check we caused an IRQ
325 * @drive: drive we are testing
326 *
327 * Check if we caused an IDE DMA interrupt. We may also have caused
328 * SATA status interrupts, if so we clean them up and continue.
329 */
330
331static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive)
332{
333 ide_hwif_t *hwif = HWIF(drive);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700334 unsigned long addr = siimage_selreg(hwif, 0x1);
335
336 if (SATA_ERROR_REG) {
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200337 unsigned long base = (unsigned long)hwif->hwif_data;
338
Bartlomiej Zolnierkiewicz0ecdca22007-02-17 02:40:25 +0100339 u32 ext_stat = readl((void __iomem *)(base + 0x10));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700340 u8 watchdog = 0;
341 if (ext_stat & ((hwif->channel) ? 0x40 : 0x10)) {
Bartlomiej Zolnierkiewicz0ecdca22007-02-17 02:40:25 +0100342 u32 sata_error = readl((void __iomem *)SATA_ERROR_REG);
343 writel(sata_error, (void __iomem *)SATA_ERROR_REG);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700344 watchdog = (sata_error & 0x00680000) ? 1 : 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700345 printk(KERN_WARNING "%s: sata_error = 0x%08x, "
346 "watchdog = %d, %s\n",
347 drive->name, sata_error, watchdog,
348 __FUNCTION__);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700349
350 } else {
351 watchdog = (ext_stat & 0x8000) ? 1 : 0;
352 }
353 ext_stat >>= 16;
354
355 if (!(ext_stat & 0x0404) && !watchdog)
356 return 0;
357 }
358
359 /* return 1 if INTR asserted */
Bartlomiej Zolnierkiewicz0ecdca22007-02-17 02:40:25 +0100360 if ((readb((void __iomem *)hwif->dma_status) & 0x04) == 0x04)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700361 return 1;
362
363 /* return 1 if Device INTR asserted */
Bartlomiej Zolnierkiewicz0ecdca22007-02-17 02:40:25 +0100364 if ((readb((void __iomem *)addr) & 8) == 8)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700365 return 0; //return 1;
366
367 return 0;
368}
369
370/**
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200371 * sil_sata_busproc - bus isolation IOCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700372 * @drive: drive to isolate/restore
373 * @state: bus state to set
374 *
375 * Used by the SII3112 to handle bus isolation. As this is a
376 * SATA controller the work required is quite limited, we
377 * just have to clean up the statistics
378 */
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200379
380static int sil_sata_busproc(ide_drive_t * drive, int state)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700381{
382 ide_hwif_t *hwif = HWIF(drive);
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100383 struct pci_dev *dev = to_pci_dev(hwif->dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700384 u32 stat_config = 0;
385 unsigned long addr = siimage_selreg(hwif, 0);
386
Bartlomiej Zolnierkiewicz0ecdca22007-02-17 02:40:25 +0100387 if (hwif->mmio)
388 stat_config = readl((void __iomem *)addr);
389 else
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100390 pci_read_config_dword(dev, addr, &stat_config);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700391
392 switch (state) {
393 case BUSSTATE_ON:
394 hwif->drives[0].failures = 0;
395 hwif->drives[1].failures = 0;
396 break;
397 case BUSSTATE_OFF:
398 hwif->drives[0].failures = hwif->drives[0].max_failures + 1;
399 hwif->drives[1].failures = hwif->drives[1].max_failures + 1;
400 break;
401 case BUSSTATE_TRISTATE:
402 hwif->drives[0].failures = hwif->drives[0].max_failures + 1;
403 hwif->drives[1].failures = hwif->drives[1].max_failures + 1;
404 break;
405 default:
406 return -EINVAL;
407 }
408 hwif->bus_state = state;
409 return 0;
410}
411
412/**
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200413 * sil_sata_reset_poll - wait for SATA reset
Linus Torvalds1da177e2005-04-16 15:20:36 -0700414 * @drive: drive we are resetting
415 *
416 * Poll the SATA phy and see whether it has come back from the dead
417 * yet.
418 */
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200419
420static int sil_sata_reset_poll(ide_drive_t *drive)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700421{
422 if (SATA_STATUS_REG) {
423 ide_hwif_t *hwif = HWIF(drive);
424
Bartlomiej Zolnierkiewicz0ecdca22007-02-17 02:40:25 +0100425 /* SATA_STATUS_REG is valid only when in MMIO mode */
426 if ((readl((void __iomem *)SATA_STATUS_REG) & 0x03) != 0x03) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700427 printk(KERN_WARNING "%s: reset phy dead, status=0x%08x\n",
Bartlomiej Zolnierkiewicz0ecdca22007-02-17 02:40:25 +0100428 hwif->name, readl((void __iomem *)SATA_STATUS_REG));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700429 HWGROUP(drive)->polling = 0;
430 return ide_started;
431 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700432 }
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200433
434 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700435}
436
437/**
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200438 * sil_sata_pre_reset - reset hook
Linus Torvalds1da177e2005-04-16 15:20:36 -0700439 * @drive: IDE device being reset
440 *
441 * For the SATA devices we need to handle recalibration/geometry
442 * differently
443 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700444
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200445static void sil_sata_pre_reset(ide_drive_t *drive)
446{
447 if (drive->media == ide_disk) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700448 drive->special.b.set_geometry = 0;
449 drive->special.b.recalibrate = 0;
450 }
451}
452
453/**
Linus Torvalds1da177e2005-04-16 15:20:36 -0700454 * proc_reports_siimage - add siimage controller to proc
455 * @dev: PCI device
456 * @clocking: SCSC value
457 * @name: controller name
458 *
459 * Report the clocking mode of the controller and add it to
460 * the /proc interface layer
461 */
462
463static void proc_reports_siimage (struct pci_dev *dev, u8 clocking, const char *name)
464{
465 if (!pdev_is_sata(dev)) {
466 printk(KERN_INFO "%s: BASE CLOCK ", name);
467 clocking &= 0x03;
468 switch (clocking) {
469 case 0x03: printk("DISABLED!\n"); break;
470 case 0x02: printk("== 2X PCI\n"); break;
471 case 0x01: printk("== 133\n"); break;
472 case 0x00: printk("== 100\n"); break;
473 }
474 }
475}
476
477/**
478 * setup_mmio_siimage - switch an SI controller into MMIO
479 * @dev: PCI device we are configuring
480 * @name: device name
481 *
482 * Attempt to put the device into mmio mode. There are some slight
483 * complications here with certain systems where the mmio bar isnt
484 * mapped so we have to be sure we can fall back to I/O.
485 */
486
487static unsigned int setup_mmio_siimage (struct pci_dev *dev, const char *name)
488{
489 unsigned long bar5 = pci_resource_start(dev, 5);
490 unsigned long barsize = pci_resource_len(dev, 5);
491 u8 tmpbyte = 0;
492 void __iomem *ioaddr;
John W. Linvilled868dd12005-11-10 00:19:14 +0100493 u32 tmp, irq_mask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700494
495 /*
496 * Drop back to PIO if we can't map the mmio. Some
497 * systems seem to get terminally confused in the PCI
498 * spaces.
499 */
500
501 if(!request_mem_region(bar5, barsize, name))
502 {
503 printk(KERN_WARNING "siimage: IDE controller MMIO ports not available.\n");
504 return 0;
505 }
506
507 ioaddr = ioremap(bar5, barsize);
508
509 if (ioaddr == NULL)
510 {
511 release_mem_region(bar5, barsize);
512 return 0;
513 }
514
515 pci_set_master(dev);
516 pci_set_drvdata(dev, (void *) ioaddr);
517
518 if (pdev_is_sata(dev)) {
John W. Linvilled868dd12005-11-10 00:19:14 +0100519 /* make sure IDE0/1 interrupts are not masked */
520 irq_mask = (1 << 22) | (1 << 23);
521 tmp = readl(ioaddr + 0x48);
522 if (tmp & irq_mask) {
523 tmp &= ~irq_mask;
524 writel(tmp, ioaddr + 0x48);
525 readl(ioaddr + 0x48); /* flush */
526 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700527 writel(0, ioaddr + 0x148);
528 writel(0, ioaddr + 0x1C8);
529 }
530
531 writeb(0, ioaddr + 0xB4);
532 writeb(0, ioaddr + 0xF4);
533 tmpbyte = readb(ioaddr + 0x4A);
534
535 switch(tmpbyte & 0x30) {
536 case 0x00:
537 /* In 100 MHz clocking, try and switch to 133 */
538 writeb(tmpbyte|0x10, ioaddr + 0x4A);
539 break;
540 case 0x10:
541 /* On 133Mhz clocking */
542 break;
543 case 0x20:
544 /* On PCIx2 clocking */
545 break;
546 case 0x30:
547 /* Clocking is disabled */
548 /* 133 clock attempt to force it on */
549 writeb(tmpbyte & ~0x20, ioaddr + 0x4A);
550 break;
551 }
552
553 writeb( 0x72, ioaddr + 0xA1);
554 writew( 0x328A, ioaddr + 0xA2);
555 writel(0x62DD62DD, ioaddr + 0xA4);
556 writel(0x43924392, ioaddr + 0xA8);
557 writel(0x40094009, ioaddr + 0xAC);
558 writeb( 0x72, ioaddr + 0xE1);
559 writew( 0x328A, ioaddr + 0xE2);
560 writel(0x62DD62DD, ioaddr + 0xE4);
561 writel(0x43924392, ioaddr + 0xE8);
562 writel(0x40094009, ioaddr + 0xEC);
563
564 if (pdev_is_sata(dev)) {
565 writel(0xFFFF0000, ioaddr + 0x108);
566 writel(0xFFFF0000, ioaddr + 0x188);
567 writel(0x00680000, ioaddr + 0x148);
568 writel(0x00680000, ioaddr + 0x1C8);
569 }
570
571 tmpbyte = readb(ioaddr + 0x4A);
572
573 proc_reports_siimage(dev, (tmpbyte>>4), name);
574 return 1;
575}
576
577/**
578 * init_chipset_siimage - set up an SI device
579 * @dev: PCI device
580 * @name: device name
581 *
582 * Perform the initial PCI set up for this device. Attempt to switch
583 * to 133MHz clocking if the system isn't already set up to do it.
584 */
585
586static unsigned int __devinit init_chipset_siimage(struct pci_dev *dev, const char *name)
587{
Bartlomiej Zolnierkiewiczfc212bb2007-10-19 00:30:08 +0200588 u8 rev = dev->revision, tmpbyte = 0, BA5_EN = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700589
Bartlomiej Zolnierkiewiczfc212bb2007-10-19 00:30:08 +0200590 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, rev ? 1 : 255);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700591
592 pci_read_config_byte(dev, 0x8A, &BA5_EN);
593 if ((BA5_EN & 0x01) || (pci_resource_start(dev, 5))) {
594 if (setup_mmio_siimage(dev, name)) {
595 return 0;
596 }
597 }
598
599 pci_write_config_byte(dev, 0x80, 0x00);
600 pci_write_config_byte(dev, 0x84, 0x00);
601 pci_read_config_byte(dev, 0x8A, &tmpbyte);
602 switch(tmpbyte & 0x30) {
603 case 0x00:
604 /* 133 clock attempt to force it on */
605 pci_write_config_byte(dev, 0x8A, tmpbyte|0x10);
606 case 0x30:
607 /* if clocking is disabled */
608 /* 133 clock attempt to force it on */
609 pci_write_config_byte(dev, 0x8A, tmpbyte & ~0x20);
610 case 0x10:
611 /* 133 already */
612 break;
613 case 0x20:
614 /* BIOS set PCI x2 clocking */
615 break;
616 }
617
618 pci_read_config_byte(dev, 0x8A, &tmpbyte);
619
620 pci_write_config_byte(dev, 0xA1, 0x72);
621 pci_write_config_word(dev, 0xA2, 0x328A);
622 pci_write_config_dword(dev, 0xA4, 0x62DD62DD);
623 pci_write_config_dword(dev, 0xA8, 0x43924392);
624 pci_write_config_dword(dev, 0xAC, 0x40094009);
625 pci_write_config_byte(dev, 0xB1, 0x72);
626 pci_write_config_word(dev, 0xB2, 0x328A);
627 pci_write_config_dword(dev, 0xB4, 0x62DD62DD);
628 pci_write_config_dword(dev, 0xB8, 0x43924392);
629 pci_write_config_dword(dev, 0xBC, 0x40094009);
630
631 proc_reports_siimage(dev, (tmpbyte>>4), name);
632 return 0;
633}
634
635/**
636 * init_mmio_iops_siimage - set up the iops for MMIO
637 * @hwif: interface to set up
638 *
639 * The basic setup here is fairly simple, we can use standard MMIO
640 * operations. However we do have to set the taskfile register offsets
641 * by hand as there isnt a standard defined layout for them this
642 * time.
643 *
644 * The hardware supports buffered taskfiles and also some rather nice
Alan Cox19c1ef52006-06-28 04:26:59 -0700645 * extended PRD tables. For better SI3112 support use the libata driver
Linus Torvalds1da177e2005-04-16 15:20:36 -0700646 */
647
648static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif)
649{
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100650 struct pci_dev *dev = to_pci_dev(hwif->dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700651 void *addr = pci_get_drvdata(dev);
652 u8 ch = hwif->channel;
653 hw_regs_t hw;
654 unsigned long base;
655
656 /*
657 * Fill in the basic HWIF bits
658 */
659
660 default_hwif_mmiops(hwif);
661 hwif->hwif_data = addr;
662
663 /*
664 * Now set up the hw. We have to do this ourselves as
Michael Opdenacker59c51592007-05-09 08:57:56 +0200665 * the MMIO layout isnt the same as the standard port
Linus Torvalds1da177e2005-04-16 15:20:36 -0700666 * based I/O
667 */
668
669 memset(&hw, 0, sizeof(hw_regs_t));
670
671 base = (unsigned long)addr;
672 if (ch)
673 base += 0xC0;
674 else
675 base += 0x80;
676
677 /*
678 * The buffered task file doesn't have status/control
679 * so we can't currently use it sanely since we want to
680 * use LBA48 mode.
681 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700682 hw.io_ports[IDE_DATA_OFFSET] = base;
683 hw.io_ports[IDE_ERROR_OFFSET] = base + 1;
684 hw.io_ports[IDE_NSECTOR_OFFSET] = base + 2;
685 hw.io_ports[IDE_SECTOR_OFFSET] = base + 3;
686 hw.io_ports[IDE_LCYL_OFFSET] = base + 4;
687 hw.io_ports[IDE_HCYL_OFFSET] = base + 5;
688 hw.io_ports[IDE_SELECT_OFFSET] = base + 6;
689 hw.io_ports[IDE_STATUS_OFFSET] = base + 7;
690 hw.io_ports[IDE_CONTROL_OFFSET] = base + 10;
691
692 hw.io_ports[IDE_IRQ_OFFSET] = 0;
693
694 if (pdev_is_sata(dev)) {
695 base = (unsigned long)addr;
696 if (ch)
697 base += 0x80;
698 hwif->sata_scr[SATA_STATUS_OFFSET] = base + 0x104;
699 hwif->sata_scr[SATA_ERROR_OFFSET] = base + 0x108;
700 hwif->sata_scr[SATA_CONTROL_OFFSET] = base + 0x100;
701 hwif->sata_misc[SATA_MISC_OFFSET] = base + 0x140;
702 hwif->sata_misc[SATA_PHY_OFFSET] = base + 0x144;
703 hwif->sata_misc[SATA_IEN_OFFSET] = base + 0x148;
704 }
705
Bartlomiej Zolnierkiewicz9239b332007-10-20 00:32:33 +0200706 memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700707
Bartlomiej Zolnierkiewicz9239b332007-10-20 00:32:33 +0200708 hwif->irq = dev->irq;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700709
Bartlomiej Zolnierkiewicz9239b332007-10-20 00:32:33 +0200710 hwif->dma_base = (unsigned long)addr + (ch ? 0x08 : 0x00);
Bartlomiej Zolnierkiewicz2ad1e552007-02-17 02:40:25 +0100711
712 hwif->mmio = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700713}
714
715static int is_dev_seagate_sata(ide_drive_t *drive)
716{
717 const char *s = &drive->id->model[0];
718 unsigned len;
719
Linus Torvalds1da177e2005-04-16 15:20:36 -0700720 len = strnlen(s, sizeof(drive->id->model));
721
722 if ((len > 4) && (!memcmp(s, "ST", 2))) {
723 if ((!memcmp(s + len - 2, "AS", 2)) ||
724 (!memcmp(s + len - 3, "ASL", 3))) {
725 printk(KERN_INFO "%s: applying pessimistic Seagate "
726 "errata fix\n", drive->name);
727 return 1;
728 }
729 }
730 return 0;
731}
732
733/**
Bartlomiej Zolnierkiewiczf01393e2008-01-26 20:13:03 +0100734 * sil_quirkproc - post probe fixups
735 * @drive: drive
Linus Torvalds1da177e2005-04-16 15:20:36 -0700736 *
737 * Called after drive probe we use this to decide whether the
738 * Seagate fixup must be applied. This used to be in init_iops but
739 * that can occur before we know what drives are present.
740 */
741
Bartlomiej Zolnierkiewiczf01393e2008-01-26 20:13:03 +0100742static void __devinit sil_quirkproc(ide_drive_t *drive)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700743{
Bartlomiej Zolnierkiewiczf01393e2008-01-26 20:13:03 +0100744 ide_hwif_t *hwif = drive->hwif;
745
Linus Torvalds1da177e2005-04-16 15:20:36 -0700746 /* Try and raise the rqsize */
Bartlomiej Zolnierkiewiczf01393e2008-01-26 20:13:03 +0100747 if (!is_sata(hwif) || !is_dev_seagate_sata(drive))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700748 hwif->rqsize = 128;
749}
750
751/**
752 * init_iops_siimage - set up iops
753 * @hwif: interface to set up
754 *
755 * Do the basic setup for the SIIMAGE hardware interface
756 * and then do the MMIO setup if we can. This is the first
757 * look in we get for setting up the hwif so that we
758 * can get the iops right before using them.
759 */
760
761static void __devinit init_iops_siimage(ide_hwif_t *hwif)
762{
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100763 struct pci_dev *dev = to_pci_dev(hwif->dev);
764
Linus Torvalds1da177e2005-04-16 15:20:36 -0700765 hwif->hwif_data = NULL;
766
767 /* Pessimal until we finish probing */
768 hwif->rqsize = 15;
769
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100770 if (pci_get_drvdata(dev) == NULL)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700771 return;
Bartlomiej Zolnierkiewiczfc212bb2007-10-19 00:30:08 +0200772
Linus Torvalds1da177e2005-04-16 15:20:36 -0700773 init_mmio_iops_siimage(hwif);
774}
775
776/**
777 * ata66_siimage - check for 80 pin cable
778 * @hwif: interface to check
779 *
780 * Check for the presence of an ATA66 capable cable on the
781 * interface.
782 */
783
Bartlomiej Zolnierkiewicz49521f92007-07-09 23:17:58 +0200784static u8 __devinit ata66_siimage(ide_hwif_t *hwif)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700785{
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100786 struct pci_dev *dev = to_pci_dev(hwif->dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700787 unsigned long addr = siimage_selreg(hwif, 0);
Bartlomiej Zolnierkiewicz49521f92007-07-09 23:17:58 +0200788 u8 ata66 = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700789
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100790 if (pci_get_drvdata(dev) == NULL)
791 pci_read_config_byte(dev, addr, &ata66);
Bartlomiej Zolnierkiewicz49521f92007-07-09 23:17:58 +0200792 else
793 ata66 = hwif->INB(addr);
794
795 return (ata66 & 0x01) ? ATA_CBL_PATA80 : ATA_CBL_PATA40;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700796}
797
798/**
799 * init_hwif_siimage - set up hwif structs
800 * @hwif: interface to set up
801 *
802 * We do the basic set up of the interface structure. The SIIMAGE
803 * requires several custom handlers so we override the default
804 * ide DMA handlers appropriately
805 */
806
807static void __devinit init_hwif_siimage(ide_hwif_t *hwif)
808{
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200809 u8 sata = is_sata(hwif);
810
Bartlomiej Zolnierkiewicz26bcb872007-10-11 23:54:00 +0200811 hwif->set_pio_mode = &sil_set_pio_mode;
Bartlomiej Zolnierkiewicz88b2b322007-10-13 17:47:51 +0200812 hwif->set_dma_mode = &sil_set_dma_mode;
Bartlomiej Zolnierkiewiczf01393e2008-01-26 20:13:03 +0100813 hwif->quirkproc = &sil_quirkproc;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700814
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200815 if (sata) {
Alan Cox19c1ef52006-06-28 04:26:59 -0700816 static int first = 1;
817
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200818 hwif->busproc = &sil_sata_busproc;
819 hwif->reset_poll = &sil_sata_reset_poll;
820 hwif->pre_reset = &sil_sata_pre_reset;
821 hwif->udma_filter = &sil_sata_udma_filter;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700822
Alan Cox19c1ef52006-06-28 04:26:59 -0700823 if (first) {
824 printk(KERN_INFO "siimage: For full SATA support you should use the libata sata_sil module.\n");
825 first = 0;
826 }
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200827 } else
828 hwif->udma_filter = &sil_pata_udma_filter;
Bartlomiej Zolnierkiewicz328dcbb2007-07-20 01:11:54 +0200829
Bartlomiej Zolnierkiewicz328dcbb2007-07-20 01:11:54 +0200830 if (hwif->dma_base == 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700831 return;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700832
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200833 if (sata)
Bartlomiej Zolnierkiewicz33c10022007-10-19 00:30:06 +0200834 hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700835
Bartlomiej Zolnierkiewicz49521f92007-07-09 23:17:58 +0200836 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
837 hwif->cbl = ata66_siimage(hwif);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700838
839 if (hwif->mmio) {
840 hwif->ide_dma_test_irq = &siimage_mmio_ide_dma_test_irq;
841 } else {
842 hwif->ide_dma_test_irq = & siimage_io_ide_dma_test_irq;
843 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700844}
845
846#define DECLARE_SII_DEV(name_str) \
847 { \
848 .name = name_str, \
849 .init_chipset = init_chipset_siimage, \
850 .init_iops = init_iops_siimage, \
851 .init_hwif = init_hwif_siimage, \
Bartlomiej Zolnierkiewicz7cab14a2007-10-19 00:30:06 +0200852 .host_flags = IDE_HFLAG_BOOTABLE, \
Bartlomiej Zolnierkiewicz4099d142007-07-20 01:11:59 +0200853 .pio_mask = ATA_PIO4, \
Bartlomiej Zolnierkiewicz5f8b6c32007-10-19 00:30:07 +0200854 .mwdma_mask = ATA_MWDMA2, \
855 .udma_mask = ATA_UDMA6, \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700856 }
857
Bartlomiej Zolnierkiewicz85620432007-10-20 00:32:34 +0200858static const struct ide_port_info siimage_chipsets[] __devinitdata = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700859 /* 0 */ DECLARE_SII_DEV("SiI680"),
860 /* 1 */ DECLARE_SII_DEV("SiI3112 Serial ATA"),
861 /* 2 */ DECLARE_SII_DEV("Adaptec AAR-1210SA")
862};
863
864/**
865 * siimage_init_one - pci layer discovery entry
866 * @dev: PCI device
867 * @id: ident table entry
868 *
869 * Called by the PCI code when it finds an SI680 or SI3112 controller.
870 * We then use the IDE PCI generic helper to do most of the work.
871 */
872
873static int __devinit siimage_init_one(struct pci_dev *dev, const struct pci_device_id *id)
874{
875 return ide_setup_pci_device(dev, &siimage_chipsets[id->driver_data]);
876}
877
Bartlomiej Zolnierkiewicz9cbcc5e2007-10-16 22:29:56 +0200878static const struct pci_device_id siimage_pci_tbl[] = {
879 { PCI_VDEVICE(CMD, PCI_DEVICE_ID_SII_680), 0 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700880#ifdef CONFIG_BLK_DEV_IDE_SATA
Bartlomiej Zolnierkiewicz9cbcc5e2007-10-16 22:29:56 +0200881 { PCI_VDEVICE(CMD, PCI_DEVICE_ID_SII_3112), 1 },
882 { PCI_VDEVICE(CMD, PCI_DEVICE_ID_SII_1210SA), 2 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700883#endif
884 { 0, },
885};
886MODULE_DEVICE_TABLE(pci, siimage_pci_tbl);
887
888static struct pci_driver driver = {
889 .name = "SiI_IDE",
890 .id_table = siimage_pci_tbl,
891 .probe = siimage_init_one,
892};
893
Bartlomiej Zolnierkiewicz82ab1ee2007-01-27 13:46:56 +0100894static int __init siimage_ide_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700895{
896 return ide_pci_register_driver(&driver);
897}
898
899module_init(siimage_ide_init);
900
901MODULE_AUTHOR("Andre Hedrick, Alan Cox");
902MODULE_DESCRIPTION("PCI driver module for SiI IDE");
903MODULE_LICENSE("GPL");