ide: add IDE_HFLAG_NO_{DMA,AUTODMA} host flags
[pandora-kernel.git] / drivers / ide / pci / serverworks.c
index 49ec0ac..338eee8 100644 (file)
@@ -97,6 +97,7 @@ static u8 svwks_udma_filter(ide_drive_t *drive)
                        mode = 2;
 
                switch(mode) {
+               case 3:  mask = 0x3f; break;
                case 2:  mask = 0x1f; break;
                case 1:  mask = 0x07; break;
                default: mask = 0x00; break;
@@ -195,19 +196,6 @@ static void svwks_set_dma_mode(ide_drive_t *drive, const u8 speed)
        pci_write_config_byte(dev, 0x54, ultra_enable);
 }
 
-static int svwks_config_drive_xfer_rate (ide_drive_t *drive)
-{
-       drive->init_speed = 0;
-
-       if (ide_tune_dma(drive))
-               return 0;
-
-       if (ide_use_fast_pio(drive))
-               ide_set_max_pio(drive);
-
-       return -1;
-}
-
 static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev, const char *name)
 {
        unsigned int reg;
@@ -379,30 +367,21 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif)
        hwif->set_dma_mode = &svwks_set_dma_mode;
        hwif->udma_filter = &svwks_udma_filter;
 
-       hwif->atapi_dma = 1;
-
        if (hwif->pci_dev->device != PCI_DEVICE_ID_SERVERWORKS_OSB4IDE)
                hwif->ultra_mask = 0x3f;
 
        hwif->mwdma_mask = 0x07;
 
-       hwif->autodma = 0;
-
        hwif->drives[0].autotune = 1;
        hwif->drives[1].autotune = 1;
 
        if (!hwif->dma_base)
                return;
 
-       hwif->ide_dma_check = &svwks_config_drive_xfer_rate;
        if (hwif->pci_dev->device != PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) {
                if (hwif->cbl != ATA_CBL_PATA40_SHORT)
                        hwif->cbl = ata66_svwks(hwif);
        }
-       if (!noautodma)
-               hwif->autodma = 1;
-
-       hwif->drives[0].autodma = hwif->drives[1].autodma = 1;
 }
 
 static int __devinit init_setup_svwks (struct pci_dev *dev, ide_pci_device_t *d)
@@ -413,9 +392,10 @@ static int __devinit init_setup_svwks (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;
                if (dev->resource[0].start == 0x01f1)
-                       d->bootable = ON_BOARD;
+                       d->host_flags |= IDE_HFLAG_BOOTABLE;
+               else
+                       d->host_flags &= ~IDE_HFLAG_BOOTABLE;
        }
 
        if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE ||
@@ -434,42 +414,35 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = {
                .init_setup     = init_setup_svwks,
                .init_chipset   = init_chipset_svwks,
                .init_hwif      = init_hwif_svwks,
-               .autodma        = AUTODMA,
-               .bootable       = ON_BOARD,
+               .host_flags     = IDE_HFLAG_BOOTABLE,
                .pio_mask       = ATA_PIO4,
        },{     /* 1 */
                .name           = "SvrWks CSB5",
                .init_setup     = init_setup_svwks,
                .init_chipset   = init_chipset_svwks,
                .init_hwif      = init_hwif_svwks,
-               .autodma        = AUTODMA,
-               .bootable       = ON_BOARD,
+               .host_flags     = IDE_HFLAG_BOOTABLE,
                .pio_mask       = ATA_PIO4,
        },{     /* 2 */
                .name           = "SvrWks CSB6",
                .init_setup     = init_setup_csb6,
                .init_chipset   = init_chipset_svwks,
                .init_hwif      = init_hwif_svwks,
-               .autodma        = AUTODMA,
-               .bootable       = ON_BOARD,
+               .host_flags     = IDE_HFLAG_BOOTABLE,
                .pio_mask       = ATA_PIO4,
        },{     /* 3 */
                .name           = "SvrWks CSB6",
                .init_setup     = init_setup_csb6,
                .init_chipset   = init_chipset_svwks,
                .init_hwif      = init_hwif_svwks,
-               .autodma        = AUTODMA,
-               .bootable       = ON_BOARD,
-               .host_flags     = IDE_HFLAG_SINGLE,
+               .host_flags     = IDE_HFLAG_SINGLE | IDE_HFLAG_BOOTABLE,
                .pio_mask       = ATA_PIO4,
        },{     /* 4 */
                .name           = "SvrWks HT1000",
                .init_setup     = init_setup_svwks,
                .init_chipset   = init_chipset_svwks,
                .init_hwif      = init_hwif_svwks,
-               .autodma        = AUTODMA,
-               .bootable       = ON_BOARD,
-               .host_flags     = IDE_HFLAG_SINGLE,
+               .host_flags     = IDE_HFLAG_SINGLE | IDE_HFLAG_BOOTABLE,
                .pio_mask       = ATA_PIO4,
        }
 };
@@ -490,12 +463,12 @@ static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device
        return d->init_setup(dev, d);
 }
 
-static struct pci_device_id svwks_pci_tbl[] = {
-       { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-       { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
-       { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2},
-       { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3},
-       { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4},
+static const struct pci_device_id svwks_pci_tbl[] = {
+       { PCI_VDEVICE(SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4IDE),   0 },
+       { PCI_VDEVICE(SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5IDE),   1 },
+       { PCI_VDEVICE(SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE),   2 },
+       { PCI_VDEVICE(SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2),  3 },
+       { PCI_VDEVICE(SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000IDE), 4 },
        { 0, },
 };
 MODULE_DEVICE_TABLE(pci, svwks_pci_tbl);