if (cmd->tf_flags & IDE_TFLAG_WRITE) {
 #ifdef TRM290_NO_DMA_WRITES
                /* always use PIO for writes */
-               trm290_prepare_drive(drive, 0); /* select PIO xfer */
                return 1;
 #endif
                rw = 1;
        if (count == 0) {
                ide_map_sg(drive, cmd);
                /* try PIO instead of DMA */
-               trm290_prepare_drive(drive, 0); /* select PIO xfer */
                return 1;
        }
-       /* select DMA xfer */
-       trm290_prepare_drive(drive, 1);
        outl(hwif->dmatable_dma | rw, hwif->dma_base);
        drive->waiting_for_dma = 1;
        /* start DMA */
 
 static void trm290_dma_start(ide_drive_t *drive)
 {
+       trm290_prepare_drive(drive, 1);
 }
 
 static int trm290_dma_end(ide_drive_t *drive)
 
        status = inw(drive->hwif->dma_base + 2);
 
+       trm290_prepare_drive(drive, 0);
+
        return status != 0x00ff;
 }