aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 19:56:40 +0100
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 19:56:40 +0100
commit1f2cf8b0014fdfa3141449b508aca25e78c078a7 (patch)
tree2bbed83a1c7f5fc037cd64c2af108f081aff4c65 /drivers
parent807b90d0be23b8d088d4369b02539dada70f03f4 (diff)
ide: add ->port_init_devs method to ide_hwif_t
* Add ->port_init_devs method to ide_hwif_t for a host specific initialization of devices on a port. Call the new method from ide_port_init_devices(). * Convert ht6560b, qd65xx and opti621 host drivers to use the new ->port_init_devs method. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ide/ide-probe.c3
-rw-r--r--drivers/ide/legacy/ht6560b.c26
-rw-r--r--drivers/ide/legacy/qd65xx.c44
-rw-r--r--drivers/ide/pci/opti621.c10
4 files changed, 57 insertions, 26 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index fee898c4a77..174c81d8793 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1305,6 +1305,9 @@ static void ide_port_init_devices(ide_hwif_t *hwif)
if ((hwif->host_flags & IDE_HFLAG_NO_AUTOTUNE) == 0)
drive->autotune = 1;
}
+
+ if (hwif->port_init_devs)
+ hwif->port_init_devs(hwif);
}
static void ide_init_port(ide_hwif_t *hwif, unsigned int port,
diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c
index a89cd80d812..02d12c74764 100644
--- a/drivers/ide/legacy/ht6560b.c
+++ b/drivers/ide/legacy/ht6560b.c
@@ -300,6 +300,18 @@ 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)
+{
+ /* 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;
+}
+
int probe_ht6560b = 0;
module_param_named(probe, probe_ht6560b, bool, 0);
@@ -318,7 +330,6 @@ static int __init ht6560b_init(void)
{
ide_hwif_t *hwif, *mate;
static u8 idx[4] = { 0, 1, 0xff, 0xff };
- int t;
if (probe_ht6560b == 0)
return -ENODEV;
@@ -343,17 +354,8 @@ static int __init ht6560b_init(void)
mate->selectproc = &ht6560b_selectproc;
mate->set_pio_mode = &ht6560b_set_pio_mode;
- /*
- * Setting default configurations for drives
- */
- t = (HT_CONFIG_DEFAULT << 8);
- t |= HT_TIMING_DEFAULT;
- hwif->drives[0].drive_data = t;
- hwif->drives[1].drive_data = t;
-
- t |= (HT_SECONDARY_IF << 8);
- mate->drives[0].drive_data = t;
- mate->drives[1].drive_data = t;
+ hwif->port_init_devs = ht6560b_port_init_devs;
+ mate->port_init_devs = ht6560b_port_init_devs;
ide_device_add(idx, &ht6560b_port_info);
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c
index 60a6ed1088d..bba29df5f21 100644
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -305,13 +305,33 @@ static int __init qd_testreg(int port)
* called to setup an ata channel : adjusts attributes & links for tuning
*/
-static void __init qd_setup(ide_hwif_t *hwif, int base, int config,
- unsigned int data0, unsigned int data1)
+static void __init qd_setup(ide_hwif_t *hwif, int base, int config)
{
hwif->select_data = base;
hwif->config_data = config;
- hwif->drives[0].drive_data = data0;
- hwif->drives[1].drive_data = data1;
+}
+
+static void __init qd6500_port_init_devs(ide_hwif_t *hwif)
+{
+ u8 base = hwif->select_data, config = QD_CONFIG(hwif);
+
+ hwif->drives[0].drive_data = QD6500_DEF_DATA;
+ hwif->drives[1].drive_data = QD6500_DEF_DATA;
+}
+
+static void __init qd6580_port_init_devs(ide_hwif_t *hwif)
+{
+ u16 t1, t2;
+ u8 base = hwif->select_data, config = QD_CONFIG(hwif);
+
+ if (QD_CONTROL(hwif) & QD_CONTR_SEC_DISABLED) {
+ t1 = QD6580_DEF_DATA;
+ t2 = QD6580_DEF_DATA2;
+ } else
+ t2 = t1 = hwif->channel ? QD6580_DEF_DATA2 : QD6580_DEF_DATA;
+
+ hwif->drives[0].drive_data = t1;
+ hwif->drives[1].drive_data = t2;
}
/*
@@ -396,8 +416,9 @@ static int __init qd_probe(int base)
return 1;
}
- qd_setup(hwif, base, config, QD6500_DEF_DATA, QD6500_DEF_DATA);
+ qd_setup(hwif, base, config);
+ hwif->port_init_devs = qd6500_port_init_devs;
hwif->set_pio_mode = &qd6500_set_pio_mode;
idx[unit] = unit;
@@ -429,9 +450,10 @@ static int __init qd_probe(int base)
hwif = &ide_hwifs[unit];
printk(KERN_INFO "%s: qd6580: single IDE board\n",
hwif->name);
- qd_setup(hwif, base, config | (control << 8),
- QD6580_DEF_DATA, QD6580_DEF_DATA2);
+ qd_setup(hwif, base, config | (control << 8));
+
+ hwif->port_init_devs = qd6580_port_init_devs;
hwif->set_pio_mode = &qd6580_set_pio_mode;
idx[unit] = unit;
@@ -450,14 +472,14 @@ static int __init qd_probe(int base)
printk(KERN_INFO "%s&%s: qd6580: dual IDE board\n",
hwif->name, mate->name);
- qd_setup(hwif, base, config | (control << 8),
- QD6580_DEF_DATA, QD6580_DEF_DATA);
+ qd_setup(hwif, base, config | (control << 8));
+ hwif->port_init_devs = qd6580_port_init_devs;
hwif->set_pio_mode = &qd6580_set_pio_mode;
- qd_setup(mate, base, config | (control << 8),
- QD6580_DEF_DATA2, QD6580_DEF_DATA2);
+ qd_setup(mate, base, config | (control << 8));
+ mate->port_init_devs = qd6580_port_init_devs;
mate->set_pio_mode = &qd6580_set_pio_mode;
idx[0] = 0;
diff --git a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c
index 1e532c9a97f..46e8748f507 100644
--- a/drivers/ide/pci/opti621.c
+++ b/drivers/ide/pci/opti621.c
@@ -315,14 +315,18 @@ static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio)
spin_unlock_irqrestore(&opti621_lock, flags);
}
+static void __devinit opti621_port_init_devs(ide_hwif_t *hwif)
+{
+ hwif->drives[0].drive_data = PIO_DONT_KNOW;
+ hwif->drives[1].drive_data = PIO_DONT_KNOW;
+}
+
/*
* init_hwif_opti621() is called once for each hwif found at boot.
*/
static void __devinit init_hwif_opti621 (ide_hwif_t *hwif)
{
- hwif->drives[0].drive_data = PIO_DONT_KNOW;
- hwif->drives[1].drive_data = PIO_DONT_KNOW;
-
+ hwif->port_init_devs = opti621_port_init_devs;
hwif->set_pio_mode = &opti621_set_pio_mode;
}