]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/pci/generic.c
Start split out of common open firmware code
[linux-2.6-omap-h63xx.git] / drivers / ide / pci / generic.c
index 9f306880491abea6b809e568ebeff51945bb49d6..48caa468b7629b00eecad7663724048287f7de4b 100644 (file)
@@ -21,8 +21,6 @@
  * are deemed to be part of the source code.
  */
 
-#undef REALLY_SLOW_IO          /* most systems can safely undef this */
-
 #include <linux/types.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
@@ -97,122 +95,77 @@ static ide_pci_device_t generic_chipsets[] __devinitdata = {
        {       /* 0 */
                .name           = "Unknown",
                .init_hwif      = init_hwif_generic,
-               .channels       = 2,
                .autodma        = AUTODMA,
                .bootable       = ON_BOARD,
        },{     /* 1 */
                .name           = "NS87410",
                .init_hwif      = init_hwif_generic,
-               .channels       = 2,
                .autodma        = AUTODMA,
                .enablebits     = {{0x43,0x08,0x08}, {0x47,0x08,0x08}},
                .bootable       = ON_BOARD,
         },{    /* 2 */
                .name           = "SAMURAI",
                .init_hwif      = init_hwif_generic,
-               .channels       = 2,
                .autodma        = AUTODMA,
                .bootable       = ON_BOARD,
        },{     /* 3 */
                .name           = "HT6565",
                .init_hwif      = init_hwif_generic,
-               .channels       = 2,
                .autodma        = AUTODMA,
                .bootable       = ON_BOARD,
        },{     /* 4 */
                .name           = "UM8673F",
                .init_hwif      = init_hwif_generic,
-               .channels       = 2,
                .autodma        = NODMA,
                .bootable       = ON_BOARD,
        },{     /* 5 */
                .name           = "UM8886A",
                .init_hwif      = init_hwif_generic,
-               .channels       = 2,
                .autodma        = NODMA,
                .bootable       = ON_BOARD,
        },{     /* 6 */
                .name           = "UM8886BF",
                .init_hwif      = init_hwif_generic,
-               .channels       = 2,
                .autodma        = NODMA,
                .bootable       = ON_BOARD,
        },{     /* 7 */
                .name           = "HINT_IDE",
                .init_hwif      = init_hwif_generic,
-               .channels       = 2,
                .autodma        = AUTODMA,
                .bootable       = ON_BOARD,
        },{     /* 8 */
                .name           = "VIA_IDE",
                .init_hwif      = init_hwif_generic,
-               .channels       = 2,
                .autodma        = NOAUTODMA,
                .bootable       = ON_BOARD,
        },{     /* 9 */
                .name           = "OPTI621V",
                .init_hwif      = init_hwif_generic,
-               .channels       = 2,
                .autodma        = NOAUTODMA,
                .bootable       = ON_BOARD,
        },{     /* 10 */
                .name           = "VIA8237SATA",
                .init_hwif      = init_hwif_generic,
-               .channels       = 2,
                .autodma        = AUTODMA,
                .bootable       = OFF_BOARD,
        },{     /* 11 */
                .name           = "Piccolo0102",
                .init_hwif      = init_hwif_generic,
-               .channels       = 2,
                .autodma        = NOAUTODMA,
                .bootable       = ON_BOARD,
        },{     /* 12 */
                .name           = "Piccolo0103",
                .init_hwif      = init_hwif_generic,
-               .channels       = 2,
                .autodma        = NOAUTODMA,
                .bootable       = ON_BOARD,
        },{     /* 13 */
                .name           = "Piccolo0105",
                .init_hwif      = init_hwif_generic,
-               .channels       = 2,
                .autodma        = NOAUTODMA,
                .bootable       = ON_BOARD,
        },{     /* 14 */
                .name           = "Revolution",
                .init_hwif      = init_hwif_generic,
-               .channels       = 2,
-               .autodma        = AUTODMA,
-               .bootable       = OFF_BOARD,
-       },{     /* 15 */
-               .name           = "JMB361",
-               .init_hwif      = init_hwif_generic,
-               .channels       = 2,
-               .autodma        = AUTODMA,
-               .bootable       = OFF_BOARD,
-       },{     /* 16 */
-               .name           = "JMB363",
-               .init_hwif      = init_hwif_generic,
-               .channels       = 2,
-               .autodma        = AUTODMA,
-               .bootable       = OFF_BOARD,
-       },{     /* 17 */
-               .name           = "JMB365",
-               .init_hwif      = init_hwif_generic,
-               .channels       = 2,
-               .autodma        = AUTODMA,
-               .bootable       = OFF_BOARD,
-       },{     /* 18 */
-               .name           = "JMB366",
-               .init_hwif      = init_hwif_generic,
-               .channels       = 2,
-               .autodma        = AUTODMA,
-               .bootable       = OFF_BOARD,
-       },{     /* 19 */
-               .name           = "JMB368",
-               .init_hwif      = init_hwif_generic,
-               .channels       = 2,
                .autodma        = AUTODMA,
                .bootable       = OFF_BOARD,
        }
@@ -230,32 +183,41 @@ static ide_pci_device_t generic_chipsets[] __devinitdata = {
 static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
        ide_pci_device_t *d = &generic_chipsets[id->driver_data];
-       u16 command;
        int ret = -ENODEV;
 
        /* Don't use the generic entry unless instructed to do so */
        if (id->driver_data == 0 && ide_generic_all == 0)
                        goto out;
 
-       if (dev->vendor == PCI_VENDOR_ID_UMC &&
-           dev->device == PCI_DEVICE_ID_UMC_UM8886A &&
-           (!(PCI_FUNC(dev->devfn) & 1)))
-               goto out; /* UM8886A/BF pair */
-
-       if (dev->vendor == PCI_VENDOR_ID_OPTI &&
-           dev->device == PCI_DEVICE_ID_OPTI_82C558 &&
-           (!(PCI_FUNC(dev->devfn) & 1)))
-               goto out;
-
-       if (dev->vendor == PCI_VENDOR_ID_JMICRON) {
-               if (dev->device != PCI_DEVICE_ID_JMICRON_JMB368 && PCI_FUNC(dev->devfn) != 1)
+       switch (dev->vendor) {
+       case PCI_VENDOR_ID_UMC:
+               if (dev->device == PCI_DEVICE_ID_UMC_UM8886A &&
+                               !(PCI_FUNC(dev->devfn) & 1))
+                       goto out; /* UM8886A/BF pair */
+               break;
+       case PCI_VENDOR_ID_OPTI:
+               if (dev->device == PCI_DEVICE_ID_OPTI_82C558 &&
+                               !(PCI_FUNC(dev->devfn) & 1))
+                       goto out;
+               break;
+       case PCI_VENDOR_ID_JMICRON:
+               if (dev->device != PCI_DEVICE_ID_JMICRON_JMB368 &&
+                               PCI_FUNC(dev->devfn) != 1)
+                       goto out;
+               break;
+       case PCI_VENDOR_ID_NS:
+               if (dev->device == PCI_DEVICE_ID_NS_87410 &&
+                               (dev->class >> 8) != PCI_CLASS_STORAGE_IDE)
                        goto out;
+               break;
        }
 
        if (dev->vendor != PCI_VENDOR_ID_JMICRON) {
+               u16 command;
                pci_read_config_word(dev, PCI_COMMAND, &command);
                if (!(command & PCI_COMMAND_IO)) {
-                       printk(KERN_INFO "Skipping disabled %s IDE controller.\n", d->name);
+                       printk(KERN_INFO "Skipping disabled %s IDE "
+                                       "controller.\n", d->name);
                        goto out;
                }
        }
@@ -281,11 +243,6 @@ static struct pci_device_id generic_pci_tbl[] = {
        { PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1,   PCI_ANY_ID, PCI_ANY_ID, 0, 0, 12},
        { PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2,   PCI_ANY_ID, PCI_ANY_ID, 0, 0, 13},
        { PCI_VENDOR_ID_NETCELL,PCI_DEVICE_ID_REVOLUTION,          PCI_ANY_ID, PCI_ANY_ID, 0, 0, 14},
-       { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361,     PCI_ANY_ID, PCI_ANY_ID, 0, 0, 15},
-       { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363,     PCI_ANY_ID, PCI_ANY_ID, 0, 0, 16},
-       { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365,     PCI_ANY_ID, PCI_ANY_ID, 0, 0, 17},
-       { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366,     PCI_ANY_ID, PCI_ANY_ID, 0, 0, 18},
-       { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB368,     PCI_ANY_ID, PCI_ANY_ID, 0, 0, 19},
        /* Must come last. If you add entries adjust this table appropriately and the init_one code */
        { PCI_ANY_ID,           PCI_ANY_ID,                        PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE << 8, 0xFFFFFF00UL, 0},
        { 0, },
@@ -298,7 +255,7 @@ static struct pci_driver driver = {
        .probe          = generic_init_one,
 };
 
-static int generic_ide_init(void)
+static int __init generic_ide_init(void)
 {
        return ide_pci_register_driver(&driver);
 }