]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/legacy/ht6560b.c
triflex: always tune PIO
[linux-2.6-omap-h63xx.git] / drivers / ide / legacy / ht6560b.c
index 19ccd006f205ae1a329c16ad64a76e29adae7ac1..2e5a9cc5c0f7ab1a48a2b26bef35ca12922f4837 100644 (file)
@@ -36,8 +36,6 @@
 
 #define HT6560B_VERSION "v0.07"
 
-#undef REALLY_SLOW_IO          /* most systems can safely undef this */
-
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
@@ -201,23 +199,24 @@ static int __init try_to_init_ht6560b(void)
        return 1;
 }
 
-static u8 ht_pio2timings(ide_drive_t *drive, u8 pio)
+static u8 ht_pio2timings(ide_drive_t *drive, const u8 pio)
 {
        int active_time, recovery_time;
        int active_cycles, recovery_cycles;
-       ide_pio_data_t d;
        int bus_speed = system_bus_clock();
        
         if (pio) {
-               pio = ide_get_best_pio_mode(drive, pio, 5, &d);
-               
+               unsigned int cycle_time;
+
+               cycle_time = ide_pio_cycle_time(drive, pio);
+
                /*
                 *  Just like opti621.c we try to calculate the
                 *  actual cycle time for recovery and activity
                 *  according system bus speed.
                 */
                active_time = ide_pio_timings[pio].active_time;
-               recovery_time = d.cycle_time 
+               recovery_time = cycle_time
                        - active_time
                        - ide_pio_timings[pio].setup_time;
                /*
@@ -277,7 +276,7 @@ static void ht_set_prefetch(ide_drive_t *drive, u8 state)
 #endif
 }
 
-static void tune_ht6560b (ide_drive_t *drive, u8 pio)
+static void ht6560b_set_pio_mode(ide_drive_t *drive, const u8 pio)
 {
        unsigned long flags;
        u8 timing;
@@ -303,12 +302,20 @@ static void tune_ht6560b (ide_drive_t *drive, u8 pio)
 #endif
 }
 
+int probe_ht6560b = 0;
+
+module_param_named(probe, probe_ht6560b, bool, 0);
+MODULE_PARM_DESC(probe, "probe for HT6560B chipset");
+
 /* Can be called directly from ide.c. */
 int __init ht6560b_init(void)
 {
        ide_hwif_t *hwif, *mate;
        int t;
 
+       if (probe_ht6560b == 0)
+               return -ENODEV;
+
        hwif = &ide_hwifs[0];
        mate = &ide_hwifs[1];
 
@@ -325,13 +332,17 @@ int __init ht6560b_init(void)
 
        hwif->chipset = ide_ht6560b;
        hwif->selectproc = &ht6560b_selectproc;
-       hwif->tuneproc = &tune_ht6560b;
+       hwif->host_flags = IDE_HFLAG_ABUSE_PREFETCH;
+       hwif->pio_mask = ATA_PIO5;
+       hwif->set_pio_mode = &ht6560b_set_pio_mode;
        hwif->serialized = 1;   /* is this needed? */
        hwif->mate = mate;
 
        mate->chipset = ide_ht6560b;
        mate->selectproc = &ht6560b_selectproc;
-       mate->tuneproc = &tune_ht6560b;
+       mate->host_flags = IDE_HFLAG_ABUSE_PREFETCH;
+       mate->pio_mask = ATA_PIO5;
+       mate->set_pio_mode = &ht6560b_set_pio_mode;
        mate->serialized = 1;   /* is this needed? */
        mate->mate = hwif;
        mate->channel = 1;
@@ -351,7 +362,8 @@ int __init ht6560b_init(void)
        probe_hwif_init(hwif);
        probe_hwif_init(mate);
 
-       create_proc_ide_interfaces();
+       ide_proc_register_port(hwif);
+       ide_proc_register_port(mate);
 
        return 0;