ide-cris: always tune PIO
[powerpc.git] / drivers / ide / cris / ide-cris.c
index 7c90218..d88d763 100644 (file)
@@ -716,19 +716,12 @@ static void cris_set_pio_mode(ide_drive_t *drive, const u8 pio)
        }
 
        cris_ide_set_speed(TYPE_PIO, setup, strobe, hold);
-
-       (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio);
 }
 
-static int speed_cris_ide(ide_drive_t *drive, const u8 speed)
+static void cris_set_dma_mode(ide_drive_t *drive, const u8 speed)
 {
        int cyc = 0, dvs = 0, strobe = 0, hold = 0;
 
-       if (speed >= XFER_PIO_0 && speed <= XFER_PIO_4) {
-               cris_set_pio_mode(drive, speed - XFER_PIO_0);
-               return ide_config_drive_speed(drive, speed);
-       }
-
        switch(speed)
        {
                case XFER_UDMA_0:
@@ -764,8 +757,6 @@ static int speed_cris_ide(ide_drive_t *drive, const u8 speed)
                cris_ide_set_speed(TYPE_UDMA, cyc, dvs, 0);
        else
                cris_ide_set_speed(TYPE_DMA, 0, strobe, hold);
-
-       return ide_config_drive_speed(drive, speed);
 }
 
 void __init
@@ -796,7 +787,7 @@ init_e100_ide (void)
                hwif->mmio = 1;
                hwif->chipset = ide_etrax100;
                hwif->set_pio_mode = &cris_set_pio_mode;
-               hwif->speedproc = &speed_cris_ide;
+               hwif->set_dma_mode = &cris_set_dma_mode;
                hwif->ata_input_data = &cris_ide_input_data;
                hwif->ata_output_data = &cris_ide_output_data;
                hwif->atapi_input_bytes = &cris_atapi_input_bytes;
@@ -817,6 +808,8 @@ init_e100_ide (void)
                hwif->dma_off_quietly = &cris_dma_off;
                hwif->cbl = ATA_CBL_PATA40;
                hwif->pio_mask = ATA_PIO4,
+               hwif->drives[0].autotune = 1;
+               hwif->drives[1].autotune = 1;
                hwif->ultra_mask = cris_ultra_mask;
                hwif->mwdma_mask = 0x07; /* Multiword DMA 0-2 */
                hwif->autodma = 1;
@@ -948,7 +941,8 @@ static int cris_ide_build_dmatable (ide_drive_t *drive)
                /* group sequential buffers into one large buffer */
                addr = page_to_phys(sg->page) + sg->offset;
                size = sg_dma_len(sg);
-               while (sg++, --i) {
+               while (--i) {
+                       sg = sg_next(sg);
                        if ((addr + size) != page_to_phys(sg->page) + sg->offset)
                                break;
                        size += sg_dma_len(sg);