]> err.no Git - linux-2.6/blobdiff - drivers/ide/legacy/ali14xx.c
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
[linux-2.6] / drivers / ide / legacy / ali14xx.c
index f9f5b8d54d6d799ff4f346553c1c288f6feadac8..2f0ef9b440335d9e1f6654c54424a4faa30b145a 100644 (file)
@@ -68,8 +68,6 @@ static RegInitializer initData[] __initdata = {
        {0x35, 0x03}, {0x00, 0x00}
 };
 
-#define ALI_MAX_PIO 4
-
 /* timing parameter registers for each drive */
 static struct { u8 reg1, reg2, reg3, reg4; } regTab[4] = {
        {0x03, 0x26, 0x04, 0x27},     /* drive 0 */
@@ -109,19 +107,16 @@ static void outReg (u8 data, u8 reg)
  * This function computes timing parameters
  * and sets controller registers accordingly.
  */
-static void ali14xx_tune_drive (ide_drive_t *drive, u8 pio)
+static void ali14xx_set_pio_mode(ide_drive_t *drive, const u8 pio)
 {
        int driveNum;
        int time1, time2;
        u8 param1, param2, param3, param4;
        unsigned long flags;
-       ide_pio_data_t d;
        int bus_speed = system_bus_clock();
 
-       pio = ide_get_best_pio_mode(drive, pio, ALI_MAX_PIO, &d);
-
        /* calculate timing, according to PIO mode */
-       time1 = d.cycle_time;
+       time1 = ide_pio_cycle_time(drive, pio);
        time2 = ide_pio_timings[pio].active_time;
        param3 = param1 = (time2 * bus_speed + 999) / 1000;
        param4 = param2 = (time1 * bus_speed + 999) / 1000 - param1;
@@ -212,25 +207,36 @@ static int __init ali14xx_probe(void)
        mate = &ide_hwifs[1];
 
        hwif->chipset = ide_ali14xx;
-       hwif->tuneproc = &ali14xx_tune_drive;
+       hwif->pio_mask = ATA_PIO4;
+       hwif->set_pio_mode = &ali14xx_set_pio_mode;
        hwif->mate = mate;
 
        mate->chipset = ide_ali14xx;
-       mate->tuneproc = &ali14xx_tune_drive;
+       mate->pio_mask = ATA_PIO4;
+       mate->set_pio_mode = &ali14xx_set_pio_mode;
        mate->mate = hwif;
        mate->channel = 1;
 
        probe_hwif_init(hwif);
        probe_hwif_init(mate);
 
-       create_proc_ide_interfaces();
+       ide_proc_register_port(hwif);
+       ide_proc_register_port(mate);
 
        return 0;
 }
 
+int probe_ali14xx = 0;
+
+module_param_named(probe, probe_ali14xx, bool, 0);
+MODULE_PARM_DESC(probe, "probe for ALI M14xx chipsets");
+
 /* Can be called directly from ide.c. */
 int __init ali14xx_init(void)
 {
+       if (probe_ali14xx == 0)
+               goto out;
+
        /* auto-detect IDE controller port */
        if (findPort()) {
                if (ali14xx_probe())
@@ -238,6 +244,7 @@ int __init ali14xx_init(void)
                return 0;
        }
        printk(KERN_ERR "ali14xx: not found.\n");
+out:
        return -ENODEV;
 }