diff options
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r-- | drivers/pcmcia/Kconfig | 7 | ||||
-rw-r--r-- | drivers/pcmcia/Makefile | 1 | ||||
-rw-r--r-- | drivers/pcmcia/au1000_generic.h | 27 | ||||
-rw-r--r-- | drivers/pcmcia/au1000_pb1x00.c | 1 | ||||
-rw-r--r-- | drivers/pcmcia/au1000_xxs1500.c | 1 | ||||
-rw-r--r-- | drivers/pcmcia/bfin_cf_pcmcia.c | 339 | ||||
-rw-r--r-- | drivers/pcmcia/cardbus.c | 2 | ||||
-rw-r--r-- | drivers/pcmcia/cistpl.c | 16 | ||||
-rw-r--r-- | drivers/pcmcia/cs.c | 14 | ||||
-rw-r--r-- | drivers/pcmcia/cs_internal.h | 13 | ||||
-rw-r--r-- | drivers/pcmcia/ds.c | 12 | ||||
-rw-r--r-- | drivers/pcmcia/hd64465_ss.c | 3 | ||||
-rw-r--r-- | drivers/pcmcia/i82092.c | 2 | ||||
-rw-r--r-- | drivers/pcmcia/i82092aa.h | 2 | ||||
-rw-r--r-- | drivers/pcmcia/i82365.c | 39 | ||||
-rw-r--r-- | drivers/pcmcia/m8xx_pcmcia.c | 3 | ||||
-rw-r--r-- | drivers/pcmcia/pcmcia_ioctl.c | 154 | ||||
-rw-r--r-- | drivers/pcmcia/pcmcia_resource.c | 81 | ||||
-rw-r--r-- | drivers/pcmcia/pxa2xx_base.c | 1 | ||||
-rw-r--r-- | drivers/pcmcia/rsrc_mgr.c | 86 | ||||
-rw-r--r-- | drivers/pcmcia/rsrc_nonstatic.c | 57 | ||||
-rw-r--r-- | drivers/pcmcia/soc_common.h | 1 | ||||
-rw-r--r-- | drivers/pcmcia/socket_sysfs.c | 8 | ||||
-rw-r--r-- | drivers/pcmcia/ti113x.h | 4 |
24 files changed, 594 insertions, 280 deletions
diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig index 1b0eb5aaf650..e45402adac3f 100644 --- a/drivers/pcmcia/Kconfig +++ b/drivers/pcmcia/Kconfig | |||
@@ -263,6 +263,13 @@ config OMAP_CF | |||
263 | Say Y here to support the CompactFlash controller on OMAP. | 263 | Say Y here to support the CompactFlash controller on OMAP. |
264 | Note that this doesn't support "True IDE" mode. | 264 | Note that this doesn't support "True IDE" mode. |
265 | 265 | ||
266 | config BFIN_CFPCMCIA | ||
267 | tristate "Blackfin CompactFlash PCMCIA Driver" | ||
268 | depends on PCMCIA && BLACKFIN | ||
269 | help | ||
270 | Say Y here to support the CompactFlash PCMCIA driver for Blackfin. | ||
271 | |||
272 | |||
266 | config AT91_CF | 273 | config AT91_CF |
267 | tristate "AT91 CompactFlash Controller" | 274 | tristate "AT91 CompactFlash Controller" |
268 | depends on PCMCIA && ARCH_AT91RM9200 | 275 | depends on PCMCIA && ARCH_AT91RM9200 |
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile index 6f6478ba7174..85c6cc931f97 100644 --- a/drivers/pcmcia/Makefile +++ b/drivers/pcmcia/Makefile | |||
@@ -36,6 +36,7 @@ obj-$(CONFIG_PCMCIA_AU1X00) += au1x00_ss.o | |||
36 | obj-$(CONFIG_PCMCIA_VRC4171) += vrc4171_card.o | 36 | obj-$(CONFIG_PCMCIA_VRC4171) += vrc4171_card.o |
37 | obj-$(CONFIG_PCMCIA_VRC4173) += vrc4173_cardu.o | 37 | obj-$(CONFIG_PCMCIA_VRC4173) += vrc4173_cardu.o |
38 | obj-$(CONFIG_OMAP_CF) += omap_cf.o | 38 | obj-$(CONFIG_OMAP_CF) += omap_cf.o |
39 | obj-$(CONFIG_BFIN_CFPCMCIA) += bfin_cf_pcmcia.o | ||
39 | obj-$(CONFIG_AT91_CF) += at91_cf.o | 40 | obj-$(CONFIG_AT91_CF) += at91_cf.o |
40 | obj-$(CONFIG_ELECTRA_CF) += electra_cf.o | 41 | obj-$(CONFIG_ELECTRA_CF) += electra_cf.o |
41 | 42 | ||
diff --git a/drivers/pcmcia/au1000_generic.h b/drivers/pcmcia/au1000_generic.h index 1e467bb54077..a53ef5902518 100644 --- a/drivers/pcmcia/au1000_generic.h +++ b/drivers/pcmcia/au1000_generic.h | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <pcmcia/cs_types.h> | 26 | #include <pcmcia/cs_types.h> |
27 | #include <pcmcia/cs.h> | 27 | #include <pcmcia/cs.h> |
28 | #include <pcmcia/ss.h> | 28 | #include <pcmcia/ss.h> |
29 | #include <pcmcia/bulkmem.h> | ||
30 | #include <pcmcia/cistpl.h> | 29 | #include <pcmcia/cistpl.h> |
31 | #include "cs_internal.h" | 30 | #include "cs_internal.h" |
32 | 31 | ||
@@ -34,9 +33,9 @@ | |||
34 | #define AU1000_PCMCIA_IO_SPEED (255) | 33 | #define AU1000_PCMCIA_IO_SPEED (255) |
35 | #define AU1000_PCMCIA_MEM_SPEED (300) | 34 | #define AU1000_PCMCIA_MEM_SPEED (300) |
36 | 35 | ||
37 | #define AU1X_SOCK0_IO 0xF00000000 | 36 | #define AU1X_SOCK0_IO 0xF00000000ULL |
38 | #define AU1X_SOCK0_PHYS_ATTR 0xF40000000 | 37 | #define AU1X_SOCK0_PHYS_ATTR 0xF40000000ULL |
39 | #define AU1X_SOCK0_PHYS_MEM 0xF80000000 | 38 | #define AU1X_SOCK0_PHYS_MEM 0xF80000000ULL |
40 | /* pseudo 32 bit phys addresses, which get fixed up to the | 39 | /* pseudo 32 bit phys addresses, which get fixed up to the |
41 | * real 36 bit address in fixup_bigphys_addr() */ | 40 | * real 36 bit address in fixup_bigphys_addr() */ |
42 | #define AU1X_SOCK0_PSEUDO_PHYS_ATTR 0xF4000000 | 41 | #define AU1X_SOCK0_PSEUDO_PHYS_ATTR 0xF4000000 |
@@ -45,16 +44,20 @@ | |||
45 | /* pcmcia socket 1 needs external glue logic so the memory map | 44 | /* pcmcia socket 1 needs external glue logic so the memory map |
46 | * differs from board to board. | 45 | * differs from board to board. |
47 | */ | 46 | */ |
48 | #if defined(CONFIG_MIPS_PB1000) || defined(CONFIG_MIPS_PB1100) || defined(CONFIG_MIPS_PB1500) || defined(CONFIG_MIPS_PB1550) || defined(CONFIG_MIPS_PB1200) | 47 | #if defined(CONFIG_MIPS_PB1000) || defined(CONFIG_MIPS_PB1100) || \ |
49 | #define AU1X_SOCK1_IO 0xF08000000 | 48 | defined(CONFIG_MIPS_PB1500) || defined(CONFIG_MIPS_PB1550) || \ |
50 | #define AU1X_SOCK1_PHYS_ATTR 0xF48000000 | 49 | defined(CONFIG_MIPS_PB1200) |
51 | #define AU1X_SOCK1_PHYS_MEM 0xF88000000 | 50 | #define AU1X_SOCK1_IO 0xF08000000ULL |
51 | #define AU1X_SOCK1_PHYS_ATTR 0xF48000000ULL | ||
52 | #define AU1X_SOCK1_PHYS_MEM 0xF88000000ULL | ||
52 | #define AU1X_SOCK1_PSEUDO_PHYS_ATTR 0xF4800000 | 53 | #define AU1X_SOCK1_PSEUDO_PHYS_ATTR 0xF4800000 |
53 | #define AU1X_SOCK1_PSEUDO_PHYS_MEM 0xF8800000 | 54 | #define AU1X_SOCK1_PSEUDO_PHYS_MEM 0xF8800000 |
54 | #elif defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100) || defined(CONFIG_MIPS_DB1500) || defined(CONFIG_MIPS_DB1550) || defined(CONFIG_MIPS_DB1200) | 55 | #elif defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100) || \ |
55 | #define AU1X_SOCK1_IO 0xF04000000 | 56 | defined(CONFIG_MIPS_DB1500) || defined(CONFIG_MIPS_DB1550) || \ |
56 | #define AU1X_SOCK1_PHYS_ATTR 0xF44000000 | 57 | defined(CONFIG_MIPS_DB1200) |
57 | #define AU1X_SOCK1_PHYS_MEM 0xF84000000 | 58 | #define AU1X_SOCK1_IO 0xF04000000ULL |
59 | #define AU1X_SOCK1_PHYS_ATTR 0xF44000000ULL | ||
60 | #define AU1X_SOCK1_PHYS_MEM 0xF84000000ULL | ||
58 | #define AU1X_SOCK1_PSEUDO_PHYS_ATTR 0xF4400000 | 61 | #define AU1X_SOCK1_PSEUDO_PHYS_ATTR 0xF4400000 |
59 | #define AU1X_SOCK1_PSEUDO_PHYS_MEM 0xF8400000 | 62 | #define AU1X_SOCK1_PSEUDO_PHYS_MEM 0xF8400000 |
60 | #endif | 63 | #endif |
diff --git a/drivers/pcmcia/au1000_pb1x00.c b/drivers/pcmcia/au1000_pb1x00.c index 157e41423a0a..aa1cd4d3aa29 100644 --- a/drivers/pcmcia/au1000_pb1x00.c +++ b/drivers/pcmcia/au1000_pb1x00.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <pcmcia/cs_types.h> | 35 | #include <pcmcia/cs_types.h> |
36 | #include <pcmcia/cs.h> | 36 | #include <pcmcia/cs.h> |
37 | #include <pcmcia/ss.h> | 37 | #include <pcmcia/ss.h> |
38 | #include <pcmcia/bulkmem.h> | ||
39 | #include <pcmcia/cistpl.h> | 38 | #include <pcmcia/cistpl.h> |
40 | #include <pcmcia/bus_ops.h> | 39 | #include <pcmcia/bus_ops.h> |
41 | #include "cs_internal.h" | 40 | #include "cs_internal.h" |
diff --git a/drivers/pcmcia/au1000_xxs1500.c b/drivers/pcmcia/au1000_xxs1500.c index c78ed5347510..8a9b18cee847 100644 --- a/drivers/pcmcia/au1000_xxs1500.c +++ b/drivers/pcmcia/au1000_xxs1500.c | |||
@@ -39,7 +39,6 @@ | |||
39 | #include <pcmcia/cs_types.h> | 39 | #include <pcmcia/cs_types.h> |
40 | #include <pcmcia/cs.h> | 40 | #include <pcmcia/cs.h> |
41 | #include <pcmcia/ss.h> | 41 | #include <pcmcia/ss.h> |
42 | #include <pcmcia/bulkmem.h> | ||
43 | #include <pcmcia/cistpl.h> | 42 | #include <pcmcia/cistpl.h> |
44 | #include <pcmcia/bus_ops.h> | 43 | #include <pcmcia/bus_ops.h> |
45 | #include "cs_internal.h" | 44 | #include "cs_internal.h" |
diff --git a/drivers/pcmcia/bfin_cf_pcmcia.c b/drivers/pcmcia/bfin_cf_pcmcia.c new file mode 100644 index 000000000000..bb7338863fb9 --- /dev/null +++ b/drivers/pcmcia/bfin_cf_pcmcia.c | |||
@@ -0,0 +1,339 @@ | |||
1 | /* | ||
2 | * file: drivers/pcmcia/bfin_cf.c | ||
3 | * | ||
4 | * based on: drivers/pcmcia/omap_cf.c | ||
5 | * omap_cf.c -- OMAP 16xx CompactFlash controller driver | ||
6 | * | ||
7 | * Copyright (c) 2005 David Brownell | ||
8 | * Copyright (c) 2006-2008 Michael Hennerich Analog Devices Inc. | ||
9 | * | ||
10 | * bugs: enter bugs at http://blackfin.uclinux.org/ | ||
11 | * | ||
12 | * this program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the gnu general public license as published by | ||
14 | * the free software foundation; either version 2, or (at your option) | ||
15 | * any later version. | ||
16 | * | ||
17 | * this program is distributed in the hope that it will be useful, | ||
18 | * but without any warranty; without even the implied warranty of | ||
19 | * merchantability or fitness for a particular purpose. see the | ||
20 | * gnu general public license for more details. | ||
21 | * | ||
22 | * you should have received a copy of the gnu general public license | ||
23 | * along with this program; see the file copying. | ||
24 | * if not, write to the free software foundation, | ||
25 | * 59 temple place - suite 330, boston, ma 02111-1307, usa. | ||
26 | */ | ||
27 | |||
28 | #include <linux/module.h> | ||
29 | #include <linux/kernel.h> | ||
30 | #include <linux/sched.h> | ||
31 | #include <linux/platform_device.h> | ||
32 | #include <linux/errno.h> | ||
33 | #include <linux/init.h> | ||
34 | #include <linux/delay.h> | ||
35 | #include <linux/interrupt.h> | ||
36 | #include <linux/irq.h> | ||
37 | #include <linux/io.h> | ||
38 | |||
39 | #include <pcmcia/ss.h> | ||
40 | #include <pcmcia/cisreg.h> | ||
41 | #include <asm/gpio.h> | ||
42 | |||
43 | #define SZ_1K 0x00000400 | ||
44 | #define SZ_8K 0x00002000 | ||
45 | #define SZ_2K (2 * SZ_1K) | ||
46 | |||
47 | #define POLL_INTERVAL (2 * HZ) | ||
48 | |||
49 | #define CF_ATASEL_ENA 0x20311802 /* Inverts RESET */ | ||
50 | #define CF_ATASEL_DIS 0x20311800 | ||
51 | |||
52 | #define bfin_cf_present(pfx) (gpio_get_value(pfx)) | ||
53 | |||
54 | /*--------------------------------------------------------------------------*/ | ||
55 | |||
56 | static const char driver_name[] = "bfin_cf_pcmcia"; | ||
57 | |||
58 | struct bfin_cf_socket { | ||
59 | struct pcmcia_socket socket; | ||
60 | |||
61 | struct timer_list timer; | ||
62 | unsigned present:1; | ||
63 | unsigned active:1; | ||
64 | |||
65 | struct platform_device *pdev; | ||
66 | unsigned long phys_cf_io; | ||
67 | unsigned long phys_cf_attr; | ||
68 | u_int irq; | ||
69 | u_short cd_pfx; | ||
70 | }; | ||
71 | |||
72 | /*--------------------------------------------------------------------------*/ | ||
73 | static int bfin_cf_reset(void) | ||
74 | { | ||
75 | outw(0, CF_ATASEL_ENA); | ||
76 | mdelay(200); | ||
77 | outw(0, CF_ATASEL_DIS); | ||
78 | |||
79 | return 0; | ||
80 | } | ||
81 | |||
82 | static int bfin_cf_ss_init(struct pcmcia_socket *s) | ||
83 | { | ||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | /* the timer is primarily to kick this socket's pccardd */ | ||
88 | static void bfin_cf_timer(unsigned long _cf) | ||
89 | { | ||
90 | struct bfin_cf_socket *cf = (void *)_cf; | ||
91 | unsigned short present = bfin_cf_present(cf->cd_pfx); | ||
92 | |||
93 | if (present != cf->present) { | ||
94 | cf->present = present; | ||
95 | dev_dbg(&cf->pdev->dev, ": card %s\n", | ||
96 | present ? "present" : "gone"); | ||
97 | pcmcia_parse_events(&cf->socket, SS_DETECT); | ||
98 | } | ||
99 | |||
100 | if (cf->active) | ||
101 | mod_timer(&cf->timer, jiffies + POLL_INTERVAL); | ||
102 | } | ||
103 | |||
104 | static int bfin_cf_get_status(struct pcmcia_socket *s, u_int *sp) | ||
105 | { | ||
106 | struct bfin_cf_socket *cf; | ||
107 | |||
108 | if (!sp) | ||
109 | return -EINVAL; | ||
110 | |||
111 | cf = container_of(s, struct bfin_cf_socket, socket); | ||
112 | |||
113 | if (bfin_cf_present(cf->cd_pfx)) { | ||
114 | *sp = SS_READY | SS_DETECT | SS_POWERON | SS_3VCARD; | ||
115 | s->irq.AssignedIRQ = 0; | ||
116 | s->pci_irq = cf->irq; | ||
117 | |||
118 | } else | ||
119 | *sp = 0; | ||
120 | return 0; | ||
121 | } | ||
122 | |||
123 | static int | ||
124 | bfin_cf_set_socket(struct pcmcia_socket *sock, struct socket_state_t *s) | ||
125 | { | ||
126 | |||
127 | struct bfin_cf_socket *cf; | ||
128 | cf = container_of(sock, struct bfin_cf_socket, socket); | ||
129 | |||
130 | switch (s->Vcc) { | ||
131 | case 0: | ||
132 | case 33: | ||
133 | break; | ||
134 | case 50: | ||
135 | break; | ||
136 | default: | ||
137 | return -EINVAL; | ||
138 | } | ||
139 | |||
140 | if (s->flags & SS_RESET) { | ||
141 | disable_irq(cf->irq); | ||
142 | bfin_cf_reset(); | ||
143 | enable_irq(cf->irq); | ||
144 | } | ||
145 | |||
146 | dev_dbg(&cf->pdev->dev, ": Vcc %d, io_irq %d, flags %04x csc %04x\n", | ||
147 | s->Vcc, s->io_irq, s->flags, s->csc_mask); | ||
148 | |||
149 | return 0; | ||
150 | } | ||
151 | |||
152 | static int bfin_cf_ss_suspend(struct pcmcia_socket *s) | ||
153 | { | ||
154 | return bfin_cf_set_socket(s, &dead_socket); | ||
155 | } | ||
156 | |||
157 | /* regions are 2K each: mem, attrib, io (and reserved-for-ide) */ | ||
158 | |||
159 | static int bfin_cf_set_io_map(struct pcmcia_socket *s, struct pccard_io_map *io) | ||
160 | { | ||
161 | struct bfin_cf_socket *cf; | ||
162 | |||
163 | cf = container_of(s, struct bfin_cf_socket, socket); | ||
164 | io->flags &= MAP_ACTIVE | MAP_ATTRIB | MAP_16BIT; | ||
165 | io->start = cf->phys_cf_io; | ||
166 | io->stop = io->start + SZ_2K - 1; | ||
167 | return 0; | ||
168 | } | ||
169 | |||
170 | static int | ||
171 | bfin_cf_set_mem_map(struct pcmcia_socket *s, struct pccard_mem_map *map) | ||
172 | { | ||
173 | struct bfin_cf_socket *cf; | ||
174 | |||
175 | if (map->card_start) | ||
176 | return -EINVAL; | ||
177 | cf = container_of(s, struct bfin_cf_socket, socket); | ||
178 | map->static_start = cf->phys_cf_io; | ||
179 | map->flags &= MAP_ACTIVE | MAP_ATTRIB | MAP_16BIT; | ||
180 | if (map->flags & MAP_ATTRIB) | ||
181 | map->static_start = cf->phys_cf_attr; | ||
182 | |||
183 | return 0; | ||
184 | } | ||
185 | |||
186 | static struct pccard_operations bfin_cf_ops = { | ||
187 | .init = bfin_cf_ss_init, | ||
188 | .suspend = bfin_cf_ss_suspend, | ||
189 | .get_status = bfin_cf_get_status, | ||
190 | .set_socket = bfin_cf_set_socket, | ||
191 | .set_io_map = bfin_cf_set_io_map, | ||
192 | .set_mem_map = bfin_cf_set_mem_map, | ||
193 | }; | ||
194 | |||
195 | /*--------------------------------------------------------------------------*/ | ||
196 | |||
197 | static int __devinit bfin_cf_probe(struct platform_device *pdev) | ||
198 | { | ||
199 | struct bfin_cf_socket *cf; | ||
200 | struct resource *io_mem, *attr_mem; | ||
201 | int irq; | ||
202 | unsigned short cd_pfx; | ||
203 | int status = 0; | ||
204 | |||
205 | dev_info(&pdev->dev, "Blackfin CompactFlash/PCMCIA Socket Driver\n"); | ||
206 | |||
207 | irq = platform_get_irq(pdev, 0); | ||
208 | if (!irq) | ||
209 | return -EINVAL; | ||
210 | |||
211 | cd_pfx = platform_get_irq(pdev, 1); /*Card Detect GPIO PIN */ | ||
212 | |||
213 | if (gpio_request(cd_pfx, "pcmcia: CD")) { | ||
214 | dev_err(&pdev->dev, | ||
215 | "Failed ro request Card Detect GPIO_%d\n", | ||
216 | cd_pfx); | ||
217 | return -EBUSY; | ||
218 | } | ||
219 | gpio_direction_input(cd_pfx); | ||
220 | |||
221 | cf = kzalloc(sizeof *cf, GFP_KERNEL); | ||
222 | if (!cf) { | ||
223 | gpio_free(cd_pfx); | ||
224 | return -ENOMEM; | ||
225 | } | ||
226 | |||
227 | cf->cd_pfx = cd_pfx; | ||
228 | |||
229 | setup_timer(&cf->timer, bfin_cf_timer, (unsigned long)cf); | ||
230 | |||
231 | cf->pdev = pdev; | ||
232 | platform_set_drvdata(pdev, cf); | ||
233 | |||
234 | cf->irq = irq; | ||
235 | cf->socket.pci_irq = irq; | ||
236 | |||
237 | set_irq_type(irq, IRQF_TRIGGER_LOW); | ||
238 | |||
239 | io_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
240 | attr_mem = platform_get_resource(pdev, IORESOURCE_MEM, 1); | ||
241 | |||
242 | if (!io_mem || !attr_mem) | ||
243 | goto fail0; | ||
244 | |||
245 | cf->phys_cf_io = io_mem->start; | ||
246 | cf->phys_cf_attr = attr_mem->start; | ||
247 | |||
248 | /* pcmcia layer only remaps "real" memory */ | ||
249 | cf->socket.io_offset = (unsigned long) | ||
250 | ioremap(cf->phys_cf_io, SZ_2K); | ||
251 | |||
252 | if (!cf->socket.io_offset) | ||
253 | goto fail0; | ||
254 | |||
255 | dev_err(&pdev->dev, ": on irq %d\n", irq); | ||
256 | |||
257 | dev_dbg(&pdev->dev, ": %s\n", | ||
258 | bfin_cf_present(cf->cd_pfx) ? "present" : "(not present)"); | ||
259 | |||
260 | cf->socket.owner = THIS_MODULE; | ||
261 | cf->socket.dev.parent = &pdev->dev; | ||
262 | cf->socket.ops = &bfin_cf_ops; | ||
263 | cf->socket.resource_ops = &pccard_static_ops; | ||
264 | cf->socket.features = SS_CAP_PCCARD | SS_CAP_STATIC_MAP | ||
265 | | SS_CAP_MEM_ALIGN; | ||
266 | cf->socket.map_size = SZ_2K; | ||
267 | |||
268 | status = pcmcia_register_socket(&cf->socket); | ||
269 | if (status < 0) | ||
270 | goto fail2; | ||
271 | |||
272 | cf->active = 1; | ||
273 | mod_timer(&cf->timer, jiffies + POLL_INTERVAL); | ||
274 | return 0; | ||
275 | |||
276 | fail2: | ||
277 | iounmap((void __iomem *)cf->socket.io_offset); | ||
278 | release_mem_region(cf->phys_cf_io, SZ_8K); | ||
279 | |||
280 | fail0: | ||
281 | gpio_free(cf->cd_pfx); | ||
282 | kfree(cf); | ||
283 | platform_set_drvdata(pdev, NULL); | ||
284 | |||
285 | return status; | ||
286 | } | ||
287 | |||
288 | static int __devexit bfin_cf_remove(struct platform_device *pdev) | ||
289 | { | ||
290 | struct bfin_cf_socket *cf = platform_get_drvdata(pdev); | ||
291 | |||
292 | gpio_free(cf->cd_pfx); | ||
293 | cf->active = 0; | ||
294 | pcmcia_unregister_socket(&cf->socket); | ||
295 | del_timer_sync(&cf->timer); | ||
296 | iounmap((void __iomem *)cf->socket.io_offset); | ||
297 | release_mem_region(cf->phys_cf_io, SZ_8K); | ||
298 | platform_set_drvdata(pdev, NULL); | ||
299 | kfree(cf); | ||
300 | return 0; | ||
301 | } | ||
302 | |||
303 | static int bfin_cf_suspend(struct platform_device *pdev, pm_message_t mesg) | ||
304 | { | ||
305 | return pcmcia_socket_dev_suspend(&pdev->dev, mesg); | ||
306 | } | ||
307 | |||
308 | static int bfin_cf_resume(struct platform_device *pdev) | ||
309 | { | ||
310 | return pcmcia_socket_dev_resume(&pdev->dev); | ||
311 | } | ||
312 | |||
313 | static struct platform_driver bfin_cf_driver = { | ||
314 | .driver = { | ||
315 | .name = (char *)driver_name, | ||
316 | .owner = THIS_MODULE, | ||
317 | }, | ||
318 | .probe = bfin_cf_probe, | ||
319 | .remove = __devexit_p(bfin_cf_remove), | ||
320 | .suspend = bfin_cf_suspend, | ||
321 | .resume = bfin_cf_resume, | ||
322 | }; | ||
323 | |||
324 | static int __init bfin_cf_init(void) | ||
325 | { | ||
326 | return platform_driver_register(&bfin_cf_driver); | ||
327 | } | ||
328 | |||
329 | static void __exit bfin_cf_exit(void) | ||
330 | { | ||
331 | platform_driver_unregister(&bfin_cf_driver); | ||
332 | } | ||
333 | |||
334 | module_init(bfin_cf_init); | ||
335 | module_exit(bfin_cf_exit); | ||
336 | |||
337 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>") | ||
338 | MODULE_DESCRIPTION("BFIN CF/PCMCIA Driver"); | ||
339 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/pcmcia/cardbus.c b/drivers/pcmcia/cardbus.c index fb2f38dc92c5..911ca0e8dfc2 100644 --- a/drivers/pcmcia/cardbus.c +++ b/drivers/pcmcia/cardbus.c | |||
@@ -30,11 +30,9 @@ | |||
30 | #include <asm/irq.h> | 30 | #include <asm/irq.h> |
31 | #include <asm/io.h> | 31 | #include <asm/io.h> |
32 | 32 | ||
33 | #define IN_CARD_SERVICES | ||
34 | #include <pcmcia/cs_types.h> | 33 | #include <pcmcia/cs_types.h> |
35 | #include <pcmcia/ss.h> | 34 | #include <pcmcia/ss.h> |
36 | #include <pcmcia/cs.h> | 35 | #include <pcmcia/cs.h> |
37 | #include <pcmcia/bulkmem.h> | ||
38 | #include <pcmcia/cistpl.h> | 36 | #include <pcmcia/cistpl.h> |
39 | #include "cs_internal.h" | 37 | #include "cs_internal.h" |
40 | 38 | ||
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index 36379535f9da..9fcff0c33619 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <pcmcia/cs_types.h> | 30 | #include <pcmcia/cs_types.h> |
31 | #include <pcmcia/ss.h> | 31 | #include <pcmcia/ss.h> |
32 | #include <pcmcia/cs.h> | 32 | #include <pcmcia/cs.h> |
33 | #include <pcmcia/bulkmem.h> | ||
34 | #include <pcmcia/cisreg.h> | 33 | #include <pcmcia/cisreg.h> |
35 | #include <pcmcia/cistpl.h> | 34 | #include <pcmcia/cistpl.h> |
36 | #include "cs_internal.h" | 35 | #include "cs_internal.h" |
@@ -1439,10 +1438,11 @@ EXPORT_SYMBOL(pccard_read_tuple); | |||
1439 | 1438 | ||
1440 | ======================================================================*/ | 1439 | ======================================================================*/ |
1441 | 1440 | ||
1442 | int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, cisinfo_t *info) | 1441 | int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned int *info) |
1443 | { | 1442 | { |
1444 | tuple_t *tuple; | 1443 | tuple_t *tuple; |
1445 | cisparse_t *p; | 1444 | cisparse_t *p; |
1445 | unsigned int count = 0; | ||
1446 | int ret, reserved, dev_ok = 0, ident_ok = 0; | 1446 | int ret, reserved, dev_ok = 0, ident_ok = 0; |
1447 | 1447 | ||
1448 | if (!s) | 1448 | if (!s) |
@@ -1457,7 +1457,7 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, cisinfo_ | |||
1457 | return CS_OUT_OF_RESOURCE; | 1457 | return CS_OUT_OF_RESOURCE; |
1458 | } | 1458 | } |
1459 | 1459 | ||
1460 | info->Chains = reserved = 0; | 1460 | count = reserved = 0; |
1461 | tuple->DesiredTuple = RETURN_FIRST_TUPLE; | 1461 | tuple->DesiredTuple = RETURN_FIRST_TUPLE; |
1462 | tuple->Attributes = TUPLE_RETURN_COMMON; | 1462 | tuple->Attributes = TUPLE_RETURN_COMMON; |
1463 | ret = pccard_get_first_tuple(s, function, tuple); | 1463 | ret = pccard_get_first_tuple(s, function, tuple); |
@@ -1482,7 +1482,7 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, cisinfo_ | |||
1482 | if (!dev_ok && !ident_ok) | 1482 | if (!dev_ok && !ident_ok) |
1483 | goto done; | 1483 | goto done; |
1484 | 1484 | ||
1485 | for (info->Chains = 1; info->Chains < MAX_TUPLES; info->Chains++) { | 1485 | for (count = 1; count < MAX_TUPLES; count++) { |
1486 | ret = pccard_get_next_tuple(s, function, tuple); | 1486 | ret = pccard_get_next_tuple(s, function, tuple); |
1487 | if (ret != CS_SUCCESS) break; | 1487 | if (ret != CS_SUCCESS) break; |
1488 | if (((tuple->TupleCode > 0x23) && (tuple->TupleCode < 0x40)) || | 1488 | if (((tuple->TupleCode > 0x23) && (tuple->TupleCode < 0x40)) || |
@@ -1490,11 +1490,13 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, cisinfo_ | |||
1490 | ((tuple->TupleCode > 0x90) && (tuple->TupleCode < 0xff))) | 1490 | ((tuple->TupleCode > 0x90) && (tuple->TupleCode < 0xff))) |
1491 | reserved++; | 1491 | reserved++; |
1492 | } | 1492 | } |
1493 | if ((info->Chains == MAX_TUPLES) || (reserved > 5) || | 1493 | if ((count) || (reserved > 5) || |
1494 | ((!dev_ok || !ident_ok) && (info->Chains > 10))) | 1494 | ((!dev_ok || !ident_ok) && (count > 10))) |
1495 | info->Chains = 0; | 1495 | count = 0; |
1496 | 1496 | ||
1497 | done: | 1497 | done: |
1498 | if (info) | ||
1499 | *info = count; | ||
1498 | kfree(tuple); | 1500 | kfree(tuple); |
1499 | kfree(p); | 1501 | kfree(p); |
1500 | return CS_SUCCESS; | 1502 | return CS_SUCCESS; |
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index 29276bd28295..d1207393fc3e 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c | |||
@@ -32,11 +32,9 @@ | |||
32 | #include <asm/system.h> | 32 | #include <asm/system.h> |
33 | #include <asm/irq.h> | 33 | #include <asm/irq.h> |
34 | 34 | ||
35 | #define IN_CARD_SERVICES | ||
36 | #include <pcmcia/cs_types.h> | 35 | #include <pcmcia/cs_types.h> |
37 | #include <pcmcia/ss.h> | 36 | #include <pcmcia/ss.h> |
38 | #include <pcmcia/cs.h> | 37 | #include <pcmcia/cs.h> |
39 | #include <pcmcia/bulkmem.h> | ||
40 | #include <pcmcia/cistpl.h> | 38 | #include <pcmcia/cistpl.h> |
41 | #include <pcmcia/cisreg.h> | 39 | #include <pcmcia/cisreg.h> |
42 | #include <pcmcia/ds.h> | 40 | #include <pcmcia/ds.h> |
@@ -238,7 +236,6 @@ int pcmcia_register_socket(struct pcmcia_socket *socket) | |||
238 | 236 | ||
239 | init_completion(&socket->socket_released); | 237 | init_completion(&socket->socket_released); |
240 | init_completion(&socket->thread_done); | 238 | init_completion(&socket->thread_done); |
241 | init_waitqueue_head(&socket->thread_wait); | ||
242 | mutex_init(&socket->skt_mutex); | 239 | mutex_init(&socket->skt_mutex); |
243 | spin_lock_init(&socket->thread_lock); | 240 | spin_lock_init(&socket->thread_lock); |
244 | 241 | ||
@@ -278,10 +275,9 @@ void pcmcia_unregister_socket(struct pcmcia_socket *socket) | |||
278 | 275 | ||
279 | cs_dbg(socket, 0, "pcmcia_unregister_socket(0x%p)\n", socket->ops); | 276 | cs_dbg(socket, 0, "pcmcia_unregister_socket(0x%p)\n", socket->ops); |
280 | 277 | ||
281 | if (socket->thread) { | 278 | if (socket->thread) |
282 | wake_up(&socket->thread_wait); | ||
283 | kthread_stop(socket->thread); | 279 | kthread_stop(socket->thread); |
284 | } | 280 | |
285 | release_cis_mem(socket); | 281 | release_cis_mem(socket); |
286 | 282 | ||
287 | /* remove from our own list */ | 283 | /* remove from our own list */ |
@@ -635,7 +631,6 @@ static void socket_detect_change(struct pcmcia_socket *skt) | |||
635 | static int pccardd(void *__skt) | 631 | static int pccardd(void *__skt) |
636 | { | 632 | { |
637 | struct pcmcia_socket *skt = __skt; | 633 | struct pcmcia_socket *skt = __skt; |
638 | DECLARE_WAITQUEUE(wait, current); | ||
639 | int ret; | 634 | int ret; |
640 | 635 | ||
641 | skt->thread = current; | 636 | skt->thread = current; |
@@ -656,7 +651,6 @@ static int pccardd(void *__skt) | |||
656 | if (ret) | 651 | if (ret) |
657 | dev_warn(&skt->dev, "err %d adding socket attributes\n", ret); | 652 | dev_warn(&skt->dev, "err %d adding socket attributes\n", ret); |
658 | 653 | ||
659 | add_wait_queue(&skt->thread_wait, &wait); | ||
660 | complete(&skt->thread_done); | 654 | complete(&skt->thread_done); |
661 | 655 | ||
662 | set_freezable(); | 656 | set_freezable(); |
@@ -694,8 +688,6 @@ static int pccardd(void *__skt) | |||
694 | /* make sure we are running before we exit */ | 688 | /* make sure we are running before we exit */ |
695 | set_current_state(TASK_RUNNING); | 689 | set_current_state(TASK_RUNNING); |
696 | 690 | ||
697 | remove_wait_queue(&skt->thread_wait, &wait); | ||
698 | |||
699 | /* remove from the device core */ | 691 | /* remove from the device core */ |
700 | pccard_sysfs_remove_socket(&skt->dev); | 692 | pccard_sysfs_remove_socket(&skt->dev); |
701 | device_unregister(&skt->dev); | 693 | device_unregister(&skt->dev); |
@@ -716,7 +708,7 @@ void pcmcia_parse_events(struct pcmcia_socket *s, u_int events) | |||
716 | s->thread_events |= events; | 708 | s->thread_events |= events; |
717 | spin_unlock_irqrestore(&s->thread_lock, flags); | 709 | spin_unlock_irqrestore(&s->thread_lock, flags); |
718 | 710 | ||
719 | wake_up(&s->thread_wait); | 711 | wake_up_process(s->thread); |
720 | } | 712 | } |
721 | } /* pcmcia_parse_events */ | 713 | } /* pcmcia_parse_events */ |
722 | EXPORT_SYMBOL(pcmcia_parse_events); | 714 | EXPORT_SYMBOL(pcmcia_parse_events); |
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index e7d5d141f24d..63dc1a28bda2 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h | |||
@@ -26,18 +26,6 @@ | |||
26 | #define CLIENT_WIN_REQ(i) (0x1<<(i)) | 26 | #define CLIENT_WIN_REQ(i) (0x1<<(i)) |
27 | #define CLIENT_CARDBUS 0x8000 | 27 | #define CLIENT_CARDBUS 0x8000 |
28 | 28 | ||
29 | #define REGION_MAGIC 0xE3C9 | ||
30 | typedef struct region_t { | ||
31 | u_short region_magic; | ||
32 | u_short state; | ||
33 | dev_info_t dev_info; | ||
34 | struct pcmcia_device *mtd; | ||
35 | u_int MediaID; | ||
36 | region_info_t info; | ||
37 | } region_t; | ||
38 | |||
39 | #define REGION_STALE 0x01 | ||
40 | |||
41 | /* Each card function gets one of these guys */ | 29 | /* Each card function gets one of these guys */ |
42 | typedef struct config_t { | 30 | typedef struct config_t { |
43 | struct kref ref; | 31 | struct kref ref; |
@@ -130,7 +118,6 @@ extern struct list_head pcmcia_socket_list; | |||
130 | int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, int idx, win_req_t *req); | 118 | int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, int idx, win_req_t *req); |
131 | int pccard_get_configuration_info(struct pcmcia_socket *s, struct pcmcia_device *p_dev, config_info_t *config); | 119 | int pccard_get_configuration_info(struct pcmcia_socket *s, struct pcmcia_device *p_dev, config_info_t *config); |
132 | int pccard_reset_card(struct pcmcia_socket *skt); | 120 | int pccard_reset_card(struct pcmcia_socket *skt); |
133 | int pccard_get_status(struct pcmcia_socket *s, struct pcmcia_device *p_dev, cs_status_t *status); | ||
134 | 121 | ||
135 | 122 | ||
136 | struct pcmcia_callback{ | 123 | struct pcmcia_callback{ |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index e40775443d04..4174d9656e35 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/kref.h> | 25 | #include <linux/kref.h> |
26 | #include <linux/dma-mapping.h> | 26 | #include <linux/dma-mapping.h> |
27 | 27 | ||
28 | #define IN_CARD_SERVICES | ||
29 | #include <pcmcia/cs_types.h> | 28 | #include <pcmcia/cs_types.h> |
30 | #include <pcmcia/cs.h> | 29 | #include <pcmcia/cs.h> |
31 | #include <pcmcia/cistpl.h> | 30 | #include <pcmcia/cistpl.h> |
@@ -741,9 +740,8 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f | |||
741 | 740 | ||
742 | static int pcmcia_card_add(struct pcmcia_socket *s) | 741 | static int pcmcia_card_add(struct pcmcia_socket *s) |
743 | { | 742 | { |
744 | cisinfo_t cisinfo; | ||
745 | cistpl_longlink_mfc_t mfc; | 743 | cistpl_longlink_mfc_t mfc; |
746 | unsigned int no_funcs, i; | 744 | unsigned int no_funcs, i, no_chains; |
747 | int ret = 0; | 745 | int ret = 0; |
748 | 746 | ||
749 | if (!(s->resource_setup_done)) { | 747 | if (!(s->resource_setup_done)) { |
@@ -757,8 +755,8 @@ static int pcmcia_card_add(struct pcmcia_socket *s) | |||
757 | return -EAGAIN; /* try again, but later... */ | 755 | return -EAGAIN; /* try again, but later... */ |
758 | } | 756 | } |
759 | 757 | ||
760 | ret = pccard_validate_cis(s, BIND_FN_ALL, &cisinfo); | 758 | ret = pccard_validate_cis(s, BIND_FN_ALL, &no_chains); |
761 | if (ret || !cisinfo.Chains) { | 759 | if (ret || !no_chains) { |
762 | ds_dbg(0, "invalid CIS or invalid resources\n"); | 760 | ds_dbg(0, "invalid CIS or invalid resources\n"); |
763 | return -ENODEV; | 761 | return -ENODEV; |
764 | } | 762 | } |
@@ -852,7 +850,7 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) | |||
852 | { | 850 | { |
853 | struct pcmcia_socket *s = dev->socket; | 851 | struct pcmcia_socket *s = dev->socket; |
854 | const struct firmware *fw; | 852 | const struct firmware *fw; |
855 | char path[20]; | 853 | char path[FIRMWARE_NAME_MAX]; |
856 | int ret = -ENOMEM; | 854 | int ret = -ENOMEM; |
857 | int no_funcs; | 855 | int no_funcs; |
858 | int old_funcs; | 856 | int old_funcs; |
@@ -864,7 +862,7 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) | |||
864 | 862 | ||
865 | ds_dbg(1, "trying to load CIS file %s\n", filename); | 863 | ds_dbg(1, "trying to load CIS file %s\n", filename); |
866 | 864 | ||
867 | if (strlen(filename) > 14) { | 865 | if (strlen(filename) > (FIRMWARE_NAME_MAX - 1)) { |
868 | printk(KERN_WARNING "pcmcia: CIS filename is too long [%s]\n", | 866 | printk(KERN_WARNING "pcmcia: CIS filename is too long [%s]\n", |
869 | filename); | 867 | filename); |
870 | return -EINVAL; | 868 | return -EINVAL; |
diff --git a/drivers/pcmcia/hd64465_ss.c b/drivers/pcmcia/hd64465_ss.c index f2e810f53c81..fb2bc1fb015d 100644 --- a/drivers/pcmcia/hd64465_ss.c +++ b/drivers/pcmcia/hd64465_ss.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: hd64465_ss.c,v 1.7 2003/07/06 14:42:50 lethal Exp $ | ||
3 | * | ||
4 | * Device driver for the PCMCIA controller module of the | 2 | * Device driver for the PCMCIA controller module of the |
5 | * Hitachi HD64465 handheld companion chip. | 3 | * Hitachi HD64465 handheld companion chip. |
6 | * | 4 | * |
@@ -48,7 +46,6 @@ | |||
48 | #include <pcmcia/cistpl.h> | 46 | #include <pcmcia/cistpl.h> |
49 | #include <pcmcia/ds.h> | 47 | #include <pcmcia/ds.h> |
50 | #include <pcmcia/ss.h> | 48 | #include <pcmcia/ss.h> |
51 | #include <pcmcia/bulkmem.h> | ||
52 | #include "cs_internal.h" | 49 | #include "cs_internal.h" |
53 | 50 | ||
54 | #define MODNAME "hd64465_ss" | 51 | #define MODNAME "hd64465_ss" |
diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c index e13618656ff7..46561face128 100644 --- a/drivers/pcmcia/i82092.c +++ b/drivers/pcmcia/i82092.c | |||
@@ -5,8 +5,6 @@ | |||
5 | * | 5 | * |
6 | * Author: Arjan Van De Ven <arjanv@redhat.com> | 6 | * Author: Arjan Van De Ven <arjanv@redhat.com> |
7 | * Loosly based on i82365.c from the pcmcia-cs package | 7 | * Loosly based on i82365.c from the pcmcia-cs package |
8 | * | ||
9 | * $Id: i82092aa.c,v 1.2 2001/10/23 14:43:34 arjanv Exp $ | ||
10 | */ | 8 | */ |
11 | 9 | ||
12 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
diff --git a/drivers/pcmcia/i82092aa.h b/drivers/pcmcia/i82092aa.h index b0d453303c5d..8836d393ad02 100644 --- a/drivers/pcmcia/i82092aa.h +++ b/drivers/pcmcia/i82092aa.h | |||
@@ -3,8 +3,6 @@ | |||
3 | 3 | ||
4 | #include <linux/interrupt.h> | 4 | #include <linux/interrupt.h> |
5 | 5 | ||
6 | /* $Id: i82092aa.h,v 1.1.1.1 2001/09/19 14:53:15 dwmw2 Exp $ */ | ||
7 | |||
8 | /* Debuging defines */ | 6 | /* Debuging defines */ |
9 | #ifdef NOTRACE | 7 | #ifdef NOTRACE |
10 | #define enter(x) printk("Enter: %s, %s line %i\n",x,__FILE__,__LINE__) | 8 | #define enter(x) printk("Enter: %s, %s line %i\n",x,__FILE__,__LINE__) |
diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c index 32a2ab119798..68f6b2702bc4 100644 --- a/drivers/pcmcia/i82365.c +++ b/drivers/pcmcia/i82365.c | |||
@@ -1263,7 +1263,7 @@ static int __init init_i82365(void) | |||
1263 | 1263 | ||
1264 | ret = driver_register(&i82365_driver); | 1264 | ret = driver_register(&i82365_driver); |
1265 | if (ret) | 1265 | if (ret) |
1266 | return ret; | 1266 | goto err_out; |
1267 | 1267 | ||
1268 | i82365_device = platform_device_alloc("i82365", 0); | 1268 | i82365_device = platform_device_alloc("i82365", 0); |
1269 | if (i82365_device) { | 1269 | if (i82365_device) { |
@@ -1273,10 +1273,8 @@ static int __init init_i82365(void) | |||
1273 | } else | 1273 | } else |
1274 | ret = -ENOMEM; | 1274 | ret = -ENOMEM; |
1275 | 1275 | ||
1276 | if (ret) { | 1276 | if (ret) |
1277 | driver_unregister(&i82365_driver); | 1277 | goto err_driver_unregister; |
1278 | return ret; | ||
1279 | } | ||
1280 | 1278 | ||
1281 | printk(KERN_INFO "Intel ISA PCIC probe: "); | 1279 | printk(KERN_INFO "Intel ISA PCIC probe: "); |
1282 | sockets = 0; | 1280 | sockets = 0; |
@@ -1285,16 +1283,17 @@ static int __init init_i82365(void) | |||
1285 | 1283 | ||
1286 | if (sockets == 0) { | 1284 | if (sockets == 0) { |
1287 | printk("not found.\n"); | 1285 | printk("not found.\n"); |
1288 | platform_device_unregister(i82365_device); | 1286 | ret = -ENODEV; |
1289 | release_region(i365_base, 2); | 1287 | goto err_dev_unregister; |
1290 | driver_unregister(&i82365_driver); | ||
1291 | return -ENODEV; | ||
1292 | } | 1288 | } |
1293 | 1289 | ||
1294 | /* Set up interrupt handler(s) */ | 1290 | /* Set up interrupt handler(s) */ |
1295 | if (grab_irq != 0) | 1291 | if (grab_irq != 0) |
1296 | request_irq(cs_irq, pcic_interrupt, 0, "i82365", pcic_interrupt); | 1292 | ret = request_irq(cs_irq, pcic_interrupt, 0, "i82365", pcic_interrupt); |
1297 | 1293 | ||
1294 | if (ret) | ||
1295 | goto err_socket_release; | ||
1296 | |||
1298 | /* register sockets with the pcmcia core */ | 1297 | /* register sockets with the pcmcia core */ |
1299 | for (i = 0; i < sockets; i++) { | 1298 | for (i = 0; i < sockets; i++) { |
1300 | socket[i].socket.dev.parent = &i82365_device->dev; | 1299 | socket[i].socket.dev.parent = &i82365_device->dev; |
@@ -1324,7 +1323,23 @@ static int __init init_i82365(void) | |||
1324 | } | 1323 | } |
1325 | 1324 | ||
1326 | return 0; | 1325 | return 0; |
1327 | 1326 | err_socket_release: | |
1327 | for (i = 0; i < sockets; i++) { | ||
1328 | /* Turn off all interrupt sources! */ | ||
1329 | i365_set(i, I365_CSCINT, 0); | ||
1330 | release_region(socket[i].ioaddr, 2); | ||
1331 | } | ||
1332 | err_dev_unregister: | ||
1333 | platform_device_unregister(i82365_device); | ||
1334 | release_region(i365_base, 2); | ||
1335 | #ifdef CONFIG_PNP | ||
1336 | if (i82365_pnpdev) | ||
1337 | pnp_disable_dev(i82365_pnpdev); | ||
1338 | #endif | ||
1339 | err_driver_unregister: | ||
1340 | driver_unregister(&i82365_driver); | ||
1341 | err_out: | ||
1342 | return ret; | ||
1328 | } /* init_i82365 */ | 1343 | } /* init_i82365 */ |
1329 | 1344 | ||
1330 | static void __exit exit_i82365(void) | 1345 | static void __exit exit_i82365(void) |
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c index ac70d2cb7dd4..13a5fbd50a07 100644 --- a/drivers/pcmcia/m8xx_pcmcia.c +++ b/drivers/pcmcia/m8xx_pcmcia.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * m8xx_pcmcia.c - Linux PCMCIA socket driver for the mpc8xx series. | 2 | * m8xx_pcmcia.c - Linux PCMCIA socket driver for the mpc8xx series. |
3 | * | 3 | * |
4 | * (C) 1999-2000 Magnus Damm <damm@bitsmart.com> | 4 | * (C) 1999-2000 Magnus Damm <damm@opensource.se> |
5 | * (C) 2001-2002 Montavista Software, Inc. | 5 | * (C) 2001-2002 Montavista Software, Inc. |
6 | * <mlocke@mvista.com> | 6 | * <mlocke@mvista.com> |
7 | * | 7 | * |
@@ -60,7 +60,6 @@ | |||
60 | #include <asm/of_device.h> | 60 | #include <asm/of_device.h> |
61 | #include <asm/of_platform.h> | 61 | #include <asm/of_platform.h> |
62 | 62 | ||
63 | #include <pcmcia/version.h> | ||
64 | #include <pcmcia/cs_types.h> | 63 | #include <pcmcia/cs_types.h> |
65 | #include <pcmcia/cs.h> | 64 | #include <pcmcia/cs.h> |
66 | #include <pcmcia/ss.h> | 65 | #include <pcmcia/ss.h> |
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index 5f186abca108..afd00e7bbbef 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c | |||
@@ -29,10 +29,10 @@ | |||
29 | #include <linux/pci.h> | 29 | #include <linux/pci.h> |
30 | #include <linux/workqueue.h> | 30 | #include <linux/workqueue.h> |
31 | 31 | ||
32 | #define IN_CARD_SERVICES | ||
33 | #include <pcmcia/cs_types.h> | 32 | #include <pcmcia/cs_types.h> |
34 | #include <pcmcia/cs.h> | 33 | #include <pcmcia/cs.h> |
35 | #include <pcmcia/cistpl.h> | 34 | #include <pcmcia/cistpl.h> |
35 | #include <pcmcia/cisreg.h> | ||
36 | #include <pcmcia/ds.h> | 36 | #include <pcmcia/ds.h> |
37 | #include <pcmcia/ss.h> | 37 | #include <pcmcia/ss.h> |
38 | 38 | ||
@@ -138,6 +138,154 @@ static int proc_read_drivers(char *buf, char **start, off_t pos, | |||
138 | } | 138 | } |
139 | #endif | 139 | #endif |
140 | 140 | ||
141 | |||
142 | #ifdef CONFIG_PCMCIA_PROBE | ||
143 | |||
144 | static int adjust_irq(struct pcmcia_socket *s, adjust_t *adj) | ||
145 | { | ||
146 | int irq; | ||
147 | u32 mask; | ||
148 | |||
149 | irq = adj->resource.irq.IRQ; | ||
150 | if ((irq < 0) || (irq > 15)) | ||
151 | return CS_BAD_IRQ; | ||
152 | |||
153 | if (adj->Action != REMOVE_MANAGED_RESOURCE) | ||
154 | return 0; | ||
155 | |||
156 | mask = 1 << irq; | ||
157 | |||
158 | if (!(s->irq_mask & mask)) | ||
159 | return 0; | ||
160 | |||
161 | s->irq_mask &= ~mask; | ||
162 | |||
163 | return 0; | ||
164 | } | ||
165 | |||
166 | #else | ||
167 | |||
168 | static inline int adjust_irq(struct pcmcia_socket *s, adjust_t *adj) { | ||
169 | return CS_SUCCESS; | ||
170 | } | ||
171 | |||
172 | #endif | ||
173 | |||
174 | static int pcmcia_adjust_resource_info(adjust_t *adj) | ||
175 | { | ||
176 | struct pcmcia_socket *s; | ||
177 | int ret = CS_UNSUPPORTED_FUNCTION; | ||
178 | unsigned long flags; | ||
179 | |||
180 | down_read(&pcmcia_socket_list_rwsem); | ||
181 | list_for_each_entry(s, &pcmcia_socket_list, socket_list) { | ||
182 | |||
183 | if (adj->Resource == RES_IRQ) | ||
184 | ret = adjust_irq(s, adj); | ||
185 | |||
186 | else if (s->resource_ops->add_io) { | ||
187 | unsigned long begin, end; | ||
188 | |||
189 | /* you can't use the old interface if the new | ||
190 | * one was used before */ | ||
191 | spin_lock_irqsave(&s->lock, flags); | ||
192 | if ((s->resource_setup_new) && | ||
193 | !(s->resource_setup_old)) { | ||
194 | spin_unlock_irqrestore(&s->lock, flags); | ||
195 | continue; | ||
196 | } else if (!(s->resource_setup_old)) | ||
197 | s->resource_setup_old = 1; | ||
198 | spin_unlock_irqrestore(&s->lock, flags); | ||
199 | |||
200 | switch (adj->Resource) { | ||
201 | case RES_MEMORY_RANGE: | ||
202 | begin = adj->resource.memory.Base; | ||
203 | end = adj->resource.memory.Base + adj->resource.memory.Size - 1; | ||
204 | if (s->resource_ops->add_mem) | ||
205 | ret =s->resource_ops->add_mem(s, adj->Action, begin, end); | ||
206 | case RES_IO_RANGE: | ||
207 | begin = adj->resource.io.BasePort; | ||
208 | end = adj->resource.io.BasePort + adj->resource.io.NumPorts - 1; | ||
209 | if (s->resource_ops->add_io) | ||
210 | ret = s->resource_ops->add_io(s, adj->Action, begin, end); | ||
211 | } | ||
212 | if (!ret) { | ||
213 | /* as there's no way we know this is the | ||
214 | * last call to adjust_resource_info, we | ||
215 | * always need to assume this is the latest | ||
216 | * one... */ | ||
217 | spin_lock_irqsave(&s->lock, flags); | ||
218 | s->resource_setup_done = 1; | ||
219 | spin_unlock_irqrestore(&s->lock, flags); | ||
220 | } | ||
221 | } | ||
222 | } | ||
223 | up_read(&pcmcia_socket_list_rwsem); | ||
224 | |||
225 | return (ret); | ||
226 | } | ||
227 | |||
228 | /** pccard_get_status | ||
229 | * | ||
230 | * Get the current socket state bits. We don't support the latched | ||
231 | * SocketState yet: I haven't seen any point for it. | ||
232 | */ | ||
233 | |||
234 | static int pccard_get_status(struct pcmcia_socket *s, | ||
235 | struct pcmcia_device *p_dev, | ||
236 | cs_status_t *status) | ||
237 | { | ||
238 | config_t *c; | ||
239 | int val; | ||
240 | |||
241 | s->ops->get_status(s, &val); | ||
242 | status->CardState = status->SocketState = 0; | ||
243 | status->CardState |= (val & SS_DETECT) ? CS_EVENT_CARD_DETECT : 0; | ||
244 | status->CardState |= (val & SS_CARDBUS) ? CS_EVENT_CB_DETECT : 0; | ||
245 | status->CardState |= (val & SS_3VCARD) ? CS_EVENT_3VCARD : 0; | ||
246 | status->CardState |= (val & SS_XVCARD) ? CS_EVENT_XVCARD : 0; | ||
247 | if (s->state & SOCKET_SUSPEND) | ||
248 | status->CardState |= CS_EVENT_PM_SUSPEND; | ||
249 | if (!(s->state & SOCKET_PRESENT)) | ||
250 | return CS_NO_CARD; | ||
251 | |||
252 | c = (p_dev) ? p_dev->function_config : NULL; | ||
253 | |||
254 | if ((c != NULL) && (c->state & CONFIG_LOCKED) && | ||
255 | (c->IntType & (INT_MEMORY_AND_IO | INT_ZOOMED_VIDEO))) { | ||
256 | u_char reg; | ||
257 | if (c->CardValues & PRESENT_PIN_REPLACE) { | ||
258 | pcmcia_read_cis_mem(s, 1, (c->ConfigBase+CISREG_PRR)>>1, 1, ®); | ||
259 | status->CardState |= | ||
260 | (reg & PRR_WP_STATUS) ? CS_EVENT_WRITE_PROTECT : 0; | ||
261 | status->CardState |= | ||
262 | (reg & PRR_READY_STATUS) ? CS_EVENT_READY_CHANGE : 0; | ||
263 | status->CardState |= | ||
264 | (reg & PRR_BVD2_STATUS) ? CS_EVENT_BATTERY_LOW : 0; | ||
265 | status->CardState |= | ||
266 | (reg & PRR_BVD1_STATUS) ? CS_EVENT_BATTERY_DEAD : 0; | ||
267 | } else { | ||
268 | /* No PRR? Then assume we're always ready */ | ||
269 | status->CardState |= CS_EVENT_READY_CHANGE; | ||
270 | } | ||
271 | if (c->CardValues & PRESENT_EXT_STATUS) { | ||
272 | pcmcia_read_cis_mem(s, 1, (c->ConfigBase+CISREG_ESR)>>1, 1, ®); | ||
273 | status->CardState |= | ||
274 | (reg & ESR_REQ_ATTN) ? CS_EVENT_REQUEST_ATTENTION : 0; | ||
275 | } | ||
276 | return CS_SUCCESS; | ||
277 | } | ||
278 | status->CardState |= | ||
279 | (val & SS_WRPROT) ? CS_EVENT_WRITE_PROTECT : 0; | ||
280 | status->CardState |= | ||
281 | (val & SS_BATDEAD) ? CS_EVENT_BATTERY_DEAD : 0; | ||
282 | status->CardState |= | ||
283 | (val & SS_BATWARN) ? CS_EVENT_BATTERY_LOW : 0; | ||
284 | status->CardState |= | ||
285 | (val & SS_READY) ? CS_EVENT_READY_CHANGE : 0; | ||
286 | return CS_SUCCESS; | ||
287 | } /* pccard_get_status */ | ||
288 | |||
141 | /*====================================================================== | 289 | /*====================================================================== |
142 | 290 | ||
143 | These manage a ring buffer of events pending for one user process | 291 | These manage a ring buffer of events pending for one user process |
@@ -546,8 +694,6 @@ static u_int ds_poll(struct file *file, poll_table *wait) | |||
546 | 694 | ||
547 | /*====================================================================*/ | 695 | /*====================================================================*/ |
548 | 696 | ||
549 | extern int pcmcia_adjust_resource_info(adjust_t *adj); | ||
550 | |||
551 | static int ds_ioctl(struct inode * inode, struct file * file, | 697 | static int ds_ioctl(struct inode * inode, struct file * file, |
552 | u_int cmd, u_long arg) | 698 | u_int cmd, u_long arg) |
553 | { | 699 | { |
@@ -649,7 +795,7 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
649 | mutex_lock(&s->skt_mutex); | 795 | mutex_lock(&s->skt_mutex); |
650 | pcmcia_validate_mem(s); | 796 | pcmcia_validate_mem(s); |
651 | mutex_unlock(&s->skt_mutex); | 797 | mutex_unlock(&s->skt_mutex); |
652 | ret = pccard_validate_cis(s, BIND_FN_ALL, &buf->cisinfo); | 798 | ret = pccard_validate_cis(s, BIND_FN_ALL, &buf->cisinfo.Chains); |
653 | break; | 799 | break; |
654 | case DS_SUSPEND_CARD: | 800 | case DS_SUSPEND_CARD: |
655 | ret = pcmcia_suspend_card(s); | 801 | ret = pcmcia_suspend_card(s); |
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 1d128fbd1a92..4884a18cf9e6 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c | |||
@@ -21,11 +21,9 @@ | |||
21 | #include <linux/pci.h> | 21 | #include <linux/pci.h> |
22 | #include <linux/device.h> | 22 | #include <linux/device.h> |
23 | 23 | ||
24 | #define IN_CARD_SERVICES | ||
25 | #include <pcmcia/cs_types.h> | 24 | #include <pcmcia/cs_types.h> |
26 | #include <pcmcia/ss.h> | 25 | #include <pcmcia/ss.h> |
27 | #include <pcmcia/cs.h> | 26 | #include <pcmcia/cs.h> |
28 | #include <pcmcia/bulkmem.h> | ||
29 | #include <pcmcia/cistpl.h> | 27 | #include <pcmcia/cistpl.h> |
30 | #include <pcmcia/cisreg.h> | 28 | #include <pcmcia/cisreg.h> |
31 | #include <pcmcia/ds.h> | 29 | #include <pcmcia/ds.h> |
@@ -311,74 +309,6 @@ int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, | |||
311 | EXPORT_SYMBOL(pcmcia_get_window); | 309 | EXPORT_SYMBOL(pcmcia_get_window); |
312 | 310 | ||
313 | 311 | ||
314 | /** pccard_get_status | ||
315 | * | ||
316 | * Get the current socket state bits. We don't support the latched | ||
317 | * SocketState yet: I haven't seen any point for it. | ||
318 | */ | ||
319 | |||
320 | int pccard_get_status(struct pcmcia_socket *s, struct pcmcia_device *p_dev, | ||
321 | cs_status_t *status) | ||
322 | { | ||
323 | config_t *c; | ||
324 | int val; | ||
325 | |||
326 | s->ops->get_status(s, &val); | ||
327 | status->CardState = status->SocketState = 0; | ||
328 | status->CardState |= (val & SS_DETECT) ? CS_EVENT_CARD_DETECT : 0; | ||
329 | status->CardState |= (val & SS_CARDBUS) ? CS_EVENT_CB_DETECT : 0; | ||
330 | status->CardState |= (val & SS_3VCARD) ? CS_EVENT_3VCARD : 0; | ||
331 | status->CardState |= (val & SS_XVCARD) ? CS_EVENT_XVCARD : 0; | ||
332 | if (s->state & SOCKET_SUSPEND) | ||
333 | status->CardState |= CS_EVENT_PM_SUSPEND; | ||
334 | if (!(s->state & SOCKET_PRESENT)) | ||
335 | return CS_NO_CARD; | ||
336 | |||
337 | c = (p_dev) ? p_dev->function_config : NULL; | ||
338 | |||
339 | if ((c != NULL) && (c->state & CONFIG_LOCKED) && | ||
340 | (c->IntType & (INT_MEMORY_AND_IO | INT_ZOOMED_VIDEO))) { | ||
341 | u_char reg; | ||
342 | if (c->CardValues & PRESENT_PIN_REPLACE) { | ||
343 | pcmcia_read_cis_mem(s, 1, (c->ConfigBase+CISREG_PRR)>>1, 1, ®); | ||
344 | status->CardState |= | ||
345 | (reg & PRR_WP_STATUS) ? CS_EVENT_WRITE_PROTECT : 0; | ||
346 | status->CardState |= | ||
347 | (reg & PRR_READY_STATUS) ? CS_EVENT_READY_CHANGE : 0; | ||
348 | status->CardState |= | ||
349 | (reg & PRR_BVD2_STATUS) ? CS_EVENT_BATTERY_LOW : 0; | ||
350 | status->CardState |= | ||
351 | (reg & PRR_BVD1_STATUS) ? CS_EVENT_BATTERY_DEAD : 0; | ||
352 | } else { | ||
353 | /* No PRR? Then assume we're always ready */ | ||
354 | status->CardState |= CS_EVENT_READY_CHANGE; | ||
355 | } | ||
356 | if (c->CardValues & PRESENT_EXT_STATUS) { | ||
357 | pcmcia_read_cis_mem(s, 1, (c->ConfigBase+CISREG_ESR)>>1, 1, ®); | ||
358 | status->CardState |= | ||
359 | (reg & ESR_REQ_ATTN) ? CS_EVENT_REQUEST_ATTENTION : 0; | ||
360 | } | ||
361 | return CS_SUCCESS; | ||
362 | } | ||
363 | status->CardState |= | ||
364 | (val & SS_WRPROT) ? CS_EVENT_WRITE_PROTECT : 0; | ||
365 | status->CardState |= | ||
366 | (val & SS_BATDEAD) ? CS_EVENT_BATTERY_DEAD : 0; | ||
367 | status->CardState |= | ||
368 | (val & SS_BATWARN) ? CS_EVENT_BATTERY_LOW : 0; | ||
369 | status->CardState |= | ||
370 | (val & SS_READY) ? CS_EVENT_READY_CHANGE : 0; | ||
371 | return CS_SUCCESS; | ||
372 | } /* pccard_get_status */ | ||
373 | |||
374 | int pcmcia_get_status(struct pcmcia_device *p_dev, cs_status_t *status) | ||
375 | { | ||
376 | return pccard_get_status(p_dev->socket, p_dev, status); | ||
377 | } | ||
378 | EXPORT_SYMBOL(pcmcia_get_status); | ||
379 | |||
380 | |||
381 | |||
382 | /** pcmcia_get_mem_page | 312 | /** pcmcia_get_mem_page |
383 | * | 313 | * |
384 | * Change the card address of an already open memory window. | 314 | * Change the card address of an already open memory window. |
@@ -812,6 +742,15 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) | |||
812 | type = IRQF_SHARED; | 742 | type = IRQF_SHARED; |
813 | 743 | ||
814 | #ifdef CONFIG_PCMCIA_PROBE | 744 | #ifdef CONFIG_PCMCIA_PROBE |
745 | |||
746 | #ifdef IRQ_NOAUTOEN | ||
747 | /* if the underlying IRQ infrastructure allows for it, only allocate | ||
748 | * the IRQ, but do not enable it | ||
749 | */ | ||
750 | if (!(req->Attributes & IRQ_HANDLE_PRESENT)) | ||
751 | type |= IRQ_NOAUTOEN; | ||
752 | #endif /* IRQ_NOAUTOEN */ | ||
753 | |||
815 | if (s->irq.AssignedIRQ != 0) { | 754 | if (s->irq.AssignedIRQ != 0) { |
816 | /* If the interrupt is already assigned, it must be the same */ | 755 | /* If the interrupt is already assigned, it must be the same */ |
817 | irq = s->irq.AssignedIRQ; | 756 | irq = s->irq.AssignedIRQ; |
@@ -966,7 +905,7 @@ void pcmcia_disable_device(struct pcmcia_device *p_dev) { | |||
966 | pcmcia_release_configuration(p_dev); | 905 | pcmcia_release_configuration(p_dev); |
967 | pcmcia_release_io(p_dev, &p_dev->io); | 906 | pcmcia_release_io(p_dev, &p_dev->io); |
968 | pcmcia_release_irq(p_dev, &p_dev->irq); | 907 | pcmcia_release_irq(p_dev, &p_dev->irq); |
969 | if (&p_dev->win) | 908 | if (p_dev->win) |
970 | pcmcia_release_window(p_dev->win); | 909 | pcmcia_release_window(p_dev->win); |
971 | } | 910 | } |
972 | EXPORT_SYMBOL(pcmcia_disable_device); | 911 | EXPORT_SYMBOL(pcmcia_disable_device); |
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c index 9414163c78e7..ccfdf1969a7f 100644 --- a/drivers/pcmcia/pxa2xx_base.c +++ b/drivers/pcmcia/pxa2xx_base.c | |||
@@ -33,7 +33,6 @@ | |||
33 | 33 | ||
34 | #include <pcmcia/cs_types.h> | 34 | #include <pcmcia/cs_types.h> |
35 | #include <pcmcia/ss.h> | 35 | #include <pcmcia/ss.h> |
36 | #include <pcmcia/bulkmem.h> | ||
37 | #include <pcmcia/cistpl.h> | 36 | #include <pcmcia/cistpl.h> |
38 | 37 | ||
39 | #include "cs_internal.h" | 38 | #include "cs_internal.h" |
diff --git a/drivers/pcmcia/rsrc_mgr.c b/drivers/pcmcia/rsrc_mgr.c index ce2226273aaa..c0e2afc79e3e 100644 --- a/drivers/pcmcia/rsrc_mgr.c +++ b/drivers/pcmcia/rsrc_mgr.c | |||
@@ -21,86 +21,6 @@ | |||
21 | #include "cs_internal.h" | 21 | #include "cs_internal.h" |
22 | 22 | ||
23 | 23 | ||
24 | #ifdef CONFIG_PCMCIA_IOCTL | ||
25 | |||
26 | #ifdef CONFIG_PCMCIA_PROBE | ||
27 | |||
28 | static int adjust_irq(struct pcmcia_socket *s, adjust_t *adj) | ||
29 | { | ||
30 | int irq; | ||
31 | u32 mask; | ||
32 | |||
33 | irq = adj->resource.irq.IRQ; | ||
34 | if ((irq < 0) || (irq > 15)) | ||
35 | return CS_BAD_IRQ; | ||
36 | |||
37 | if (adj->Action != REMOVE_MANAGED_RESOURCE) | ||
38 | return 0; | ||
39 | |||
40 | mask = 1 << irq; | ||
41 | |||
42 | if (!(s->irq_mask & mask)) | ||
43 | return 0; | ||
44 | |||
45 | s->irq_mask &= ~mask; | ||
46 | |||
47 | return 0; | ||
48 | } | ||
49 | |||
50 | #else | ||
51 | |||
52 | static inline int adjust_irq(struct pcmcia_socket *s, adjust_t *adj) { | ||
53 | return CS_SUCCESS; | ||
54 | } | ||
55 | |||
56 | #endif | ||
57 | |||
58 | |||
59 | int pcmcia_adjust_resource_info(adjust_t *adj) | ||
60 | { | ||
61 | struct pcmcia_socket *s; | ||
62 | int ret = CS_UNSUPPORTED_FUNCTION; | ||
63 | unsigned long flags; | ||
64 | |||
65 | down_read(&pcmcia_socket_list_rwsem); | ||
66 | list_for_each_entry(s, &pcmcia_socket_list, socket_list) { | ||
67 | |||
68 | if (adj->Resource == RES_IRQ) | ||
69 | ret = adjust_irq(s, adj); | ||
70 | |||
71 | else if (s->resource_ops->adjust_resource) { | ||
72 | |||
73 | /* you can't use the old interface if the new | ||
74 | * one was used before */ | ||
75 | spin_lock_irqsave(&s->lock, flags); | ||
76 | if ((s->resource_setup_new) && | ||
77 | !(s->resource_setup_old)) { | ||
78 | spin_unlock_irqrestore(&s->lock, flags); | ||
79 | continue; | ||
80 | } else if (!(s->resource_setup_old)) | ||
81 | s->resource_setup_old = 1; | ||
82 | spin_unlock_irqrestore(&s->lock, flags); | ||
83 | |||
84 | ret = s->resource_ops->adjust_resource(s, adj); | ||
85 | if (!ret) { | ||
86 | /* as there's no way we know this is the | ||
87 | * last call to adjust_resource_info, we | ||
88 | * always need to assume this is the latest | ||
89 | * one... */ | ||
90 | spin_lock_irqsave(&s->lock, flags); | ||
91 | s->resource_setup_done = 1; | ||
92 | spin_unlock_irqrestore(&s->lock, flags); | ||
93 | } | ||
94 | } | ||
95 | } | ||
96 | up_read(&pcmcia_socket_list_rwsem); | ||
97 | |||
98 | return (ret); | ||
99 | } | ||
100 | EXPORT_SYMBOL(pcmcia_adjust_resource_info); | ||
101 | |||
102 | #endif | ||
103 | |||
104 | int pcmcia_validate_mem(struct pcmcia_socket *s) | 24 | int pcmcia_validate_mem(struct pcmcia_socket *s) |
105 | { | 25 | { |
106 | if (s->resource_ops->validate_mem) | 26 | if (s->resource_ops->validate_mem) |
@@ -164,7 +84,8 @@ struct pccard_resource_ops pccard_static_ops = { | |||
164 | .adjust_io_region = NULL, | 84 | .adjust_io_region = NULL, |
165 | .find_io = NULL, | 85 | .find_io = NULL, |
166 | .find_mem = NULL, | 86 | .find_mem = NULL, |
167 | .adjust_resource = NULL, | 87 | .add_io = NULL, |
88 | .add_mem = NULL, | ||
168 | .init = static_init, | 89 | .init = static_init, |
169 | .exit = NULL, | 90 | .exit = NULL, |
170 | }; | 91 | }; |
@@ -264,7 +185,8 @@ struct pccard_resource_ops pccard_iodyn_ops = { | |||
264 | .adjust_io_region = iodyn_adjust_io_region, | 185 | .adjust_io_region = iodyn_adjust_io_region, |
265 | .find_io = iodyn_find_io_region, | 186 | .find_io = iodyn_find_io_region, |
266 | .find_mem = NULL, | 187 | .find_mem = NULL, |
267 | .adjust_resource = NULL, | 188 | .add_io = NULL, |
189 | .add_mem = NULL, | ||
268 | .init = static_init, | 190 | .init = static_init, |
269 | .exit = NULL, | 191 | .exit = NULL, |
270 | }; | 192 | }; |
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c index 0fcf763b9175..d0c1d63d1891 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <pcmcia/cs_types.h> | 31 | #include <pcmcia/cs_types.h> |
32 | #include <pcmcia/ss.h> | 32 | #include <pcmcia/ss.h> |
33 | #include <pcmcia/cs.h> | 33 | #include <pcmcia/cs.h> |
34 | #include <pcmcia/bulkmem.h> | ||
35 | #include <pcmcia/cistpl.h> | 34 | #include <pcmcia/cistpl.h> |
36 | #include "cs_internal.h" | 35 | #include "cs_internal.h" |
37 | 36 | ||
@@ -261,21 +260,22 @@ static void do_io_probe(struct pcmcia_socket *s, unsigned int base, | |||
261 | ======================================================================*/ | 260 | ======================================================================*/ |
262 | 261 | ||
263 | /* Validation function for cards with a valid CIS */ | 262 | /* Validation function for cards with a valid CIS */ |
264 | static int readable(struct pcmcia_socket *s, struct resource *res, cisinfo_t *info) | 263 | static int readable(struct pcmcia_socket *s, struct resource *res, |
264 | unsigned int *count) | ||
265 | { | 265 | { |
266 | int ret = -1; | 266 | int ret = -1; |
267 | 267 | ||
268 | s->cis_mem.res = res; | 268 | s->cis_mem.res = res; |
269 | s->cis_virt = ioremap(res->start, s->map_size); | 269 | s->cis_virt = ioremap(res->start, s->map_size); |
270 | if (s->cis_virt) { | 270 | if (s->cis_virt) { |
271 | ret = pccard_validate_cis(s, BIND_FN_ALL, info); | 271 | ret = pccard_validate_cis(s, BIND_FN_ALL, count); |
272 | /* invalidate mapping and CIS cache */ | 272 | /* invalidate mapping and CIS cache */ |
273 | iounmap(s->cis_virt); | 273 | iounmap(s->cis_virt); |
274 | s->cis_virt = NULL; | 274 | s->cis_virt = NULL; |
275 | destroy_cis_cache(s); | 275 | destroy_cis_cache(s); |
276 | } | 276 | } |
277 | s->cis_mem.res = NULL; | 277 | s->cis_mem.res = NULL; |
278 | if ((ret != 0) || (info->Chains == 0)) | 278 | if ((ret != 0) || (count == 0)) |
279 | return 0; | 279 | return 0; |
280 | return 1; | 280 | return 1; |
281 | } | 281 | } |
@@ -316,7 +316,7 @@ static int | |||
316 | cis_readable(struct pcmcia_socket *s, unsigned long base, unsigned long size) | 316 | cis_readable(struct pcmcia_socket *s, unsigned long base, unsigned long size) |
317 | { | 317 | { |
318 | struct resource *res1, *res2; | 318 | struct resource *res1, *res2; |
319 | cisinfo_t info1, info2; | 319 | unsigned int info1, info2; |
320 | int ret = 0; | 320 | int ret = 0; |
321 | 321 | ||
322 | res1 = claim_region(s, base, size/2, IORESOURCE_MEM, "cs memory probe"); | 322 | res1 = claim_region(s, base, size/2, IORESOURCE_MEM, "cs memory probe"); |
@@ -330,7 +330,7 @@ cis_readable(struct pcmcia_socket *s, unsigned long base, unsigned long size) | |||
330 | free_region(res2); | 330 | free_region(res2); |
331 | free_region(res1); | 331 | free_region(res1); |
332 | 332 | ||
333 | return (ret == 2) && (info1.Chains == info2.Chains); | 333 | return (ret == 2) && (info1 == info2); |
334 | } | 334 | } |
335 | 335 | ||
336 | static int | 336 | static int |
@@ -766,21 +766,6 @@ static int adjust_io(struct pcmcia_socket *s, unsigned int action, unsigned long | |||
766 | } | 766 | } |
767 | 767 | ||
768 | 768 | ||
769 | static int nonstatic_adjust_resource_info(struct pcmcia_socket *s, adjust_t *adj) | ||
770 | { | ||
771 | unsigned long end; | ||
772 | |||
773 | switch (adj->Resource) { | ||
774 | case RES_MEMORY_RANGE: | ||
775 | end = adj->resource.memory.Base + adj->resource.memory.Size - 1; | ||
776 | return adjust_memory(s, adj->Action, adj->resource.memory.Base, end); | ||
777 | case RES_IO_RANGE: | ||
778 | end = adj->resource.io.BasePort + adj->resource.io.NumPorts - 1; | ||
779 | return adjust_io(s, adj->Action, adj->resource.io.BasePort, end); | ||
780 | } | ||
781 | return CS_UNSUPPORTED_FUNCTION; | ||
782 | } | ||
783 | |||
784 | #ifdef CONFIG_PCI | 769 | #ifdef CONFIG_PCI |
785 | static int nonstatic_autoadd_resources(struct pcmcia_socket *s) | 770 | static int nonstatic_autoadd_resources(struct pcmcia_socket *s) |
786 | { | 771 | { |
@@ -889,7 +874,8 @@ struct pccard_resource_ops pccard_nonstatic_ops = { | |||
889 | .adjust_io_region = nonstatic_adjust_io_region, | 874 | .adjust_io_region = nonstatic_adjust_io_region, |
890 | .find_io = nonstatic_find_io_region, | 875 | .find_io = nonstatic_find_io_region, |
891 | .find_mem = nonstatic_find_mem_region, | 876 | .find_mem = nonstatic_find_mem_region, |
892 | .adjust_resource = nonstatic_adjust_resource_info, | 877 | .add_io = adjust_io, |
878 | .add_mem = adjust_memory, | ||
893 | .init = nonstatic_init, | 879 | .init = nonstatic_init, |
894 | .exit = nonstatic_release_resource_db, | 880 | .exit = nonstatic_release_resource_db, |
895 | }; | 881 | }; |
@@ -1008,41 +994,34 @@ static ssize_t store_mem_db(struct device *dev, | |||
1008 | } | 994 | } |
1009 | static DEVICE_ATTR(available_resources_mem, 0600, show_mem_db, store_mem_db); | 995 | static DEVICE_ATTR(available_resources_mem, 0600, show_mem_db, store_mem_db); |
1010 | 996 | ||
1011 | static struct device_attribute *pccard_rsrc_attributes[] = { | 997 | static struct attribute *pccard_rsrc_attributes[] = { |
1012 | &dev_attr_available_resources_io, | 998 | &dev_attr_available_resources_io.attr, |
1013 | &dev_attr_available_resources_mem, | 999 | &dev_attr_available_resources_mem.attr, |
1014 | NULL, | 1000 | NULL, |
1015 | }; | 1001 | }; |
1016 | 1002 | ||
1003 | static const struct attribute_group rsrc_attributes = { | ||
1004 | .attrs = pccard_rsrc_attributes, | ||
1005 | }; | ||
1006 | |||
1017 | static int __devinit pccard_sysfs_add_rsrc(struct device *dev, | 1007 | static int __devinit pccard_sysfs_add_rsrc(struct device *dev, |
1018 | struct class_interface *class_intf) | 1008 | struct class_interface *class_intf) |
1019 | { | 1009 | { |
1020 | struct pcmcia_socket *s = dev_get_drvdata(dev); | 1010 | struct pcmcia_socket *s = dev_get_drvdata(dev); |
1021 | struct device_attribute **attr; | 1011 | |
1022 | int ret = 0; | ||
1023 | if (s->resource_ops != &pccard_nonstatic_ops) | 1012 | if (s->resource_ops != &pccard_nonstatic_ops) |
1024 | return 0; | 1013 | return 0; |
1025 | 1014 | return sysfs_create_group(&dev->kobj, &rsrc_attributes); | |
1026 | for (attr = pccard_rsrc_attributes; *attr; attr++) { | ||
1027 | ret = device_create_file(dev, *attr); | ||
1028 | if (ret) | ||
1029 | break; | ||
1030 | } | ||
1031 | |||
1032 | return ret; | ||
1033 | } | 1015 | } |
1034 | 1016 | ||
1035 | static void __devexit pccard_sysfs_remove_rsrc(struct device *dev, | 1017 | static void __devexit pccard_sysfs_remove_rsrc(struct device *dev, |
1036 | struct class_interface *class_intf) | 1018 | struct class_interface *class_intf) |
1037 | { | 1019 | { |
1038 | struct pcmcia_socket *s = dev_get_drvdata(dev); | 1020 | struct pcmcia_socket *s = dev_get_drvdata(dev); |
1039 | struct device_attribute **attr; | ||
1040 | 1021 | ||
1041 | if (s->resource_ops != &pccard_nonstatic_ops) | 1022 | if (s->resource_ops != &pccard_nonstatic_ops) |
1042 | return; | 1023 | return; |
1043 | 1024 | sysfs_remove_group(&dev->kobj, &rsrc_attributes); | |
1044 | for (attr = pccard_rsrc_attributes; *attr; attr++) | ||
1045 | device_remove_file(dev, *attr); | ||
1046 | } | 1025 | } |
1047 | 1026 | ||
1048 | static struct class_interface pccard_rsrc_interface __refdata = { | 1027 | static struct class_interface pccard_rsrc_interface __refdata = { |
diff --git a/drivers/pcmcia/soc_common.h b/drivers/pcmcia/soc_common.h index 1edc1da9d353..91ef6a0da3ab 100644 --- a/drivers/pcmcia/soc_common.h +++ b/drivers/pcmcia/soc_common.h | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <pcmcia/cs_types.h> | 14 | #include <pcmcia/cs_types.h> |
15 | #include <pcmcia/cs.h> | 15 | #include <pcmcia/cs.h> |
16 | #include <pcmcia/ss.h> | 16 | #include <pcmcia/ss.h> |
17 | #include <pcmcia/bulkmem.h> | ||
18 | #include <pcmcia/cistpl.h> | 17 | #include <pcmcia/cistpl.h> |
19 | #include "cs_internal.h" | 18 | #include "cs_internal.h" |
20 | 19 | ||
diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c index 562384d6f321..006a29e91d83 100644 --- a/drivers/pcmcia/socket_sysfs.c +++ b/drivers/pcmcia/socket_sysfs.c | |||
@@ -27,11 +27,9 @@ | |||
27 | #include <asm/system.h> | 27 | #include <asm/system.h> |
28 | #include <asm/irq.h> | 28 | #include <asm/irq.h> |
29 | 29 | ||
30 | #define IN_CARD_SERVICES | ||
31 | #include <pcmcia/cs_types.h> | 30 | #include <pcmcia/cs_types.h> |
32 | #include <pcmcia/ss.h> | 31 | #include <pcmcia/ss.h> |
33 | #include <pcmcia/cs.h> | 32 | #include <pcmcia/cs.h> |
34 | #include <pcmcia/bulkmem.h> | ||
35 | #include <pcmcia/cistpl.h> | 33 | #include <pcmcia/cistpl.h> |
36 | #include <pcmcia/cisreg.h> | 34 | #include <pcmcia/cisreg.h> |
37 | #include <pcmcia/ds.h> | 35 | #include <pcmcia/ds.h> |
@@ -293,7 +291,7 @@ static ssize_t pccard_show_cis(struct kobject *kobj, | |||
293 | count = 0; | 291 | count = 0; |
294 | else { | 292 | else { |
295 | struct pcmcia_socket *s; | 293 | struct pcmcia_socket *s; |
296 | cisinfo_t cisinfo; | 294 | unsigned int chains; |
297 | 295 | ||
298 | if (off + count > size) | 296 | if (off + count > size) |
299 | count = size - off; | 297 | count = size - off; |
@@ -302,9 +300,9 @@ static ssize_t pccard_show_cis(struct kobject *kobj, | |||
302 | 300 | ||
303 | if (!(s->state & SOCKET_PRESENT)) | 301 | if (!(s->state & SOCKET_PRESENT)) |
304 | return -ENODEV; | 302 | return -ENODEV; |
305 | if (pccard_validate_cis(s, BIND_FN_ALL, &cisinfo)) | 303 | if (pccard_validate_cis(s, BIND_FN_ALL, &chains)) |
306 | return -EIO; | 304 | return -EIO; |
307 | if (!cisinfo.Chains) | 305 | if (!chains) |
308 | return -ENODATA; | 306 | return -ENODATA; |
309 | 307 | ||
310 | count = pccard_extract_cis(s, buf, off, count); | 308 | count = pccard_extract_cis(s, buf, off, count); |
diff --git a/drivers/pcmcia/ti113x.h b/drivers/pcmcia/ti113x.h index d29657bf1b40..129db7bd06c3 100644 --- a/drivers/pcmcia/ti113x.h +++ b/drivers/pcmcia/ti113x.h | |||
@@ -155,7 +155,7 @@ | |||
155 | #define ENE_TEST_C9_TLTENABLE 0x02 | 155 | #define ENE_TEST_C9_TLTENABLE 0x02 |
156 | #define ENE_TEST_C9_PFENABLE_F0 0x04 | 156 | #define ENE_TEST_C9_PFENABLE_F0 0x04 |
157 | #define ENE_TEST_C9_PFENABLE_F1 0x08 | 157 | #define ENE_TEST_C9_PFENABLE_F1 0x08 |
158 | #define ENE_TEST_C9_PFENABLE (ENE_TEST_C9_PFENABLE_F0 | ENE_TEST_C9_PFENABLE_F0) | 158 | #define ENE_TEST_C9_PFENABLE (ENE_TEST_C9_PFENABLE_F0 | ENE_TEST_C9_PFENABLE_F1) |
159 | #define ENE_TEST_C9_WPDISALBLE_F0 0x40 | 159 | #define ENE_TEST_C9_WPDISALBLE_F0 0x40 |
160 | #define ENE_TEST_C9_WPDISALBLE_F1 0x80 | 160 | #define ENE_TEST_C9_WPDISALBLE_F1 0x80 |
161 | #define ENE_TEST_C9_WPDISALBLE (ENE_TEST_C9_WPDISALBLE_F0 | ENE_TEST_C9_WPDISALBLE_F1) | 161 | #define ENE_TEST_C9_WPDISALBLE (ENE_TEST_C9_WPDISALBLE_F0 | ENE_TEST_C9_WPDISALBLE_F1) |
@@ -692,7 +692,7 @@ static int ti12xx_2nd_slot_empty(struct yenta_socket *socket) | |||
692 | goto out; | 692 | goto out; |
693 | 693 | ||
694 | /* check state */ | 694 | /* check state */ |
695 | yenta_get_status(&socket->socket, &state); | 695 | yenta_get_status(&slot2->socket, &state); |
696 | if (state & SS_DETECT) { | 696 | if (state & SS_DETECT) { |
697 | ret = 0; | 697 | ret = 0; |
698 | goto out; | 698 | goto out; |