Root/
1 | |
2 | #include <linux/kernel.h> |
3 | #include <linux/init.h> |
4 | #include <linux/module.h> |
5 | #include <linux/ide.h> |
6 | |
7 | #define DRV_NAME "ide-4drives" |
8 | |
9 | static bool probe_4drives; |
10 | |
11 | module_param_named(probe, probe_4drives, bool, 0); |
12 | MODULE_PARM_DESC(probe, "probe for generic IDE chipset with 4 drives/port"); |
13 | |
14 | static void ide_4drives_init_dev(ide_drive_t *drive) |
15 | { |
16 | if (drive->hwif->channel) |
17 | drive->select ^= 0x20; |
18 | } |
19 | |
20 | static const struct ide_port_ops ide_4drives_port_ops = { |
21 | .init_dev = ide_4drives_init_dev, |
22 | }; |
23 | |
24 | static const struct ide_port_info ide_4drives_port_info = { |
25 | .port_ops = &ide_4drives_port_ops, |
26 | .host_flags = IDE_HFLAG_SERIALIZE | IDE_HFLAG_NO_DMA | |
27 | IDE_HFLAG_4DRIVES, |
28 | .chipset = ide_4drives, |
29 | }; |
30 | |
31 | static int __init ide_4drives_init(void) |
32 | { |
33 | unsigned long base = 0x1f0, ctl = 0x3f6; |
34 | struct ide_hw hw, *hws[] = { &hw, &hw }; |
35 | |
36 | if (probe_4drives == 0) |
37 | return -ENODEV; |
38 | |
39 | if (!request_region(base, 8, DRV_NAME)) { |
40 | printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n", |
41 | DRV_NAME, base, base + 7); |
42 | return -EBUSY; |
43 | } |
44 | |
45 | if (!request_region(ctl, 1, DRV_NAME)) { |
46 | printk(KERN_ERR "%s: I/O resource 0x%lX not free.\n", |
47 | DRV_NAME, ctl); |
48 | release_region(base, 8); |
49 | return -EBUSY; |
50 | } |
51 | |
52 | memset(&hw, 0, sizeof(hw)); |
53 | |
54 | ide_std_init_ports(&hw, base, ctl); |
55 | hw.irq = 14; |
56 | |
57 | return ide_host_add(&ide_4drives_port_info, hws, 2, NULL); |
58 | } |
59 | |
60 | module_init(ide_4drives_init); |
61 | |
62 | MODULE_AUTHOR("Bartlomiej Zolnierkiewicz"); |
63 | MODULE_DESCRIPTION("generic IDE chipset with 4 drives/port support"); |
64 | MODULE_LICENSE("GPL"); |
65 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9