diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-17 18:46:34 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-17 18:46:34 -0400 |
commit | ffd4f6f0eed0423652826f3775077d11918b4180 (patch) | |
tree | f574449a3fa0da029d42b401336adefa42bca06b /drivers/ide/legacy/ide-4drives.c | |
parent | 26d799b729003220c0f3e5d9e046e1588c011897 (diff) |
ide: add ide-4drives host driver (take 3)
CONFIG_BLK_DEV_4DRIVES deserves its own host driver:
* Add drivers/ide/legacy/ide-4drives.c and move "4drives" support there.
* Add ide-4drives.o in the link order after all other legacy host
drivers enabled by "ide0=" options (they all are mutually exclusive).
* Make ide-4drives host driver probe itself for IDE devices instead of
indirectly depending on ide_generic host driver.
* Add "probe" module parameter to ide-4drives and update documentation.
v2:
* s/paramater/parameter/ in ide.txt. (Noticed by Randy Dunlap)
v3:
* s/ide_4drives.probe/ide-4drives.probe/ in help entry.
(Noticed by Sergei Shtylyov)
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/legacy/ide-4drives.c')
-rw-r--r-- | drivers/ide/legacy/ide-4drives.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/ide/legacy/ide-4drives.c b/drivers/ide/legacy/ide-4drives.c new file mode 100644 index 000000000000..5aa7e93cfd31 --- /dev/null +++ b/drivers/ide/legacy/ide-4drives.c | |||
@@ -0,0 +1,46 @@ | |||
1 | |||
2 | #include <linux/kernel.h> | ||
3 | #include <linux/init.h> | ||
4 | #include <linux/module.h> | ||
5 | #include <linux/ide.h> | ||
6 | |||
7 | int probe_4drives = 0; | ||
8 | |||
9 | module_param_named(probe, probe_4drives, bool, 0); | ||
10 | MODULE_PARM_DESC(probe, "probe for generic IDE chipset with 4 drives/port"); | ||
11 | |||
12 | static int __init ide_4drives_init(void) | ||
13 | { | ||
14 | ide_hwif_t *hwif, *mate; | ||
15 | u8 idx[4] = { 0, 1, 0xff, 0xff }; | ||
16 | |||
17 | if (probe_4drives == 0) | ||
18 | return -ENODEV; | ||
19 | |||
20 | hwif = &ide_hwifs[0]; | ||
21 | mate = &ide_hwifs[1]; | ||
22 | |||
23 | memcpy(mate->io_ports, hwif->io_ports, sizeof(hwif->io_ports)); | ||
24 | |||
25 | mate->irq = hwif->irq; | ||
26 | |||
27 | mate->chipset = hwif->chipset = ide_4drives; | ||
28 | |||
29 | mate->drives[0].select.all ^= 0x20; | ||
30 | mate->drives[1].select.all ^= 0x20; | ||
31 | |||
32 | hwif->mate = mate; | ||
33 | mate->mate = hwif; | ||
34 | |||
35 | hwif->serialized = mate->serialized = 1; | ||
36 | |||
37 | ide_device_add(idx, NULL); | ||
38 | |||
39 | return 0; | ||
40 | } | ||
41 | |||
42 | module_init(ide_4drives_init); | ||
43 | |||
44 | MODULE_AUTHOR("Bartlomiej Zolnierkiewicz"); | ||
45 | MODULE_DESCRIPTION("generic IDE chipset with 4 drives/port support"); | ||
46 | MODULE_LICENSE("GPL"); | ||