Root/
1 | #include <linux/kernel.h> |
2 | #include <linux/ide.h> |
3 | |
4 | static void ide_legacy_init_one(struct ide_hw **hws, struct ide_hw *hw, |
5 | u8 port_no, const struct ide_port_info *d, |
6 | unsigned long config) |
7 | { |
8 | unsigned long base, ctl; |
9 | int irq; |
10 | |
11 | if (port_no == 0) { |
12 | base = 0x1f0; |
13 | ctl = 0x3f6; |
14 | irq = 14; |
15 | } else { |
16 | base = 0x170; |
17 | ctl = 0x376; |
18 | irq = 15; |
19 | } |
20 | |
21 | if (!request_region(base, 8, d->name)) { |
22 | printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n", |
23 | d->name, base, base + 7); |
24 | return; |
25 | } |
26 | |
27 | if (!request_region(ctl, 1, d->name)) { |
28 | printk(KERN_ERR "%s: I/O resource 0x%lX not free.\n", |
29 | d->name, ctl); |
30 | release_region(base, 8); |
31 | return; |
32 | } |
33 | |
34 | ide_std_init_ports(hw, base, ctl); |
35 | hw->irq = irq; |
36 | hw->config = config; |
37 | |
38 | hws[port_no] = hw; |
39 | } |
40 | |
41 | int ide_legacy_device_add(const struct ide_port_info *d, unsigned long config) |
42 | { |
43 | struct ide_hw hw[2], *hws[] = { NULL, NULL }; |
44 | |
45 | memset(&hw, 0, sizeof(hw)); |
46 | |
47 | if ((d->host_flags & IDE_HFLAG_QD_2ND_PORT) == 0) |
48 | ide_legacy_init_one(hws, &hw[0], 0, d, config); |
49 | ide_legacy_init_one(hws, &hw[1], 1, d, config); |
50 | |
51 | if (hws[0] == NULL && hws[1] == NULL && |
52 | (d->host_flags & IDE_HFLAG_SINGLE)) |
53 | return -ENOENT; |
54 | |
55 | return ide_host_add(d, hws, 2, NULL); |
56 | } |
57 | EXPORT_SYMBOL_GPL(ide_legacy_device_add); |
58 |
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