blob: c352f12348af944bbdb512af53e923c950389bc6 [file] [log] [blame]
Bartlomiej Zolnierkiewiczffd4f6f2008-04-18 00:46:34 +02001
2#include <linux/kernel.h>
3#include <linux/init.h>
4#include <linux/module.h>
5#include <linux/ide.h>
6
Paolo Ciarrocchif94e0082008-04-26 17:36:40 +02007int probe_4drives;
Bartlomiej Zolnierkiewiczffd4f6f2008-04-18 00:46:34 +02008
9module_param_named(probe, probe_4drives, bool, 0);
10MODULE_PARM_DESC(probe, "probe for generic IDE chipset with 4 drives/port");
11
12static int __init ide_4drives_init(void)
13{
14 ide_hwif_t *hwif, *mate;
Bartlomiej Zolnierkiewicze277f912008-04-26 17:36:36 +020015 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
Bartlomiej Zolnierkiewiczdfd87842008-04-18 00:46:35 +020016 hw_regs_t hw;
Bartlomiej Zolnierkiewiczffd4f6f2008-04-18 00:46:34 +020017
18 if (probe_4drives == 0)
19 return -ENODEV;
20
Bartlomiej Zolnierkiewiczdfd87842008-04-18 00:46:35 +020021 memset(&hw, 0, sizeof(hw));
Bartlomiej Zolnierkiewiczffd4f6f2008-04-18 00:46:34 +020022
Bartlomiej Zolnierkiewiczdfd87842008-04-18 00:46:35 +020023 ide_std_init_ports(&hw, 0x1f0, 0x3f6);
24 hw.irq = 14;
25 hw.chipset = ide_4drives;
Bartlomiej Zolnierkiewiczffd4f6f2008-04-18 00:46:34 +020026
Bartlomiej Zolnierkiewicze277f912008-04-26 17:36:36 +020027 hwif = ide_find_port();
28 if (hwif) {
29 ide_init_port_hw(hwif, &hw);
30 idx[0] = hwif->index;
31 }
Bartlomiej Zolnierkiewiczffd4f6f2008-04-18 00:46:34 +020032
Bartlomiej Zolnierkiewicze277f912008-04-26 17:36:36 +020033 mate = ide_find_port();
34 if (mate) {
35 ide_init_port_hw(mate, &hw);
36 mate->drives[0].select.all ^= 0x20;
37 mate->drives[1].select.all ^= 0x20;
38 idx[1] = mate->index;
Bartlomiej Zolnierkiewiczffd4f6f2008-04-18 00:46:34 +020039
Bartlomiej Zolnierkiewicze277f912008-04-26 17:36:36 +020040 if (hwif) {
41 hwif->mate = mate;
42 mate->mate = hwif;
43 hwif->serialized = mate->serialized = 1;
44 }
45 }
Bartlomiej Zolnierkiewiczffd4f6f2008-04-18 00:46:34 +020046
47 ide_device_add(idx, NULL);
48
49 return 0;
50}
51
52module_init(ide_4drives_init);
53
54MODULE_AUTHOR("Bartlomiej Zolnierkiewicz");
55MODULE_DESCRIPTION("generic IDE chipset with 4 drives/port support");
56MODULE_LICENSE("GPL");