Skip to content

Commit

Permalink
ide: make remaining built-in only IDE host drivers modular (take 2)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Cc: Mikael Starvik <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Cc: Roman Zippel <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
  • Loading branch information
bzolnier committed Jan 26, 2008
1 parent 8ac4ce7 commit ade2daf
Show file tree
Hide file tree
Showing 30 changed files with 171 additions and 221 deletions.
9 changes: 5 additions & 4 deletions Documentation/ide.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
***
*** The CMD640 is also used on some Vesa Local Bus (VLB) cards, and is *NOT*
*** automatically detected by Linux. For safe, reliable operation with such
*** interfaces, one *MUST* use the "ide0=cmd640_vlb" kernel option.
*** interfaces, one *MUST* use the "cmd640.probe_vlb" kernel option.
***
*** Use of the "serialize" option is no longer necessary.

Expand Down Expand Up @@ -292,9 +292,6 @@ The following are valid ONLY on ide0, which usually corresponds
to the first ATA interface found on the particular host, and the defaults for
the base,ctl ports must not be altered.

"ide0=cmd640_vlb" : *REQUIRED* for VLB cards with the CMD640 chip
(not for PCI -- automatically detected)

"ide=doubler" : probe/support IDE doublers on Amiga

There may be more options than shown -- use the source, Luke!
Expand All @@ -310,6 +307,10 @@ i.e. to enable probing for ALI M14xx chipsets (ali14xx host driver) use:
* "probe" module parameter when ali14xx driver is compiled as module
("modprobe ali14xx probe")

Also for legacy CMD640 host driver (cmd640) you need to use "probe_vlb"
kernel paremeter to enable probing for VLB version of the chipset (PCI ones
are detected automatically).

================================================================================

IDE ATAPI streaming tape driver
Expand Down
26 changes: 14 additions & 12 deletions drivers/ide/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ config BLK_DEV_PLATFORM
If unsure, say N.

config BLK_DEV_CMD640
bool "CMD640 chipset bugfix/support"
tristate "CMD640 chipset bugfix/support"
depends on X86
---help---
The CMD-Technologies CMD640 IDE chip is used on many common 486 and
Expand Down Expand Up @@ -359,7 +359,7 @@ config BLK_DEV_CMD640_ENHANCED
Otherwise say N.

config BLK_DEV_IDEPNP
bool "PNP EIDE support"
tristate "PNP EIDE support"
depends on PNP
help
If you have a PnP (Plug and Play) compatible EIDE card and
Expand Down Expand Up @@ -788,7 +788,7 @@ config BLK_DEV_CELLEB
endif

config BLK_DEV_IDE_PMAC
bool "Builtin PowerMac IDE support"
tristate "Builtin PowerMac IDE support"
depends on PPC_PMAC && IDE=y && BLK_DEV_IDE=y
help
This driver provides support for the built-in IDE controller on
Expand Down Expand Up @@ -842,7 +842,9 @@ config BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ
depends on BLK_DEV_IDE_AU1XXX

config IDE_ARM
def_bool ARM && (ARCH_CLPS7500 || ARCH_RPC || ARCH_SHARK)
tristate "ARM IDE support"
depends on ARM && (ARCH_CLPS7500 || ARCH_RPC || ARCH_SHARK)
default y

config BLK_DEV_IDE_ICSIDE
tristate "ICS IDE interface support"
Expand Down Expand Up @@ -874,7 +876,7 @@ config BLK_DEV_IDE_BAST
Simtec BAST or the Thorcom VR1000

config ETRAX_IDE
bool "ETRAX IDE support"
tristate "ETRAX IDE support"
depends on CRIS && BROKEN
select BLK_DEV_IDEDMA
help
Expand Down Expand Up @@ -908,14 +910,14 @@ config ETRAX_IDE_G27_RESET
endchoice

config IDE_H8300
bool "H8300 IDE support"
tristate "H8300 IDE support"
depends on H8300
default y
help
Enables the H8300 IDE driver.

config BLK_DEV_GAYLE
bool "Amiga Gayle IDE interface support"
tristate "Amiga Gayle IDE interface support"
depends on AMIGA
help
This is the IDE driver for the Amiga Gayle IDE interface. It supports
Expand Down Expand Up @@ -946,7 +948,7 @@ config BLK_DEV_IDEDOUBLER
runtime using the "ide=doubler" kernel boot parameter.

config BLK_DEV_BUDDHA
bool "Buddha/Catweasel/X-Surf IDE interface support (EXPERIMENTAL)"
tristate "Buddha/Catweasel/X-Surf IDE interface support (EXPERIMENTAL)"
depends on ZORRO && EXPERIMENTAL
help
This is the IDE driver for the IDE interfaces on the Buddha,
Expand All @@ -958,7 +960,7 @@ config BLK_DEV_BUDDHA
to one of its IDE interfaces.

