diff options
-rw-r--r-- | drivers/pcmcia/Kconfig | 12 | ||||
-rw-r--r-- | drivers/pcmcia/Makefile | 1 | ||||
-rw-r--r-- | drivers/pcmcia/rsrc_pci.c | 173 |
3 files changed, 3 insertions, 183 deletions
diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig index 3bb49252a098..45f67c63d385 100644 --- a/drivers/pcmcia/Kconfig +++ b/drivers/pcmcia/Kconfig | |||
@@ -69,8 +69,7 @@ config YENTA | |||
69 | tristate "CardBus yenta-compatible bridge support" | 69 | tristate "CardBus yenta-compatible bridge support" |
70 | depends on PCI | 70 | depends on PCI |
71 | select CARDBUS if !EXPERT | 71 | select CARDBUS if !EXPERT |
72 | select PCCARD_NONSTATIC if PCMCIA != n && ISA | 72 | select PCCARD_NONSTATIC if PCMCIA != n |
73 | select PCCARD_PCI if PCMCIA !=n && !ISA | ||
74 | ---help--- | 73 | ---help--- |
75 | This option enables support for CardBus host bridges. Virtually | 74 | This option enables support for CardBus host bridges. Virtually |
76 | all modern PCMCIA bridges are CardBus compatible. A "bridge" is | 75 | all modern PCMCIA bridges are CardBus compatible. A "bridge" is |
@@ -110,8 +109,7 @@ config YENTA_TOSHIBA | |||
110 | config PD6729 | 109 | config PD6729 |
111 | tristate "Cirrus PD6729 compatible bridge support" | 110 | tristate "Cirrus PD6729 compatible bridge support" |
112 | depends on PCMCIA && PCI | 111 | depends on PCMCIA && PCI |
113 | select PCCARD_NONSTATIC if PCMCIA != n && ISA | 112 | select PCCARD_NONSTATIC |
114 | select PCCARD_PCI if PCMCIA !=n && !ISA | ||
115 | help | 113 | help |
116 | This provides support for the Cirrus PD6729 PCI-to-PCMCIA bridge | 114 | This provides support for the Cirrus PD6729 PCI-to-PCMCIA bridge |
117 | device, found in some older laptops and PCMCIA card readers. | 115 | device, found in some older laptops and PCMCIA card readers. |
@@ -119,8 +117,7 @@ config PD6729 | |||
119 | config I82092 | 117 | config I82092 |
120 | tristate "i82092 compatible bridge support" | 118 | tristate "i82092 compatible bridge support" |
121 | depends on PCMCIA && PCI | 119 | depends on PCMCIA && PCI |
122 | select PCCARD_NONSTATIC if PCMCIA != n && ISA | 120 | select PCCARD_NONSTATIC |
123 | select PCCARD_PCI if PCMCIA !=n && !ISA | ||
124 | help | 121 | help |
125 | This provides support for the Intel I82092AA PCI-to-PCMCIA bridge device, | 122 | This provides support for the Intel I82092AA PCI-to-PCMCIA bridge device, |
126 | found in some older laptops and more commonly in evaluation boards for the | 123 | found in some older laptops and more commonly in evaluation boards for the |
@@ -291,9 +288,6 @@ config ELECTRA_CF | |||
291 | Say Y here to support the CompactFlash controller on the | 288 | Say Y here to support the CompactFlash controller on the |
292 | PA Semi Electra eval board. | 289 | PA Semi Electra eval board. |
293 | 290 | ||
294 | config PCCARD_PCI | ||
295 | bool | ||
296 | |||
297 | config PCCARD_NONSTATIC | 291 | config PCCARD_NONSTATIC |
298 | bool | 292 | bool |
299 | 293 | ||
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile index f1a7ca04d89e..27e94b30cf96 100644 --- a/drivers/pcmcia/Makefile +++ b/drivers/pcmcia/Makefile | |||
@@ -12,7 +12,6 @@ obj-$(CONFIG_PCMCIA) += pcmcia.o | |||
12 | pcmcia_rsrc-y += rsrc_mgr.o | 12 | pcmcia_rsrc-y += rsrc_mgr.o |
13 | pcmcia_rsrc-$(CONFIG_PCCARD_NONSTATIC) += rsrc_nonstatic.o | 13 | pcmcia_rsrc-$(CONFIG_PCCARD_NONSTATIC) += rsrc_nonstatic.o |
14 | pcmcia_rsrc-$(CONFIG_PCCARD_IODYN) += rsrc_iodyn.o | 14 | pcmcia_rsrc-$(CONFIG_PCCARD_IODYN) += rsrc_iodyn.o |
15 | pcmcia_rsrc-$(CONFIG_PCCARD_PCI) += rsrc_pci.o | ||
16 | obj-$(CONFIG_PCCARD) += pcmcia_rsrc.o | 15 | obj-$(CONFIG_PCCARD) += pcmcia_rsrc.o |
17 | 16 | ||
18 | 17 | ||
diff --git a/drivers/pcmcia/rsrc_pci.c b/drivers/pcmcia/rsrc_pci.c deleted file mode 100644 index 1f67b3ba70fb..000000000000 --- a/drivers/pcmcia/rsrc_pci.c +++ /dev/null | |||
@@ -1,173 +0,0 @@ | |||
1 | #include <linux/slab.h> | ||
2 | #include <linux/module.h> | ||
3 | #include <linux/kernel.h> | ||
4 | #include <linux/pci.h> | ||
5 | |||
6 | #include <pcmcia/ss.h> | ||
7 | #include <pcmcia/cistpl.h> | ||
8 | #include "cs_internal.h" | ||
9 | |||
10 | |||
11 | struct pcmcia_align_data { | ||
12 | unsigned long mask; | ||
13 | unsigned long offset; | ||
14 | }; | ||
15 | |||
16 | static resource_size_t pcmcia_align(void *align_data, | ||
17 | const struct resource *res, | ||
18 | resource_size_t size, resource_size_t align) | ||
19 | { | ||
20 | struct pcmcia_align_data *data = align_data; | ||
21 | resource_size_t start; | ||
22 | |||
23 | start = (res->start & ~data->mask) + data->offset; | ||
24 | if (start < res->start) | ||
25 | start += data->mask + 1; | ||
26 | return start; | ||
27 | } | ||
28 | |||
29 | static struct resource *find_io_region(struct pcmcia_socket *s, | ||
30 | unsigned long base, int num, | ||
31 | unsigned long align) | ||
32 | { | ||
33 | struct resource *res = pcmcia_make_resource(0, num, IORESOURCE_IO, | ||
34 | dev_name(&s->dev)); | ||
35 | struct pcmcia_align_data data; | ||
36 | int ret; | ||
37 | |||
38 | data.mask = align - 1; | ||
39 | data.offset = base & data.mask; | ||
40 | |||
41 | ret = pci_bus_alloc_resource(s->cb_dev->bus, res, num, 1, | ||
42 | base, 0, pcmcia_align, &data); | ||
43 | if (ret != 0) { | ||
44 | kfree(res); | ||
45 | res = NULL; | ||
46 | } | ||
47 | return res; | ||
48 | } | ||
49 | |||
50 | static int res_pci_find_io(struct pcmcia_socket *s, unsigned int attr, | ||
51 | unsigned int *base, unsigned int num, | ||
52 | unsigned int align, struct resource **parent) | ||
53 | { | ||
54 | int i, ret = 0; | ||
55 | |||
56 | /* Check for an already-allocated window that must conflict with | ||
57 | * what was asked for. It is a hack because it does not catch all | ||
58 | * potential conflicts, just the most obvious ones. | ||
59 | */ | ||
60 | for (i = 0; i < MAX_IO_WIN; i++) { | ||
61 | if (!s->io[i].res) | ||
62 | continue; | ||
63 | |||
64 | if (!*base) | ||
65 | continue; | ||
66 | |||
67 | if ((s->io[i].res->start & (align-1)) == *base) | ||
68 | return -EBUSY; | ||
69 | } | ||
70 | |||
71 | for (i = 0; i < MAX_IO_WIN; i++) { | ||
72 | struct resource *res = s->io[i].res; | ||
73 | unsigned int try; | ||
74 | |||
75 | if (res && (res->flags & IORESOURCE_BITS) != | ||
76 | (attr & IORESOURCE_BITS)) | ||
77 | continue; | ||
78 | |||
79 | if (!res) { | ||
80 | if (align == 0) | ||
81 | align = 0x10000; | ||
82 | |||
83 | res = s->io[i].res = find_io_region(s, *base, num, | ||
84 | align); | ||
85 | if (!res) | ||
86 | return -EINVAL; | ||
87 | |||
88 | *base = res->start; | ||
89 | s->io[i].res->flags = | ||
90 | ((res->flags & ~IORESOURCE_BITS) | | ||
91 | (attr & IORESOURCE_BITS)); | ||
92 | s->io[i].InUse = num; | ||
93 | *parent = res; | ||
94 | return 0; | ||
95 | } | ||
96 | |||
97 | /* Try to extend top of window */ | ||
98 | try = res->end + 1; | ||
99 | if ((*base == 0) || (*base == try)) { | ||
100 | ret = adjust_resource(s->io[i].res, res->start, | ||
101 | resource_size(res) + num); | ||
102 | if (ret) | ||
103 | continue; | ||
104 | *base = try; | ||
105 | s->io[i].InUse += num; | ||
106 | *parent = res; | ||
107 | return 0; | ||
108 | } | ||
109 | |||
110 | /* Try to extend bottom of window */ | ||
111 | try = res->start - num; | ||
112 | if ((*base == 0) || (*base == try)) { | ||
113 | ret = adjust_resource(s->io[i].res, | ||
114 | res->start - num, | ||
115 | resource_size(res) + num); | ||
116 | if (ret) | ||
117 | continue; | ||
118 | *base = try; | ||
119 | s->io[i].InUse += num; | ||
120 | *parent = res; | ||
121 | return 0; | ||
122 | } | ||
123 | } | ||
124 | return -EINVAL; | ||
125 | } | ||
126 | |||
127 | static struct resource *res_pci_find_mem(u_long base, u_long num, | ||
128 | u_long align, int low, struct pcmcia_socket *s) | ||
129 | { | ||
130 | struct resource *res = pcmcia_make_resource(0, num, IORESOURCE_MEM, | ||
131 | dev_name(&s->dev)); | ||
132 | struct pcmcia_align_data data; | ||
133 | unsigned long min; | ||
134 | int ret; | ||
135 | |||
136 | if (align < 0x20000) | ||
137 | align = 0x20000; | ||
138 | data.mask = align - 1; | ||
139 | data.offset = base & data.mask; | ||
140 | |||
141 | min = 0; | ||
142 | if (!low) | ||
143 | min = 0x100000UL; | ||
144 | |||
145 | ret = pci_bus_alloc_resource(s->cb_dev->bus, | ||
146 | res, num, 1, min, 0, | ||
147 | pcmcia_align, &data); | ||
148 | |||
149 | if (ret != 0) { | ||
150 | kfree(res); | ||
151 | res = NULL; | ||
152 | } | ||
153 | return res; | ||
154 | } | ||
155 | |||
156 | |||
157 | static int res_pci_init(struct pcmcia_socket *s) | ||
158 | { | ||
159 | if (!s->cb_dev || !(s->features & SS_CAP_PAGE_REGS)) { | ||
160 | dev_err(&s->dev, "not supported by res_pci\n"); | ||
161 | return -EOPNOTSUPP; | ||
162 | } | ||
163 | return 0; | ||
164 | } | ||
165 | |||
166 | struct pccard_resource_ops pccard_nonstatic_ops = { | ||
167 | .validate_mem = NULL, | ||
168 | .find_io = res_pci_find_io, | ||
169 | .find_mem = res_pci_find_mem, | ||
170 | .init = res_pci_init, | ||
171 | .exit = NULL, | ||
172 | }; | ||
173 | EXPORT_SYMBOL(pccard_nonstatic_ops); | ||