]> err.no Git - linux-2.6/blobdiff - drivers/ide/legacy/ht6560b.c
Merge branch 'for-2.6.24' of master.kernel.org:/pub/scm/linux/kernel/git/jwboyer...
[linux-2.6] / drivers / ide / legacy / ht6560b.c
index c8f353b1296f9ca84c50bb8e1f127f2b2e3f3bd3..a4245d13f11b83d2dced3d1f82d33f0caa6c34e7 100644 (file)
@@ -199,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;
                /*
@@ -246,6 +247,8 @@ static u8 ht_pio2timings(ide_drive_t *drive, u8 pio)
        }
 }
 
+static DEFINE_SPINLOCK(ht6560b_lock);
+
 /*
  *  Enable/Disable so called prefetch mode
  */
@@ -253,9 +256,9 @@ static void ht_set_prefetch(ide_drive_t *drive, u8 state)
 {
        unsigned long flags;
        int t = HT_PREFETCH_MODE << 8;
-       
-       spin_lock_irqsave(&ide_lock, flags);
-       
+
+       spin_lock_irqsave(&ht6560b_lock, flags);
+
        /*
         *  Prefetch mode and unmask irq seems to conflict
         */
@@ -267,15 +270,15 @@ static void ht_set_prefetch(ide_drive_t *drive, u8 state)
                drive->drive_data &= ~t;  /* disable prefetch mode */
                drive->no_unmask = 0;
        }
-       
-       spin_unlock_irqrestore(&ide_lock, flags);
-       
+
+       spin_unlock_irqrestore(&ht6560b_lock, flags);
+
 #ifdef DEBUG
        printk("ht6560b: drive %s prefetch mode %sabled\n", drive->name, (state ? "en" : "dis"));
 #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;
@@ -286,16 +289,14 @@ static void tune_ht6560b (ide_drive_t *drive, u8 pio)
                ht_set_prefetch(drive, pio & 1);
                return;
        }
-       
+
        timing = ht_pio2timings(drive, pio);
-       
-       spin_lock_irqsave(&ide_lock, flags);
-       
+
+       spin_lock_irqsave(&ht6560b_lock, flags);
        drive->drive_data &= 0xff00;
        drive->drive_data |= timing;
-       
-       spin_unlock_irqrestore(&ide_lock, flags);
-       
+       spin_unlock_irqrestore(&ht6560b_lock, flags);
+
 #ifdef DEBUG
        printk("ht6560b: drive %s tuned to pio mode %#x timing=%#x\n", drive->name, pio, timing);
 #endif
@@ -310,6 +311,7 @@ MODULE_PARM_DESC(probe, "probe for HT6560B chipset");
 int __init ht6560b_init(void)
 {
        ide_hwif_t *hwif, *mate;
+       static u8 idx[4] = { 0, 1, 0xff, 0xff };
        int t;
 
        if (probe_ht6560b == 0)
@@ -331,13 +333,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;
@@ -354,11 +360,7 @@ int __init ht6560b_init(void)
        mate->drives[0].drive_data = t;
        mate->drives[1].drive_data = t;
 
-       probe_hwif_init(hwif);
-       probe_hwif_init(mate);
-
-       ide_proc_register_port(hwif);
-       ide_proc_register_port(mate);
+       ide_device_add(idx);
 
        return 0;