]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/ide/pci/serverworks.c
ide/pci/serverworks.c: Fix corruption/timeouts with MegaIDE
[karo-tx-linux.git] / drivers / ide / pci / serverworks.c
index a94e77d67db35a2f82af61d8bc62af15e016608f..1f80c6d58805b1fb2d2f5fad997689d10264c332 100644 (file)
@@ -158,6 +158,12 @@ static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed)
        pci_read_config_word(dev, 0x4A, &csb5_pio);
        pci_read_config_byte(dev, 0x54, &ultra_enable);
 
+       /* If we are in RAID mode (eg AMI MegaIDE) then we can't it
+          turns out trust the firmware configuration */
+
+       if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE)
+               goto oem_setup_failed;
+
        /* Per Specified Design by OEM, and ASIC Architect */
        if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) ||
            (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) {
@@ -270,22 +276,11 @@ static void svwks_tune_drive (ide_drive_t *drive, u8 pio)
        (void)svwks_tune_chipset(drive, XFER_PIO_0 + pio);
 }
 
-static int config_chipset_for_dma (ide_drive_t *drive)
-{
-       u8 speed = ide_max_dma_mode(drive);
-
-       if (!speed)
-               return 0;
-
-       (void) svwks_tune_chipset(drive, speed);
-       return ide_dma_enable(drive);
-}
-
 static int svwks_config_drive_xfer_rate (ide_drive_t *drive)
 {
        drive->init_speed = 0;
 
-       if (ide_use_dma(drive) && config_chipset_for_dma(drive))
+       if (ide_tune_dma(drive))
                return 0;
 
        if (ide_use_fast_pio(drive))