]> err.no Git - linux-2.6/blobdiff - drivers/ide/legacy/ht6560b.c
Merge branch 'for-linus' of git://neil.brown.name/md
[linux-2.6] / drivers / ide / legacy / ht6560b.c
index 88fe9070c9c30668878ac79eb75853ab4cbe0392..7bc8fd59ea9ee336dbcab2a5981c0bf696df6401 100644 (file)
@@ -35,6 +35,7 @@
  *  Try:  http://www.maf.iki.fi/~maf/ht6560b/
  */
 
+#define DRV_NAME       "ht6560b"
 #define HT6560B_VERSION "v0.08"
 
 #include <linux/module.h>
@@ -156,8 +157,8 @@ static void ht6560b_selectproc (ide_drive_t *drive)
                /*
                 * Set timing for this drive:
                 */
-               outb(timing, hwif->io_ports[IDE_SELECT_OFFSET]);
-               (void)inb(hwif->io_ports[IDE_STATUS_OFFSET]);
+               outb(timing, hwif->io_ports.device_addr);
+               (void)inb(hwif->io_ports.status_addr);
 #ifdef DEBUG
                printk("ht6560b: %s: select=%#x timing=%#x\n",
                        drive->name, select, timing);
@@ -211,10 +212,11 @@ static u8 ht_pio2timings(ide_drive_t *drive, const u8 pio)
 {
        int active_time, recovery_time;
        int active_cycles, recovery_cycles;
-       int bus_speed = system_bus_clock();
-       
+       int bus_speed = ide_vlb_clk ? ide_vlb_clk : 50;
+
         if (pio) {
                unsigned int cycle_time;
+               struct ide_timing *t = ide_timing_find_mode(XFER_PIO_0 + pio);
 
                cycle_time = ide_pio_cycle_time(drive, pio);
 
@@ -223,10 +225,8 @@ static u8 ht_pio2timings(ide_drive_t *drive, const u8 pio)
                 *  actual cycle time for recovery and activity
                 *  according system bus speed.
                 */
-               active_time = ide_pio_timings[pio].active_time;
-               recovery_time = cycle_time
-                       - active_time
-                       - ide_pio_timings[pio].setup_time;
+               active_time = t->active;
+               recovery_time = cycle_time - active_time - t->setup;
                /*
                 *  Cycle times should be Vesa bus cycles
                 */
@@ -310,78 +310,56 @@ static void ht6560b_set_pio_mode(ide_drive_t *drive, const u8 pio)
 #endif
 }
 
-static void __init ht6560b_port_init_devs(ide_hwif_t *hwif)
+static void __init ht6560b_init_dev(ide_drive_t *drive)
 {
+       ide_hwif_t *hwif = drive->hwif;
        /* Setting default configurations for drives. */
        int t = (HT_CONFIG_DEFAULT << 8) | HT_TIMING_DEFAULT;
 
        if (hwif->channel)
                t |= (HT_SECONDARY_IF << 8);
 
-       hwif->drives[0].drive_data = t;
-       hwif->drives[1].drive_data = t;
+       drive->drive_data = t;
 }
 
-int probe_ht6560b = 0;
+static int probe_ht6560b;
 
 module_param_named(probe, probe_ht6560b, bool, 0);
 MODULE_PARM_DESC(probe, "probe for HT6560B chipset");
 
+static const struct ide_port_ops ht6560b_port_ops = {
+       .init_dev               = ht6560b_init_dev,
+       .set_pio_mode           = ht6560b_set_pio_mode,
+       .selectproc             = ht6560b_selectproc,
+};
+
 static const struct ide_port_info ht6560b_port_info __initdata = {
+       .name                   = DRV_NAME,
        .chipset                = ide_ht6560b,
+       .port_ops               = &ht6560b_port_ops,
        .host_flags             = IDE_HFLAG_SERIALIZE | /* is this needed? */
                                  IDE_HFLAG_NO_DMA |
-                                 IDE_HFLAG_NO_AUTOTUNE |
                                  IDE_HFLAG_ABUSE_PREFETCH,
        .pio_mask               = ATA_PIO4,
 };
 
 static int __init ht6560b_init(void)
 {
-       ide_hwif_t *hwif, *mate;
-       static u8 idx[4] = { 0, 1, 0xff, 0xff };
-       hw_regs_t hw[2];
-
        if (probe_ht6560b == 0)
                return -ENODEV;
 
-       hwif = &ide_hwifs[0];
-       mate = &ide_hwifs[1];
-
-       if (!request_region(HT_CONFIG_PORT, 1, hwif->name)) {
+       if (!request_region(HT_CONFIG_PORT, 1, DRV_NAME)) {
                printk(KERN_NOTICE "%s: HT_CONFIG_PORT not found\n",
-                       __FUNCTION__);
+                       __func__);
                return -ENODEV;
        }
 
        if (!try_to_init_ht6560b()) {
-               printk(KERN_NOTICE "%s: HBA not found\n", __FUNCTION__);
+               printk(KERN_NOTICE "%s: HBA not found\n", __func__);
                goto release_region;
        }
 
-       memset(&hw, 0, sizeof(hw));
-
-       ide_std_init_ports(&hw[0], 0x1f0, 0x3f6);
-       hw[0].irq = 14;
-
-       ide_std_init_ports(&hw[1], 0x170, 0x376);
-       hw[1].irq = 15;
-
-       ide_init_port_hw(hwif, &hw[0]);
-       ide_init_port_hw(mate, &hw[1]);
-
-       hwif->selectproc = &ht6560b_selectproc;
-       hwif->set_pio_mode = &ht6560b_set_pio_mode;
-
-       mate->selectproc = &ht6560b_selectproc;
-       mate->set_pio_mode = &ht6560b_set_pio_mode;
-
-       hwif->port_init_devs = ht6560b_port_init_devs;
-       mate->port_init_devs = ht6560b_port_init_devs;
-
-       ide_device_add(idx, &ht6560b_port_info);
-
-       return 0;
+       return ide_legacy_device_add(&ht6560b_port_info, 0);
 
 release_region:
        release_region(HT_CONFIG_PORT, 1);