config BLK_DEV_FALCON_IDE
bool "Falcon IDE interface support"
tristate "Falcon IDE interface support"
depends on ATARI
help
This is the IDE driver for the builtin IDE interface on the Atari
Expand All @@ -967,7 +969,7 @@ config BLK_DEV_FALCON_IDE
interface.

config BLK_DEV_MAC_IDE
bool "Macintosh Quadra/Powerbook IDE interface support"
tristate "Macintosh Quadra/Powerbook IDE interface support"
depends on MAC
help
This is the IDE driver for the builtin IDE interface on some m68k
Expand All @@ -980,15 +982,15 @@ config BLK_DEV_MAC_IDE
builtin IDE interface.

config BLK_DEV_Q40IDE
bool "Q40/Q60 IDE interface support"
tristate "Q40/Q60 IDE interface support"
depends on Q40
help
Enable the on-board IDE controller in the Q40/Q60. This should
normally be on; disable it only if you are running a custom hard
drive subsystem through an expansion card.

config BLK_DEV_MPC8xx_IDE
bool "MPC8xx IDE support"
tristate "MPC8xx IDE support"
depends on 8xx && (LWMON || IVMS8 || IVML24 || TQM8xxL) && IDE=y && BLK_DEV_IDE=y && !PPC_MERGE
help
This option provides support for IDE on Motorola MPC8xx Systems.
Expand Down
58 changes: 34 additions & 24 deletions drivers/ide/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,58 @@
# Note : at this point, these files are compiled on all systems.
# In the future, some of these should be built conditionally.
#
# First come modules that register themselves with the core
# link order is important here

EXTRA_CFLAGS += -Idrivers/ide

obj-$(CONFIG_BLK_DEV_IDE) += pci/

ide-core-y += ide.o ide-io.o ide-iops.o ide-lib.o ide-probe.o ide-taskfile.o

ide-core-$(CONFIG_BLK_DEV_CMD640) += pci/cmd640.o

# Core IDE code - must come before legacy
# core IDE code
ide-core-$(CONFIG_BLK_DEV_IDEPCI) += setup-pci.o
ide-core-$(CONFIG_BLK_DEV_IDEDMA) += ide-dma.o
ide-core-$(CONFIG_IDE_PROC_FS) += ide-proc.o
ide-core-$(CONFIG_BLK_DEV_IDEPNP) += ide-pnp.o
ide-core-$(CONFIG_BLK_DEV_IDEACPI) += ide-acpi.o

# built-in only drivers from arm/
ide-core-$(CONFIG_IDE_ARM) += arm/ide_arm.o
obj-$(CONFIG_BLK_DEV_IDE) += ide-core.o

# built-in only drivers from legacy/
ide-core-$(CONFIG_BLK_DEV_BUDDHA) += legacy/buddha.o
ide-core-$(CONFIG_BLK_DEV_FALCON_IDE) += legacy/falconide.o
ide-core-$(CONFIG_BLK_DEV_GAYLE) += legacy/gayle.o
ide-core-$(CONFIG_BLK_DEV_MAC_IDE) += legacy/macide.o
ide-core-$(CONFIG_BLK_DEV_Q40IDE) += legacy/q40ide.o
ifeq ($(CONFIG_IDE_ARM), y)
ide-arm-core-y += arm/ide_arm.o
obj-y += ide-arm-core.o
endif

# built-in only drivers from ppc/
ide-core-$(CONFIG_BLK_DEV_MPC8xx_IDE) += ppc/mpc8xx.o
ide-core-$(CONFIG_BLK_DEV_IDE_PMAC) += ppc/pmac.o
obj-$(CONFIG_BLK_DEV_IDE) += legacy/ pci/

# built-in only drivers from h8300/
ide-core-$(CONFIG_IDE_H8300) += h8300/ide-h8300.o
obj-$(CONFIG_IDEPCI_PCIBUS_ORDER) += ide-scan-pci.o

obj-$(CONFIG_BLK_DEV_IDE) += ide-core.o
ifeq ($(CONFIG_BLK_DEV_CMD640), y)
cmd640-core-y += pci/cmd640.o
obj-y += cmd640-core.o
endif

obj-$(CONFIG_BLK_DEV_IDE) += cris/ ppc/
obj-$(CONFIG_BLK_DEV_IDEPNP) += ide-pnp.o
obj-$(CONFIG_IDE_H8300) += h8300/
obj-$(CONFIG_IDE_GENERIC) += ide-generic.o

obj-$(CONFIG_BLK_DEV_IDEDISK) += ide-disk.o
obj-$(CONFIG_BLK_DEV_IDECD) += ide-cd.o
obj-$(CONFIG_BLK_DEV_IDETAPE) += ide-tape.o
obj-$(CONFIG_BLK_DEV_IDEFLOPPY) += ide-floppy.o

