blob: 391eea88c7605a8172e200a5e2d729ddb8827076 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Sergei Shtylyov8ac98ce2007-11-27 21:35:53 +01002 * linux/drivers/ide/pci/siimage.c Version 1.19 Nov 16 2007
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 *
4 * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2003 Red Hat <alan@redhat.com>
Sergei Shtylyov075cb652007-02-17 02:40:22 +01006 * Copyright (C) 2007 MontaVista Software, Inc.
Bartlomiej Zolnierkiewicz328dcbb2007-07-20 01:11:54 +02007 * Copyright (C) 2007 Bartlomiej Zolnierkiewicz
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 *
9 * May be copied or modified under the terms of the GNU General Public License
10 *
Jeff Garzikbf4c7962005-11-18 22:55:47 +010011 * Documentation for CMD680:
12 * http://gkernel.sourceforge.net/specs/sii/sii-0680a-v1.31.pdf.bz2
13 *
14 * Documentation for SiI 3112:
15 * http://gkernel.sourceforge.net/specs/sii/3112A_SiI-DS-0095-B2.pdf.bz2
16 *
17 * Errata and other documentation only available under NDA.
Linus Torvalds1da177e2005-04-16 15:20:36 -070018 *
19 *
20 * FAQ Items:
21 * If you are using Marvell SATA-IDE adapters with Maxtor drives
22 * ensure the system is set up for ATA100/UDMA5 not UDMA6.
23 *
24 * If you are using WD drives with SATA bridges you must set the
25 * drive to "Single". "Master" will hang
26 *
27 * If you have strange problems with nVidia chipset systems please
28 * see the SI support documentation and update your system BIOS
Robert P. J. Day3a4fa0a2007-10-19 23:10:43 +020029 * if necessary
Alan Cox8693d3e2007-03-03 17:48:54 +010030 *
31 * The Dell DRAC4 has some interesting features including effectively hot
32 * unplugging/replugging the virtual CD interface when the DRAC is reset.
33 * This often causes drivers/ide/siimage to panic but is ok with the rather
34 * smarter code in libata.
Bartlomiej Zolnierkiewicz328dcbb2007-07-20 01:11:54 +020035 *
36 * TODO:
37 * - IORDY fixes
38 * - VDMA support
Linus Torvalds1da177e2005-04-16 15:20:36 -070039 */
40
Linus Torvalds1da177e2005-04-16 15:20:36 -070041#include <linux/types.h>
42#include <linux/module.h>
43#include <linux/pci.h>
44#include <linux/delay.h>
45#include <linux/hdreg.h>
46#include <linux/ide.h>
47#include <linux/init.h>
48
49#include <asm/io.h>
50
Linus Torvalds1da177e2005-04-16 15:20:36 -070051/**
52 * pdev_is_sata - check if device is SATA
53 * @pdev: PCI device to check
54 *
55 * Returns true if this is a SATA controller
56 */
57
58static int pdev_is_sata(struct pci_dev *pdev)
59{
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +020060#ifdef CONFIG_BLK_DEV_IDE_SATA
61 switch(pdev->device) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070062 case PCI_DEVICE_ID_SII_3112:
63 case PCI_DEVICE_ID_SII_1210SA:
64 return 1;
65 case PCI_DEVICE_ID_SII_680:
66 return 0;
67 }
68 BUG();
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +020069#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070070 return 0;
71}
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +020072
Linus Torvalds1da177e2005-04-16 15:20:36 -070073/**
74 * is_sata - check if hwif is SATA
75 * @hwif: interface to check
76 *
77 * Returns true if this is a SATA controller
78 */
79
80static inline int is_sata(ide_hwif_t *hwif)
81{
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +010082 return pdev_is_sata(to_pci_dev(hwif->dev));
Linus Torvalds1da177e2005-04-16 15:20:36 -070083}
84
85/**
86 * siimage_selreg - return register base
87 * @hwif: interface
88 * @r: config offset
89 *
90 * Turn a config register offset into the right address in either
91 * PCI space or MMIO space to access the control register in question
92 * Thankfully this is a configuration operation so isnt performance
93 * criticial.
94 */
95
96static unsigned long siimage_selreg(ide_hwif_t *hwif, int r)
97{
98 unsigned long base = (unsigned long)hwif->hwif_data;
99 base += 0xA0 + r;
100 if(hwif->mmio)
101 base += (hwif->channel << 6);
102 else
103 base += (hwif->channel << 4);
104 return base;
105}
106
107/**
108 * siimage_seldev - return register base
109 * @hwif: interface
110 * @r: config offset
111 *
112 * Turn a config register offset into the right address in either
113 * PCI space or MMIO space to access the control register in question
114 * including accounting for the unit shift.
115 */
116
117static inline unsigned long siimage_seldev(ide_drive_t *drive, int r)
118{
119 ide_hwif_t *hwif = HWIF(drive);
120 unsigned long base = (unsigned long)hwif->hwif_data;
121 base += 0xA0 + r;
122 if(hwif->mmio)
123 base += (hwif->channel << 6);
124 else
125 base += (hwif->channel << 4);
126 base |= drive->select.b.unit << drive->select.b.unit;
127 return base;
128}
129
130/**
Bartlomiej Zolnierkiewicz2d5eaa62007-05-10 00:01:08 +0200131 * sil_udma_filter - compute UDMA mask
132 * @drive: IDE device
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133 *
Bartlomiej Zolnierkiewicz2d5eaa62007-05-10 00:01:08 +0200134 * Compute the available UDMA speeds for the device on the interface.
135 *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700136 * For the CMD680 this depends on the clocking mode (scsc), for the
Bartlomiej Zolnierkiewicz2d5eaa62007-05-10 00:01:08 +0200137 * SI3112 SATA controller life is a bit simpler.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138 */
Bartlomiej Zolnierkiewicz2d5eaa62007-05-10 00:01:08 +0200139
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200140static u8 sil_pata_udma_filter(ide_drive_t *drive)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141{
Bartlomiej Zolnierkiewicz2d5eaa62007-05-10 00:01:08 +0200142 ide_hwif_t *hwif = drive->hwif;
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100143 struct pci_dev *dev = to_pci_dev(hwif->dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144 unsigned long base = (unsigned long) hwif->hwif_data;
Bartlomiej Zolnierkiewicz2d5eaa62007-05-10 00:01:08 +0200145 u8 mask = 0, scsc = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146
147 if (hwif->mmio)
148 scsc = hwif->INB(base + 0x4A);
149 else
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100150 pci_read_config_byte(dev, 0x8A, &scsc);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152 if ((scsc & 0x30) == 0x10) /* 133 */
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200153 mask = ATA_UDMA6;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154 else if ((scsc & 0x30) == 0x20) /* 2xPCI */
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200155 mask = ATA_UDMA6;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156 else if ((scsc & 0x30) == 0x00) /* 100 */
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200157 mask = ATA_UDMA5;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700158 else /* Disabled ? */
159 BUG();
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200160
Bartlomiej Zolnierkiewicz2d5eaa62007-05-10 00:01:08 +0200161 return mask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700162}
163
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200164static u8 sil_sata_udma_filter(ide_drive_t *drive)
165{
166 return strstr(drive->id->model, "Maxtor") ? ATA_UDMA5 : ATA_UDMA6;
167}
168
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169/**
Bartlomiej Zolnierkiewicz88b2b322007-10-13 17:47:51 +0200170 * sil_set_pio_mode - set host controller for PIO mode
171 * @drive: drive
172 * @pio: PIO mode number
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173 *
174 * Load the timing settings for this device mode into the
175 * controller. If we are in PIO mode 3 or 4 turn on IORDY
176 * monitoring (bit 9). The TF timing is bits 31:16
177 */
Bartlomiej Zolnierkiewicz328dcbb2007-07-20 01:11:54 +0200178
Bartlomiej Zolnierkiewicz88b2b322007-10-13 17:47:51 +0200179static void sil_set_pio_mode(ide_drive_t *drive, u8 pio)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700180{
Bartlomiej Zolnierkiewicz328dcbb2007-07-20 01:11:54 +0200181 const u16 tf_speed[] = { 0x328a, 0x2283, 0x1281, 0x10c3, 0x10c1 };
182 const u16 data_speed[] = { 0x328a, 0x2283, 0x1104, 0x10c3, 0x10c1 };
183
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184 ide_hwif_t *hwif = HWIF(drive);
Benjamin Herrenschmidta87a87c2007-10-19 00:30:05 +0200185 ide_drive_t *pair = ide_get_paired_drive(drive);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700186 u32 speedt = 0;
187 u16 speedp = 0;
188 unsigned long addr = siimage_seldev(drive, 0x04);
189 unsigned long tfaddr = siimage_selreg(hwif, 0x02);
Bartlomiej Zolnierkiewiczffe54152007-10-11 23:54:01 +0200190 unsigned long base = (unsigned long)hwif->hwif_data;
Bartlomiej Zolnierkiewicz328dcbb2007-07-20 01:11:54 +0200191 u8 tf_pio = pio;
Bartlomiej Zolnierkiewiczffe54152007-10-11 23:54:01 +0200192 u8 addr_mask = hwif->channel ? (hwif->mmio ? 0xF4 : 0x84)
193 : (hwif->mmio ? 0xB4 : 0x80);
194 u8 mode = 0;
195 u8 unit = drive->select.b.unit;
Bartlomiej Zolnierkiewicz328dcbb2007-07-20 01:11:54 +0200196
197 /* trim *taskfile* PIO to the slowest of the master/slave */
198 if (pair->present) {
Bartlomiej Zolnierkiewicz21347582007-07-20 01:11:58 +0200199 u8 pair_pio = ide_get_best_pio_mode(pair, 255, 4);
Bartlomiej Zolnierkiewicz328dcbb2007-07-20 01:11:54 +0200200
201 if (pair_pio < tf_pio)
202 tf_pio = pair_pio;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700203 }
Sergei Shtylyov075cb652007-02-17 02:40:22 +0100204
Bartlomiej Zolnierkiewicz328dcbb2007-07-20 01:11:54 +0200205 /* cheat for now and use the docs */
206 speedp = data_speed[pio];
207 speedt = tf_speed[tf_pio];
208
Sergei Shtylyov075cb652007-02-17 02:40:22 +0100209 if (hwif->mmio) {
210 hwif->OUTW(speedp, addr);
211 hwif->OUTW(speedt, tfaddr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212 /* Now set up IORDY */
Bartlomiej Zolnierkiewicz328dcbb2007-07-20 01:11:54 +0200213 if (pio > 2)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214 hwif->OUTW(hwif->INW(tfaddr-2)|0x200, tfaddr-2);
215 else
216 hwif->OUTW(hwif->INW(tfaddr-2)&~0x200, tfaddr-2);
Bartlomiej Zolnierkiewiczffe54152007-10-11 23:54:01 +0200217
218 mode = hwif->INB(base + addr_mask);
219 mode &= ~(unit ? 0x30 : 0x03);
220 mode |= (unit ? 0x10 : 0x01);
221 hwif->OUTB(mode, base + addr_mask);
Sergei Shtylyov075cb652007-02-17 02:40:22 +0100222 } else {
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100223 struct pci_dev *dev = to_pci_dev(hwif->dev);
224
225 pci_write_config_word(dev, addr, speedp);
226 pci_write_config_word(dev, tfaddr, speedt);
227 pci_read_config_word(dev, tfaddr - 2, &speedp);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700228 speedp &= ~0x200;
229 /* Set IORDY for mode 3 or 4 */
Bartlomiej Zolnierkiewicz328dcbb2007-07-20 01:11:54 +0200230 if (pio > 2)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700231 speedp |= 0x200;
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100232 pci_write_config_word(dev, tfaddr - 2, speedp);
Bartlomiej Zolnierkiewiczffe54152007-10-11 23:54:01 +0200233
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100234 pci_read_config_byte(dev, addr_mask, &mode);
Bartlomiej Zolnierkiewiczffe54152007-10-11 23:54:01 +0200235 mode &= ~(unit ? 0x30 : 0x03);
236 mode |= (unit ? 0x10 : 0x01);
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100237 pci_write_config_byte(dev, addr_mask, mode);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238 }
239}
240
Linus Torvalds1da177e2005-04-16 15:20:36 -0700241/**
Bartlomiej Zolnierkiewicz88b2b322007-10-13 17:47:51 +0200242 * sil_set_dma_mode - set host controller for DMA mode
243 * @drive: drive
244 * @speed: DMA mode
Linus Torvalds1da177e2005-04-16 15:20:36 -0700245 *
Bartlomiej Zolnierkiewicz88b2b322007-10-13 17:47:51 +0200246 * Tune the SiI chipset for the desired DMA mode.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700247 */
Bartlomiej Zolnierkiewiczf212ff22007-10-11 23:53:59 +0200248
Bartlomiej Zolnierkiewicz88b2b322007-10-13 17:47:51 +0200249static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700250{
251 u8 ultra6[] = { 0x0F, 0x0B, 0x07, 0x05, 0x03, 0x02, 0x01 };
252 u8 ultra5[] = { 0x0C, 0x07, 0x05, 0x04, 0x02, 0x01 };
253 u16 dma[] = { 0x2208, 0x10C2, 0x10C1 };
254
255 ide_hwif_t *hwif = HWIF(drive);
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100256 struct pci_dev *dev = to_pci_dev(hwif->dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700257 u16 ultra = 0, multi = 0;
258 u8 mode = 0, unit = drive->select.b.unit;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700259 unsigned long base = (unsigned long)hwif->hwif_data;
260 u8 scsc = 0, addr_mask = ((hwif->channel) ?
261 ((hwif->mmio) ? 0xF4 : 0x84) :
262 ((hwif->mmio) ? 0xB4 : 0x80));
263
264 unsigned long ma = siimage_seldev(drive, 0x08);
265 unsigned long ua = siimage_seldev(drive, 0x0C);
266
267 if (hwif->mmio) {
268 scsc = hwif->INB(base + 0x4A);
269 mode = hwif->INB(base + addr_mask);
270 multi = hwif->INW(ma);
271 ultra = hwif->INW(ua);
272 } else {
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100273 pci_read_config_byte(dev, 0x8A, &scsc);
274 pci_read_config_byte(dev, addr_mask, &mode);
275 pci_read_config_word(dev, ma, &multi);
276 pci_read_config_word(dev, ua, &ultra);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700277 }
278
279 mode &= ~((unit) ? 0x30 : 0x03);
280 ultra &= ~0x3F;
281 scsc = ((scsc & 0x30) == 0x00) ? 0 : 1;
282
283 scsc = is_sata(hwif) ? 1 : scsc;
284
Bartlomiej Zolnierkiewicz4db90a12008-01-25 22:17:18 +0100285 if (speed >= XFER_UDMA_0) {
286 multi = dma[2];
287 ultra |= (scsc ? ultra6[speed - XFER_UDMA_0] :
288 ultra5[speed - XFER_UDMA_0]);
289 mode |= (unit ? 0x30 : 0x03);
290 } else {
291 multi = dma[speed - XFER_MW_DMA_0];
292 mode |= (unit ? 0x20 : 0x02);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700293 }
294
295 if (hwif->mmio) {
296 hwif->OUTB(mode, base + addr_mask);
297 hwif->OUTW(multi, ma);
298 hwif->OUTW(ultra, ua);
299 } else {
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100300 pci_write_config_byte(dev, addr_mask, mode);
301 pci_write_config_word(dev, ma, multi);
302 pci_write_config_word(dev, ua, ultra);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700303 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700304}
305
Linus Torvalds1da177e2005-04-16 15:20:36 -0700306/* returns 1 if dma irq issued, 0 otherwise */
307static int siimage_io_ide_dma_test_irq (ide_drive_t *drive)
308{
309 ide_hwif_t *hwif = HWIF(drive);
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100310 struct pci_dev *dev = to_pci_dev(hwif->dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700311 u8 dma_altstat = 0;
312 unsigned long addr = siimage_selreg(hwif, 1);
313
314 /* return 1 if INTR asserted */
315 if ((hwif->INB(hwif->dma_status) & 4) == 4)
316 return 1;
317
318 /* return 1 if Device INTR asserted */
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100319 pci_read_config_byte(dev, addr, &dma_altstat);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700320 if (dma_altstat & 8)
321 return 0; //return 1;
322 return 0;
323}
324
Linus Torvalds1da177e2005-04-16 15:20:36 -0700325/**
326 * siimage_mmio_ide_dma_test_irq - check we caused an IRQ
327 * @drive: drive we are testing
328 *
329 * Check if we caused an IDE DMA interrupt. We may also have caused
330 * SATA status interrupts, if so we clean them up and continue.
331 */
332
333static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive)
334{
335 ide_hwif_t *hwif = HWIF(drive);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700336 unsigned long addr = siimage_selreg(hwif, 0x1);
337
338 if (SATA_ERROR_REG) {
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200339 unsigned long base = (unsigned long)hwif->hwif_data;
340
Bartlomiej Zolnierkiewicz0ecdca22007-02-17 02:40:25 +0100341 u32 ext_stat = readl((void __iomem *)(base + 0x10));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700342 u8 watchdog = 0;
343 if (ext_stat & ((hwif->channel) ? 0x40 : 0x10)) {
Bartlomiej Zolnierkiewicz0ecdca22007-02-17 02:40:25 +0100344 u32 sata_error = readl((void __iomem *)SATA_ERROR_REG);
345 writel(sata_error, (void __iomem *)SATA_ERROR_REG);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700346 watchdog = (sata_error & 0x00680000) ? 1 : 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700347 printk(KERN_WARNING "%s: sata_error = 0x%08x, "
348 "watchdog = %d, %s\n",
349 drive->name, sata_error, watchdog,
350 __FUNCTION__);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700351
352 } else {
353 watchdog = (ext_stat & 0x8000) ? 1 : 0;
354 }
355 ext_stat >>= 16;
356
357 if (!(ext_stat & 0x0404) && !watchdog)
358 return 0;
359 }
360
361 /* return 1 if INTR asserted */
Bartlomiej Zolnierkiewicz0ecdca22007-02-17 02:40:25 +0100362 if ((readb((void __iomem *)hwif->dma_status) & 0x04) == 0x04)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700363 return 1;
364
365 /* return 1 if Device INTR asserted */
Bartlomiej Zolnierkiewicz0ecdca22007-02-17 02:40:25 +0100366 if ((readb((void __iomem *)addr) & 8) == 8)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700367 return 0; //return 1;
368
369 return 0;
370}
371
372/**
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200373 * sil_sata_busproc - bus isolation IOCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700374 * @drive: drive to isolate/restore
375 * @state: bus state to set
376 *
377 * Used by the SII3112 to handle bus isolation. As this is a
378 * SATA controller the work required is quite limited, we
379 * just have to clean up the statistics
380 */
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200381
382static int sil_sata_busproc(ide_drive_t * drive, int state)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700383{
384 ide_hwif_t *hwif = HWIF(drive);
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100385 struct pci_dev *dev = to_pci_dev(hwif->dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700386 u32 stat_config = 0;
387 unsigned long addr = siimage_selreg(hwif, 0);
388
Bartlomiej Zolnierkiewicz0ecdca22007-02-17 02:40:25 +0100389 if (hwif->mmio)
390 stat_config = readl((void __iomem *)addr);
391 else
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100392 pci_read_config_dword(dev, addr, &stat_config);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700393
394 switch (state) {
395 case BUSSTATE_ON:
396 hwif->drives[0].failures = 0;
397 hwif->drives[1].failures = 0;
398 break;
399 case BUSSTATE_OFF:
400 hwif->drives[0].failures = hwif->drives[0].max_failures + 1;
401 hwif->drives[1].failures = hwif->drives[1].max_failures + 1;
402 break;
403 case BUSSTATE_TRISTATE:
404 hwif->drives[0].failures = hwif->drives[0].max_failures + 1;
405 hwif->drives[1].failures = hwif->drives[1].max_failures + 1;
406 break;
407 default:
408 return -EINVAL;
409 }
410 hwif->bus_state = state;
411 return 0;
412}
413
414/**
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200415 * sil_sata_reset_poll - wait for SATA reset
Linus Torvalds1da177e2005-04-16 15:20:36 -0700416 * @drive: drive we are resetting
417 *
418 * Poll the SATA phy and see whether it has come back from the dead
419 * yet.
420 */
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200421
422static int sil_sata_reset_poll(ide_drive_t *drive)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700423{
424 if (SATA_STATUS_REG) {
425 ide_hwif_t *hwif = HWIF(drive);
426
Bartlomiej Zolnierkiewicz0ecdca22007-02-17 02:40:25 +0100427 /* SATA_STATUS_REG is valid only when in MMIO mode */
428 if ((readl((void __iomem *)SATA_STATUS_REG) & 0x03) != 0x03) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700429 printk(KERN_WARNING "%s: reset phy dead, status=0x%08x\n",
Bartlomiej Zolnierkiewicz0ecdca22007-02-17 02:40:25 +0100430 hwif->name, readl((void __iomem *)SATA_STATUS_REG));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700431 HWGROUP(drive)->polling = 0;
432 return ide_started;
433 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700434 }
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200435
436 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700437}
438
439/**
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200440 * sil_sata_pre_reset - reset hook
Linus Torvalds1da177e2005-04-16 15:20:36 -0700441 * @drive: IDE device being reset
442 *
443 * For the SATA devices we need to handle recalibration/geometry
444 * differently
445 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700446
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200447static void sil_sata_pre_reset(ide_drive_t *drive)
448{
449 if (drive->media == ide_disk) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700450 drive->special.b.set_geometry = 0;
451 drive->special.b.recalibrate = 0;
452 }
453}
454
455/**
Linus Torvalds1da177e2005-04-16 15:20:36 -0700456 * proc_reports_siimage - add siimage controller to proc
457 * @dev: PCI device
458 * @clocking: SCSC value
459 * @name: controller name
460 *
461 * Report the clocking mode of the controller and add it to
462 * the /proc interface layer
463 */
464
465static void proc_reports_siimage (struct pci_dev *dev, u8 clocking, const char *name)
466{
467 if (!pdev_is_sata(dev)) {
468 printk(KERN_INFO "%s: BASE CLOCK ", name);
469 clocking &= 0x03;
470 switch (clocking) {
471 case 0x03: printk("DISABLED!\n"); break;
472 case 0x02: printk("== 2X PCI\n"); break;
473 case 0x01: printk("== 133\n"); break;
474 case 0x00: printk("== 100\n"); break;
475 }
476 }
477}
478
479/**
480 * setup_mmio_siimage - switch an SI controller into MMIO
481 * @dev: PCI device we are configuring
482 * @name: device name
483 *
484 * Attempt to put the device into mmio mode. There are some slight
485 * complications here with certain systems where the mmio bar isnt
486 * mapped so we have to be sure we can fall back to I/O.
487 */
488
489static unsigned int setup_mmio_siimage (struct pci_dev *dev, const char *name)
490{
491 unsigned long bar5 = pci_resource_start(dev, 5);
492 unsigned long barsize = pci_resource_len(dev, 5);
493 u8 tmpbyte = 0;
494 void __iomem *ioaddr;
John W. Linvilled868dd12005-11-10 00:19:14 +0100495 u32 tmp, irq_mask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700496
497 /*
498 * Drop back to PIO if we can't map the mmio. Some
499 * systems seem to get terminally confused in the PCI
500 * spaces.
501 */
502
503 if(!request_mem_region(bar5, barsize, name))
504 {
505 printk(KERN_WARNING "siimage: IDE controller MMIO ports not available.\n");
506 return 0;
507 }
508
509 ioaddr = ioremap(bar5, barsize);
510
511 if (ioaddr == NULL)
512 {
513 release_mem_region(bar5, barsize);
514 return 0;
515 }
516
517 pci_set_master(dev);
518 pci_set_drvdata(dev, (void *) ioaddr);
519
520 if (pdev_is_sata(dev)) {
John W. Linvilled868dd12005-11-10 00:19:14 +0100521 /* make sure IDE0/1 interrupts are not masked */
522 irq_mask = (1 << 22) | (1 << 23);
523 tmp = readl(ioaddr + 0x48);
524 if (tmp & irq_mask) {
525 tmp &= ~irq_mask;
526 writel(tmp, ioaddr + 0x48);
527 readl(ioaddr + 0x48); /* flush */
528 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700529 writel(0, ioaddr + 0x148);
530 writel(0, ioaddr + 0x1C8);
531 }
532
533 writeb(0, ioaddr + 0xB4);
534 writeb(0, ioaddr + 0xF4);
535 tmpbyte = readb(ioaddr + 0x4A);
536
537 switch(tmpbyte & 0x30) {
538 case 0x00:
539 /* In 100 MHz clocking, try and switch to 133 */
540 writeb(tmpbyte|0x10, ioaddr + 0x4A);
541 break;
542 case 0x10:
543 /* On 133Mhz clocking */
544 break;
545 case 0x20:
546 /* On PCIx2 clocking */
547 break;
548 case 0x30:
549 /* Clocking is disabled */
550 /* 133 clock attempt to force it on */
551 writeb(tmpbyte & ~0x20, ioaddr + 0x4A);
552 break;
553 }
554
555 writeb( 0x72, ioaddr + 0xA1);
556 writew( 0x328A, ioaddr + 0xA2);
557 writel(0x62DD62DD, ioaddr + 0xA4);
558 writel(0x43924392, ioaddr + 0xA8);
559 writel(0x40094009, ioaddr + 0xAC);
560 writeb( 0x72, ioaddr + 0xE1);
561 writew( 0x328A, ioaddr + 0xE2);
562 writel(0x62DD62DD, ioaddr + 0xE4);
563 writel(0x43924392, ioaddr + 0xE8);
564 writel(0x40094009, ioaddr + 0xEC);
565
566 if (pdev_is_sata(dev)) {
567 writel(0xFFFF0000, ioaddr + 0x108);
568 writel(0xFFFF0000, ioaddr + 0x188);
569 writel(0x00680000, ioaddr + 0x148);
570 writel(0x00680000, ioaddr + 0x1C8);
571 }
572
573 tmpbyte = readb(ioaddr + 0x4A);
574
575 proc_reports_siimage(dev, (tmpbyte>>4), name);
576 return 1;
577}
578
579/**
580 * init_chipset_siimage - set up an SI device
581 * @dev: PCI device
582 * @name: device name
583 *
584 * Perform the initial PCI set up for this device. Attempt to switch
585 * to 133MHz clocking if the system isn't already set up to do it.
586 */
587
588static unsigned int __devinit init_chipset_siimage(struct pci_dev *dev, const char *name)
589{
Bartlomiej Zolnierkiewiczfc212bb2007-10-19 00:30:08 +0200590 u8 rev = dev->revision, tmpbyte = 0, BA5_EN = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700591
Bartlomiej Zolnierkiewiczfc212bb2007-10-19 00:30:08 +0200592 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, rev ? 1 : 255);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700593
594 pci_read_config_byte(dev, 0x8A, &BA5_EN);
595 if ((BA5_EN & 0x01) || (pci_resource_start(dev, 5))) {
596 if (setup_mmio_siimage(dev, name)) {
597 return 0;
598 }
599 }
600
601 pci_write_config_byte(dev, 0x80, 0x00);
602 pci_write_config_byte(dev, 0x84, 0x00);
603 pci_read_config_byte(dev, 0x8A, &tmpbyte);
604 switch(tmpbyte & 0x30) {
605 case 0x00:
606 /* 133 clock attempt to force it on */
607 pci_write_config_byte(dev, 0x8A, tmpbyte|0x10);
608 case 0x30:
609 /* if clocking is disabled */
610 /* 133 clock attempt to force it on */
611 pci_write_config_byte(dev, 0x8A, tmpbyte & ~0x20);
612 case 0x10:
613 /* 133 already */
614 break;
615 case 0x20:
616 /* BIOS set PCI x2 clocking */
617 break;
618 }
619
620 pci_read_config_byte(dev, 0x8A, &tmpbyte);
621
622 pci_write_config_byte(dev, 0xA1, 0x72);
623 pci_write_config_word(dev, 0xA2, 0x328A);
624 pci_write_config_dword(dev, 0xA4, 0x62DD62DD);
625 pci_write_config_dword(dev, 0xA8, 0x43924392);
626 pci_write_config_dword(dev, 0xAC, 0x40094009);
627 pci_write_config_byte(dev, 0xB1, 0x72);
628 pci_write_config_word(dev, 0xB2, 0x328A);
629 pci_write_config_dword(dev, 0xB4, 0x62DD62DD);
630 pci_write_config_dword(dev, 0xB8, 0x43924392);
631 pci_write_config_dword(dev, 0xBC, 0x40094009);
632
633 proc_reports_siimage(dev, (tmpbyte>>4), name);
634 return 0;
635}
636
637/**
638 * init_mmio_iops_siimage - set up the iops for MMIO
639 * @hwif: interface to set up
640 *
641 * The basic setup here is fairly simple, we can use standard MMIO
642 * operations. However we do have to set the taskfile register offsets
643 * by hand as there isnt a standard defined layout for them this
644 * time.
645 *
646 * The hardware supports buffered taskfiles and also some rather nice
Alan Cox19c1ef52006-06-28 04:26:59 -0700647 * extended PRD tables. For better SI3112 support use the libata driver
Linus Torvalds1da177e2005-04-16 15:20:36 -0700648 */
649
650static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif)
651{
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100652 struct pci_dev *dev = to_pci_dev(hwif->dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700653 void *addr = pci_get_drvdata(dev);
654 u8 ch = hwif->channel;
655 hw_regs_t hw;
656 unsigned long base;
657
658 /*
659 * Fill in the basic HWIF bits
660 */
661
662 default_hwif_mmiops(hwif);
663 hwif->hwif_data = addr;
664
665 /*
666 * Now set up the hw. We have to do this ourselves as
Michael Opdenacker59c51592007-05-09 08:57:56 +0200667 * the MMIO layout isnt the same as the standard port
Linus Torvalds1da177e2005-04-16 15:20:36 -0700668 * based I/O
669 */
670
671 memset(&hw, 0, sizeof(hw_regs_t));
672
673 base = (unsigned long)addr;
674 if (ch)
675 base += 0xC0;
676 else
677 base += 0x80;
678
679 /*
680 * The buffered task file doesn't have status/control
681 * so we can't currently use it sanely since we want to
682 * use LBA48 mode.
683 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700684 hw.io_ports[IDE_DATA_OFFSET] = base;
685 hw.io_ports[IDE_ERROR_OFFSET] = base + 1;
686 hw.io_ports[IDE_NSECTOR_OFFSET] = base + 2;
687 hw.io_ports[IDE_SECTOR_OFFSET] = base + 3;
688 hw.io_ports[IDE_LCYL_OFFSET] = base + 4;
689 hw.io_ports[IDE_HCYL_OFFSET] = base + 5;
690 hw.io_ports[IDE_SELECT_OFFSET] = base + 6;
691 hw.io_ports[IDE_STATUS_OFFSET] = base + 7;
692 hw.io_ports[IDE_CONTROL_OFFSET] = base + 10;
693
694 hw.io_ports[IDE_IRQ_OFFSET] = 0;
695
696 if (pdev_is_sata(dev)) {
697 base = (unsigned long)addr;
698 if (ch)
699 base += 0x80;
700 hwif->sata_scr[SATA_STATUS_OFFSET] = base + 0x104;
701 hwif->sata_scr[SATA_ERROR_OFFSET] = base + 0x108;
702 hwif->sata_scr[SATA_CONTROL_OFFSET] = base + 0x100;
703 hwif->sata_misc[SATA_MISC_OFFSET] = base + 0x140;
704 hwif->sata_misc[SATA_PHY_OFFSET] = base + 0x144;
705 hwif->sata_misc[SATA_IEN_OFFSET] = base + 0x148;
706 }
707
Bartlomiej Zolnierkiewicz9239b332007-10-20 00:32:33 +0200708 memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700709
Bartlomiej Zolnierkiewicz9239b332007-10-20 00:32:33 +0200710 hwif->irq = dev->irq;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700711
Bartlomiej Zolnierkiewicz9239b332007-10-20 00:32:33 +0200712 hwif->dma_base = (unsigned long)addr + (ch ? 0x08 : 0x00);
Bartlomiej Zolnierkiewicz2ad1e552007-02-17 02:40:25 +0100713
714 hwif->mmio = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700715}
716
717static int is_dev_seagate_sata(ide_drive_t *drive)
718{
719 const char *s = &drive->id->model[0];
720 unsigned len;
721
Linus Torvalds1da177e2005-04-16 15:20:36 -0700722 len = strnlen(s, sizeof(drive->id->model));
723
724 if ((len > 4) && (!memcmp(s, "ST", 2))) {
725 if ((!memcmp(s + len - 2, "AS", 2)) ||
726 (!memcmp(s + len - 3, "ASL", 3))) {
727 printk(KERN_INFO "%s: applying pessimistic Seagate "
728 "errata fix\n", drive->name);
729 return 1;
730 }
731 }
732 return 0;
733}
734
735/**
Bartlomiej Zolnierkiewiczf01393e2008-01-26 20:13:03 +0100736 * sil_quirkproc - post probe fixups
737 * @drive: drive
Linus Torvalds1da177e2005-04-16 15:20:36 -0700738 *
739 * Called after drive probe we use this to decide whether the
740 * Seagate fixup must be applied. This used to be in init_iops but
741 * that can occur before we know what drives are present.
742 */
743
Bartlomiej Zolnierkiewiczf01393e2008-01-26 20:13:03 +0100744static void __devinit sil_quirkproc(ide_drive_t *drive)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700745{
Bartlomiej Zolnierkiewiczf01393e2008-01-26 20:13:03 +0100746 ide_hwif_t *hwif = drive->hwif;
747
Linus Torvalds1da177e2005-04-16 15:20:36 -0700748 /* Try and raise the rqsize */
Bartlomiej Zolnierkiewiczf01393e2008-01-26 20:13:03 +0100749 if (!is_sata(hwif) || !is_dev_seagate_sata(drive))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700750 hwif->rqsize = 128;
751}
752
753/**
754 * init_iops_siimage - set up iops
755 * @hwif: interface to set up
756 *
757 * Do the basic setup for the SIIMAGE hardware interface
758 * and then do the MMIO setup if we can. This is the first
759 * look in we get for setting up the hwif so that we
760 * can get the iops right before using them.
761 */
762
763static void __devinit init_iops_siimage(ide_hwif_t *hwif)
764{
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100765 struct pci_dev *dev = to_pci_dev(hwif->dev);
766
Linus Torvalds1da177e2005-04-16 15:20:36 -0700767 hwif->hwif_data = NULL;
768
769 /* Pessimal until we finish probing */
770 hwif->rqsize = 15;
771
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100772 if (pci_get_drvdata(dev) == NULL)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700773 return;
Bartlomiej Zolnierkiewiczfc212bb2007-10-19 00:30:08 +0200774
Linus Torvalds1da177e2005-04-16 15:20:36 -0700775 init_mmio_iops_siimage(hwif);
776}
777
778/**
779 * ata66_siimage - check for 80 pin cable
780 * @hwif: interface to check
781 *
782 * Check for the presence of an ATA66 capable cable on the
783 * interface.
784 */
785
Bartlomiej Zolnierkiewicz49521f92007-07-09 23:17:58 +0200786static u8 __devinit ata66_siimage(ide_hwif_t *hwif)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700787{
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100788 struct pci_dev *dev = to_pci_dev(hwif->dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700789 unsigned long addr = siimage_selreg(hwif, 0);
Bartlomiej Zolnierkiewicz49521f92007-07-09 23:17:58 +0200790 u8 ata66 = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700791
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +0100792 if (pci_get_drvdata(dev) == NULL)
793 pci_read_config_byte(dev, addr, &ata66);
Bartlomiej Zolnierkiewicz49521f92007-07-09 23:17:58 +0200794 else
795 ata66 = hwif->INB(addr);
796
797 return (ata66 & 0x01) ? ATA_CBL_PATA80 : ATA_CBL_PATA40;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700798}
799
800/**
801 * init_hwif_siimage - set up hwif structs
802 * @hwif: interface to set up
803 *
804 * We do the basic set up of the interface structure. The SIIMAGE
805 * requires several custom handlers so we override the default
806 * ide DMA handlers appropriately
807 */
808
809static void __devinit init_hwif_siimage(ide_hwif_t *hwif)
810{
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200811 u8 sata = is_sata(hwif);
812
Bartlomiej Zolnierkiewicz26bcb872007-10-11 23:54:00 +0200813 hwif->set_pio_mode = &sil_set_pio_mode;
Bartlomiej Zolnierkiewicz88b2b322007-10-13 17:47:51 +0200814 hwif->set_dma_mode = &sil_set_dma_mode;
Bartlomiej Zolnierkiewiczf01393e2008-01-26 20:13:03 +0100815 hwif->quirkproc = &sil_quirkproc;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700816
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200817 if (sata) {
Alan Cox19c1ef52006-06-28 04:26:59 -0700818 static int first = 1;
819
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200820 hwif->busproc = &sil_sata_busproc;
821 hwif->reset_poll = &sil_sata_reset_poll;
822 hwif->pre_reset = &sil_sata_pre_reset;
823 hwif->udma_filter = &sil_sata_udma_filter;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700824
Alan Cox19c1ef52006-06-28 04:26:59 -0700825 if (first) {
826 printk(KERN_INFO "siimage: For full SATA support you should use the libata sata_sil module.\n");
827 first = 0;
828 }
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200829 } else
830 hwif->udma_filter = &sil_pata_udma_filter;
Bartlomiej Zolnierkiewicz328dcbb2007-07-20 01:11:54 +0200831
Bartlomiej Zolnierkiewicz328dcbb2007-07-20 01:11:54 +0200832 if (hwif->dma_base == 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700833 return;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700834
Bartlomiej Zolnierkiewicz438c4702007-10-20 00:32:31 +0200835 if (sata)
Bartlomiej Zolnierkiewicz33c10022007-10-19 00:30:06 +0200836 hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700837
Bartlomiej Zolnierkiewicz49521f92007-07-09 23:17:58 +0200838 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
839 hwif->cbl = ata66_siimage(hwif);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700840
841 if (hwif->mmio) {
842 hwif->ide_dma_test_irq = &siimage_mmio_ide_dma_test_irq;
843 } else {
844 hwif->ide_dma_test_irq = & siimage_io_ide_dma_test_irq;
845 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700846}
847
848#define DECLARE_SII_DEV(name_str) \
849 { \
850 .name = name_str, \
851 .init_chipset = init_chipset_siimage, \
852 .init_iops = init_iops_siimage, \
853 .init_hwif = init_hwif_siimage, \
Bartlomiej Zolnierkiewicz7cab14a2007-10-19 00:30:06 +0200854 .host_flags = IDE_HFLAG_BOOTABLE, \
Bartlomiej Zolnierkiewicz4099d142007-07-20 01:11:59 +0200855 .pio_mask = ATA_PIO4, \
Bartlomiej Zolnierkiewicz5f8b6c32007-10-19 00:30:07 +0200856 .mwdma_mask = ATA_MWDMA2, \
857 .udma_mask = ATA_UDMA6, \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700858 }
859
Bartlomiej Zolnierkiewicz85620432007-10-20 00:32:34 +0200860static const struct ide_port_info siimage_chipsets[] __devinitdata = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700861 /* 0 */ DECLARE_SII_DEV("SiI680"),
862 /* 1 */ DECLARE_SII_DEV("SiI3112 Serial ATA"),
863 /* 2 */ DECLARE_SII_DEV("Adaptec AAR-1210SA")
864};
865
866/**
867 * siimage_init_one - pci layer discovery entry
868 * @dev: PCI device
869 * @id: ident table entry
870 *
871 * Called by the PCI code when it finds an SI680 or SI3112 controller.
872 * We then use the IDE PCI generic helper to do most of the work.
873 */
874
875static int __devinit siimage_init_one(struct pci_dev *dev, const struct pci_device_id *id)
876{
877 return ide_setup_pci_device(dev, &siimage_chipsets[id->driver_data]);
878}
879
Bartlomiej Zolnierkiewicz9cbcc5e2007-10-16 22:29:56 +0200880static const struct pci_device_id siimage_pci_tbl[] = {
881 { PCI_VDEVICE(CMD, PCI_DEVICE_ID_SII_680), 0 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700882#ifdef CONFIG_BLK_DEV_IDE_SATA
Bartlomiej Zolnierkiewicz9cbcc5e2007-10-16 22:29:56 +0200883 { PCI_VDEVICE(CMD, PCI_DEVICE_ID_SII_3112), 1 },
884 { PCI_VDEVICE(CMD, PCI_DEVICE_ID_SII_1210SA), 2 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700885#endif
886 { 0, },
887};
888MODULE_DEVICE_TABLE(pci, siimage_pci_tbl);
889
890static struct pci_driver driver = {
891 .name = "SiI_IDE",
892 .id_table = siimage_pci_tbl,
893 .probe = siimage_init_one,
894};
895
Bartlomiej Zolnierkiewicz82ab1ee2007-01-27 13:46:56 +0100896static int __init siimage_ide_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700897{
898 return ide_pci_register_driver(&driver);
899}
900
901module_init(siimage_ide_init);
902
903MODULE_AUTHOR("Andre Hedrick, Alan Cox");
904MODULE_DESCRIPTION("PCI driver module for SiI IDE");
905MODULE_LICENSE("GPL");