]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/ide/pci/serverworks.c
ide: add ide_use_fast_pio() helper (v3)
[mirror_ubuntu-bionic-kernel.git] / drivers / ide / pci / serverworks.c
index ea9a28a45853348d21cc59e3d2f2b764556ae0e8..9e92e7ba0227a2230c099c64d6d9fab32f89bfe6 100644 (file)
@@ -316,21 +316,13 @@ static int config_chipset_for_dma (ide_drive_t *drive)
 static int svwks_config_drive_xfer_rate (ide_drive_t *drive)
 {
        ide_hwif_t *hwif        = HWIF(drive);
-       struct hd_driveid *id   = drive->id;
 
        drive->init_speed = 0;
 
-       if ((id->capability & 1) && drive->autodma) {
+       if (ide_use_dma(drive) && config_chipset_for_dma(drive))
+               return hwif->ide_dma_on(drive);
 
-               if (ide_use_dma(drive)) {
-                       if (config_chipset_for_dma(drive))
-                               return hwif->ide_dma_on(drive);
-               }
-
-               goto fast_ata_pio;
-
-       } else if ((id->capability & 8) || (id->field_valid & 2)) {
-fast_ata_pio:
+       if (ide_use_fast_pio(drive)) {
                config_chipset_for_pio(drive);
                //      hwif->tuneproc(drive, 5);
                return hwif->ide_dma_off_quietly(drive);
@@ -339,13 +331,6 @@ fast_ata_pio:
        return 0;
 }
 
-/* This can go soon */
-
-static int svwks_ide_dma_end (ide_drive_t *drive)
-{
-       return __ide_dma_end(drive);
-}
-
 static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev, const char *name)
 {
        unsigned int reg;
@@ -537,10 +522,10 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif)
        }
 
        hwif->ide_dma_check = &svwks_config_drive_xfer_rate;
-       if (hwif->pci_dev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4IDE)
-               hwif->ide_dma_end = &svwks_ide_dma_end;
-       else if (!(hwif->udma_four))
-               hwif->udma_four = ata66_svwks(hwif);
+       if (hwif->pci_dev->device != PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) {
+               if (!hwif->udma_four)
+                       hwif->udma_four = ata66_svwks(hwif);
+       }
        if (!noautodma)
                hwif->autodma = 1;
 
@@ -551,21 +536,6 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif)
        hwif->drives[1].autotune = (!(dma_stat & 0x40));
 }
 
-/*
- * We allow the BM-DMA driver to only work on enabled interfaces.
- */
-static void __devinit init_dma_svwks (ide_hwif_t *hwif, unsigned long dmabase)
-{
-       struct pci_dev *dev = hwif->pci_dev;
-
-       if (((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) ||
-            (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) &&
-           (!(PCI_FUNC(dev->devfn) & 1)) && (hwif->channel))
-               return;
-
-       ide_setup_dma(hwif, dmabase, 8);
-}
-
 static int __devinit init_setup_svwks (struct pci_dev *dev, ide_pci_device_t *d)
 {
        return ide_setup_pci_device(dev, d);
@@ -600,7 +570,6 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = {
                .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,
@@ -609,7 +578,6 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = {
                .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,
@@ -618,7 +586,6 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = {
                .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,
@@ -627,7 +594,6 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = {
                .init_setup     = init_setup_svwks,
                .init_chipset   = init_chipset_svwks,
                .init_hwif      = init_hwif_svwks,
-               .init_dma       = init_dma_svwks,
                .channels       = 1,    /* 2 */
                .autodma        = AUTODMA,
                .bootable       = ON_BOARD,