obj-$(CONFIG_BLK_DEV_IDE) += legacy/ arm/ mips/
obj-$(CONFIG_BLK_DEV_HD) += legacy/
obj-$(CONFIG_ETRAX_IDE) += cris/
ifeq ($(CONFIG_BLK_DEV_IDECS), y)
ide-cs-core-y += legacy/ide-cs.o
obj-y += ide-cs-core.o
endif

ifeq ($(CONFIG_BLK_DEV_PLATFORM), y)
ide-platform-core-y += legacy/ide_platform.o
obj-y += ide-platform-core.o
endif

obj-$(CONFIG_BLK_DEV_IDE) += arm/ mips/

# old hd driver must be last
ifeq ($(CONFIG_BLK_DEV_HD), y)
hd-core-y += legacy/hd.o
obj-y += hd-core.o
endif
4 changes: 4 additions & 0 deletions drivers/ide/arm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ obj-$(CONFIG_BLK_DEV_IDE_ICSIDE) += icside.o
obj-$(CONFIG_BLK_DEV_IDE_RAPIDE) += rapide.o
obj-$(CONFIG_BLK_DEV_IDE_BAST) += bast-ide.o

ifeq ($(CONFIG_IDE_ARM), m)
obj-m += ide_arm.o
endif

EXTRA_CFLAGS := -Idrivers/ide
6 changes: 5 additions & 1 deletion drivers/ide/arm/ide_arm.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# define IDE_ARM_IRQ IRQ_HARDDISK
#endif

void __init ide_arm_init(void)
static int __init ide_arm_init(void)
{
ide_hwif_t *hwif;
hw_regs_t hw;
Expand All @@ -41,4 +41,8 @@ void __init ide_arm_init(void)

ide_device_add(idx);
}

return 0;
}

module_init(ide_arm_init);
2 changes: 1 addition & 1 deletion drivers/ide/cris/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
EXTRA_CFLAGS += -Idrivers/ide

obj-y += ide-cris.o
obj-$(CONFIG_IDE_ETRAX) += ide-cris.o
7 changes: 5 additions & 2 deletions drivers/ide/cris/ide-cris.c
Original file line number Diff line number Diff line change
Expand Up @@ -754,8 +754,7 @@ static void cris_set_dma_mode(ide_drive_t *drive, const u8 speed)
cris_ide_set_speed(TYPE_DMA, 0, strobe, hold);
}

void __init
init_e100_ide (void)
static int __init init_e100_ide(void)
{
hw_regs_t hw;
int ide_offsets[IDE_NR_PORTS], h, i;
Expand Down Expand Up @@ -823,6 +822,8 @@ init_e100_ide (void)
cris_ide_set_speed(TYPE_UDMA, ATA_UDMA2_CYC, ATA_UDMA2_DVS, 0);

ide_device_add(idx);

return 0;
}

static cris_dma_descr_type mydescr __attribute__ ((__aligned__(16)));
Expand Down Expand Up @@ -1056,3 +1057,5 @@ static void cris_dma_start(ide_drive_t *drive)
LED_DISK_READ(1);
}
}

module_init(init_e100_ide);
2 changes: 2 additions & 0 deletions drivers/ide/h8300/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

obj-$(CONFIG_IDE_H8300) += ide-h8300.o
10 changes: 7 additions & 3 deletions drivers/ide/h8300/ide-h8300.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static inline void hwif_setup(ide_hwif_t *hwif)
hwif->INSL = NULL;
}

void __init h8300_ide_init(void)
static int __init h8300_ide_init(void)
{
hw_regs_t hw;
ide_hwif_t *hwif;
Expand All @@ -104,7 +104,7 @@ void __init h8300_ide_init(void)
hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
if (hwif == NULL) {
printk(KERN_ERR "ide-h8300: IDE I/F register failed\n");
return;
return -ENOENT;
}

index = hwif->index;
Expand All @@ -117,8 +117,12 @@ void __init h8300_ide_init(void)

ide_device_add(idx);

return;
return 0;

out_busy:
printk(KERN_ERR "ide-h8300: IDE I/F resource already used.\n");

return -EBUSY;
}

module_init(h8300_ide_init);
9 changes: 6 additions & 3 deletions drivers/ide/ide-pnp.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,15 @@ static struct pnp_driver idepnp_driver = {
.remove = idepnp_remove,
};

void __init pnpide_init(void)
static int __init pnpide_init(void)
{
pnp_register_driver(&idepnp_driver);
return pnp_register_driver(&idepnp_driver);
}

void __exit pnpide_exit(void)
static void __exit pnpide_exit(void)
{
pnp_unregister_driver(&idepnp_driver);
}

module_init(pnpide_init);
module_exit(pnpide_exit);
11 changes: 11 additions & 0 deletions drivers/ide/ide-scan-pci.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/ide.h>

static int __init ide_scan_pci(void)
{
return ide_scan_pcibus();
}

module_init(ide_scan_pci);
Loading

0 comments on commit ade2daf

Please sign in to comment.