blob: ecd7f3553554e8f9c17da4537fd46818dd9feabe [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
7int probe_4drives = 0;
8
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;
15 u8 idx[4] = { 0, 1, 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
21 hwif = &ide_hwifs[0];
22 mate = &ide_hwifs[1];
23
Bartlomiej Zolnierkiewiczdfd87842008-04-18 00:46:35 +020024 memset(&hw, 0, sizeof(hw));
Bartlomiej Zolnierkiewiczffd4f6f2008-04-18 00:46:34 +020025
Bartlomiej Zolnierkiewiczdfd87842008-04-18 00:46:35 +020026 ide_std_init_ports(&hw, 0x1f0, 0x3f6);
27 hw.irq = 14;
28 hw.chipset = ide_4drives;
Bartlomiej Zolnierkiewiczffd4f6f2008-04-18 00:46:34 +020029
Bartlomiej Zolnierkiewiczdfd87842008-04-18 00:46:35 +020030 ide_init_port_hw(hwif, &hw);
31 ide_init_port_hw(mate, &hw);
Bartlomiej Zolnierkiewiczffd4f6f2008-04-18 00:46:34 +020032
33 mate->drives[0].select.all ^= 0x20;
34 mate->drives[1].select.all ^= 0x20;
35
36 hwif->mate = mate;
37 mate->mate = hwif;
38
39 hwif->serialized = mate->serialized = 1;
40
41 ide_device_add(idx, NULL);
42
43 return 0;
44}
45
46module_init(ide_4drives_init);
47
48MODULE_AUTHOR("Bartlomiej Zolnierkiewicz");
49MODULE_DESCRIPTION("generic IDE chipset with 4 drives/port support");
50MODULE_LICENSE("GPL");