vserver 1.9.5.x5
[linux-2.6.git] / drivers / ide / pci / via82cxxx.c
index 044b6c4..d90f4d2 100644 (file)
 #include <linux/ide.h>
 #include <asm/io.h>
 
+#ifdef CONFIG_PPC_MULTIPLATFORM
+#include <asm/processor.h>
+#endif
+
 #include "ide-timing.h"
-#include "via82cxxx.h"
+
+#define DISPLAY_VIA_TIMINGS
 
 #define VIA_IDE_ENABLE         0x40
 #define VIA_IDE_CONFIG         0x41
@@ -583,6 +588,13 @@ static void __init init_hwif_via82cxxx(ide_hwif_t *hwif)
        hwif->tuneproc = &via82cxxx_tune_drive;
        hwif->speedproc = &via_set_drive;
 
+
+#if defined(CONFIG_PPC_MULTIPLATFORM) && defined(CONFIG_PPC32)
+       if(_machine == _MACH_chrp && _chrp_type == _CHRP_Pegasos) {
+               hwif->irq = hwif->channel ? 15 : 14;
+       }
+#endif
+
        for (i = 0; i < 2; i++) {
                hwif->drives[i].io_32bit = 1;
                hwif->drives[i].unmask = (via_config->flags & VIA_NO_UNMASK) ? 0 : 1;
@@ -607,24 +619,30 @@ static void __init init_hwif_via82cxxx(ide_hwif_t *hwif)
        hwif->drives[1].autodma = hwif->autodma;
 }
 
+static ide_pci_device_t via82cxxx_chipset __devinitdata = {
+       .name           = "VP_IDE",
+       .init_chipset   = init_chipset_via82cxxx,
+       .init_hwif      = init_hwif_via82cxxx,
+       .channels       = 2,
+       .autodma        = NOAUTODMA,
+       .enablebits     = {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
+       .bootable       = ON_BOARD,
+};
+
 static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
-       ide_pci_device_t *d = &via82cxxx_chipsets[id->driver_data];
-       if (dev->device != d->device)
-               BUG();
-       ide_setup_pci_device(dev, d);
-       return 0;
+       return ide_setup_pci_device(dev, &via82cxxx_chipset);
 }
 
 static struct pci_device_id via_pci_tbl[] = {
        { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C576_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-       { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
+       { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
        { 0, },
 };
 MODULE_DEVICE_TABLE(pci, via_pci_tbl);
 
 static struct pci_driver driver = {
-       .name           = "VIA IDE",
+       .name           = "VIA_IDE",
        .id_table       = via_pci_tbl,
        .probe          = via_init_one,
 };