]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/ide/pci/cmd640.c
Merge branch 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6
[mv-sheeva.git] / drivers / ide / pci / cmd640.c
index 61b5f9c0b2f4da7620b8655b43afed4d580bc460..f369645e4d1645ce91651df6742c78302fc3752b 100644 (file)
@@ -98,7 +98,6 @@
  *                      (patch courtesy of Zoltan Hidvegi)
  */
 
-#undef REALLY_SLOW_IO          /* most systems can safely undef this */
 #define CMD640_PREFETCH_MASKS 1
 
 //#define CMD640_DUMP_REGS
@@ -629,50 +628,42 @@ static void cmd640_set_mode (unsigned int index, u8 pio_mode, unsigned int cycle
        program_drive_counts (index);
 }
 
-/*
- * Drive PIO mode selection:
- */
-static void cmd640_tune_drive (ide_drive_t *drive, u8 mode_wanted)
+static void cmd640_set_pio_mode(ide_drive_t *drive, const u8 pio)
 {
+       unsigned int index = 0, cycle_time;
        u8 b;
-       ide_pio_data_t  d;
-       unsigned int index = 0;
 
        while (drive != cmd_drives[index]) {
                if (++index > 3) {
-                       printk("%s: bad news in cmd640_tune_drive\n", drive->name);
+                       printk(KERN_ERR "%s: bad news in %s\n",
+                                       drive->name, __FUNCTION__);
                        return;
                }
        }
-       switch (mode_wanted) {
+       switch (pio) {
                case 6: /* set fast-devsel off */
                case 7: /* set fast-devsel on */
-                       mode_wanted &= 1;
                        b = get_cmd640_reg(CNTRL) & ~0x27;
-                       if (mode_wanted)
+                       if (pio & 1)
                                b |= 0x27;
                        put_cmd640_reg(CNTRL, b);
-                       printk("%s: %sabled cmd640 fast host timing (devsel)\n", drive->name, mode_wanted ? "en" : "dis");
+                       printk("%s: %sabled cmd640 fast host timing (devsel)\n", drive->name, (pio & 1) ? "en" : "dis");
                        return;
 
                case 8: /* set prefetch off */
                case 9: /* set prefetch on */
-                       mode_wanted &= 1;
-                       set_prefetch_mode(index, mode_wanted);
-                       printk("%s: %sabled cmd640 prefetch\n", drive->name, mode_wanted ? "en" : "dis");
+                       set_prefetch_mode(index, pio & 1);
+                       printk("%s: %sabled cmd640 prefetch\n", drive->name, (pio & 1) ? "en" : "dis");
                        return;
        }
 
-       (void) ide_get_best_pio_mode (drive, mode_wanted, 5, &d);
-       cmd640_set_mode (index, d.pio_mode, d.cycle_time);
+       cycle_time = ide_pio_cycle_time(drive, pio);
+       cmd640_set_mode(index, pio, cycle_time);
+
+       printk("%s: selected cmd640 PIO mode%d (%dns)",
+               drive->name, pio, cycle_time);
 
-       printk ("%s: selected cmd640 PIO mode%d (%dns)%s",
-               drive->name,
-               d.pio_mode,
-               d.cycle_time,
-               d.overridden ? " (overriding vendor mode)" : "");
        display_clocks(index);
-       return;
 }
 
 #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
@@ -770,7 +761,10 @@ int __init ide_probe_for_cmd640x (void)
               cmd_hwif0->name, 'a' + cmd640_chip_version - 1, bus_type, cfr);
        cmd_hwif0->chipset = ide_cmd640;
 #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
-       cmd_hwif0->tuneproc = &cmd640_tune_drive;
+       cmd_hwif0->host_flags = IDE_HFLAG_ABUSE_PREFETCH |
+                               IDE_HFLAG_ABUSE_FAST_DEVSEL;
+       cmd_hwif0->pio_mask = ATA_PIO5;
+       cmd_hwif0->set_pio_mode = &cmd640_set_pio_mode;
 #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
 
        /*
@@ -825,7 +819,10 @@ int __init ide_probe_for_cmd640x (void)
                cmd_hwif1->mate = cmd_hwif0;
                cmd_hwif1->channel = 1;
 #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
-               cmd_hwif1->tuneproc = &cmd640_tune_drive;
+               cmd_hwif1->host_flags = IDE_HFLAG_ABUSE_PREFETCH |
+                                       IDE_HFLAG_ABUSE_FAST_DEVSEL;
+               cmd_hwif1->pio_mask = ATA_PIO5;
+               cmd_hwif1->set_pio_mode = &cmd640_set_pio_mode;
 #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
        }
        printk(KERN_INFO "%s: %sserialized, secondary interface %s\n", cmd_hwif1->name,