diff options
author | David Woodhouse <dwmw2@infradead.org> | 2008-02-03 18:29:41 +1100 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2008-02-03 18:30:32 +1100 |
commit | c1f3ee120bb61045b1c0a3ead620d1d65af47130 (patch) | |
tree | 908430bf2b47fe8e96ac623ae7ab6dd5698d0938 /drivers/ide/legacy/qd65xx.c | |
parent | e619a75ff6201b567a539e787aa9af9bc63a3187 (diff) | |
parent | 9135f1901ee6449dfe338adf6e40e9c2025b8150 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Diffstat (limited to 'drivers/ide/legacy/qd65xx.c')
-rw-r--r-- | drivers/ide/legacy/qd65xx.c | 74 |
1 files changed, 47 insertions, 27 deletions
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c index 912e73853fa..bba29df5f21 100644 --- a/drivers/ide/legacy/qd65xx.c +++ b/drivers/ide/legacy/qd65xx.c @@ -1,6 +1,4 @@ /* - * linux/drivers/ide/legacy/qd65xx.c Version 0.07 Sep 30, 2001 - * * Copyright (C) 1996-2001 Linus Torvalds & author (see below) */ @@ -307,18 +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->chipset = ide_qd65xx; - hwif->channel = hwif->index; hwif->select_data = base; hwif->config_data = config; - hwif->drives[0].drive_data = data0; - hwif->drives[1].drive_data = data1; - hwif->drives[0].io_32bit = - hwif->drives[1].io_32bit = 1; - hwif->pio_mask = ATA_PIO4; +} + +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; } /* @@ -358,6 +371,14 @@ static void __exit qd_unsetup(ide_hwif_t *hwif) } */ +static const struct ide_port_info qd65xx_port_info __initdata = { + .chipset = ide_qd65xx, + .host_flags = IDE_HFLAG_IO_32BIT | + IDE_HFLAG_NO_DMA | + IDE_HFLAG_NO_AUTOTUNE, + .pio_mask = ATA_PIO4, +}; + /* * qd_probe: * @@ -395,13 +416,14 @@ 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[0] = unit; + idx[unit] = unit; - ide_device_add(idx); + ide_device_add(idx, &qd65xx_port_info); return 1; } @@ -428,14 +450,15 @@ 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[0] = unit; + idx[unit] = unit; - ide_device_add(idx); + ide_device_add(idx, &qd65xx_port_info); outb(QD_DEF_CONTR, QD_CONTROL_PORT); @@ -449,20 +472,20 @@ 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; idx[1] = 1; - ide_device_add(idx); + ide_device_add(idx, &qd65xx_port_info); outb(QD_DEF_CONTR, QD_CONTROL_PORT); @@ -478,8 +501,7 @@ 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) +static int __init qd65xx_init(void) { if (probe_qd65xx == 0) return -ENODEV; @@ -492,9 +514,7 @@ int __init qd65xx_init(void) return 0; } -#ifdef MODULE module_init(qd65xx_init); -#endif MODULE_AUTHOR("Samuel Thibault"); MODULE_DESCRIPTION("support of qd65xx vlb ide chipset"); |