]> err.no Git - linux-2.6/blobdiff - drivers/ide/cris/ide-cris.c
ide-cris: fix ->speedproc and wrong ->swdma_mask
[linux-2.6] / drivers / ide / cris / ide-cris.c
index cd15e6260510d29e330f9eb5b509174dae00f040..5e8efc89255a79fdf8dd1399325e37dcb7eb5efe 100644 (file)
@@ -17,9 +17,6 @@
  * device can't do DMA handshaking for some stupid reason. We don't need to do that.
  */
 
-#undef REALLY_SLOW_IO           /* most systems can safely undef this */
-
-#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/timer.h>
@@ -683,9 +680,12 @@ static void cris_ide_input_data (ide_drive_t *drive, void *, unsigned int);
 static void cris_ide_output_data (ide_drive_t *drive, void *, unsigned int);
 static void cris_atapi_input_bytes(ide_drive_t *drive, void *, unsigned int);
 static void cris_atapi_output_bytes(ide_drive_t *drive, void *, unsigned int);
-static int cris_dma_off (ide_drive_t *drive);
 static int cris_dma_on (ide_drive_t *drive);
 
+static void cris_dma_off(ide_drive_t *drive)
+{
+}
+
 static void tune_cris_ide(ide_drive_t *drive, u8 pio)
 {
        int setup, strobe, hold;
@@ -730,7 +730,7 @@ static int speed_cris_ide(ide_drive_t *drive, u8 speed)
 
        if (speed >= XFER_PIO_0 && speed <= XFER_PIO_4) {
                tune_cris_ide(drive, speed - XFER_PIO_0);
-               return 0;
+               return ide_config_drive_speed(drive, speed);
        }
 
        switch(speed)
@@ -760,7 +760,8 @@ static int speed_cris_ide(ide_drive_t *drive, u8 speed)
                        hold = ATA_DMA2_HOLD;
                        break;
                default:
-                       return 0;
+                       BUG();
+                       break;
        }
 
        if (speed >= XFER_UDMA_0)
@@ -768,7 +769,7 @@ static int speed_cris_ide(ide_drive_t *drive, u8 speed)
        else
                cris_ide_set_speed(TYPE_DMA, 0, strobe, hold);
 
-       return 0;
+       return ide_config_drive_speed(drive, speed);
 }
 
 void __init
@@ -796,7 +797,7 @@ init_e100_ide (void)
                                0, 0, cris_ide_ack_intr,
                                ide_default_irq(0));
                ide_register_hw(&hw, &hwif);
-               hwif->mmio = 2;
+               hwif->mmio = 1;
                hwif->chipset = ide_etrax100;
                hwif->tuneproc = &tune_cris_ide;
                hwif->speedproc = &speed_cris_ide;
@@ -815,13 +816,15 @@ init_e100_ide (void)
                hwif->OUTBSYNC = &cris_ide_outbsync;
                hwif->INB = &cris_ide_inb;
                hwif->INW = &cris_ide_inw;
-               hwif->ide_dma_host_off = &cris_dma_off;
-               hwif->ide_dma_host_on = &cris_dma_on;
-               hwif->ide_dma_off_quietly = &cris_dma_off;
+               hwif->dma_host_off = &cris_dma_off;
+               hwif->dma_host_on = &cris_dma_on;
+               hwif->dma_off_quietly = &cris_dma_off;
                hwif->udma_four = 0;
                hwif->ultra_mask = cris_ultra_mask;
                hwif->mwdma_mask = 0x07; /* Multiword DMA 0-2 */
-               hwif->swdma_mask = 0x07; /* Singleword DMA 0-2 */
+               hwif->autodma = 1;
+               hwif->drives[0].autodma = 1;
+               hwif->drives[1].autodma = 1;
        }
 
        /* Reset pulse */
@@ -836,11 +839,6 @@ init_e100_ide (void)
        cris_ide_set_speed(TYPE_UDMA, ATA_UDMA2_CYC, ATA_UDMA2_DVS, 0);
 }
 
-static int cris_dma_off (ide_drive_t *drive)
-{
-       return 0;
-}
-
 static int cris_dma_on (ide_drive_t *drive)
 {
        return 0;
@@ -1012,7 +1010,6 @@ static int cris_config_drive_for_dma (ide_drive_t *drive)
                return 0;
 
        speed_cris_ide(drive, speed);
-       ide_config_drive_speed(drive, speed);
 
        return ide_dma_enable(drive);
 }
@@ -1046,17 +1043,10 @@ static ide_startstop_t cris_dma_intr (ide_drive_t *drive)
 
 static int cris_dma_check(ide_drive_t *drive)
 {
-       ide_hwif_t *hwif = drive->hwif;
-       struct hd_driveid* id = drive->id;
-
-       if (id && (id->capability & 1)) {
-               if (ide_use_dma(drive)) {
-                       if (cris_config_drive_for_dma(drive))
-                               return hwif->ide_dma_on(drive);
-               }
-       }
+       if (ide_use_dma(drive) && cris_config_drive_for_dma(drive))
+               return 0;
 
-       return hwif->ide_dma_off_quietly(drive);
+       return -1;
 }
 
 static int cris_dma_end(ide_drive_t *drive)