]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/ide/ppc/pmac.c
ide-pmac: convert to use ide_timing_find_mode()
[karo-tx-linux.git] / drivers / ide / ppc / pmac.c
index ba2d58727964f2bfa6a527b683535035da2da3b1..cfa103a51b314e5ea8d3faf2425dd3e58c30b3d9 100644 (file)
@@ -5,7 +5,7 @@
  * for doing DMA.
  *
  *  Copyright (C) 1998-2003 Paul Mackerras & Ben. Herrenschmidt
- *  Copyright (C)      2007 Bartlomiej Zolnierkiewicz
+ *  Copyright (C) 2007-2008 Bartlomiej Zolnierkiewicz
  *
  *  This program is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU General Public License
@@ -48,8 +48,6 @@
 #include <asm/mediabay.h>
 #endif
 
-#include "../ide-timing.h"
-
 #undef IDE_PMAC_DEBUG
 
 #define DMA_WAIT_TIMEOUT       50
@@ -480,13 +478,13 @@ pmac_ide_do_update_timings(ide_drive_t *drive)
                pmac_ide_selectproc(drive);
 }
 
-static void
-pmac_outbsync(ide_drive_t *drive, u8 value, unsigned long port)
+static void pmac_outbsync(ide_hwif_t *hwif, u8 value, unsigned long port)
 {
        u32 tmp;
        
        writeb(value, (void __iomem *) port);
-       tmp = readl(PMAC_IDE_REG(IDE_TIMING_CONFIG));
+       tmp = readl((void __iomem *)(hwif->io_ports.data_addr
+                                    + IDE_TIMING_CONFIG));
 }
 
 /*
@@ -495,6 +493,7 @@ pmac_outbsync(ide_drive_t *drive, u8 value, unsigned long port)
 static void
 pmac_ide_set_pio_mode(ide_drive_t *drive, const u8 pio)
 {
+       struct ide_timing *tim = ide_timing_find_mode(XFER_PIO_0 + pio);
        u32 *timings, t;
        unsigned accessTicks, recTicks;
        unsigned accessTime, recTime;
@@ -526,10 +525,9 @@ pmac_ide_set_pio_mode(ide_drive_t *drive, const u8 pio)
                }
        case controller_kl_ata4:
                /* 66Mhz cell */
-               recTime = cycle_time - ide_pio_timings[pio].active_time
-                               - ide_pio_timings[pio].setup_time;
+               recTime = cycle_time - tim->active - tim->setup;
                recTime = max(recTime, 150U);
-               accessTime = ide_pio_timings[pio].active_time;
+               accessTime = tim->active;
                accessTime = max(accessTime, 150U);
                accessTicks = SYSCLK_TICKS_66(accessTime);
                accessTicks = min(accessTicks, 0x1fU);
@@ -542,10 +540,9 @@ pmac_ide_set_pio_mode(ide_drive_t *drive, const u8 pio)
        default: {
                /* 33Mhz cell */
                int ebit = 0;
-               recTime = cycle_time - ide_pio_timings[pio].active_time
-                               - ide_pio_timings[pio].setup_time;
+               recTime = cycle_time - tim->active - tim->setup;
                recTime = max(recTime, 150U);
-               accessTime = ide_pio_timings[pio].active_time;
+               accessTime = tim->active;
                accessTime = max(accessTime, 150U);
                accessTicks = SYSCLK_TICKS(accessTime);
                accessTicks = min(accessTicks, 0x1fU);