From ade2daf9c6e57845fe83a24e0a9fa1c03c6e91b1 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 26 Jan 2008 20:13:07 +0100 Subject: ide: make remaining built-in only IDE host drivers modular (take 2) * Make remaining built-in only IDE host drivers modular, add ide-scan-pci.c file for probing PCI host drivers registered with IDE core (special case for built-in IDE and CONFIG_IDEPCI_PCIBUS_ORDER=y) and then take care of the ordering in which all IDE host drivers are probed when IDE is built-in during link time. * Move probing of gayle, falconide, macide, q40ide and buddha (m68k arch specific) host drivers, before PCI ones (no PCI on m68k), ide-cris (cris arch specific), cmd640 (x86 arch specific) and pmac (ppc arch specific). * Move probing of ide-cris (cris arch specific) host driver before cmd640 (x86 arch specific). * Move probing of mpc8xx (ppc specific) host driver before ide-pnp (depends on ISA and none of ppc platform that use mpc8xx supports ISA) and ide-h8300 (h8300 arch specific). * Add "probe_vlb" kernel parameter to cmd640 host driver and update Documentation/ide.txt accordingly. * Make IDE_ARM config option visible so it can also be disabled if needed. * Remove bogus comment from ide.c while at it. v2: * Fix two issues spotted by Sergei: - replace ENOMEM error value by ENOENT in ide-h8300 host driver - fix MODULE_PARM_DESC() in cmd640 host driver Cc: Sergei Shtylyov Cc: Mikael Starvik Cc: Geert Uytterhoeven Cc: Roman Zippel Cc: Benjamin Herrenschmidt Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/legacy/qd65xx.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers/ide/legacy/qd65xx.c') diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c index 912e73853fa..2bac4c1a653 100644 --- a/drivers/ide/legacy/qd65xx.c +++ b/drivers/ide/legacy/qd65xx.c @@ -478,8 +478,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 +491,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"); -- cgit v1.2.3 From 58f189fccc72bb8a91de1854e519b47d64fbdbaa Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:33 +0100 Subject: ide: delete filenames/versions from comments Delete filenames/versions from comments. I'm leaving decisions about adding DRV_VERSION defines and MODULE_VERSION()-s to maintainers of the respective drivers. While at it: * Remove unused VERSION define from ide.c. * Remove unused/stale DRV_VERSION define from au1xxx-ide.c. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/legacy/qd65xx.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/ide/legacy/qd65xx.c') diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c index 2bac4c1a653..37534bb483a 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) */ -- cgit v1.2.3 From c413b9b94d9a8e7548cc4b2e04b7df0439ce76fd Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 2 Feb 2008 19:56:31 +0100 Subject: ide: add struct ide_port_info instances to legacy host drivers * Remove 'struct pci_dev *dev' argument from ide_hwif_setup_dma(). * Un-static ide_hwif_setup_dma() and add CONFIG_BLK_DEV_IDEDMA_PCI=n version. * Add 'const struct ide_port_info *d' argument to ide_device_add[_all](). * Factor out generic ports init from ide_pci_setup_ports() to ide_init_port(), move it to ide-probe.c and call it in in ide_device_add_all() instead of ide_pci_setup_ports(). * Move ->mate setup to ide_device_add_all() from ide_port_init(). * Add IDE_HFLAG_NO_AUTOTUNE host flag for host drivers that don't enable ->autotune currently. * Setup hwif->chipset in ide_init_port() but iff pi->chipset is set (to not override setup done by ide_hwif_configure()). * Add ETRAX host handling to ide_device_add_all(). * cmd640.c: set IDE_HFLAG_ABUSE_* also for CONFIG_BLK_DEV_CMD640_ENHANCED=n. * pmac.c: make pmac_ide_setup_dma() return an error value and move DMA masks setup to pmac_ide_setup_device(). * Add 'struct ide_port_info' instances to legacy host drivers, pass them to ide_device_add() calls and then remove open-coded ports initialization. Reviewed-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/legacy/qd65xx.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'drivers/ide/legacy/qd65xx.c') diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c index 37534bb483a..60a6ed1088d 100644 --- a/drivers/ide/legacy/qd65xx.c +++ b/drivers/ide/legacy/qd65xx.c @@ -308,15 +308,10 @@ static int __init qd_testreg(int port) static void __init qd_setup(ide_hwif_t *hwif, int base, int config, unsigned int data0, unsigned int data1) { - 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; } /* @@ -356,6 +351,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: * @@ -397,9 +400,9 @@ static int __init qd_probe(int base) 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; } @@ -431,9 +434,9 @@ static int __init qd_probe(int base) 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); @@ -460,7 +463,7 @@ static int __init qd_probe(int base) idx[0] = 0; idx[1] = 1; - ide_device_add(idx); + ide_device_add(idx, &qd65xx_port_info); outb(QD_DEF_CONTR, QD_CONTROL_PORT); -- cgit v1.2.3 From 1f2cf8b0014fdfa3141449b508aca25e78c078a7 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 2 Feb 2008 19:56:40 +0100 Subject: 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 --- drivers/ide/legacy/qd65xx.c | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) (limited to 'drivers/ide/legacy/qd65xx.c') 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; -- cgit v1.2.3