upgrade to fedora-2.6.12-1.1398.FC4 + vserver 2.0.rc7
[linux-2.6.git] / drivers / ide / pci / serverworks.c
index bd78de6..c6f5fa4 100644 (file)
 
 #include <asm/io.h>
 
-#include "serverworks.h"
+#define SVWKS_CSB5_REVISION_NEW        0x92 /* min PCI_REVISION_ID for UDMA5 (A2.0) */
+#define SVWKS_CSB6_REVISION    0xa0 /* min PCI_REVISION_ID for UDMA4 (A1.0) */
+
+/* Seagate Barracuda ATA IV Family drives in UDMA mode 5
+ * can overrun their FIFOs when used with the CSB5 */
+static const char *svwks_bad_ata100[] = {
+       "ST320011A",
+       "ST340016A",
+       "ST360021A",
+       "ST380021A",
+       NULL
+};
 
 static u8 svwks_revision = 0;
 static struct pci_dev *isa_dev;
@@ -330,7 +341,7 @@ static int svwks_ide_dma_end (ide_drive_t *drive)
        return __ide_dma_end(drive);
 }
 
-static unsigned int __init init_chipset_svwks (struct pci_dev *dev, const char *name)
+static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev, const char *name)
 {
        unsigned int reg;
        u8 btr;
@@ -431,7 +442,7 @@ static unsigned int __init init_chipset_svwks (struct pci_dev *dev, const char *
        return (dev->irq) ? dev->irq : 0;
 }
 
-static unsigned int __init ata66_svwks_svwks (ide_hwif_t *hwif)
+static unsigned int __devinit ata66_svwks_svwks (ide_hwif_t *hwif)
 {
        return 1;
 }
@@ -443,7 +454,7 @@ static unsigned int __init ata66_svwks_svwks (ide_hwif_t *hwif)
  * Bit 14 clear = primary IDE channel does not have 80-pin cable.
  * Bit 14 set   = primary IDE channel has 80-pin cable.
  */
-static unsigned int __init ata66_svwks_dell (ide_hwif_t *hwif)
+static unsigned int __devinit ata66_svwks_dell (ide_hwif_t *hwif)
 {
        struct pci_dev *dev = hwif->pci_dev;
        if (dev->subsystem_vendor == PCI_VENDOR_ID_DELL &&
@@ -461,7 +472,7 @@ static unsigned int __init ata66_svwks_dell (ide_hwif_t *hwif)
  *
  * WARNING: this only works on Alpine hardware!
  */
-static unsigned int __init ata66_svwks_cobalt (ide_hwif_t *hwif)
+static unsigned int __devinit ata66_svwks_cobalt (ide_hwif_t *hwif)
 {
        struct pci_dev *dev = hwif->pci_dev;
        if (dev->subsystem_vendor == PCI_VENDOR_ID_SUN &&
@@ -472,7 +483,7 @@ static unsigned int __init ata66_svwks_cobalt (ide_hwif_t *hwif)
        return 0;
 }
 
-static unsigned int __init ata66_svwks (ide_hwif_t *hwif)
+static unsigned int __devinit ata66_svwks (ide_hwif_t *hwif)
 {
        struct pci_dev *dev = hwif->pci_dev;
 
@@ -497,7 +508,7 @@ static unsigned int __init ata66_svwks (ide_hwif_t *hwif)
 }
 
 #undef CAN_SW_DMA
-static void __init init_hwif_svwks (ide_hwif_t *hwif)
+static void __devinit init_hwif_svwks (ide_hwif_t *hwif)
 {
        u8 dma_stat = 0;
 
@@ -545,7 +556,7 @@ static void __init init_hwif_svwks (ide_hwif_t *hwif)
 /*
  * We allow the BM-DMA driver to only work on enabled interfaces.
  */
-static void __init init_dma_svwks (ide_hwif_t *hwif, unsigned long dmabase)
+static void __devinit init_dma_svwks (ide_hwif_t *hwif, unsigned long dmabase)
 {
        struct pci_dev *dev = hwif->pci_dev;
 
@@ -557,12 +568,12 @@ static void __init init_dma_svwks (ide_hwif_t *hwif, unsigned long dmabase)
        ide_setup_dma(hwif, dmabase, 8);
 }
 
-static void __init init_setup_svwks (struct pci_dev *dev, ide_pci_device_t *d)
+static int __devinit init_setup_svwks (struct pci_dev *dev, ide_pci_device_t *d)
 {
-       ide_setup_pci_device(dev, d);
+       return ide_setup_pci_device(dev, d);
 }
 
-static void __init init_setup_csb6 (struct pci_dev *dev, ide_pci_device_t *d)
+static int __devinit init_setup_csb6 (struct pci_dev *dev, ide_pci_device_t *d)
 {
        if (!(PCI_FUNC(dev->devfn) & 1)) {
                d->bootable = NEVER_BOARD;
@@ -579,9 +590,47 @@ static void __init init_setup_csb6 (struct pci_dev *dev, ide_pci_device_t *d)
                        dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) &&
                       (!(PCI_FUNC(dev->devfn) & 1))) ? 1 : 2;
 
-       ide_setup_pci_device(dev, d);
+       return ide_setup_pci_device(dev, d);
 }
 
+static ide_pci_device_t serverworks_chipsets[] __devinitdata = {
+       {       /* 0 */
+               .name           = "SvrWks OSB4",
+               .init_setup     = init_setup_svwks,
+               .init_chipset   = init_chipset_svwks,
+               .init_hwif      = init_hwif_svwks,
+               .channels       = 2,
+               .autodma        = AUTODMA,
+               .bootable       = ON_BOARD,
+       },{     /* 1 */
+               .name           = "SvrWks CSB5",
+               .init_setup     = init_setup_svwks,
+               .init_chipset   = init_chipset_svwks,
+               .init_hwif      = init_hwif_svwks,
+               .init_dma       = init_dma_svwks,
+               .channels       = 2,
+               .autodma        = AUTODMA,
+               .bootable       = ON_BOARD,
+       },{     /* 2 */
+               .name           = "SvrWks CSB6",
+               .init_setup     = init_setup_csb6,
+               .init_chipset   = init_chipset_svwks,
+               .init_hwif      = init_hwif_svwks,
+               .init_dma       = init_dma_svwks,
+               .channels       = 2,
+               .autodma        = AUTODMA,
+               .bootable       = ON_BOARD,
+       },{     /* 3 */
+               .name           = "SvrWks CSB6",
+               .init_setup     = init_setup_csb6,
+               .init_chipset   = init_chipset_svwks,
+               .init_hwif      = init_hwif_svwks,
+               .init_dma       = init_dma_svwks,
+               .channels       = 1,    /* 2 */
+               .autodma        = AUTODMA,
+               .bootable       = ON_BOARD,
+       }
+};
 
 /**
  *     svwks_init_one  -       called when a OSB/CSB is found
@@ -596,8 +645,7 @@ static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device
 {
        ide_pci_device_t *d = &serverworks_chipsets[id->driver_data];
 
-       d->init_setup(dev, d);
-       return 0;
+       return d->init_setup(dev, d);
 }
 
 static struct pci_device_id svwks_pci_tbl[] = {