]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/legacy/qd65xx.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog
[linux-2.6-omap-h63xx.git] / drivers / ide / legacy / qd65xx.c
index 563fab0098beb74bfc7e97754a89b6b11e7afac0..8b87a424094adec1a7be378d2b5b51082b3267a4 100644 (file)
@@ -16,8 +16,8 @@
  * Please set local bus speed using kernel parameter idebus
  *     for example, "idebus=33" stands for 33Mhz VLbus
  * To activate controller support, use "ide0=qd65xx"
- * To enable tuning, use "ide0=autotune"
- * To enable second channel tuning (qd6580 only), use "ide1=autotune"
+ * To enable tuning, use "hda=autotune hdb=autotune"
+ * To enable 2nd channel tuning (qd6580 only), use "hdc=autotune hdd=autotune"
  */
 
 /*
  * Samuel Thibault <samuel.thibault@fnac.net>
  */
 
-#undef REALLY_SLOW_IO          /* most systems can safely undef this */
-
 #include <linux/module.h>
-#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/delay.h>
@@ -255,39 +252,38 @@ static void qd6500_tune_drive (ide_drive_t *drive, u8 pio)
 
 static void qd6580_tune_drive (ide_drive_t *drive, u8 pio)
 {
-       ide_pio_data_t d;
        int base = HWIF(drive)->select_data;
+       unsigned int cycle_time;
        int active_time   = 175;
        int recovery_time = 415; /* worst case values from the dos driver */
 
        if (drive->id && !qd_find_disk_type(drive, &active_time, &recovery_time)) {
-               pio = ide_get_best_pio_mode(drive, pio, 255, &d);
-               pio = min_t(u8, pio, 4);
+               pio = ide_get_best_pio_mode(drive, pio, 4);
+               cycle_time = ide_pio_cycle_time(drive, pio);
 
                switch (pio) {
                        case 0: break;
                        case 3:
-                               if (d.cycle_time >= 110) {
+                               if (cycle_time >= 110) {
                                        active_time = 86;
-                                       recovery_time = d.cycle_time - 102;
+                                       recovery_time = cycle_time - 102;
                                } else
                                        printk(KERN_WARNING "%s: Strange recovery time !\n",drive->name);
                                break;
                        case 4:
-                               if (d.cycle_time >= 69) {
+                               if (cycle_time >= 69) {
                                        active_time = 70;
-                                       recovery_time = d.cycle_time - 61;
+                                       recovery_time = cycle_time - 61;
                                } else
                                        printk(KERN_WARNING "%s: Strange recovery time !\n",drive->name);
                                break;
                        default:
-                               if (d.cycle_time >= 180) {
+                               if (cycle_time >= 180) {
                                        active_time = 110;
-                                       recovery_time = d.cycle_time - 120;
+                                       recovery_time = cycle_time - 120;
                                } else {
                                        active_time = ide_pio_timings[pio].active_time;
-                                       recovery_time = d.cycle_time
-                                                       -active_time;
+                                       recovery_time = cycle_time - active_time;
                                }
                }
                printk(KERN_INFO "%s: PIO mode%d\n", drive->name,pio);
@@ -350,6 +346,7 @@ static void __init qd_setup(ide_hwif_t *hwif, int base, int config,
        hwif->drives[1].drive_data = data1;
        hwif->drives[0].io_32bit =
        hwif->drives[1].io_32bit = 1;
+       hwif->pio_mask = ATA_PIO4;
        hwif->tuneproc = tuneproc;
        probe_hwif_init(hwif);
 }
@@ -430,7 +427,7 @@ static int __init qd_probe(int base)
                qd_setup(hwif, base, config, QD6500_DEF_DATA, QD6500_DEF_DATA,
                         &qd6500_tune_drive);
 
-               create_proc_ide_interfaces();
+               ide_proc_register_port(hwif);
 
                return 1;
        }
@@ -462,7 +459,7 @@ static int __init qd_probe(int base)
                                 &qd6580_tune_drive);
                        qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT);
 
-                       create_proc_ide_interfaces();
+                       ide_proc_register_port(hwif);
 
                        return 1;
                } else {
@@ -482,7 +479,8 @@ static int __init qd_probe(int base)
                                 &qd6580_tune_drive);
                        qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT);
 
-                       create_proc_ide_interfaces();
+                       ide_proc_register_port(hwif);
+                       ide_proc_register_port(mate);
 
                        return 0; /* no other qd65xx possible */
                }
@@ -491,9 +489,17 @@ static int __init qd_probe(int base)
        return 1;
 }
 
+int probe_qd65xx = 0;
+
+module_param_named(probe, probe_qd65xx, bool, 0);
+MODULE_PARM_DESC(probe, "probe for QD65xx chipsets");
+
 /* Can be called directly from ide.c. */
 int __init qd65xx_init(void)
 {
+       if (probe_qd65xx == 0)
+               return -ENODEV;
+
        if (qd_probe(0x30))
                qd_probe(0xb0);
        if (ide_hwifs[0].chipset != ide_qd65xx &&