Merge branch 'devel-stable' into devel
[firefly-linux-kernel-4.4.55.git] / drivers / ide / cs5520.c
index 09f98ed0731fa251bfb08f46eea0e369eefe3f05..2c1e5f7cd261f79e82f947ae0cf7baaa3fc0505e 100644 (file)
@@ -57,11 +57,11 @@ static struct pio_clocks cs5520_pio_clocks[]={
        {1, 2, 1}
 };
 
-static void cs5520_set_pio_mode(ide_drive_t *drive, const u8 pio)
+static void cs5520_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
 {
-       ide_hwif_t *hwif = drive->hwif;
        struct pci_dev *pdev = to_pci_dev(hwif->dev);
        int controller = drive->dn > 1 ? 1 : 0;
+       const u8 pio = drive->pio_mode - XFER_PIO_0;
 
        /* 8bit CAT/CRT - 8bit command timing for channel */
        pci_write_config_byte(pdev, 0x62 + controller, 
@@ -81,11 +81,12 @@ static void cs5520_set_pio_mode(ide_drive_t *drive, const u8 pio)
                (cs5520_pio_clocks[pio].assert));
 }
 
-static void cs5520_set_dma_mode(ide_drive_t *drive, const u8 speed)
+static void cs5520_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive)
 {
        printk(KERN_ERR "cs55x0: bad ide timing.\n");
 
-       cs5520_set_pio_mode(drive, 0);
+       drive->pio_mode = XFER_PIO_0 + 0;
+       cs5520_set_pio_mode(hwif, drive);
 }
 
 static const struct ide_port_ops cs5520_port_ops = {