diff options
Diffstat (limited to 'drivers/pcmcia')
47 files changed, 1161 insertions, 1000 deletions
diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig index 17f38a781d47..cd5082d3ca19 100644 --- a/drivers/pcmcia/Kconfig +++ b/drivers/pcmcia/Kconfig | |||
@@ -17,24 +17,6 @@ menuconfig PCCARD | |||
17 | 17 | ||
18 | if PCCARD | 18 | if PCCARD |
19 | 19 | ||
20 | config PCMCIA_DEBUG | ||
21 | bool "Enable PCCARD debugging" | ||
22 | help | ||
23 | Say Y here to enable PCMCIA subsystem debugging. You | ||
24 | will need to choose the debugging level either via the | ||
25 | kernel command line, or module options depending whether | ||
26 | you build the PCMCIA as modules. | ||
27 | |||
28 | The kernel command line options are: | ||
29 | pcmcia_core.pc_debug=N | ||
30 | pcmcia.pc_debug=N | ||
31 | sa11xx_core.pc_debug=N | ||
32 | |||
33 | The module option is called pc_debug=N | ||
34 | |||
35 | In all the above examples, N is the debugging verbosity | ||
36 | level. | ||
37 | |||
38 | config PCMCIA | 20 | config PCMCIA |
39 | tristate "16-bit PCMCIA support" | 21 | tristate "16-bit PCMCIA support" |
40 | select CRC32 | 22 | select CRC32 |
@@ -196,9 +178,13 @@ config PCMCIA_BCM63XX | |||
196 | tristate "bcm63xx pcmcia support" | 178 | tristate "bcm63xx pcmcia support" |
197 | depends on BCM63XX && PCMCIA | 179 | depends on BCM63XX && PCMCIA |
198 | 180 | ||
181 | config PCMCIA_SOC_COMMON | ||
182 | tristate | ||
183 | |||
199 | config PCMCIA_SA1100 | 184 | config PCMCIA_SA1100 |
200 | tristate "SA1100 support" | 185 | tristate "SA1100 support" |
201 | depends on ARM && ARCH_SA1100 && PCMCIA | 186 | depends on ARM && ARCH_SA1100 && PCMCIA |
187 | select PCMCIA_SOC_COMMON | ||
202 | help | 188 | help |
203 | Say Y here to include support for SA11x0-based PCMCIA or CF | 189 | Say Y here to include support for SA11x0-based PCMCIA or CF |
204 | sockets, found on HP iPAQs, Yopy, and other StrongARM(R)/ | 190 | sockets, found on HP iPAQs, Yopy, and other StrongARM(R)/ |
@@ -209,6 +195,7 @@ config PCMCIA_SA1100 | |||
209 | config PCMCIA_SA1111 | 195 | config PCMCIA_SA1111 |
210 | tristate "SA1111 support" | 196 | tristate "SA1111 support" |
211 | depends on ARM && ARCH_SA1100 && SA1111 && PCMCIA | 197 | depends on ARM && ARCH_SA1100 && SA1111 && PCMCIA |
198 | select PCMCIA_SOC_COMMON | ||
212 | help | 199 | help |
213 | Say Y here to include support for SA1111-based PCMCIA or CF | 200 | Say Y here to include support for SA1111-based PCMCIA or CF |
214 | sockets, found on the Jornada 720, Graphicsmaster and other | 201 | sockets, found on the Jornada 720, Graphicsmaster and other |
@@ -222,9 +209,28 @@ config PCMCIA_PXA2XX | |||
222 | depends on (ARCH_LUBBOCK || MACH_MAINSTONE || PXA_SHARPSL \ | 209 | depends on (ARCH_LUBBOCK || MACH_MAINSTONE || PXA_SHARPSL \ |
223 | || MACH_ARMCORE || ARCH_PXA_PALM || TRIZEPS_PCMCIA \ | 210 | || MACH_ARMCORE || ARCH_PXA_PALM || TRIZEPS_PCMCIA \ |
224 | || ARCH_VIPER || ARCH_PXA_ESERIES || MACH_STARGATE2) | 211 | || ARCH_VIPER || ARCH_PXA_ESERIES || MACH_STARGATE2) |
212 | select PCMCIA_SOC_COMMON | ||
225 | help | 213 | help |
226 | Say Y here to include support for the PXA2xx PCMCIA controller | 214 | Say Y here to include support for the PXA2xx PCMCIA controller |
227 | 215 | ||
216 | config PCMCIA_DEBUG | ||
217 | bool "Enable debugging" | ||
218 | depends on (PCMCIA_SA1111 || PCMCIA_SA1100 || PCMCIA_PXA2XX) | ||
219 | help | ||
220 | Say Y here to enable debugging for the SoC PCMCIA layer. | ||
221 | You will need to choose the debugging level either via the | ||
222 | kernel command line, or module options depending whether | ||
223 | you build the drivers as modules. | ||
224 | |||
225 | The kernel command line options are: | ||
226 | sa11xx_core.pc_debug=N | ||
227 | pxa2xx_core.pc_debug=N | ||
228 | |||
229 | The module option is called pc_debug=N | ||
230 | |||
231 | In all the above examples, N is the debugging verbosity | ||
232 | level. | ||
233 | |||
228 | config PCMCIA_PROBE | 234 | config PCMCIA_PROBE |
229 | bool | 235 | bool |
230 | default y if ISA && !ARCH_SA1100 && !ARCH_CLPS711X && !PARISC | 236 | default y if ISA && !ARCH_SA1100 && !ARCH_CLPS711X && !PARISC |
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile index a03a38acd77d..382938313991 100644 --- a/drivers/pcmcia/Makefile +++ b/drivers/pcmcia/Makefile | |||
@@ -22,8 +22,9 @@ obj-$(CONFIG_I82365) += i82365.o | |||
22 | obj-$(CONFIG_I82092) += i82092.o | 22 | obj-$(CONFIG_I82092) += i82092.o |
23 | obj-$(CONFIG_TCIC) += tcic.o | 23 | obj-$(CONFIG_TCIC) += tcic.o |
24 | obj-$(CONFIG_PCMCIA_M8XX) += m8xx_pcmcia.o | 24 | obj-$(CONFIG_PCMCIA_M8XX) += m8xx_pcmcia.o |
25 | obj-$(CONFIG_PCMCIA_SA1100) += sa11xx_core.o sa1100_cs.o | 25 | obj-$(CONFIG_PCMCIA_SOC_COMMON) += soc_common.o |
26 | obj-$(CONFIG_PCMCIA_SA1111) += sa11xx_core.o sa1111_cs.o | 26 | obj-$(CONFIG_PCMCIA_SA1100) += sa11xx_base.o sa1100_cs.o |
27 | obj-$(CONFIG_PCMCIA_SA1111) += sa11xx_base.o sa1111_cs.o | ||
27 | obj-$(CONFIG_M32R_PCC) += m32r_pcc.o | 28 | obj-$(CONFIG_M32R_PCC) += m32r_pcc.o |
28 | obj-$(CONFIG_M32R_CFC) += m32r_cfc.o | 29 | obj-$(CONFIG_M32R_CFC) += m32r_cfc.o |
29 | obj-$(CONFIG_PCMCIA_AU1X00) += au1x00_ss.o | 30 | obj-$(CONFIG_PCMCIA_AU1X00) += au1x00_ss.o |
@@ -35,9 +36,6 @@ obj-$(CONFIG_BFIN_CFPCMCIA) += bfin_cf_pcmcia.o | |||
35 | obj-$(CONFIG_AT91_CF) += at91_cf.o | 36 | obj-$(CONFIG_AT91_CF) += at91_cf.o |
36 | obj-$(CONFIG_ELECTRA_CF) += electra_cf.o | 37 | obj-$(CONFIG_ELECTRA_CF) += electra_cf.o |
37 | 38 | ||
38 | sa11xx_core-y += soc_common.o sa11xx_base.o | ||
39 | pxa2xx_core-y += soc_common.o pxa2xx_base.o | ||
40 | |||
41 | au1x00_ss-y += au1000_generic.o | 39 | au1x00_ss-y += au1000_generic.o |
42 | au1x00_ss-$(CONFIG_MIPS_PB1000) += au1000_pb1x00.o | 40 | au1x00_ss-$(CONFIG_MIPS_PB1000) += au1000_pb1x00.o |
43 | au1x00_ss-$(CONFIG_MIPS_PB1100) += au1000_pb1x00.o | 41 | au1x00_ss-$(CONFIG_MIPS_PB1100) += au1000_pb1x00.o |
@@ -77,4 +75,4 @@ pxa2xx-obj-$(CONFIG_MACH_PALMLD) += pxa2xx_palmld.o | |||
77 | pxa2xx-obj-$(CONFIG_MACH_E740) += pxa2xx_e740.o | 75 | pxa2xx-obj-$(CONFIG_MACH_E740) += pxa2xx_e740.o |
78 | pxa2xx-obj-$(CONFIG_MACH_STARGATE2) += pxa2xx_stargate2.o | 76 | pxa2xx-obj-$(CONFIG_MACH_STARGATE2) += pxa2xx_stargate2.o |
79 | 77 | ||
80 | obj-$(CONFIG_PCMCIA_PXA2XX) += pxa2xx_core.o $(pxa2xx-obj-y) | 78 | obj-$(CONFIG_PCMCIA_PXA2XX) += pxa2xx_base.o $(pxa2xx-obj-y) |
diff --git a/drivers/pcmcia/cardbus.c b/drivers/pcmcia/cardbus.c index db77e1f3309a..4cd70d056810 100644 --- a/drivers/pcmcia/cardbus.c +++ b/drivers/pcmcia/cardbus.c | |||
@@ -91,7 +91,7 @@ static u_int xlate_rom_addr(void __iomem *b, u_int addr) | |||
91 | static void cb_release_cis_mem(struct pcmcia_socket * s) | 91 | static void cb_release_cis_mem(struct pcmcia_socket * s) |
92 | { | 92 | { |
93 | if (s->cb_cis_virt) { | 93 | if (s->cb_cis_virt) { |
94 | cs_dbg(s, 1, "cb_release_cis_mem()\n"); | 94 | dev_dbg(&s->dev, "cb_release_cis_mem()\n"); |
95 | iounmap(s->cb_cis_virt); | 95 | iounmap(s->cb_cis_virt); |
96 | s->cb_cis_virt = NULL; | 96 | s->cb_cis_virt = NULL; |
97 | s->cb_cis_res = NULL; | 97 | s->cb_cis_res = NULL; |
@@ -132,7 +132,7 @@ int read_cb_mem(struct pcmcia_socket * s, int space, u_int addr, u_int len, void | |||
132 | struct pci_dev *dev; | 132 | struct pci_dev *dev; |
133 | struct resource *res; | 133 | struct resource *res; |
134 | 134 | ||
135 | cs_dbg(s, 3, "read_cb_mem(%d, %#x, %u)\n", space, addr, len); | 135 | dev_dbg(&s->dev, "read_cb_mem(%d, %#x, %u)\n", space, addr, len); |
136 | 136 | ||
137 | dev = pci_get_slot(s->cb_dev->subordinate, 0); | 137 | dev = pci_get_slot(s->cb_dev->subordinate, 0); |
138 | if (!dev) | 138 | if (!dev) |
diff --git a/drivers/pcmcia/cirrus.h b/drivers/pcmcia/cirrus.h index ecd4fc7f666f..446a4576e73e 100644 --- a/drivers/pcmcia/cirrus.h +++ b/drivers/pcmcia/cirrus.h | |||
@@ -30,16 +30,6 @@ | |||
30 | #ifndef _LINUX_CIRRUS_H | 30 | #ifndef _LINUX_CIRRUS_H |
31 | #define _LINUX_CIRRUS_H | 31 | #define _LINUX_CIRRUS_H |
32 | 32 | ||
33 | #ifndef PCI_VENDOR_ID_CIRRUS | ||
34 | #define PCI_VENDOR_ID_CIRRUS 0x1013 | ||
35 | #endif | ||
36 | #ifndef PCI_DEVICE_ID_CIRRUS_6729 | ||
37 | #define PCI_DEVICE_ID_CIRRUS_6729 0x1100 | ||
38 | #endif | ||
39 | #ifndef PCI_DEVICE_ID_CIRRUS_6832 | ||
40 | #define PCI_DEVICE_ID_CIRRUS_6832 0x1110 | ||
41 | #endif | ||
42 | |||
43 | #define PD67_MISC_CTL_1 0x16 /* Misc control 1 */ | 33 | #define PD67_MISC_CTL_1 0x16 /* Misc control 1 */ |
44 | #define PD67_FIFO_CTL 0x17 /* FIFO control */ | 34 | #define PD67_FIFO_CTL 0x17 /* FIFO control */ |
45 | #define PD67_MISC_CTL_2 0x1E /* Misc control 2 */ | 35 | #define PD67_MISC_CTL_2 0x1E /* Misc control 2 */ |
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index 6c4a4fc83630..8c1b73cf021b 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c | |||
@@ -138,7 +138,7 @@ int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, | |||
138 | void __iomem *sys, *end; | 138 | void __iomem *sys, *end; |
139 | unsigned char *buf = ptr; | 139 | unsigned char *buf = ptr; |
140 | 140 | ||
141 | cs_dbg(s, 3, "pcmcia_read_cis_mem(%d, %#x, %u)\n", attr, addr, len); | 141 | dev_dbg(&s->dev, "pcmcia_read_cis_mem(%d, %#x, %u)\n", attr, addr, len); |
142 | 142 | ||
143 | if (attr & IS_INDIRECT) { | 143 | if (attr & IS_INDIRECT) { |
144 | /* Indirect accesses use a bunch of special registers at fixed | 144 | /* Indirect accesses use a bunch of special registers at fixed |
@@ -190,7 +190,7 @@ int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, | |||
190 | addr = 0; | 190 | addr = 0; |
191 | } | 191 | } |
192 | } | 192 | } |
193 | cs_dbg(s, 3, " %#2.2x %#2.2x %#2.2x %#2.2x ...\n", | 193 | dev_dbg(&s->dev, " %#2.2x %#2.2x %#2.2x %#2.2x ...\n", |
194 | *(u_char *)(ptr+0), *(u_char *)(ptr+1), | 194 | *(u_char *)(ptr+0), *(u_char *)(ptr+1), |
195 | *(u_char *)(ptr+2), *(u_char *)(ptr+3)); | 195 | *(u_char *)(ptr+2), *(u_char *)(ptr+3)); |
196 | return 0; | 196 | return 0; |
@@ -204,7 +204,7 @@ void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, | |||
204 | void __iomem *sys, *end; | 204 | void __iomem *sys, *end; |
205 | unsigned char *buf = ptr; | 205 | unsigned char *buf = ptr; |
206 | 206 | ||
207 | cs_dbg(s, 3, "pcmcia_write_cis_mem(%d, %#x, %u)\n", attr, addr, len); | 207 | dev_dbg(&s->dev, "pcmcia_write_cis_mem(%d, %#x, %u)\n", attr, addr, len); |
208 | 208 | ||
209 | if (attr & IS_INDIRECT) { | 209 | if (attr & IS_INDIRECT) { |
210 | /* Indirect accesses use a bunch of special registers at fixed | 210 | /* Indirect accesses use a bunch of special registers at fixed |
@@ -584,7 +584,7 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, tuple_ | |||
584 | ofs += link[1] + 2; | 584 | ofs += link[1] + 2; |
585 | } | 585 | } |
586 | if (i == MAX_TUPLES) { | 586 | if (i == MAX_TUPLES) { |
587 | cs_dbg(s, 1, "cs: overrun in pcmcia_get_next_tuple\n"); | 587 | dev_dbg(&s->dev, "cs: overrun in pcmcia_get_next_tuple\n"); |
588 | return -ENOSPC; | 588 | return -ENOSPC; |
589 | } | 589 | } |
590 | 590 | ||
@@ -1440,7 +1440,7 @@ int pcmcia_parse_tuple(tuple_t *tuple, cisparse_t *parse) | |||
1440 | break; | 1440 | break; |
1441 | } | 1441 | } |
1442 | if (ret) | 1442 | if (ret) |
1443 | __cs_dbg(0, "parse_tuple failed %d\n", ret); | 1443 | pr_debug("parse_tuple failed %d\n", ret); |
1444 | return ret; | 1444 | return ret; |
1445 | } | 1445 | } |
1446 | EXPORT_SYMBOL(pcmcia_parse_tuple); | 1446 | EXPORT_SYMBOL(pcmcia_parse_tuple); |
@@ -1482,6 +1482,67 @@ done: | |||
1482 | } | 1482 | } |
1483 | EXPORT_SYMBOL(pccard_read_tuple); | 1483 | EXPORT_SYMBOL(pccard_read_tuple); |
1484 | 1484 | ||
1485 | |||
1486 | /** | ||
1487 | * pccard_loop_tuple() - loop over tuples in the CIS | ||
1488 | * @s: the struct pcmcia_socket where the card is inserted | ||
1489 | * @function: the device function we loop for | ||
1490 | * @code: which CIS code shall we look for? | ||
1491 | * @parse: buffer where the tuple shall be parsed (or NULL, if no parse) | ||
1492 | * @priv_data: private data to be passed to the loop_tuple function. | ||
1493 | * @loop_tuple: function to call for each CIS entry of type @function. IT | ||
1494 | * gets passed the raw tuple, the paresed tuple (if @parse is | ||
1495 | * set) and @priv_data. | ||
1496 | * | ||
1497 | * pccard_loop_tuple() loops over all CIS entries of type @function, and | ||
1498 | * calls the @loop_tuple function for each entry. If the call to @loop_tuple | ||
1499 | * returns 0, the loop exits. Returns 0 on success or errorcode otherwise. | ||
1500 | */ | ||
1501 | int pccard_loop_tuple(struct pcmcia_socket *s, unsigned int function, | ||
1502 | cisdata_t code, cisparse_t *parse, void *priv_data, | ||
1503 | int (*loop_tuple) (tuple_t *tuple, | ||
1504 | cisparse_t *parse, | ||
1505 | void *priv_data)) | ||
1506 | { | ||
1507 | tuple_t tuple; | ||
1508 | cisdata_t *buf; | ||
1509 | int ret; | ||
1510 | |||
1511 | buf = kzalloc(256, GFP_KERNEL); | ||
1512 | if (buf == NULL) { | ||
1513 | dev_printk(KERN_WARNING, &s->dev, "no memory to read tuple\n"); | ||
1514 | return -ENOMEM; | ||
1515 | } | ||
1516 | |||
1517 | tuple.TupleData = buf; | ||
1518 | tuple.TupleDataMax = 255; | ||
1519 | tuple.TupleOffset = 0; | ||
1520 | tuple.DesiredTuple = code; | ||
1521 | tuple.Attributes = 0; | ||
1522 | |||
1523 | ret = pccard_get_first_tuple(s, function, &tuple); | ||
1524 | while (!ret) { | ||
1525 | if (pccard_get_tuple_data(s, &tuple)) | ||
1526 | goto next_entry; | ||
1527 | |||
1528 | if (parse) | ||
1529 | if (pcmcia_parse_tuple(&tuple, parse)) | ||
1530 | goto next_entry; | ||
1531 | |||
1532 | ret = loop_tuple(&tuple, parse, priv_data); | ||
1533 | if (!ret) | ||
1534 | break; | ||
1535 | |||
1536 | next_entry: | ||
1537 | ret = pccard_get_next_tuple(s, function, &tuple); | ||
1538 | } | ||
1539 | |||
1540 | kfree(buf); | ||
1541 | return ret; | ||
1542 | } | ||
1543 | EXPORT_SYMBOL(pccard_loop_tuple); | ||
1544 | |||
1545 | |||
1485 | /*====================================================================== | 1546 | /*====================================================================== |
1486 | 1547 | ||
1487 | This tries to determine if a card has a sensible CIS. It returns | 1548 | This tries to determine if a card has a sensible CIS. It returns |
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index 698d75cda084..790af87a922f 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c | |||
@@ -61,17 +61,6 @@ INT_MODULE_PARM(unreset_limit, 30); /* unreset_check's */ | |||
61 | /* Access speed for attribute memory windows */ | 61 | /* Access speed for attribute memory windows */ |
62 | INT_MODULE_PARM(cis_speed, 300); /* ns */ | 62 | INT_MODULE_PARM(cis_speed, 300); /* ns */ |
63 | 63 | ||
64 | #ifdef CONFIG_PCMCIA_DEBUG | ||
65 | static int pc_debug; | ||
66 | |||
67 | module_param(pc_debug, int, 0644); | ||
68 | |||
69 | int cs_debug_level(int level) | ||
70 | { | ||
71 | return pc_debug > level; | ||
72 | } | ||
73 | #endif | ||
74 | |||
75 | 64 | ||
76 | socket_state_t dead_socket = { | 65 | socket_state_t dead_socket = { |
77 | .csc_mask = SS_DETECT, | 66 | .csc_mask = SS_DETECT, |
@@ -190,7 +179,7 @@ int pcmcia_register_socket(struct pcmcia_socket *socket) | |||
190 | if (!socket || !socket->ops || !socket->dev.parent || !socket->resource_ops) | 179 | if (!socket || !socket->ops || !socket->dev.parent || !socket->resource_ops) |
191 | return -EINVAL; | 180 | return -EINVAL; |
192 | 181 | ||
193 | cs_dbg(socket, 0, "pcmcia_register_socket(0x%p)\n", socket->ops); | 182 | dev_dbg(&socket->dev, "pcmcia_register_socket(0x%p)\n", socket->ops); |
194 | 183 | ||
195 | spin_lock_init(&socket->lock); | 184 | spin_lock_init(&socket->lock); |
196 | 185 | ||
@@ -262,6 +251,13 @@ int pcmcia_register_socket(struct pcmcia_socket *socket) | |||
262 | 251 | ||
263 | pcmcia_parse_events(socket, SS_DETECT); | 252 | pcmcia_parse_events(socket, SS_DETECT); |
264 | 253 | ||
254 | /* | ||
255 | * Let's try to get the PCMCIA module for 16-bit PCMCIA support. | ||
256 | * If it fails, it doesn't matter -- we still have 32-bit CardBus | ||
257 | * support to offer, so this is not a failure mode. | ||
258 | */ | ||
259 | request_module_nowait("pcmcia"); | ||
260 | |||
265 | return 0; | 261 | return 0; |
266 | 262 | ||
267 | err: | 263 | err: |
@@ -282,7 +278,7 @@ void pcmcia_unregister_socket(struct pcmcia_socket *socket) | |||
282 | if (!socket) | 278 | if (!socket) |
283 | return; | 279 | return; |
284 | 280 | ||
285 | cs_dbg(socket, 0, "pcmcia_unregister_socket(0x%p)\n", socket->ops); | 281 | dev_dbg(&socket->dev, "pcmcia_unregister_socket(0x%p)\n", socket->ops); |
286 | 282 | ||
287 | if (socket->thread) | 283 | if (socket->thread) |
288 | kthread_stop(socket->thread); | 284 | kthread_stop(socket->thread); |
@@ -335,7 +331,7 @@ static int send_event(struct pcmcia_socket *s, event_t event, int priority) | |||
335 | if (s->state & SOCKET_CARDBUS) | 331 | if (s->state & SOCKET_CARDBUS) |
336 | return 0; | 332 | return 0; |
337 | 333 | ||
338 | cs_dbg(s, 1, "send_event(event %d, pri %d, callback 0x%p)\n", | 334 | dev_dbg(&s->dev, "send_event(event %d, pri %d, callback 0x%p)\n", |
339 | event, priority, s->callback); | 335 | event, priority, s->callback); |
340 | 336 | ||
341 | if (!s->callback) | 337 | if (!s->callback) |
@@ -352,7 +348,7 @@ static int send_event(struct pcmcia_socket *s, event_t event, int priority) | |||
352 | 348 | ||
353 | static void socket_remove_drivers(struct pcmcia_socket *skt) | 349 | static void socket_remove_drivers(struct pcmcia_socket *skt) |
354 | { | 350 | { |
355 | cs_dbg(skt, 4, "remove_drivers\n"); | 351 | dev_dbg(&skt->dev, "remove_drivers\n"); |
356 | 352 | ||
357 | send_event(skt, CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_HIGH); | 353 | send_event(skt, CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_HIGH); |
358 | } | 354 | } |
@@ -361,7 +357,7 @@ static int socket_reset(struct pcmcia_socket *skt) | |||
361 | { | 357 | { |
362 | int status, i; | 358 | int status, i; |
363 | 359 | ||
364 | cs_dbg(skt, 4, "reset\n"); | 360 | dev_dbg(&skt->dev, "reset\n"); |
365 | 361 | ||
366 | skt->socket.flags |= SS_OUTPUT_ENA | SS_RESET; | 362 | skt->socket.flags |= SS_OUTPUT_ENA | SS_RESET; |
367 | skt->ops->set_socket(skt, &skt->socket); | 363 | skt->ops->set_socket(skt, &skt->socket); |
@@ -383,7 +379,7 @@ static int socket_reset(struct pcmcia_socket *skt) | |||
383 | msleep(unreset_check * 10); | 379 | msleep(unreset_check * 10); |
384 | } | 380 | } |
385 | 381 | ||
386 | cs_err(skt, "time out after reset.\n"); | 382 | dev_printk(KERN_ERR, &skt->dev, "time out after reset.\n"); |
387 | return -ETIMEDOUT; | 383 | return -ETIMEDOUT; |
388 | } | 384 | } |
389 | 385 | ||
@@ -397,7 +393,7 @@ static void socket_shutdown(struct pcmcia_socket *s) | |||
397 | { | 393 | { |
398 | int status; | 394 | int status; |
399 | 395 | ||
400 | cs_dbg(s, 4, "shutdown\n"); | 396 | dev_dbg(&s->dev, "shutdown\n"); |
401 | 397 | ||
402 | socket_remove_drivers(s); | 398 | socket_remove_drivers(s); |
403 | s->state &= SOCKET_INUSE | SOCKET_PRESENT; | 399 | s->state &= SOCKET_INUSE | SOCKET_PRESENT; |
@@ -432,7 +428,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay) | |||
432 | { | 428 | { |
433 | int status, i; | 429 | int status, i; |
434 | 430 | ||
435 | cs_dbg(skt, 4, "setup\n"); | 431 | dev_dbg(&skt->dev, "setup\n"); |
436 | 432 | ||
437 | skt->ops->get_status(skt, &status); | 433 | skt->ops->get_status(skt, &status); |
438 | if (!(status & SS_DETECT)) | 434 | if (!(status & SS_DETECT)) |
@@ -452,13 +448,15 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay) | |||
452 | } | 448 | } |
453 | 449 | ||
454 | if (status & SS_PENDING) { | 450 | if (status & SS_PENDING) { |
455 | cs_err(skt, "voltage interrogation timed out.\n"); | 451 | dev_printk(KERN_ERR, &skt->dev, |
452 | "voltage interrogation timed out.\n"); | ||
456 | return -ETIMEDOUT; | 453 | return -ETIMEDOUT; |
457 | } | 454 | } |
458 | 455 | ||
459 | if (status & SS_CARDBUS) { | 456 | if (status & SS_CARDBUS) { |
460 | if (!(skt->features & SS_CAP_CARDBUS)) { | 457 | if (!(skt->features & SS_CAP_CARDBUS)) { |
461 | cs_err(skt, "cardbus cards are not supported.\n"); | 458 | dev_printk(KERN_ERR, &skt->dev, |
459 | "cardbus cards are not supported.\n"); | ||
462 | return -EINVAL; | 460 | return -EINVAL; |
463 | } | 461 | } |
464 | skt->state |= SOCKET_CARDBUS; | 462 | skt->state |= SOCKET_CARDBUS; |
@@ -472,7 +470,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay) | |||
472 | else if (!(status & SS_XVCARD)) | 470 | else if (!(status & SS_XVCARD)) |
473 | skt->socket.Vcc = skt->socket.Vpp = 50; | 471 | skt->socket.Vcc = skt->socket.Vpp = 50; |
474 | else { | 472 | else { |
475 | cs_err(skt, "unsupported voltage key.\n"); | 473 | dev_printk(KERN_ERR, &skt->dev, "unsupported voltage key.\n"); |
476 | return -EIO; | 474 | return -EIO; |
477 | } | 475 | } |
478 | 476 | ||
@@ -489,7 +487,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay) | |||
489 | 487 | ||
490 | skt->ops->get_status(skt, &status); | 488 | skt->ops->get_status(skt, &status); |
491 | if (!(status & SS_POWERON)) { | 489 | if (!(status & SS_POWERON)) { |
492 | cs_err(skt, "unable to apply power.\n"); | 490 | dev_printk(KERN_ERR, &skt->dev, "unable to apply power.\n"); |
493 | return -EIO; | 491 | return -EIO; |
494 | } | 492 | } |
495 | 493 | ||
@@ -509,7 +507,7 @@ static int socket_insert(struct pcmcia_socket *skt) | |||
509 | { | 507 | { |
510 | int ret; | 508 | int ret; |
511 | 509 | ||
512 | cs_dbg(skt, 4, "insert\n"); | 510 | dev_dbg(&skt->dev, "insert\n"); |
513 | 511 | ||
514 | if (!cs_socket_get(skt)) | 512 | if (!cs_socket_get(skt)) |
515 | return -ENODEV; | 513 | return -ENODEV; |
@@ -529,7 +527,7 @@ static int socket_insert(struct pcmcia_socket *skt) | |||
529 | skt->state |= SOCKET_CARDBUS_CONFIG; | 527 | skt->state |= SOCKET_CARDBUS_CONFIG; |
530 | } | 528 | } |
531 | #endif | 529 | #endif |
532 | cs_dbg(skt, 4, "insert done\n"); | 530 | dev_dbg(&skt->dev, "insert done\n"); |
533 | 531 | ||
534 | send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW); | 532 | send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW); |
535 | } else { | 533 | } else { |
@@ -576,7 +574,7 @@ static int socket_late_resume(struct pcmcia_socket *skt) | |||
576 | * FIXME: need a better check here for cardbus cards. | 574 | * FIXME: need a better check here for cardbus cards. |
577 | */ | 575 | */ |
578 | if (verify_cis_cache(skt) != 0) { | 576 | if (verify_cis_cache(skt) != 0) { |
579 | cs_dbg(skt, 4, "cis mismatch - different card\n"); | 577 | dev_dbg(&skt->dev, "cis mismatch - different card\n"); |
580 | socket_remove_drivers(skt); | 578 | socket_remove_drivers(skt); |
581 | destroy_cis_cache(skt); | 579 | destroy_cis_cache(skt); |
582 | /* | 580 | /* |
@@ -587,7 +585,7 @@ static int socket_late_resume(struct pcmcia_socket *skt) | |||
587 | msleep(200); | 585 | msleep(200); |
588 | send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW); | 586 | send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW); |
589 | } else { | 587 | } else { |
590 | cs_dbg(skt, 4, "cis matches cache\n"); | 588 | dev_dbg(&skt->dev, "cis matches cache\n"); |
591 | send_event(skt, CS_EVENT_PM_RESUME, CS_EVENT_PRI_LOW); | 589 | send_event(skt, CS_EVENT_PM_RESUME, CS_EVENT_PRI_LOW); |
592 | } | 590 | } |
593 | } else { | 591 | } else { |
@@ -723,7 +721,7 @@ static int pccardd(void *__skt) | |||
723 | void pcmcia_parse_events(struct pcmcia_socket *s, u_int events) | 721 | void pcmcia_parse_events(struct pcmcia_socket *s, u_int events) |
724 | { | 722 | { |
725 | unsigned long flags; | 723 | unsigned long flags; |
726 | cs_dbg(s, 4, "parse_events: events %08x\n", events); | 724 | dev_dbg(&s->dev, "parse_events: events %08x\n", events); |
727 | if (s->thread) { | 725 | if (s->thread) { |
728 | spin_lock_irqsave(&s->thread_lock, flags); | 726 | spin_lock_irqsave(&s->thread_lock, flags); |
729 | s->thread_events |= events; | 727 | s->thread_events |= events; |
@@ -773,19 +771,22 @@ int pcmcia_reset_card(struct pcmcia_socket *skt) | |||
773 | { | 771 | { |
774 | int ret; | 772 | int ret; |
775 | 773 | ||
776 | cs_dbg(skt, 1, "resetting socket\n"); | 774 | dev_dbg(&skt->dev, "resetting socket\n"); |
777 | 775 | ||
778 | mutex_lock(&skt->skt_mutex); | 776 | mutex_lock(&skt->skt_mutex); |
779 | do { | 777 | do { |
780 | if (!(skt->state & SOCKET_PRESENT)) { | 778 | if (!(skt->state & SOCKET_PRESENT)) { |
779 | dev_dbg(&skt->dev, "can't reset, not present\n"); | ||
781 | ret = -ENODEV; | 780 | ret = -ENODEV; |
782 | break; | 781 | break; |
783 | } | 782 | } |
784 | if (skt->state & SOCKET_SUSPEND) { | 783 | if (skt->state & SOCKET_SUSPEND) { |
784 | dev_dbg(&skt->dev, "can't reset, suspended\n"); | ||
785 | ret = -EBUSY; | 785 | ret = -EBUSY; |
786 | break; | 786 | break; |
787 | } | 787 | } |
788 | if (skt->state & SOCKET_CARDBUS) { | 788 | if (skt->state & SOCKET_CARDBUS) { |
789 | dev_dbg(&skt->dev, "can't reset, is cardbus\n"); | ||
789 | ret = -EPERM; | 790 | ret = -EPERM; |
790 | break; | 791 | break; |
791 | } | 792 | } |
@@ -818,7 +819,7 @@ int pcmcia_suspend_card(struct pcmcia_socket *skt) | |||
818 | { | 819 | { |
819 | int ret; | 820 | int ret; |
820 | 821 | ||
821 | cs_dbg(skt, 1, "suspending socket\n"); | 822 | dev_dbg(&skt->dev, "suspending socket\n"); |
822 | 823 | ||
823 | mutex_lock(&skt->skt_mutex); | 824 | mutex_lock(&skt->skt_mutex); |
824 | do { | 825 | do { |
@@ -848,7 +849,7 @@ int pcmcia_resume_card(struct pcmcia_socket *skt) | |||
848 | { | 849 | { |
849 | int ret; | 850 | int ret; |
850 | 851 | ||
851 | cs_dbg(skt, 1, "waking up socket\n"); | 852 | dev_dbg(&skt->dev, "waking up socket\n"); |
852 | 853 | ||
853 | mutex_lock(&skt->skt_mutex); | 854 | mutex_lock(&skt->skt_mutex); |
854 | do { | 855 | do { |
@@ -876,7 +877,7 @@ int pcmcia_eject_card(struct pcmcia_socket *skt) | |||
876 | { | 877 | { |
877 | int ret; | 878 | int ret; |
878 | 879 | ||
879 | cs_dbg(skt, 1, "user eject request\n"); | 880 | dev_dbg(&skt->dev, "user eject request\n"); |
880 | 881 | ||
881 | mutex_lock(&skt->skt_mutex); | 882 | mutex_lock(&skt->skt_mutex); |
882 | do { | 883 | do { |
@@ -905,7 +906,7 @@ int pcmcia_insert_card(struct pcmcia_socket *skt) | |||
905 | { | 906 | { |
906 | int ret; | 907 | int ret; |
907 | 908 | ||
908 | cs_dbg(skt, 1, "user insert request\n"); | 909 | dev_dbg(&skt->dev, "user insert request\n"); |
909 | 910 | ||
910 | mutex_lock(&skt->skt_mutex); | 911 | mutex_lock(&skt->skt_mutex); |
911 | do { | 912 | do { |
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index 1f4098f1354d..3bc02d53a3a3 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h | |||
@@ -107,28 +107,6 @@ static inline void cs_socket_put(struct pcmcia_socket *skt) | |||
107 | } | 107 | } |
108 | } | 108 | } |
109 | 109 | ||
110 | #ifdef CONFIG_PCMCIA_DEBUG | ||
111 | extern int cs_debug_level(int); | ||
112 | |||
113 | #define cs_dbg(skt, lvl, fmt, arg...) do { \ | ||
114 | if (cs_debug_level(lvl)) \ | ||
115 | dev_printk(KERN_DEBUG, &skt->dev, \ | ||
116 | "cs: " fmt, ## arg); \ | ||
117 | } while (0) | ||
118 | #define __cs_dbg(lvl, fmt, arg...) do { \ | ||
119 | if (cs_debug_level(lvl)) \ | ||
120 | printk(KERN_DEBUG \ | ||
121 | "cs: " fmt, ## arg); \ | ||
122 | } while (0) | ||
123 | |||
124 | #else | ||
125 | #define cs_dbg(skt, lvl, fmt, arg...) do { } while (0) | ||
126 | #define __cs_dbg(lvl, fmt, arg...) do { } while (0) | ||
127 | #endif | ||
128 | |||
129 | #define cs_err(skt, fmt, arg...) \ | ||
130 | dev_printk(KERN_ERR, &skt->dev, "cs: " fmt, ## arg) | ||
131 | |||
132 | 110 | ||
133 | /* | 111 | /* |
134 | * Stuff internal to module "pcmcia_core": | 112 | * Stuff internal to module "pcmcia_core": |
@@ -170,10 +148,6 @@ extern struct rw_semaphore pcmcia_socket_list_rwsem; | |||
170 | extern struct list_head pcmcia_socket_list; | 148 | extern struct list_head pcmcia_socket_list; |
171 | extern struct class pcmcia_socket_class; | 149 | extern struct class pcmcia_socket_class; |
172 | 150 | ||
173 | int pcmcia_get_window(struct pcmcia_socket *s, | ||
174 | window_handle_t *handle, | ||
175 | int idx, | ||
176 | win_req_t *req); | ||
177 | int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c); | 151 | int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c); |
178 | struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr); | 152 | struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr); |
179 | 153 | ||
@@ -199,6 +173,22 @@ int pcmcia_replace_cis(struct pcmcia_socket *s, | |||
199 | const u8 *data, const size_t len); | 173 | const u8 *data, const size_t len); |
200 | int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *count); | 174 | int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *count); |
201 | 175 | ||
176 | /* loop over CIS entries */ | ||
177 | int pccard_loop_tuple(struct pcmcia_socket *s, unsigned int function, | ||
178 | cisdata_t code, cisparse_t *parse, void *priv_data, | ||
179 | int (*loop_tuple) (tuple_t *tuple, | ||
180 | cisparse_t *parse, | ||
181 | void *priv_data)); | ||
182 | |||
183 | int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function, | ||
184 | tuple_t *tuple); | ||
185 | |||
186 | int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, | ||
187 | tuple_t *tuple); | ||
188 | |||
189 | int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple); | ||
190 | |||
191 | |||
202 | /* rsrc_mgr.c */ | 192 | /* rsrc_mgr.c */ |
203 | int pcmcia_validate_mem(struct pcmcia_socket *s); | 193 | int pcmcia_validate_mem(struct pcmcia_socket *s); |
204 | struct resource *pcmcia_find_io_region(unsigned long base, | 194 | struct resource *pcmcia_find_io_region(unsigned long base, |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index f5b7079f13d3..05893d41dd41 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -41,129 +41,11 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>"); | |||
41 | MODULE_DESCRIPTION("PCMCIA Driver Services"); | 41 | MODULE_DESCRIPTION("PCMCIA Driver Services"); |
42 | MODULE_LICENSE("GPL"); | 42 | MODULE_LICENSE("GPL"); |
43 | 43 | ||
44 | #ifdef CONFIG_PCMCIA_DEBUG | ||
45 | int ds_pc_debug; | ||
46 | |||
47 | module_param_named(pc_debug, ds_pc_debug, int, 0644); | ||
48 | |||
49 | #define ds_dbg(lvl, fmt, arg...) do { \ | ||
50 | if (ds_pc_debug > (lvl)) \ | ||
51 | printk(KERN_DEBUG "ds: " fmt , ## arg); \ | ||
52 | } while (0) | ||
53 | #define ds_dev_dbg(lvl, dev, fmt, arg...) do { \ | ||
54 | if (ds_pc_debug > (lvl)) \ | ||
55 | dev_printk(KERN_DEBUG, dev, "ds: " fmt , ## arg); \ | ||
56 | } while (0) | ||
57 | #else | ||
58 | #define ds_dbg(lvl, fmt, arg...) do { } while (0) | ||
59 | #define ds_dev_dbg(lvl, dev, fmt, arg...) do { } while (0) | ||
60 | #endif | ||
61 | 44 | ||
62 | spinlock_t pcmcia_dev_list_lock; | 45 | spinlock_t pcmcia_dev_list_lock; |
63 | 46 | ||
64 | /*====================================================================*/ | 47 | /*====================================================================*/ |
65 | 48 | ||
66 | /* code which was in cs.c before */ | ||
67 | |||
68 | /* String tables for error messages */ | ||
69 | |||
70 | typedef struct lookup_t { | ||
71 | const int key; | ||
72 | const char *msg; | ||
73 | } lookup_t; | ||
74 | |||
75 | static const lookup_t error_table[] = { | ||
76 | { 0, "Operation succeeded" }, | ||
77 | { -EIO, "Input/Output error" }, | ||
78 | { -ENODEV, "No card present" }, | ||
79 | { -EINVAL, "Bad parameter" }, | ||
80 | { -EACCES, "Configuration locked" }, | ||
81 | { -EBUSY, "Resource in use" }, | ||
82 | { -ENOSPC, "No more items" }, | ||
83 | { -ENOMEM, "Out of resource" }, | ||
84 | }; | ||
85 | |||
86 | |||
87 | static const lookup_t service_table[] = { | ||
88 | { AccessConfigurationRegister, "AccessConfigurationRegister" }, | ||
89 | { AddSocketServices, "AddSocketServices" }, | ||
90 | { AdjustResourceInfo, "AdjustResourceInfo" }, | ||
91 | { CheckEraseQueue, "CheckEraseQueue" }, | ||
92 | { CloseMemory, "CloseMemory" }, | ||
93 | { DeregisterClient, "DeregisterClient" }, | ||
94 | { DeregisterEraseQueue, "DeregisterEraseQueue" }, | ||
95 | { GetCardServicesInfo, "GetCardServicesInfo" }, | ||
96 | { GetClientInfo, "GetClientInfo" }, | ||
97 | { GetConfigurationInfo, "GetConfigurationInfo" }, | ||
98 | { GetEventMask, "GetEventMask" }, | ||
99 | { GetFirstClient, "GetFirstClient" }, | ||
100 | { GetFirstRegion, "GetFirstRegion" }, | ||
101 | { GetFirstTuple, "GetFirstTuple" }, | ||
102 | { GetNextClient, "GetNextClient" }, | ||
103 | { GetNextRegion, "GetNextRegion" }, | ||
104 | { GetNextTuple, "GetNextTuple" }, | ||
105 | { GetStatus, "GetStatus" }, | ||
106 | { GetTupleData, "GetTupleData" }, | ||
107 | { MapMemPage, "MapMemPage" }, | ||
108 | { ModifyConfiguration, "ModifyConfiguration" }, | ||
109 | { ModifyWindow, "ModifyWindow" }, | ||
110 | { OpenMemory, "OpenMemory" }, | ||
111 | { ParseTuple, "ParseTuple" }, | ||
112 | { ReadMemory, "ReadMemory" }, | ||
113 | { RegisterClient, "RegisterClient" }, | ||
114 | { RegisterEraseQueue, "RegisterEraseQueue" }, | ||
115 | { RegisterMTD, "RegisterMTD" }, | ||
116 | { ReleaseConfiguration, "ReleaseConfiguration" }, | ||
117 | { ReleaseIO, "ReleaseIO" }, | ||
118 | { ReleaseIRQ, "ReleaseIRQ" }, | ||
119 | { ReleaseWindow, "ReleaseWindow" }, | ||
120 | { RequestConfiguration, "RequestConfiguration" }, | ||
121 | { RequestIO, "RequestIO" }, | ||
122 | { RequestIRQ, "RequestIRQ" }, | ||
123 | { RequestSocketMask, "RequestSocketMask" }, | ||
124 | { RequestWindow, "RequestWindow" }, | ||
125 | { ResetCard, "ResetCard" }, | ||
126 | { SetEventMask, "SetEventMask" }, | ||
127 | { ValidateCIS, "ValidateCIS" }, | ||
128 | { WriteMemory, "WriteMemory" }, | ||
129 | { BindDevice, "BindDevice" }, | ||
130 | { BindMTD, "BindMTD" }, | ||
131 | { ReportError, "ReportError" }, | ||
132 | { SuspendCard, "SuspendCard" }, | ||
133 | { ResumeCard, "ResumeCard" }, | ||
134 | { EjectCard, "EjectCard" }, | ||
135 | { InsertCard, "InsertCard" }, | ||
136 | { ReplaceCIS, "ReplaceCIS" } | ||
137 | }; | ||
138 | |||
139 | const char *pcmcia_error_func(int func) | ||
140 | { | ||
141 | int i; | ||
142 | |||
143 | for (i = 0; i < ARRAY_SIZE(service_table); i++) | ||
144 | if (service_table[i].key == func) | ||
145 | return service_table[i].msg; | ||
146 | |||
147 | return "Unknown service number"; | ||
148 | } | ||
149 | EXPORT_SYMBOL(pcmcia_error_func); | ||
150 | |||
151 | const char *pcmcia_error_ret(int ret) | ||
152 | { | ||
153 | int i; | ||
154 | |||
155 | for (i = 0; i < ARRAY_SIZE(error_table); i++) | ||
156 | if (error_table[i].key == ret) | ||
157 | return error_table[i].msg; | ||
158 | |||
159 | return "unknown"; | ||
160 | } | ||
161 | EXPORT_SYMBOL(pcmcia_error_ret); | ||
162 | |||
163 | /*======================================================================*/ | ||
164 | |||
165 | |||
166 | |||
167 | static void pcmcia_check_driver(struct pcmcia_driver *p_drv) | 49 | static void pcmcia_check_driver(struct pcmcia_driver *p_drv) |
168 | { | 50 | { |
169 | struct pcmcia_device_id *did = p_drv->id_table; | 51 | struct pcmcia_device_id *did = p_drv->id_table; |
@@ -303,7 +185,7 @@ int pcmcia_register_driver(struct pcmcia_driver *driver) | |||
303 | spin_lock_init(&driver->dynids.lock); | 185 | spin_lock_init(&driver->dynids.lock); |
304 | INIT_LIST_HEAD(&driver->dynids.list); | 186 | INIT_LIST_HEAD(&driver->dynids.list); |
305 | 187 | ||
306 | ds_dbg(3, "registering driver %s\n", driver->drv.name); | 188 | pr_debug("registering driver %s\n", driver->drv.name); |
307 | 189 | ||
308 | error = driver_register(&driver->drv); | 190 | error = driver_register(&driver->drv); |
309 | if (error < 0) | 191 | if (error < 0) |
@@ -323,7 +205,7 @@ EXPORT_SYMBOL(pcmcia_register_driver); | |||
323 | */ | 205 | */ |
324 | void pcmcia_unregister_driver(struct pcmcia_driver *driver) | 206 | void pcmcia_unregister_driver(struct pcmcia_driver *driver) |
325 | { | 207 | { |
326 | ds_dbg(3, "unregistering driver %s\n", driver->drv.name); | 208 | pr_debug("unregistering driver %s\n", driver->drv.name); |
327 | driver_unregister(&driver->drv); | 209 | driver_unregister(&driver->drv); |
328 | pcmcia_free_dynids(driver); | 210 | pcmcia_free_dynids(driver); |
329 | } | 211 | } |
@@ -350,14 +232,14 @@ void pcmcia_put_dev(struct pcmcia_device *p_dev) | |||
350 | static void pcmcia_release_function(struct kref *ref) | 232 | static void pcmcia_release_function(struct kref *ref) |
351 | { | 233 | { |
352 | struct config_t *c = container_of(ref, struct config_t, ref); | 234 | struct config_t *c = container_of(ref, struct config_t, ref); |
353 | ds_dbg(1, "releasing config_t\n"); | 235 | pr_debug("releasing config_t\n"); |
354 | kfree(c); | 236 | kfree(c); |
355 | } | 237 | } |
356 | 238 | ||
357 | static void pcmcia_release_dev(struct device *dev) | 239 | static void pcmcia_release_dev(struct device *dev) |
358 | { | 240 | { |
359 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); | 241 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); |
360 | ds_dev_dbg(1, dev, "releasing device\n"); | 242 | dev_dbg(dev, "releasing device\n"); |
361 | pcmcia_put_socket(p_dev->socket); | 243 | pcmcia_put_socket(p_dev->socket); |
362 | kfree(p_dev->devname); | 244 | kfree(p_dev->devname); |
363 | kref_put(&p_dev->function_config->ref, pcmcia_release_function); | 245 | kref_put(&p_dev->function_config->ref, pcmcia_release_function); |
@@ -367,7 +249,7 @@ static void pcmcia_release_dev(struct device *dev) | |||
367 | static void pcmcia_add_device_later(struct pcmcia_socket *s, int mfc) | 249 | static void pcmcia_add_device_later(struct pcmcia_socket *s, int mfc) |
368 | { | 250 | { |
369 | if (!s->pcmcia_state.device_add_pending) { | 251 | if (!s->pcmcia_state.device_add_pending) { |
370 | ds_dev_dbg(1, &s->dev, "scheduling to add %s secondary" | 252 | dev_dbg(&s->dev, "scheduling to add %s secondary" |
371 | " device to %d\n", mfc ? "mfc" : "pfc", s->sock); | 253 | " device to %d\n", mfc ? "mfc" : "pfc", s->sock); |
372 | s->pcmcia_state.device_add_pending = 1; | 254 | s->pcmcia_state.device_add_pending = 1; |
373 | s->pcmcia_state.mfc_pfc = mfc; | 255 | s->pcmcia_state.mfc_pfc = mfc; |
@@ -405,7 +287,7 @@ static int pcmcia_device_probe(struct device * dev) | |||
405 | */ | 287 | */ |
406 | did = dev_get_drvdata(&p_dev->dev); | 288 | did = dev_get_drvdata(&p_dev->dev); |
407 | 289 | ||
408 | ds_dev_dbg(1, dev, "trying to bind to %s\n", p_drv->drv.name); | 290 | dev_dbg(dev, "trying to bind to %s\n", p_drv->drv.name); |
409 | 291 | ||
410 | if ((!p_drv->probe) || (!p_dev->function_config) || | 292 | if ((!p_drv->probe) || (!p_dev->function_config) || |
411 | (!try_module_get(p_drv->owner))) { | 293 | (!try_module_get(p_drv->owner))) { |
@@ -428,7 +310,7 @@ static int pcmcia_device_probe(struct device * dev) | |||
428 | 310 | ||
429 | ret = p_drv->probe(p_dev); | 311 | ret = p_drv->probe(p_dev); |
430 | if (ret) { | 312 | if (ret) { |
431 | ds_dev_dbg(1, dev, "binding to %s failed with %d\n", | 313 | dev_dbg(dev, "binding to %s failed with %d\n", |
432 | p_drv->drv.name, ret); | 314 | p_drv->drv.name, ret); |
433 | goto put_module; | 315 | goto put_module; |
434 | } | 316 | } |
@@ -456,7 +338,7 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le | |||
456 | struct pcmcia_device *tmp; | 338 | struct pcmcia_device *tmp; |
457 | unsigned long flags; | 339 | unsigned long flags; |
458 | 340 | ||
459 | ds_dev_dbg(2, leftover ? &leftover->dev : &s->dev, | 341 | dev_dbg(leftover ? &leftover->dev : &s->dev, |
460 | "pcmcia_card_remove(%d) %s\n", s->sock, | 342 | "pcmcia_card_remove(%d) %s\n", s->sock, |
461 | leftover ? leftover->devname : ""); | 343 | leftover ? leftover->devname : ""); |
462 | 344 | ||
@@ -475,7 +357,7 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le | |||
475 | p_dev->_removed=1; | 357 | p_dev->_removed=1; |
476 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); | 358 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); |
477 | 359 | ||
478 | ds_dev_dbg(2, &p_dev->dev, "unregistering device\n"); | 360 | dev_dbg(&p_dev->dev, "unregistering device\n"); |
479 | device_unregister(&p_dev->dev); | 361 | device_unregister(&p_dev->dev); |
480 | } | 362 | } |
481 | 363 | ||
@@ -492,7 +374,7 @@ static int pcmcia_device_remove(struct device * dev) | |||
492 | p_dev = to_pcmcia_dev(dev); | 374 | p_dev = to_pcmcia_dev(dev); |
493 | p_drv = to_pcmcia_drv(dev->driver); | 375 | p_drv = to_pcmcia_drv(dev->driver); |
494 | 376 | ||
495 | ds_dev_dbg(1, dev, "removing device\n"); | 377 | dev_dbg(dev, "removing device\n"); |
496 | 378 | ||
497 | /* If we're removing the primary module driving a | 379 | /* If we're removing the primary module driving a |
498 | * pseudo multi-function card, we need to unbind | 380 | * pseudo multi-function card, we need to unbind |
@@ -572,7 +454,7 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev) | |||
572 | } | 454 | } |
573 | if (!pccard_read_tuple(p_dev->socket, p_dev->func, | 455 | if (!pccard_read_tuple(p_dev->socket, p_dev->func, |
574 | CISTPL_DEVICE_GEO, devgeo)) { | 456 | CISTPL_DEVICE_GEO, devgeo)) { |
575 | ds_dev_dbg(0, &p_dev->dev, | 457 | dev_dbg(&p_dev->dev, |
576 | "mem device geometry probably means " | 458 | "mem device geometry probably means " |
577 | "FUNCID_MEMORY\n"); | 459 | "FUNCID_MEMORY\n"); |
578 | p_dev->func_id = CISTPL_FUNCID_MEMORY; | 460 | p_dev->func_id = CISTPL_FUNCID_MEMORY; |
@@ -628,7 +510,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f | |||
628 | 510 | ||
629 | mutex_lock(&device_add_lock); | 511 | mutex_lock(&device_add_lock); |
630 | 512 | ||
631 | ds_dbg(3, "adding device to %d, function %d\n", s->sock, function); | 513 | pr_debug("adding device to %d, function %d\n", s->sock, function); |
632 | 514 | ||
633 | /* max of 4 devices per card */ | 515 | /* max of 4 devices per card */ |
634 | if (s->device_count == 4) | 516 | if (s->device_count == 4) |
@@ -654,7 +536,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f | |||
654 | p_dev->devname = kasprintf(GFP_KERNEL, "pcmcia%s", dev_name(&p_dev->dev)); | 536 | p_dev->devname = kasprintf(GFP_KERNEL, "pcmcia%s", dev_name(&p_dev->dev)); |
655 | if (!p_dev->devname) | 537 | if (!p_dev->devname) |
656 | goto err_free; | 538 | goto err_free; |
657 | ds_dev_dbg(3, &p_dev->dev, "devname is %s\n", p_dev->devname); | 539 | dev_dbg(&p_dev->dev, "devname is %s\n", p_dev->devname); |
658 | 540 | ||
659 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); | 541 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); |
660 | 542 | ||
@@ -677,7 +559,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f | |||
677 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); | 559 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); |
678 | 560 | ||
679 | if (!p_dev->function_config) { | 561 | if (!p_dev->function_config) { |
680 | ds_dev_dbg(3, &p_dev->dev, "creating config_t\n"); | 562 | dev_dbg(&p_dev->dev, "creating config_t\n"); |
681 | p_dev->function_config = kzalloc(sizeof(struct config_t), | 563 | p_dev->function_config = kzalloc(sizeof(struct config_t), |
682 | GFP_KERNEL); | 564 | GFP_KERNEL); |
683 | if (!p_dev->function_config) | 565 | if (!p_dev->function_config) |
@@ -722,20 +604,20 @@ static int pcmcia_card_add(struct pcmcia_socket *s) | |||
722 | int ret = 0; | 604 | int ret = 0; |
723 | 605 | ||
724 | if (!(s->resource_setup_done)) { | 606 | if (!(s->resource_setup_done)) { |
725 | ds_dev_dbg(3, &s->dev, | 607 | dev_dbg(&s->dev, |
726 | "no resources available, delaying card_add\n"); | 608 | "no resources available, delaying card_add\n"); |
727 | return -EAGAIN; /* try again, but later... */ | 609 | return -EAGAIN; /* try again, but later... */ |
728 | } | 610 | } |
729 | 611 | ||
730 | if (pcmcia_validate_mem(s)) { | 612 | if (pcmcia_validate_mem(s)) { |
731 | ds_dev_dbg(3, &s->dev, "validating mem resources failed, " | 613 | dev_dbg(&s->dev, "validating mem resources failed, " |
732 | "delaying card_add\n"); | 614 | "delaying card_add\n"); |
733 | return -EAGAIN; /* try again, but later... */ | 615 | return -EAGAIN; /* try again, but later... */ |
734 | } | 616 | } |
735 | 617 | ||
736 | ret = pccard_validate_cis(s, &no_chains); | 618 | ret = pccard_validate_cis(s, &no_chains); |
737 | if (ret || !no_chains) { | 619 | if (ret || !no_chains) { |
738 | ds_dev_dbg(0, &s->dev, "invalid CIS or invalid resources\n"); | 620 | dev_dbg(&s->dev, "invalid CIS or invalid resources\n"); |
739 | return -ENODEV; | 621 | return -ENODEV; |
740 | } | 622 | } |
741 | 623 | ||
@@ -756,7 +638,7 @@ static void pcmcia_delayed_add_device(struct work_struct *work) | |||
756 | { | 638 | { |
757 | struct pcmcia_socket *s = | 639 | struct pcmcia_socket *s = |
758 | container_of(work, struct pcmcia_socket, device_add); | 640 | container_of(work, struct pcmcia_socket, device_add); |
759 | ds_dev_dbg(1, &s->dev, "adding additional device to %d\n", s->sock); | 641 | dev_dbg(&s->dev, "adding additional device to %d\n", s->sock); |
760 | pcmcia_device_add(s, s->pcmcia_state.mfc_pfc); | 642 | pcmcia_device_add(s, s->pcmcia_state.mfc_pfc); |
761 | s->pcmcia_state.device_add_pending = 0; | 643 | s->pcmcia_state.device_add_pending = 0; |
762 | s->pcmcia_state.mfc_pfc = 0; | 644 | s->pcmcia_state.mfc_pfc = 0; |
@@ -766,7 +648,7 @@ static int pcmcia_requery(struct device *dev, void * _data) | |||
766 | { | 648 | { |
767 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); | 649 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); |
768 | if (!p_dev->dev.driver) { | 650 | if (!p_dev->dev.driver) { |
769 | ds_dev_dbg(1, dev, "update device information\n"); | 651 | dev_dbg(dev, "update device information\n"); |
770 | pcmcia_device_query(p_dev); | 652 | pcmcia_device_query(p_dev); |
771 | } | 653 | } |
772 | 654 | ||
@@ -780,7 +662,7 @@ static void pcmcia_bus_rescan(struct pcmcia_socket *skt, int new_cis) | |||
780 | unsigned long flags; | 662 | unsigned long flags; |
781 | 663 | ||
782 | /* must be called with skt_mutex held */ | 664 | /* must be called with skt_mutex held */ |
783 | ds_dev_dbg(0, &skt->dev, "re-scanning socket %d\n", skt->sock); | 665 | dev_dbg(&skt->dev, "re-scanning socket %d\n", skt->sock); |
784 | 666 | ||
785 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); | 667 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); |
786 | if (list_empty(&skt->devices_list)) | 668 | if (list_empty(&skt->devices_list)) |
@@ -835,7 +717,7 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) | |||
835 | if (!filename) | 717 | if (!filename) |
836 | return -EINVAL; | 718 | return -EINVAL; |
837 | 719 | ||
838 | ds_dev_dbg(1, &dev->dev, "trying to load CIS file %s\n", filename); | 720 | dev_dbg(&dev->dev, "trying to load CIS file %s\n", filename); |
839 | 721 | ||
840 | if (request_firmware(&fw, filename, &dev->dev) == 0) { | 722 | if (request_firmware(&fw, filename, &dev->dev) == 0) { |
841 | if (fw->size >= CISTPL_MAX_CIS_SIZE) { | 723 | if (fw->size >= CISTPL_MAX_CIS_SIZE) { |
@@ -953,14 +835,14 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev, | |||
953 | * after it has re-checked that there is no possible module | 835 | * after it has re-checked that there is no possible module |
954 | * with a prod_id/manf_id/card_id match. | 836 | * with a prod_id/manf_id/card_id match. |
955 | */ | 837 | */ |
956 | ds_dev_dbg(0, &dev->dev, | 838 | dev_dbg(&dev->dev, |
957 | "skipping FUNC_ID match until userspace interaction\n"); | 839 | "skipping FUNC_ID match until userspace interaction\n"); |
958 | if (!dev->allow_func_id_match) | 840 | if (!dev->allow_func_id_match) |
959 | return 0; | 841 | return 0; |
960 | } | 842 | } |
961 | 843 | ||
962 | if (did->match_flags & PCMCIA_DEV_ID_MATCH_FAKE_CIS) { | 844 | if (did->match_flags & PCMCIA_DEV_ID_MATCH_FAKE_CIS) { |
963 | ds_dev_dbg(0, &dev->dev, "device needs a fake CIS\n"); | 845 | dev_dbg(&dev->dev, "device needs a fake CIS\n"); |
964 | if (!dev->socket->fake_cis) | 846 | if (!dev->socket->fake_cis) |
965 | pcmcia_load_firmware(dev, did->cisfile); | 847 | pcmcia_load_firmware(dev, did->cisfile); |
966 | 848 | ||
@@ -992,9 +874,9 @@ static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) { | |||
992 | /* match dynamic devices first */ | 874 | /* match dynamic devices first */ |
993 | spin_lock(&p_drv->dynids.lock); | 875 | spin_lock(&p_drv->dynids.lock); |
994 | list_for_each_entry(dynid, &p_drv->dynids.list, node) { | 876 | list_for_each_entry(dynid, &p_drv->dynids.list, node) { |
995 | ds_dev_dbg(3, dev, "trying to match to %s\n", drv->name); | 877 | dev_dbg(dev, "trying to match to %s\n", drv->name); |
996 | if (pcmcia_devmatch(p_dev, &dynid->id)) { | 878 | if (pcmcia_devmatch(p_dev, &dynid->id)) { |
997 | ds_dev_dbg(0, dev, "matched to %s\n", drv->name); | 879 | dev_dbg(dev, "matched to %s\n", drv->name); |
998 | spin_unlock(&p_drv->dynids.lock); | 880 | spin_unlock(&p_drv->dynids.lock); |
999 | return 1; | 881 | return 1; |
1000 | } | 882 | } |
@@ -1004,15 +886,15 @@ static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) { | |||
1004 | #ifdef CONFIG_PCMCIA_IOCTL | 886 | #ifdef CONFIG_PCMCIA_IOCTL |
1005 | /* matching by cardmgr */ | 887 | /* matching by cardmgr */ |
1006 | if (p_dev->cardmgr == p_drv) { | 888 | if (p_dev->cardmgr == p_drv) { |
1007 | ds_dev_dbg(0, dev, "cardmgr matched to %s\n", drv->name); | 889 | dev_dbg(dev, "cardmgr matched to %s\n", drv->name); |
1008 | return 1; | 890 | return 1; |
1009 | } | 891 | } |
1010 | #endif | 892 | #endif |
1011 | 893 | ||
1012 | while (did && did->match_flags) { | 894 | while (did && did->match_flags) { |
1013 | ds_dev_dbg(3, dev, "trying to match to %s\n", drv->name); | 895 | dev_dbg(dev, "trying to match to %s\n", drv->name); |
1014 | if (pcmcia_devmatch(p_dev, did)) { | 896 | if (pcmcia_devmatch(p_dev, did)) { |
1015 | ds_dev_dbg(0, dev, "matched to %s\n", drv->name); | 897 | dev_dbg(dev, "matched to %s\n", drv->name); |
1016 | return 1; | 898 | return 1; |
1017 | } | 899 | } |
1018 | did++; | 900 | did++; |
@@ -1218,7 +1100,7 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state) | |||
1218 | if (p_dev->suspended) | 1100 | if (p_dev->suspended) |
1219 | return 0; | 1101 | return 0; |
1220 | 1102 | ||
1221 | ds_dev_dbg(2, dev, "suspending\n"); | 1103 | dev_dbg(dev, "suspending\n"); |
1222 | 1104 | ||
1223 | if (dev->driver) | 1105 | if (dev->driver) |
1224 | p_drv = to_pcmcia_drv(dev->driver); | 1106 | p_drv = to_pcmcia_drv(dev->driver); |
@@ -1238,7 +1120,7 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state) | |||
1238 | } | 1120 | } |
1239 | 1121 | ||
1240 | if (p_dev->device_no == p_dev->func) { | 1122 | if (p_dev->device_no == p_dev->func) { |
1241 | ds_dev_dbg(2, dev, "releasing configuration\n"); | 1123 | dev_dbg(dev, "releasing configuration\n"); |
1242 | pcmcia_release_configuration(p_dev); | 1124 | pcmcia_release_configuration(p_dev); |
1243 | } | 1125 | } |
1244 | 1126 | ||
@@ -1258,7 +1140,7 @@ static int pcmcia_dev_resume(struct device * dev) | |||
1258 | if (!p_dev->suspended) | 1140 | if (!p_dev->suspended) |
1259 | return 0; | 1141 | return 0; |
1260 | 1142 | ||
1261 | ds_dev_dbg(2, dev, "resuming\n"); | 1143 | dev_dbg(dev, "resuming\n"); |
1262 | 1144 | ||
1263 | if (dev->driver) | 1145 | if (dev->driver) |
1264 | p_drv = to_pcmcia_drv(dev->driver); | 1146 | p_drv = to_pcmcia_drv(dev->driver); |
@@ -1267,7 +1149,7 @@ static int pcmcia_dev_resume(struct device * dev) | |||
1267 | goto out; | 1149 | goto out; |
1268 | 1150 | ||
1269 | if (p_dev->device_no == p_dev->func) { | 1151 | if (p_dev->device_no == p_dev->func) { |
1270 | ds_dev_dbg(2, dev, "requesting configuration\n"); | 1152 | dev_dbg(dev, "requesting configuration\n"); |
1271 | ret = pcmcia_request_configuration(p_dev, &p_dev->conf); | 1153 | ret = pcmcia_request_configuration(p_dev, &p_dev->conf); |
1272 | if (ret) | 1154 | if (ret) |
1273 | goto out; | 1155 | goto out; |
@@ -1309,14 +1191,14 @@ static int pcmcia_bus_resume_callback(struct device *dev, void * _data) | |||
1309 | 1191 | ||
1310 | static int pcmcia_bus_resume(struct pcmcia_socket *skt) | 1192 | static int pcmcia_bus_resume(struct pcmcia_socket *skt) |
1311 | { | 1193 | { |
1312 | ds_dev_dbg(2, &skt->dev, "resuming socket %d\n", skt->sock); | 1194 | dev_dbg(&skt->dev, "resuming socket %d\n", skt->sock); |
1313 | bus_for_each_dev(&pcmcia_bus_type, NULL, skt, pcmcia_bus_resume_callback); | 1195 | bus_for_each_dev(&pcmcia_bus_type, NULL, skt, pcmcia_bus_resume_callback); |
1314 | return 0; | 1196 | return 0; |
1315 | } | 1197 | } |
1316 | 1198 | ||
1317 | static int pcmcia_bus_suspend(struct pcmcia_socket *skt) | 1199 | static int pcmcia_bus_suspend(struct pcmcia_socket *skt) |
1318 | { | 1200 | { |
1319 | ds_dev_dbg(2, &skt->dev, "suspending socket %d\n", skt->sock); | 1201 | dev_dbg(&skt->dev, "suspending socket %d\n", skt->sock); |
1320 | if (bus_for_each_dev(&pcmcia_bus_type, NULL, skt, | 1202 | if (bus_for_each_dev(&pcmcia_bus_type, NULL, skt, |
1321 | pcmcia_bus_suspend_callback)) { | 1203 | pcmcia_bus_suspend_callback)) { |
1322 | pcmcia_bus_resume(skt); | 1204 | pcmcia_bus_resume(skt); |
@@ -1348,7 +1230,7 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority) | |||
1348 | return -ENODEV; | 1230 | return -ENODEV; |
1349 | } | 1231 | } |
1350 | 1232 | ||
1351 | ds_dev_dbg(1, &skt->dev, "ds_event(0x%06x, %d, 0x%p)\n", | 1233 | dev_dbg(&skt->dev, "ds_event(0x%06x, %d, 0x%p)\n", |
1352 | event, priority, skt); | 1234 | event, priority, skt); |
1353 | 1235 | ||
1354 | switch (event) { | 1236 | switch (event) { |
diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c index a4aacb830b80..c13fd9360511 100644 --- a/drivers/pcmcia/i82365.c +++ b/drivers/pcmcia/i82365.c | |||
@@ -63,21 +63,6 @@ | |||
63 | #include "vg468.h" | 63 | #include "vg468.h" |
64 | #include "ricoh.h" | 64 | #include "ricoh.h" |
65 | 65 | ||
66 | #ifdef CONFIG_PCMCIA_DEBUG | ||
67 | static const char version[] = | ||
68 | "i82365.c 1.265 1999/11/10 18:36:21 (David Hinds)"; | ||
69 | |||
70 | static int pc_debug; | ||
71 | |||
72 | module_param(pc_debug, int, 0644); | ||
73 | |||
74 | #define debug(lvl, fmt, arg...) do { \ | ||
75 | if (pc_debug > (lvl)) \ | ||
76 | printk(KERN_DEBUG "i82365: " fmt , ## arg); \ | ||
77 | } while (0) | ||
78 | #else | ||
79 | #define debug(lvl, fmt, arg...) do { } while (0) | ||
80 | #endif | ||
81 | 66 | ||
82 | static irqreturn_t i365_count_irq(int, void *); | 67 | static irqreturn_t i365_count_irq(int, void *); |
83 | static inline int _check_irq(int irq, int flags) | 68 | static inline int _check_irq(int irq, int flags) |
@@ -501,13 +486,13 @@ static irqreturn_t i365_count_irq(int irq, void *dev) | |||
501 | { | 486 | { |
502 | i365_get(irq_sock, I365_CSC); | 487 | i365_get(irq_sock, I365_CSC); |
503 | irq_hits++; | 488 | irq_hits++; |
504 | debug(2, "-> hit on irq %d\n", irq); | 489 | pr_debug("i82365: -> hit on irq %d\n", irq); |
505 | return IRQ_HANDLED; | 490 | return IRQ_HANDLED; |
506 | } | 491 | } |
507 | 492 | ||
508 | static u_int __init test_irq(u_short sock, int irq) | 493 | static u_int __init test_irq(u_short sock, int irq) |
509 | { | 494 | { |
510 | debug(2, " testing ISA irq %d\n", irq); | 495 | pr_debug("i82365: testing ISA irq %d\n", irq); |
511 | if (request_irq(irq, i365_count_irq, IRQF_PROBE_SHARED, "scan", | 496 | if (request_irq(irq, i365_count_irq, IRQF_PROBE_SHARED, "scan", |
512 | i365_count_irq) != 0) | 497 | i365_count_irq) != 0) |
513 | return 1; | 498 | return 1; |
@@ -515,7 +500,7 @@ static u_int __init test_irq(u_short sock, int irq) | |||
515 | msleep(10); | 500 | msleep(10); |
516 | if (irq_hits) { | 501 | if (irq_hits) { |
517 | free_irq(irq, i365_count_irq); | 502 | free_irq(irq, i365_count_irq); |
518 | debug(2, " spurious hit!\n"); | 503 | pr_debug("i82365: spurious hit!\n"); |
519 | return 1; | 504 | return 1; |
520 | } | 505 | } |
521 | 506 | ||
@@ -528,7 +513,7 @@ static u_int __init test_irq(u_short sock, int irq) | |||
528 | 513 | ||
529 | /* mask all interrupts */ | 514 | /* mask all interrupts */ |
530 | i365_set(sock, I365_CSCINT, 0); | 515 | i365_set(sock, I365_CSCINT, 0); |
531 | debug(2, " hits = %d\n", irq_hits); | 516 | pr_debug("i82365: hits = %d\n", irq_hits); |
532 | 517 | ||
533 | return (irq_hits != 1); | 518 | return (irq_hits != 1); |
534 | } | 519 | } |
@@ -854,7 +839,7 @@ static irqreturn_t pcic_interrupt(int irq, void *dev) | |||
854 | u_long flags = 0; | 839 | u_long flags = 0; |
855 | int handled = 0; | 840 | int handled = 0; |
856 | 841 | ||
857 | debug(4, "pcic_interrupt(%d)\n", irq); | 842 | pr_debug("pcic_interrupt(%d)\n", irq); |
858 | 843 | ||
859 | for (j = 0; j < 20; j++) { | 844 | for (j = 0; j < 20; j++) { |
860 | active = 0; | 845 | active = 0; |
@@ -878,7 +863,7 @@ static irqreturn_t pcic_interrupt(int irq, void *dev) | |||
878 | events |= (csc & I365_CSC_READY) ? SS_READY : 0; | 863 | events |= (csc & I365_CSC_READY) ? SS_READY : 0; |
879 | } | 864 | } |
880 | ISA_UNLOCK(i, flags); | 865 | ISA_UNLOCK(i, flags); |
881 | debug(2, "socket %d event 0x%02x\n", i, events); | 866 | pr_debug("socket %d event 0x%02x\n", i, events); |
882 | 867 | ||
883 | if (events) | 868 | if (events) |
884 | pcmcia_parse_events(&socket[i].socket, events); | 869 | pcmcia_parse_events(&socket[i].socket, events); |
@@ -890,7 +875,7 @@ static irqreturn_t pcic_interrupt(int irq, void *dev) | |||
890 | if (j == 20) | 875 | if (j == 20) |
891 | printk(KERN_NOTICE "i82365: infinite loop in interrupt handler\n"); | 876 | printk(KERN_NOTICE "i82365: infinite loop in interrupt handler\n"); |
892 | 877 | ||
893 | debug(4, "interrupt done\n"); | 878 | pr_debug("pcic_interrupt done\n"); |
894 | return IRQ_RETVAL(handled); | 879 | return IRQ_RETVAL(handled); |
895 | } /* pcic_interrupt */ | 880 | } /* pcic_interrupt */ |
896 | 881 | ||
@@ -932,7 +917,7 @@ static int i365_get_status(u_short sock, u_int *value) | |||
932 | } | 917 | } |
933 | } | 918 | } |
934 | 919 | ||
935 | debug(1, "GetStatus(%d) = %#4.4x\n", sock, *value); | 920 | pr_debug("GetStatus(%d) = %#4.4x\n", sock, *value); |
936 | return 0; | 921 | return 0; |
937 | } /* i365_get_status */ | 922 | } /* i365_get_status */ |
938 | 923 | ||
@@ -943,7 +928,7 @@ static int i365_set_socket(u_short sock, socket_state_t *state) | |||
943 | struct i82365_socket *t = &socket[sock]; | 928 | struct i82365_socket *t = &socket[sock]; |
944 | u_char reg; | 929 | u_char reg; |
945 | 930 | ||
946 | debug(1, "SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " | 931 | pr_debug("SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " |
947 | "io_irq %d, csc_mask %#2.2x)\n", sock, state->flags, | 932 | "io_irq %d, csc_mask %#2.2x)\n", sock, state->flags, |
948 | state->Vcc, state->Vpp, state->io_irq, state->csc_mask); | 933 | state->Vcc, state->Vpp, state->io_irq, state->csc_mask); |
949 | 934 | ||
@@ -1052,7 +1037,7 @@ static int i365_set_io_map(u_short sock, struct pccard_io_map *io) | |||
1052 | { | 1037 | { |
1053 | u_char map, ioctl; | 1038 | u_char map, ioctl; |
1054 | 1039 | ||
1055 | debug(1, "SetIOMap(%d, %d, %#2.2x, %d ns, " | 1040 | pr_debug("SetIOMap(%d, %d, %#2.2x, %d ns, " |
1056 | "%#llx-%#llx)\n", sock, io->map, io->flags, io->speed, | 1041 | "%#llx-%#llx)\n", sock, io->map, io->flags, io->speed, |
1057 | (unsigned long long)io->start, (unsigned long long)io->stop); | 1042 | (unsigned long long)io->start, (unsigned long long)io->stop); |
1058 | map = io->map; | 1043 | map = io->map; |
@@ -1082,7 +1067,7 @@ static int i365_set_mem_map(u_short sock, struct pccard_mem_map *mem) | |||
1082 | u_short base, i; | 1067 | u_short base, i; |
1083 | u_char map; | 1068 | u_char map; |
1084 | 1069 | ||
1085 | debug(1, "SetMemMap(%d, %d, %#2.2x, %d ns, %#llx-%#llx, " | 1070 | pr_debug("SetMemMap(%d, %d, %#2.2x, %d ns, %#llx-%#llx, " |
1086 | "%#x)\n", sock, mem->map, mem->flags, mem->speed, | 1071 | "%#x)\n", sock, mem->map, mem->flags, mem->speed, |
1087 | (unsigned long long)mem->res->start, | 1072 | (unsigned long long)mem->res->start, |
1088 | (unsigned long long)mem->res->end, mem->card_start); | 1073 | (unsigned long long)mem->res->end, mem->card_start); |
diff --git a/drivers/pcmcia/m32r_cfc.c b/drivers/pcmcia/m32r_cfc.c index 7dfbee1dcd76..26a621c9e2fc 100644 --- a/drivers/pcmcia/m32r_cfc.c +++ b/drivers/pcmcia/m32r_cfc.c | |||
@@ -38,17 +38,6 @@ | |||
38 | 38 | ||
39 | #include "m32r_cfc.h" | 39 | #include "m32r_cfc.h" |
40 | 40 | ||
41 | #ifdef CONFIG_PCMCIA_DEBUG | ||
42 | static int m32r_cfc_debug; | ||
43 | module_param(m32r_cfc_debug, int, 0644); | ||
44 | #define debug(lvl, fmt, arg...) do { \ | ||
45 | if (m32r_cfc_debug > (lvl)) \ | ||
46 | printk(KERN_DEBUG "m32r_cfc: " fmt , ## arg); \ | ||
47 | } while (0) | ||
48 | #else | ||
49 | #define debug(n, args...) do { } while (0) | ||
50 | #endif | ||
51 | |||
52 | /* Poll status interval -- 0 means default to interrupt */ | 41 | /* Poll status interval -- 0 means default to interrupt */ |
53 | static int poll_interval = 0; | 42 | static int poll_interval = 0; |
54 | 43 | ||
@@ -123,7 +112,7 @@ void pcc_ioread_byte(int sock, unsigned long port, void *buf, size_t size, | |||
123 | unsigned char *bp = (unsigned char *)buf; | 112 | unsigned char *bp = (unsigned char *)buf; |
124 | unsigned long flags; | 113 | unsigned long flags; |
125 | 114 | ||
126 | debug(3, "m32r_cfc: pcc_ioread_byte: sock=%d, port=%#lx, buf=%p, " | 115 | pr_debug("m32r_cfc: pcc_ioread_byte: sock=%d, port=%#lx, buf=%p, " |
127 | "size=%u, nmemb=%d, flag=%d\n", | 116 | "size=%u, nmemb=%d, flag=%d\n", |
128 | sock, port, buf, size, nmemb, flag); | 117 | sock, port, buf, size, nmemb, flag); |
129 | 118 | ||
@@ -132,7 +121,7 @@ void pcc_ioread_byte(int sock, unsigned long port, void *buf, size_t size, | |||
132 | printk("m32r_cfc:ioread_byte null port :%#lx\n",port); | 121 | printk("m32r_cfc:ioread_byte null port :%#lx\n",port); |
133 | return; | 122 | return; |
134 | } | 123 | } |
135 | debug(3, "m32r_cfc: pcc_ioread_byte: addr=%#lx\n", addr); | 124 | pr_debug("m32r_cfc: pcc_ioread_byte: addr=%#lx\n", addr); |
136 | 125 | ||
137 | spin_lock_irqsave(&pcc_lock, flags); | 126 | spin_lock_irqsave(&pcc_lock, flags); |
138 | /* read Byte */ | 127 | /* read Byte */ |
@@ -148,7 +137,7 @@ void pcc_ioread_word(int sock, unsigned long port, void *buf, size_t size, | |||
148 | unsigned short *bp = (unsigned short *)buf; | 137 | unsigned short *bp = (unsigned short *)buf; |
149 | unsigned long flags; | 138 | unsigned long flags; |
150 | 139 | ||
151 | debug(3, "m32r_cfc: pcc_ioread_word: sock=%d, port=%#lx, " | 140 | pr_debug("m32r_cfc: pcc_ioread_word: sock=%d, port=%#lx, " |
152 | "buf=%p, size=%u, nmemb=%d, flag=%d\n", | 141 | "buf=%p, size=%u, nmemb=%d, flag=%d\n", |
153 | sock, port, buf, size, nmemb, flag); | 142 | sock, port, buf, size, nmemb, flag); |
154 | 143 | ||
@@ -163,7 +152,7 @@ void pcc_ioread_word(int sock, unsigned long port, void *buf, size_t size, | |||
163 | printk("m32r_cfc:ioread_word null port :%#lx\n",port); | 152 | printk("m32r_cfc:ioread_word null port :%#lx\n",port); |
164 | return; | 153 | return; |
165 | } | 154 | } |
166 | debug(3, "m32r_cfc: pcc_ioread_word: addr=%#lx\n", addr); | 155 | pr_debug("m32r_cfc: pcc_ioread_word: addr=%#lx\n", addr); |
167 | 156 | ||
168 | spin_lock_irqsave(&pcc_lock, flags); | 157 | spin_lock_irqsave(&pcc_lock, flags); |
169 | /* read Word */ | 158 | /* read Word */ |
@@ -179,7 +168,7 @@ void pcc_iowrite_byte(int sock, unsigned long port, void *buf, size_t size, | |||
179 | unsigned char *bp = (unsigned char *)buf; | 168 | unsigned char *bp = (unsigned char *)buf; |
180 | unsigned long flags; | 169 | unsigned long flags; |
181 | 170 | ||
182 | debug(3, "m32r_cfc: pcc_iowrite_byte: sock=%d, port=%#lx, " | 171 | pr_debug("m32r_cfc: pcc_iowrite_byte: sock=%d, port=%#lx, " |
183 | "buf=%p, size=%u, nmemb=%d, flag=%d\n", | 172 | "buf=%p, size=%u, nmemb=%d, flag=%d\n", |
184 | sock, port, buf, size, nmemb, flag); | 173 | sock, port, buf, size, nmemb, flag); |
185 | 174 | ||
@@ -189,7 +178,7 @@ void pcc_iowrite_byte(int sock, unsigned long port, void *buf, size_t size, | |||
189 | printk("m32r_cfc:iowrite_byte null port:%#lx\n",port); | 178 | printk("m32r_cfc:iowrite_byte null port:%#lx\n",port); |
190 | return; | 179 | return; |
191 | } | 180 | } |
192 | debug(3, "m32r_cfc: pcc_iowrite_byte: addr=%#lx\n", addr); | 181 | pr_debug("m32r_cfc: pcc_iowrite_byte: addr=%#lx\n", addr); |
193 | 182 | ||
194 | spin_lock_irqsave(&pcc_lock, flags); | 183 | spin_lock_irqsave(&pcc_lock, flags); |
195 | while (nmemb--) | 184 | while (nmemb--) |
@@ -204,7 +193,7 @@ void pcc_iowrite_word(int sock, unsigned long port, void *buf, size_t size, | |||
204 | unsigned short *bp = (unsigned short *)buf; | 193 | unsigned short *bp = (unsigned short *)buf; |
205 | unsigned long flags; | 194 | unsigned long flags; |
206 | 195 | ||
207 | debug(3, "m32r_cfc: pcc_iowrite_word: sock=%d, port=%#lx, " | 196 | pr_debug("m32r_cfc: pcc_iowrite_word: sock=%d, port=%#lx, " |
208 | "buf=%p, size=%u, nmemb=%d, flag=%d\n", | 197 | "buf=%p, size=%u, nmemb=%d, flag=%d\n", |
209 | sock, port, buf, size, nmemb, flag); | 198 | sock, port, buf, size, nmemb, flag); |
210 | 199 | ||
@@ -226,7 +215,7 @@ void pcc_iowrite_word(int sock, unsigned long port, void *buf, size_t size, | |||
226 | return; | 215 | return; |
227 | } | 216 | } |
228 | #endif | 217 | #endif |
229 | debug(3, "m32r_cfc: pcc_iowrite_word: addr=%#lx\n", addr); | 218 | pr_debug("m32r_cfc: pcc_iowrite_word: addr=%#lx\n", addr); |
230 | 219 | ||
231 | spin_lock_irqsave(&pcc_lock, flags); | 220 | spin_lock_irqsave(&pcc_lock, flags); |
232 | while (nmemb--) | 221 | while (nmemb--) |
@@ -262,7 +251,7 @@ static struct timer_list poll_timer; | |||
262 | static unsigned int pcc_get(u_short sock, unsigned int reg) | 251 | static unsigned int pcc_get(u_short sock, unsigned int reg) |
263 | { | 252 | { |
264 | unsigned int val = inw(reg); | 253 | unsigned int val = inw(reg); |
265 | debug(3, "m32r_cfc: pcc_get: reg(0x%08x)=0x%04x\n", reg, val); | 254 | pr_debug("m32r_cfc: pcc_get: reg(0x%08x)=0x%04x\n", reg, val); |
266 | return val; | 255 | return val; |
267 | } | 256 | } |
268 | 257 | ||
@@ -270,7 +259,7 @@ static unsigned int pcc_get(u_short sock, unsigned int reg) | |||
270 | static void pcc_set(u_short sock, unsigned int reg, unsigned int data) | 259 | static void pcc_set(u_short sock, unsigned int reg, unsigned int data) |
271 | { | 260 | { |
272 | outw(data, reg); | 261 | outw(data, reg); |
273 | debug(3, "m32r_cfc: pcc_set: reg(0x%08x)=0x%04x\n", reg, data); | 262 | pr_debug("m32r_cfc: pcc_set: reg(0x%08x)=0x%04x\n", reg, data); |
274 | } | 263 | } |
275 | 264 | ||
276 | /*====================================================================== | 265 | /*====================================================================== |
@@ -286,14 +275,14 @@ static int __init is_alive(u_short sock) | |||
286 | { | 275 | { |
287 | unsigned int stat; | 276 | unsigned int stat; |
288 | 277 | ||
289 | debug(3, "m32r_cfc: is_alive:\n"); | 278 | pr_debug("m32r_cfc: is_alive:\n"); |
290 | 279 | ||
291 | printk("CF: "); | 280 | printk("CF: "); |
292 | stat = pcc_get(sock, (unsigned int)PLD_CFSTS); | 281 | stat = pcc_get(sock, (unsigned int)PLD_CFSTS); |
293 | if (!stat) | 282 | if (!stat) |
294 | printk("No "); | 283 | printk("No "); |
295 | printk("Card is detected at socket %d : stat = 0x%08x\n", sock, stat); | 284 | printk("Card is detected at socket %d : stat = 0x%08x\n", sock, stat); |
296 | debug(3, "m32r_cfc: is_alive: sock stat is 0x%04x\n", stat); | 285 | pr_debug("m32r_cfc: is_alive: sock stat is 0x%04x\n", stat); |
297 | 286 | ||
298 | return 0; | 287 | return 0; |
299 | } | 288 | } |
@@ -303,7 +292,7 @@ static void add_pcc_socket(ulong base, int irq, ulong mapaddr, | |||
303 | { | 292 | { |
304 | pcc_socket_t *t = &socket[pcc_sockets]; | 293 | pcc_socket_t *t = &socket[pcc_sockets]; |
305 | 294 | ||
306 | debug(3, "m32r_cfc: add_pcc_socket: base=%#lx, irq=%d, " | 295 | pr_debug("m32r_cfc: add_pcc_socket: base=%#lx, irq=%d, " |
307 | "mapaddr=%#lx, ioaddr=%08x\n", | 296 | "mapaddr=%#lx, ioaddr=%08x\n", |
308 | base, irq, mapaddr, ioaddr); | 297 | base, irq, mapaddr, ioaddr); |
309 | 298 | ||
@@ -358,7 +347,7 @@ static void add_pcc_socket(ulong base, int irq, ulong mapaddr, | |||
358 | /* eject interrupt */ | 347 | /* eject interrupt */ |
359 | request_irq(irq+1, pcc_interrupt, 0, "m32r_cfc", pcc_interrupt); | 348 | request_irq(irq+1, pcc_interrupt, 0, "m32r_cfc", pcc_interrupt); |
360 | #endif | 349 | #endif |
361 | debug(3, "m32r_cfc: enable CFMSK, RDYSEL\n"); | 350 | pr_debug("m32r_cfc: enable CFMSK, RDYSEL\n"); |
362 | pcc_set(pcc_sockets, (unsigned int)PLD_CFIMASK, 0x01); | 351 | pcc_set(pcc_sockets, (unsigned int)PLD_CFIMASK, 0x01); |
363 | #endif /* CONFIG_PLAT_USRV */ | 352 | #endif /* CONFIG_PLAT_USRV */ |
364 | #if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) || defined(CONFIG_PLAT_OPSPUT) | 353 | #if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) || defined(CONFIG_PLAT_OPSPUT) |
@@ -378,26 +367,26 @@ static irqreturn_t pcc_interrupt(int irq, void *dev) | |||
378 | u_int events = 0; | 367 | u_int events = 0; |
379 | int handled = 0; | 368 | int handled = 0; |
380 | 369 | ||
381 | debug(3, "m32r_cfc: pcc_interrupt: irq=%d, dev=%p\n", irq, dev); | 370 | pr_debug("m32r_cfc: pcc_interrupt: irq=%d, dev=%p\n", irq, dev); |
382 | for (i = 0; i < pcc_sockets; i++) { | 371 | for (i = 0; i < pcc_sockets; i++) { |
383 | if (socket[i].cs_irq1 != irq && socket[i].cs_irq2 != irq) | 372 | if (socket[i].cs_irq1 != irq && socket[i].cs_irq2 != irq) |
384 | continue; | 373 | continue; |
385 | 374 | ||
386 | handled = 1; | 375 | handled = 1; |
387 | debug(3, "m32r_cfc: pcc_interrupt: socket %d irq 0x%02x ", | 376 | pr_debug("m32r_cfc: pcc_interrupt: socket %d irq 0x%02x ", |
388 | i, irq); | 377 | i, irq); |
389 | events |= SS_DETECT; /* insert or eject */ | 378 | events |= SS_DETECT; /* insert or eject */ |
390 | if (events) | 379 | if (events) |
391 | pcmcia_parse_events(&socket[i].socket, events); | 380 | pcmcia_parse_events(&socket[i].socket, events); |
392 | } | 381 | } |
393 | debug(3, "m32r_cfc: pcc_interrupt: done\n"); | 382 | pr_debug("m32r_cfc: pcc_interrupt: done\n"); |
394 | 383 | ||
395 | return IRQ_RETVAL(handled); | 384 | return IRQ_RETVAL(handled); |
396 | } /* pcc_interrupt */ | 385 | } /* pcc_interrupt */ |
397 | 386 | ||
398 | static void pcc_interrupt_wrapper(u_long data) | 387 | static void pcc_interrupt_wrapper(u_long data) |
399 | { | 388 | { |
400 | debug(3, "m32r_cfc: pcc_interrupt_wrapper:\n"); | 389 | pr_debug("m32r_cfc: pcc_interrupt_wrapper:\n"); |
401 | pcc_interrupt(0, NULL); | 390 | pcc_interrupt(0, NULL); |
402 | init_timer(&poll_timer); | 391 | init_timer(&poll_timer); |
403 | poll_timer.expires = jiffies + poll_interval; | 392 | poll_timer.expires = jiffies + poll_interval; |
@@ -410,17 +399,17 @@ static int _pcc_get_status(u_short sock, u_int *value) | |||
410 | { | 399 | { |
411 | u_int status; | 400 | u_int status; |
412 | 401 | ||
413 | debug(3, "m32r_cfc: _pcc_get_status:\n"); | 402 | pr_debug("m32r_cfc: _pcc_get_status:\n"); |
414 | status = pcc_get(sock, (unsigned int)PLD_CFSTS); | 403 | status = pcc_get(sock, (unsigned int)PLD_CFSTS); |
415 | *value = (status) ? SS_DETECT : 0; | 404 | *value = (status) ? SS_DETECT : 0; |
416 | debug(3, "m32r_cfc: _pcc_get_status: status=0x%08x\n", status); | 405 | pr_debug("m32r_cfc: _pcc_get_status: status=0x%08x\n", status); |
417 | 406 | ||
418 | #if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) || defined(CONFIG_PLAT_OPSPUT) | 407 | #if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) || defined(CONFIG_PLAT_OPSPUT) |
419 | if ( status ) { | 408 | if ( status ) { |
420 | /* enable CF power */ | 409 | /* enable CF power */ |
421 | status = inw((unsigned int)PLD_CPCR); | 410 | status = inw((unsigned int)PLD_CPCR); |
422 | if (!(status & PLD_CPCR_CF)) { | 411 | if (!(status & PLD_CPCR_CF)) { |
423 | debug(3, "m32r_cfc: _pcc_get_status: " | 412 | pr_debug("m32r_cfc: _pcc_get_status: " |
424 | "power on (CPCR=0x%08x)\n", status); | 413 | "power on (CPCR=0x%08x)\n", status); |
425 | status |= PLD_CPCR_CF; | 414 | status |= PLD_CPCR_CF; |
426 | outw(status, (unsigned int)PLD_CPCR); | 415 | outw(status, (unsigned int)PLD_CPCR); |
@@ -439,7 +428,7 @@ static int _pcc_get_status(u_short sock, u_int *value) | |||
439 | status &= ~PLD_CPCR_CF; | 428 | status &= ~PLD_CPCR_CF; |
440 | outw(status, (unsigned int)PLD_CPCR); | 429 | outw(status, (unsigned int)PLD_CPCR); |
441 | udelay(100); | 430 | udelay(100); |
442 | debug(3, "m32r_cfc: _pcc_get_status: " | 431 | pr_debug("m32r_cfc: _pcc_get_status: " |
443 | "power off (CPCR=0x%08x)\n", status); | 432 | "power off (CPCR=0x%08x)\n", status); |
444 | } | 433 | } |
445 | #elif defined(CONFIG_PLAT_MAPPI2) || defined(CONFIG_PLAT_MAPPI3) | 434 | #elif defined(CONFIG_PLAT_MAPPI2) || defined(CONFIG_PLAT_MAPPI3) |
@@ -465,13 +454,13 @@ static int _pcc_get_status(u_short sock, u_int *value) | |||
465 | /* disable CF power */ | 454 | /* disable CF power */ |
466 | pcc_set(sock, (unsigned int)PLD_CPCR, 0); | 455 | pcc_set(sock, (unsigned int)PLD_CPCR, 0); |
467 | udelay(100); | 456 | udelay(100); |
468 | debug(3, "m32r_cfc: _pcc_get_status: " | 457 | pr_debug("m32r_cfc: _pcc_get_status: " |
469 | "power off (CPCR=0x%08x)\n", status); | 458 | "power off (CPCR=0x%08x)\n", status); |
470 | } | 459 | } |
471 | #else | 460 | #else |
472 | #error no platform configuration | 461 | #error no platform configuration |
473 | #endif | 462 | #endif |
474 | debug(3, "m32r_cfc: _pcc_get_status: GetStatus(%d) = %#4.4x\n", | 463 | pr_debug("m32r_cfc: _pcc_get_status: GetStatus(%d) = %#4.4x\n", |
475 | sock, *value); | 464 | sock, *value); |
476 | return 0; | 465 | return 0; |
477 | } /* _get_status */ | 466 | } /* _get_status */ |
@@ -480,7 +469,7 @@ static int _pcc_get_status(u_short sock, u_int *value) | |||
480 | 469 | ||
481 | static int _pcc_set_socket(u_short sock, socket_state_t *state) | 470 | static int _pcc_set_socket(u_short sock, socket_state_t *state) |
482 | { | 471 | { |
483 | debug(3, "m32r_cfc: SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " | 472 | pr_debug("m32r_cfc: SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " |
484 | "io_irq %d, csc_mask %#2.2x)\n", sock, state->flags, | 473 | "io_irq %d, csc_mask %#2.2x)\n", sock, state->flags, |
485 | state->Vcc, state->Vpp, state->io_irq, state->csc_mask); | 474 | state->Vcc, state->Vpp, state->io_irq, state->csc_mask); |
486 | 475 | ||
@@ -492,41 +481,39 @@ static int _pcc_set_socket(u_short sock, socket_state_t *state) | |||
492 | } | 481 | } |
493 | #endif | 482 | #endif |
494 | if (state->flags & SS_RESET) { | 483 | if (state->flags & SS_RESET) { |
495 | debug(3, ":RESET\n"); | 484 | pr_debug(":RESET\n"); |
496 | pcc_set(sock,(unsigned int)PLD_CFRSTCR,0x101); | 485 | pcc_set(sock,(unsigned int)PLD_CFRSTCR,0x101); |
497 | }else{ | 486 | }else{ |
498 | pcc_set(sock,(unsigned int)PLD_CFRSTCR,0x100); | 487 | pcc_set(sock,(unsigned int)PLD_CFRSTCR,0x100); |
499 | } | 488 | } |
500 | if (state->flags & SS_OUTPUT_ENA){ | 489 | if (state->flags & SS_OUTPUT_ENA){ |
501 | debug(3, ":OUTPUT_ENA\n"); | 490 | pr_debug(":OUTPUT_ENA\n"); |
502 | /* bit clear */ | 491 | /* bit clear */ |
503 | pcc_set(sock,(unsigned int)PLD_CFBUFCR,0); | 492 | pcc_set(sock,(unsigned int)PLD_CFBUFCR,0); |
504 | } else { | 493 | } else { |
505 | pcc_set(sock,(unsigned int)PLD_CFBUFCR,1); | 494 | pcc_set(sock,(unsigned int)PLD_CFBUFCR,1); |
506 | } | 495 | } |
507 | 496 | ||
508 | #ifdef CONFIG_PCMCIA_DEBUG | ||
509 | if(state->flags & SS_IOCARD){ | 497 | if(state->flags & SS_IOCARD){ |
510 | debug(3, ":IOCARD"); | 498 | pr_debug(":IOCARD"); |
511 | } | 499 | } |
512 | if (state->flags & SS_PWR_AUTO) { | 500 | if (state->flags & SS_PWR_AUTO) { |
513 | debug(3, ":PWR_AUTO"); | 501 | pr_debug(":PWR_AUTO"); |
514 | } | 502 | } |
515 | if (state->csc_mask & SS_DETECT) | 503 | if (state->csc_mask & SS_DETECT) |
516 | debug(3, ":csc-SS_DETECT"); | 504 | pr_debug(":csc-SS_DETECT"); |
517 | if (state->flags & SS_IOCARD) { | 505 | if (state->flags & SS_IOCARD) { |
518 | if (state->csc_mask & SS_STSCHG) | 506 | if (state->csc_mask & SS_STSCHG) |
519 | debug(3, ":STSCHG"); | 507 | pr_debug(":STSCHG"); |
520 | } else { | 508 | } else { |
521 | if (state->csc_mask & SS_BATDEAD) | 509 | if (state->csc_mask & SS_BATDEAD) |
522 | debug(3, ":BATDEAD"); | 510 | pr_debug(":BATDEAD"); |
523 | if (state->csc_mask & SS_BATWARN) | 511 | if (state->csc_mask & SS_BATWARN) |
524 | debug(3, ":BATWARN"); | 512 | pr_debug(":BATWARN"); |
525 | if (state->csc_mask & SS_READY) | 513 | if (state->csc_mask & SS_READY) |
526 | debug(3, ":READY"); | 514 | pr_debug(":READY"); |
527 | } | 515 | } |
528 | debug(3, "\n"); | 516 | pr_debug("\n"); |
529 | #endif | ||
530 | return 0; | 517 | return 0; |
531 | } /* _set_socket */ | 518 | } /* _set_socket */ |
532 | 519 | ||
@@ -536,7 +523,7 @@ static int _pcc_set_io_map(u_short sock, struct pccard_io_map *io) | |||
536 | { | 523 | { |
537 | u_char map; | 524 | u_char map; |
538 | 525 | ||
539 | debug(3, "m32r_cfc: SetIOMap(%d, %d, %#2.2x, %d ns, " | 526 | pr_debug("m32r_cfc: SetIOMap(%d, %d, %#2.2x, %d ns, " |
540 | "%#llx-%#llx)\n", sock, io->map, io->flags, | 527 | "%#llx-%#llx)\n", sock, io->map, io->flags, |
541 | io->speed, (unsigned long long)io->start, | 528 | io->speed, (unsigned long long)io->start, |
542 | (unsigned long long)io->stop); | 529 | (unsigned long long)io->stop); |
@@ -554,7 +541,7 @@ static int _pcc_set_mem_map(u_short sock, struct pccard_mem_map *mem) | |||
554 | u_long addr; | 541 | u_long addr; |
555 | pcc_socket_t *t = &socket[sock]; | 542 | pcc_socket_t *t = &socket[sock]; |
556 | 543 | ||
557 | debug(3, "m32r_cfc: SetMemMap(%d, %d, %#2.2x, %d ns, " | 544 | pr_debug("m32r_cfc: SetMemMap(%d, %d, %#2.2x, %d ns, " |
558 | "%#llx, %#x)\n", sock, map, mem->flags, | 545 | "%#llx, %#x)\n", sock, map, mem->flags, |
559 | mem->speed, (unsigned long long)mem->static_start, | 546 | mem->speed, (unsigned long long)mem->static_start, |
560 | mem->card_start); | 547 | mem->card_start); |
@@ -640,11 +627,11 @@ static int pcc_get_status(struct pcmcia_socket *s, u_int *value) | |||
640 | unsigned int sock = container_of(s, struct pcc_socket, socket)->number; | 627 | unsigned int sock = container_of(s, struct pcc_socket, socket)->number; |
641 | 628 | ||
642 | if (socket[sock].flags & IS_ALIVE) { | 629 | if (socket[sock].flags & IS_ALIVE) { |
643 | debug(3, "m32r_cfc: pcc_get_status: sock(%d) -EINVAL\n", sock); | 630 | dev_dbg(&s->dev, "pcc_get_status: sock(%d) -EINVAL\n", sock); |
644 | *value = 0; | 631 | *value = 0; |
645 | return -EINVAL; | 632 | return -EINVAL; |
646 | } | 633 | } |
647 | debug(3, "m32r_cfc: pcc_get_status: sock(%d)\n", sock); | 634 | dev_dbg(&s->dev, "pcc_get_status: sock(%d)\n", sock); |
648 | LOCKED(_pcc_get_status(sock, value)); | 635 | LOCKED(_pcc_get_status(sock, value)); |
649 | } | 636 | } |
650 | 637 | ||
@@ -653,10 +640,10 @@ static int pcc_set_socket(struct pcmcia_socket *s, socket_state_t *state) | |||
653 | unsigned int sock = container_of(s, struct pcc_socket, socket)->number; | 640 | unsigned int sock = container_of(s, struct pcc_socket, socket)->number; |
654 | 641 | ||
655 | if (socket[sock].flags & IS_ALIVE) { | 642 | if (socket[sock].flags & IS_ALIVE) { |
656 | debug(3, "m32r_cfc: pcc_set_socket: sock(%d) -EINVAL\n", sock); | 643 | dev_dbg(&s->dev, "pcc_set_socket: sock(%d) -EINVAL\n", sock); |
657 | return -EINVAL; | 644 | return -EINVAL; |
658 | } | 645 | } |
659 | debug(3, "m32r_cfc: pcc_set_socket: sock(%d)\n", sock); | 646 | dev_dbg(&s->dev, "pcc_set_socket: sock(%d)\n", sock); |
660 | LOCKED(_pcc_set_socket(sock, state)); | 647 | LOCKED(_pcc_set_socket(sock, state)); |
661 | } | 648 | } |
662 | 649 | ||
@@ -665,10 +652,10 @@ static int pcc_set_io_map(struct pcmcia_socket *s, struct pccard_io_map *io) | |||
665 | unsigned int sock = container_of(s, struct pcc_socket, socket)->number; | 652 | unsigned int sock = container_of(s, struct pcc_socket, socket)->number; |
666 | 653 | ||
667 | if (socket[sock].flags & IS_ALIVE) { | 654 | if (socket[sock].flags & IS_ALIVE) { |
668 | debug(3, "m32r_cfc: pcc_set_io_map: sock(%d) -EINVAL\n", sock); | 655 | dev_dbg(&s->dev, "pcc_set_io_map: sock(%d) -EINVAL\n", sock); |
669 | return -EINVAL; | 656 | return -EINVAL; |
670 | } | 657 | } |
671 | debug(3, "m32r_cfc: pcc_set_io_map: sock(%d)\n", sock); | 658 | dev_dbg(&s->dev, "pcc_set_io_map: sock(%d)\n", sock); |
672 | LOCKED(_pcc_set_io_map(sock, io)); | 659 | LOCKED(_pcc_set_io_map(sock, io)); |
673 | } | 660 | } |
674 | 661 | ||
@@ -677,16 +664,16 @@ static int pcc_set_mem_map(struct pcmcia_socket *s, struct pccard_mem_map *mem) | |||
677 | unsigned int sock = container_of(s, struct pcc_socket, socket)->number; | 664 | unsigned int sock = container_of(s, struct pcc_socket, socket)->number; |
678 | 665 | ||
679 | if (socket[sock].flags & IS_ALIVE) { | 666 | if (socket[sock].flags & IS_ALIVE) { |
680 | debug(3, "m32r_cfc: pcc_set_mem_map: sock(%d) -EINVAL\n", sock); | 667 | dev_dbg(&s->dev, "pcc_set_mem_map: sock(%d) -EINVAL\n", sock); |
681 | return -EINVAL; | 668 | return -EINVAL; |
682 | } | 669 | } |
683 | debug(3, "m32r_cfc: pcc_set_mem_map: sock(%d)\n", sock); | 670 | dev_dbg(&s->dev, "pcc_set_mem_map: sock(%d)\n", sock); |
684 | LOCKED(_pcc_set_mem_map(sock, mem)); | 671 | LOCKED(_pcc_set_mem_map(sock, mem)); |
685 | } | 672 | } |
686 | 673 | ||
687 | static int pcc_init(struct pcmcia_socket *s) | 674 | static int pcc_init(struct pcmcia_socket *s) |
688 | { | 675 | { |
689 | debug(3, "m32r_cfc: pcc_init()\n"); | 676 | dev_dbg(&s->dev, "pcc_init()\n"); |
690 | return 0; | 677 | return 0; |
691 | } | 678 | } |
692 | 679 | ||
diff --git a/drivers/pcmcia/m32r_pcc.c b/drivers/pcmcia/m32r_pcc.c index c6524f99ccc3..72844c5a6d05 100644 --- a/drivers/pcmcia/m32r_pcc.c +++ b/drivers/pcmcia/m32r_pcc.c | |||
@@ -45,16 +45,6 @@ | |||
45 | 45 | ||
46 | #define PCC_DEBUG_DBEX | 46 | #define PCC_DEBUG_DBEX |
47 | 47 | ||
48 | #ifdef CONFIG_PCMCIA_DEBUG | ||
49 | static int m32r_pcc_debug; | ||
50 | module_param(m32r_pcc_debug, int, 0644); | ||
51 | #define debug(lvl, fmt, arg...) do { \ | ||
52 | if (m32r_pcc_debug > (lvl)) \ | ||
53 | printk(KERN_DEBUG "m32r_pcc: " fmt , ## arg); \ | ||
54 | } while (0) | ||
55 | #else | ||
56 | #define debug(n, args...) do { } while (0) | ||
57 | #endif | ||
58 | 48 | ||
59 | /* Poll status interval -- 0 means default to interrupt */ | 49 | /* Poll status interval -- 0 means default to interrupt */ |
60 | static int poll_interval = 0; | 50 | static int poll_interval = 0; |
@@ -358,7 +348,7 @@ static irqreturn_t pcc_interrupt(int irq, void *dev) | |||
358 | u_int events, active; | 348 | u_int events, active; |
359 | int handled = 0; | 349 | int handled = 0; |
360 | 350 | ||
361 | debug(4, "m32r: pcc_interrupt(%d)\n", irq); | 351 | pr_debug("m32r_pcc: pcc_interrupt(%d)\n", irq); |
362 | 352 | ||
363 | for (j = 0; j < 20; j++) { | 353 | for (j = 0; j < 20; j++) { |
364 | active = 0; | 354 | active = 0; |
@@ -369,13 +359,14 @@ static irqreturn_t pcc_interrupt(int irq, void *dev) | |||
369 | handled = 1; | 359 | handled = 1; |
370 | irc = pcc_get(i, PCIRC); | 360 | irc = pcc_get(i, PCIRC); |
371 | irc >>=16; | 361 | irc >>=16; |
372 | debug(2, "m32r-pcc:interrupt: socket %d pcirc 0x%02x ", i, irc); | 362 | pr_debug("m32r_pcc: interrupt: socket %d pcirc 0x%02x ", |
363 | i, irc); | ||
373 | if (!irc) | 364 | if (!irc) |
374 | continue; | 365 | continue; |
375 | 366 | ||
376 | events = (irc) ? SS_DETECT : 0; | 367 | events = (irc) ? SS_DETECT : 0; |
377 | events |= (pcc_get(i,PCCR) & PCCR_PCEN) ? SS_READY : 0; | 368 | events |= (pcc_get(i,PCCR) & PCCR_PCEN) ? SS_READY : 0; |
378 | debug(2, " event 0x%02x\n", events); | 369 | pr_debug("m32r_pcc: event 0x%02x\n", events); |
379 | 370 | ||
380 | if (events) | 371 | if (events) |
381 | pcmcia_parse_events(&socket[i].socket, events); | 372 | pcmcia_parse_events(&socket[i].socket, events); |
@@ -388,7 +379,7 @@ static irqreturn_t pcc_interrupt(int irq, void *dev) | |||
388 | if (j == 20) | 379 | if (j == 20) |
389 | printk(KERN_NOTICE "m32r-pcc: infinite loop in interrupt handler\n"); | 380 | printk(KERN_NOTICE "m32r-pcc: infinite loop in interrupt handler\n"); |
390 | 381 | ||
391 | debug(4, "m32r-pcc: interrupt done\n"); | 382 | pr_debug("m32r_pcc: interrupt done\n"); |
392 | 383 | ||
393 | return IRQ_RETVAL(handled); | 384 | return IRQ_RETVAL(handled); |
394 | } /* pcc_interrupt */ | 385 | } /* pcc_interrupt */ |
@@ -422,7 +413,7 @@ static int _pcc_get_status(u_short sock, u_int *value) | |||
422 | status = pcc_get(sock,PCCSIGCR); | 413 | status = pcc_get(sock,PCCSIGCR); |
423 | *value |= (status & PCCSIGCR_VEN) ? SS_POWERON : 0; | 414 | *value |= (status & PCCSIGCR_VEN) ? SS_POWERON : 0; |
424 | 415 | ||
425 | debug(3, "m32r-pcc: GetStatus(%d) = %#4.4x\n", sock, *value); | 416 | pr_debug("m32r_pcc: GetStatus(%d) = %#4.4x\n", sock, *value); |
426 | return 0; | 417 | return 0; |
427 | } /* _get_status */ | 418 | } /* _get_status */ |
428 | 419 | ||
@@ -432,7 +423,7 @@ static int _pcc_set_socket(u_short sock, socket_state_t *state) | |||
432 | { | 423 | { |
433 | u_long reg = 0; | 424 | u_long reg = 0; |
434 | 425 | ||
435 | debug(3, "m32r-pcc: SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " | 426 | pr_debug("m32r_pcc: SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " |
436 | "io_irq %d, csc_mask %#2.2x)", sock, state->flags, | 427 | "io_irq %d, csc_mask %#2.2x)", sock, state->flags, |
437 | state->Vcc, state->Vpp, state->io_irq, state->csc_mask); | 428 | state->Vcc, state->Vpp, state->io_irq, state->csc_mask); |
438 | 429 | ||
@@ -448,11 +439,11 @@ static int _pcc_set_socket(u_short sock, socket_state_t *state) | |||
448 | } | 439 | } |
449 | 440 | ||
450 | if (state->flags & SS_RESET) { | 441 | if (state->flags & SS_RESET) { |
451 | debug(3, ":RESET\n"); | 442 | pr_debug("m32r_pcc: :RESET\n"); |
452 | reg |= PCCSIGCR_CRST; | 443 | reg |= PCCSIGCR_CRST; |
453 | } | 444 | } |
454 | if (state->flags & SS_OUTPUT_ENA){ | 445 | if (state->flags & SS_OUTPUT_ENA){ |
455 | debug(3, ":OUTPUT_ENA\n"); | 446 | pr_debug("m32r_pcc: :OUTPUT_ENA\n"); |
456 | /* bit clear */ | 447 | /* bit clear */ |
457 | } else { | 448 | } else { |
458 | reg |= PCCSIGCR_SEN; | 449 | reg |= PCCSIGCR_SEN; |
@@ -460,28 +451,26 @@ static int _pcc_set_socket(u_short sock, socket_state_t *state) | |||
460 | 451 | ||
461 | pcc_set(sock,PCCSIGCR,reg); | 452 | pcc_set(sock,PCCSIGCR,reg); |
462 | 453 | ||
463 | #ifdef CONFIG_PCMCIA_DEBUG | ||
464 | if(state->flags & SS_IOCARD){ | 454 | if(state->flags & SS_IOCARD){ |
465 | debug(3, ":IOCARD"); | 455 | pr_debug("m32r_pcc: :IOCARD"); |
466 | } | 456 | } |
467 | if (state->flags & SS_PWR_AUTO) { | 457 | if (state->flags & SS_PWR_AUTO) { |
468 | debug(3, ":PWR_AUTO"); | 458 | pr_debug("m32r_pcc: :PWR_AUTO"); |
469 | } | 459 | } |
470 | if (state->csc_mask & SS_DETECT) | 460 | if (state->csc_mask & SS_DETECT) |
471 | debug(3, ":csc-SS_DETECT"); | 461 | pr_debug("m32r_pcc: :csc-SS_DETECT"); |
472 | if (state->flags & SS_IOCARD) { | 462 | if (state->flags & SS_IOCARD) { |
473 | if (state->csc_mask & SS_STSCHG) | 463 | if (state->csc_mask & SS_STSCHG) |
474 | debug(3, ":STSCHG"); | 464 | pr_debug("m32r_pcc: :STSCHG"); |
475 | } else { | 465 | } else { |
476 | if (state->csc_mask & SS_BATDEAD) | 466 | if (state->csc_mask & SS_BATDEAD) |
477 | debug(3, ":BATDEAD"); | 467 | pr_debug("m32r_pcc: :BATDEAD"); |
478 | if (state->csc_mask & SS_BATWARN) | 468 | if (state->csc_mask & SS_BATWARN) |
479 | debug(3, ":BATWARN"); | 469 | pr_debug("m32r_pcc: :BATWARN"); |
480 | if (state->csc_mask & SS_READY) | 470 | if (state->csc_mask & SS_READY) |
481 | debug(3, ":READY"); | 471 | pr_debug("m32r_pcc: :READY"); |
482 | } | 472 | } |
483 | debug(3, "\n"); | 473 | pr_debug("m32r_pcc: \n"); |
484 | #endif | ||
485 | return 0; | 474 | return 0; |
486 | } /* _set_socket */ | 475 | } /* _set_socket */ |
487 | 476 | ||
@@ -491,7 +480,7 @@ static int _pcc_set_io_map(u_short sock, struct pccard_io_map *io) | |||
491 | { | 480 | { |
492 | u_char map; | 481 | u_char map; |
493 | 482 | ||
494 | debug(3, "m32r-pcc: SetIOMap(%d, %d, %#2.2x, %d ns, " | 483 | pr_debug("m32r_pcc: SetIOMap(%d, %d, %#2.2x, %d ns, " |
495 | "%#llx-%#llx)\n", sock, io->map, io->flags, | 484 | "%#llx-%#llx)\n", sock, io->map, io->flags, |
496 | io->speed, (unsigned long long)io->start, | 485 | io->speed, (unsigned long long)io->start, |
497 | (unsigned long long)io->stop); | 486 | (unsigned long long)io->stop); |
@@ -515,7 +504,7 @@ static int _pcc_set_mem_map(u_short sock, struct pccard_mem_map *mem) | |||
515 | #endif | 504 | #endif |
516 | #endif | 505 | #endif |
517 | 506 | ||
518 | debug(3, "m32r-pcc: SetMemMap(%d, %d, %#2.2x, %d ns, " | 507 | pr_debug("m32r_pcc: SetMemMap(%d, %d, %#2.2x, %d ns, " |
519 | "%#llx, %#x)\n", sock, map, mem->flags, | 508 | "%#llx, %#x)\n", sock, map, mem->flags, |
520 | mem->speed, (unsigned long long)mem->static_start, | 509 | mem->speed, (unsigned long long)mem->static_start, |
521 | mem->card_start); | 510 | mem->card_start); |
@@ -662,7 +651,7 @@ static int pcc_set_mem_map(struct pcmcia_socket *s, struct pccard_mem_map *mem) | |||
662 | 651 | ||
663 | static int pcc_init(struct pcmcia_socket *s) | 652 | static int pcc_init(struct pcmcia_socket *s) |
664 | { | 653 | { |
665 | debug(4, "m32r-pcc: init call\n"); | 654 | pr_debug("m32r_pcc: init call\n"); |
666 | return 0; | 655 | return 0; |
667 | } | 656 | } |
668 | 657 | ||
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c index 403559ba49dd..7f79c4e169ae 100644 --- a/drivers/pcmcia/m8xx_pcmcia.c +++ b/drivers/pcmcia/m8xx_pcmcia.c | |||
@@ -64,14 +64,6 @@ | |||
64 | #include <pcmcia/cs.h> | 64 | #include <pcmcia/cs.h> |
65 | #include <pcmcia/ss.h> | 65 | #include <pcmcia/ss.h> |
66 | 66 | ||
67 | #ifdef CONFIG_PCMCIA_DEBUG | ||
68 | static int pc_debug; | ||
69 | module_param(pc_debug, int, 0); | ||
70 | #define dprintk(args...) printk(KERN_DEBUG "m8xx_pcmcia: " args); | ||
71 | #else | ||
72 | #define dprintk(args...) | ||
73 | #endif | ||
74 | |||
75 | #define pcmcia_info(args...) printk(KERN_INFO "m8xx_pcmcia: "args) | 67 | #define pcmcia_info(args...) printk(KERN_INFO "m8xx_pcmcia: "args) |
76 | #define pcmcia_error(args...) printk(KERN_ERR "m8xx_pcmcia: "args) | 68 | #define pcmcia_error(args...) printk(KERN_ERR "m8xx_pcmcia: "args) |
77 | 69 | ||
@@ -565,7 +557,7 @@ static irqreturn_t m8xx_interrupt(int irq, void *dev) | |||
565 | unsigned int i, events, pscr, pipr, per; | 557 | unsigned int i, events, pscr, pipr, per; |
566 | pcmconf8xx_t *pcmcia = socket[0].pcmcia; | 558 | pcmconf8xx_t *pcmcia = socket[0].pcmcia; |
567 | 559 | ||
568 | dprintk("Interrupt!\n"); | 560 | pr_debug("m8xx_pcmcia: Interrupt!\n"); |
569 | /* get interrupt sources */ | 561 | /* get interrupt sources */ |
570 | 562 | ||
571 | pscr = in_be32(&pcmcia->pcmc_pscr); | 563 | pscr = in_be32(&pcmcia->pcmc_pscr); |
@@ -614,7 +606,7 @@ static irqreturn_t m8xx_interrupt(int irq, void *dev) | |||
614 | 606 | ||
615 | /* call the handler */ | 607 | /* call the handler */ |
616 | 608 | ||
617 | dprintk("slot %u: events = 0x%02x, pscr = 0x%08x, " | 609 | pr_debug("m8xx_pcmcia: slot %u: events = 0x%02x, pscr = 0x%08x, " |
618 | "pipr = 0x%08x\n", i, events, pscr, pipr); | 610 | "pipr = 0x%08x\n", i, events, pscr, pipr); |
619 | 611 | ||
620 | if (events) { | 612 | if (events) { |
@@ -641,7 +633,7 @@ static irqreturn_t m8xx_interrupt(int irq, void *dev) | |||
641 | /* clear the interrupt sources */ | 633 | /* clear the interrupt sources */ |
642 | out_be32(&pcmcia->pcmc_pscr, pscr); | 634 | out_be32(&pcmcia->pcmc_pscr, pscr); |
643 | 635 | ||
644 | dprintk("Interrupt done.\n"); | 636 | pr_debug("m8xx_pcmcia: Interrupt done.\n"); |
645 | 637 | ||
646 | return IRQ_HANDLED; | 638 | return IRQ_HANDLED; |
647 | } | 639 | } |
@@ -815,7 +807,7 @@ static int m8xx_get_status(struct pcmcia_socket *sock, unsigned int *value) | |||
815 | }; | 807 | }; |
816 | } | 808 | } |
817 | 809 | ||
818 | dprintk("GetStatus(%d) = %#2.2x\n", lsock, *value); | 810 | pr_debug("m8xx_pcmcia: GetStatus(%d) = %#2.2x\n", lsock, *value); |
819 | return 0; | 811 | return 0; |
820 | } | 812 | } |
821 | 813 | ||
@@ -828,7 +820,7 @@ static int m8xx_set_socket(struct pcmcia_socket *sock, socket_state_t * state) | |||
828 | unsigned long flags; | 820 | unsigned long flags; |
829 | pcmconf8xx_t *pcmcia = socket[0].pcmcia; | 821 | pcmconf8xx_t *pcmcia = socket[0].pcmcia; |
830 | 822 | ||
831 | dprintk("SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " | 823 | pr_debug("m8xx_pcmcia: SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " |
832 | "io_irq %d, csc_mask %#2.2x)\n", lsock, state->flags, | 824 | "io_irq %d, csc_mask %#2.2x)\n", lsock, state->flags, |
833 | state->Vcc, state->Vpp, state->io_irq, state->csc_mask); | 825 | state->Vcc, state->Vpp, state->io_irq, state->csc_mask); |
834 | 826 | ||
@@ -974,7 +966,7 @@ static int m8xx_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io) | |||
974 | #define M8XX_SIZE (io->stop - io->start + 1) | 966 | #define M8XX_SIZE (io->stop - io->start + 1) |
975 | #define M8XX_BASE (PCMCIA_IO_WIN_BASE + io->start) | 967 | #define M8XX_BASE (PCMCIA_IO_WIN_BASE + io->start) |
976 | 968 | ||
977 | dprintk("SetIOMap(%d, %d, %#2.2x, %d ns, " | 969 | pr_debug("m8xx_pcmcia: SetIOMap(%d, %d, %#2.2x, %d ns, " |
978 | "%#4.4llx-%#4.4llx)\n", lsock, io->map, io->flags, | 970 | "%#4.4llx-%#4.4llx)\n", lsock, io->map, io->flags, |
979 | io->speed, (unsigned long long)io->start, | 971 | io->speed, (unsigned long long)io->start, |
980 | (unsigned long long)io->stop); | 972 | (unsigned long long)io->stop); |
@@ -988,7 +980,7 @@ static int m8xx_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io) | |||
988 | 980 | ||
989 | if (io->flags & MAP_ACTIVE) { | 981 | if (io->flags & MAP_ACTIVE) { |
990 | 982 | ||
991 | dprintk("io->flags & MAP_ACTIVE\n"); | 983 | pr_debug("m8xx_pcmcia: io->flags & MAP_ACTIVE\n"); |
992 | 984 | ||
993 | winnr = (PCMCIA_MEM_WIN_NO * PCMCIA_SOCKETS_NO) | 985 | winnr = (PCMCIA_MEM_WIN_NO * PCMCIA_SOCKETS_NO) |
994 | + (lsock * PCMCIA_IO_WIN_NO) + io->map; | 986 | + (lsock * PCMCIA_IO_WIN_NO) + io->map; |
@@ -1018,8 +1010,8 @@ static int m8xx_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io) | |||
1018 | 1010 | ||
1019 | out_be32(&w->or, reg); | 1011 | out_be32(&w->or, reg); |
1020 | 1012 | ||
1021 | dprintk("Socket %u: Mapped io window %u at %#8.8x, " | 1013 | pr_debug("m8xx_pcmcia: Socket %u: Mapped io window %u at " |
1022 | "OR = %#8.8x.\n", lsock, io->map, w->br, w->or); | 1014 | "%#8.8x, OR = %#8.8x.\n", lsock, io->map, w->br, w->or); |
1023 | } else { | 1015 | } else { |
1024 | /* shutdown IO window */ | 1016 | /* shutdown IO window */ |
1025 | winnr = (PCMCIA_MEM_WIN_NO * PCMCIA_SOCKETS_NO) | 1017 | winnr = (PCMCIA_MEM_WIN_NO * PCMCIA_SOCKETS_NO) |
@@ -1033,14 +1025,14 @@ static int m8xx_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io) | |||
1033 | out_be32(&w->or, 0); /* turn off window */ | 1025 | out_be32(&w->or, 0); /* turn off window */ |
1034 | out_be32(&w->br, 0); /* turn off base address */ | 1026 | out_be32(&w->br, 0); /* turn off base address */ |
1035 | 1027 | ||
1036 | dprintk("Socket %u: Unmapped io window %u at %#8.8x, " | 1028 | pr_debug("m8xx_pcmcia: Socket %u: Unmapped io window %u at " |
1037 | "OR = %#8.8x.\n", lsock, io->map, w->br, w->or); | 1029 | "%#8.8x, OR = %#8.8x.\n", lsock, io->map, w->br, w->or); |
1038 | } | 1030 | } |
1039 | 1031 | ||
1040 | /* copy the struct and modify the copy */ | 1032 | /* copy the struct and modify the copy */ |
1041 | s->io_win[io->map] = *io; | 1033 | s->io_win[io->map] = *io; |
1042 | s->io_win[io->map].flags &= (MAP_WRPROT | MAP_16BIT | MAP_ACTIVE); | 1034 | s->io_win[io->map].flags &= (MAP_WRPROT | MAP_16BIT | MAP_ACTIVE); |
1043 | dprintk("SetIOMap exit\n"); | 1035 | pr_debug("m8xx_pcmcia: SetIOMap exit\n"); |
1044 | 1036 | ||
1045 | return 0; | 1037 | return 0; |
1046 | } | 1038 | } |
@@ -1055,7 +1047,7 @@ static int m8xx_set_mem_map(struct pcmcia_socket *sock, | |||
1055 | unsigned int reg, winnr; | 1047 | unsigned int reg, winnr; |
1056 | pcmconf8xx_t *pcmcia = s->pcmcia; | 1048 | pcmconf8xx_t *pcmcia = s->pcmcia; |
1057 | 1049 | ||
1058 | dprintk("SetMemMap(%d, %d, %#2.2x, %d ns, " | 1050 | pr_debug("m8xx_pcmcia: SetMemMap(%d, %d, %#2.2x, %d ns, " |
1059 | "%#5.5llx, %#5.5x)\n", lsock, mem->map, mem->flags, | 1051 | "%#5.5llx, %#5.5x)\n", lsock, mem->map, mem->flags, |
1060 | mem->speed, (unsigned long long)mem->static_start, | 1052 | mem->speed, (unsigned long long)mem->static_start, |
1061 | mem->card_start); | 1053 | mem->card_start); |
@@ -1098,7 +1090,7 @@ static int m8xx_set_mem_map(struct pcmcia_socket *sock, | |||
1098 | 1090 | ||
1099 | out_be32(&w->or, reg); | 1091 | out_be32(&w->or, reg); |
1100 | 1092 | ||
1101 | dprintk("Socket %u: Mapped memory window %u at %#8.8x, " | 1093 | pr_debug("m8xx_pcmcia: Socket %u: Mapped memory window %u at %#8.8x, " |
1102 | "OR = %#8.8x.\n", lsock, mem->map, w->br, w->or); | 1094 | "OR = %#8.8x.\n", lsock, mem->map, w->br, w->or); |
1103 | 1095 | ||
1104 | if (mem->flags & MAP_ACTIVE) { | 1096 | if (mem->flags & MAP_ACTIVE) { |
@@ -1108,7 +1100,7 @@ static int m8xx_set_mem_map(struct pcmcia_socket *sock, | |||
1108 | + mem->card_start; | 1100 | + mem->card_start; |
1109 | } | 1101 | } |
1110 | 1102 | ||
1111 | dprintk("SetMemMap(%d, %d, %#2.2x, %d ns, " | 1103 | pr_debug("m8xx_pcmcia: SetMemMap(%d, %d, %#2.2x, %d ns, " |
1112 | "%#5.5llx, %#5.5x)\n", lsock, mem->map, mem->flags, | 1104 | "%#5.5llx, %#5.5x)\n", lsock, mem->map, mem->flags, |
1113 | mem->speed, (unsigned long long)mem->static_start, | 1105 | mem->speed, (unsigned long long)mem->static_start, |
1114 | mem->card_start); | 1106 | mem->card_start); |
@@ -1129,7 +1121,7 @@ static int m8xx_sock_init(struct pcmcia_socket *sock) | |||
1129 | pccard_io_map io = { 0, 0, 0, 0, 1 }; | 1121 | pccard_io_map io = { 0, 0, 0, 0, 1 }; |
1130 | pccard_mem_map mem = { 0, 0, 0, 0, 0, 0 }; | 1122 | pccard_mem_map mem = { 0, 0, 0, 0, 0, 0 }; |
1131 | 1123 | ||
1132 | dprintk("sock_init(%d)\n", s); | 1124 | pr_debug("m8xx_pcmcia: sock_init(%d)\n", s); |
1133 | 1125 | ||
1134 | m8xx_set_socket(sock, &dead_socket); | 1126 | m8xx_set_socket(sock, &dead_socket); |
1135 | for (i = 0; i < PCMCIA_IO_WIN_NO; i++) { | 1127 | for (i = 0; i < PCMCIA_IO_WIN_NO; i++) { |
diff --git a/drivers/pcmcia/o2micro.h b/drivers/pcmcia/o2micro.h index 72188c462c9c..624442fc0d35 100644 --- a/drivers/pcmcia/o2micro.h +++ b/drivers/pcmcia/o2micro.h | |||
@@ -30,28 +30,6 @@ | |||
30 | #ifndef _LINUX_O2MICRO_H | 30 | #ifndef _LINUX_O2MICRO_H |
31 | #define _LINUX_O2MICRO_H | 31 | #define _LINUX_O2MICRO_H |
32 | 32 | ||
33 | #ifndef PCI_VENDOR_ID_O2 | ||
34 | #define PCI_VENDOR_ID_O2 0x1217 | ||
35 | #endif | ||
36 | #ifndef PCI_DEVICE_ID_O2_6729 | ||
37 | #define PCI_DEVICE_ID_O2_6729 0x6729 | ||
38 | #endif | ||
39 | #ifndef PCI_DEVICE_ID_O2_6730 | ||
40 | #define PCI_DEVICE_ID_O2_6730 0x673a | ||
41 | #endif | ||
42 | #ifndef PCI_DEVICE_ID_O2_6832 | ||
43 | #define PCI_DEVICE_ID_O2_6832 0x6832 | ||
44 | #endif | ||
45 | #ifndef PCI_DEVICE_ID_O2_6836 | ||
46 | #define PCI_DEVICE_ID_O2_6836 0x6836 | ||
47 | #endif | ||
48 | #ifndef PCI_DEVICE_ID_O2_6812 | ||
49 | #define PCI_DEVICE_ID_O2_6812 0x6872 | ||
50 | #endif | ||
51 | #ifndef PCI_DEVICE_ID_O2_6933 | ||
52 | #define PCI_DEVICE_ID_O2_6933 0x6933 | ||
53 | #endif | ||
54 | |||
55 | /* Additional PCI configuration registers */ | 33 | /* Additional PCI configuration registers */ |
56 | 34 | ||
57 | #define O2_MUX_CONTROL 0x90 /* 32 bit */ | 35 | #define O2_MUX_CONTROL 0x90 /* 32 bit */ |
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index 30cf71d2ee23..c4d7908fa37f 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c | |||
@@ -58,17 +58,6 @@ typedef struct user_info_t { | |||
58 | } user_info_t; | 58 | } user_info_t; |
59 | 59 | ||
60 | 60 | ||
61 | #ifdef CONFIG_PCMCIA_DEBUG | ||
62 | extern int ds_pc_debug; | ||
63 | |||
64 | #define ds_dbg(lvl, fmt, arg...) do { \ | ||
65 | if (ds_pc_debug >= lvl) \ | ||
66 | printk(KERN_DEBUG "ds: " fmt , ## arg); \ | ||
67 | } while (0) | ||
68 | #else | ||
69 | #define ds_dbg(lvl, fmt, arg...) do { } while (0) | ||
70 | #endif | ||
71 | |||
72 | static struct pcmcia_device *get_pcmcia_device(struct pcmcia_socket *s, | 61 | static struct pcmcia_device *get_pcmcia_device(struct pcmcia_socket *s, |
73 | unsigned int function) | 62 | unsigned int function) |
74 | { | 63 | { |
@@ -229,6 +218,61 @@ static int pcmcia_adjust_resource_info(adjust_t *adj) | |||
229 | return (ret); | 218 | return (ret); |
230 | } | 219 | } |
231 | 220 | ||
221 | |||
222 | /** pcmcia_get_window | ||
223 | */ | ||
224 | static int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *wh_out, | ||
225 | window_handle_t wh, win_req_t *req) | ||
226 | { | ||
227 | pccard_mem_map *win; | ||
228 | window_handle_t w; | ||
229 | |||
230 | wh--; | ||
231 | if (!s || !(s->state & SOCKET_PRESENT)) | ||
232 | return -ENODEV; | ||
233 | if (wh >= MAX_WIN) | ||
234 | return -EINVAL; | ||
235 | for (w = wh; w < MAX_WIN; w++) | ||
236 | if (s->state & SOCKET_WIN_REQ(w)) | ||
237 | break; | ||
238 | if (w == MAX_WIN) | ||
239 | return -EINVAL; | ||
240 | win = &s->win[w]; | ||
241 | req->Base = win->res->start; | ||
242 | req->Size = win->res->end - win->res->start + 1; | ||
243 | req->AccessSpeed = win->speed; | ||
244 | req->Attributes = 0; | ||
245 | if (win->flags & MAP_ATTRIB) | ||
246 | req->Attributes |= WIN_MEMORY_TYPE_AM; | ||
247 | if (win->flags & MAP_ACTIVE) | ||
248 | req->Attributes |= WIN_ENABLE; | ||
249 | if (win->flags & MAP_16BIT) | ||
250 | req->Attributes |= WIN_DATA_WIDTH_16; | ||
251 | if (win->flags & MAP_USE_WAIT) | ||
252 | req->Attributes |= WIN_USE_WAIT; | ||
253 | |||
254 | *wh_out = w + 1; | ||
255 | return 0; | ||
256 | } /* pcmcia_get_window */ | ||
257 | |||
258 | |||
259 | /** pcmcia_get_mem_page | ||
260 | * | ||
261 | * Change the card address of an already open memory window. | ||
262 | */ | ||
263 | static int pcmcia_get_mem_page(struct pcmcia_socket *skt, window_handle_t wh, | ||
264 | memreq_t *req) | ||
265 | { | ||
266 | wh--; | ||
267 | if (wh >= MAX_WIN) | ||
268 | return -EINVAL; | ||
269 | |||
270 | req->Page = 0; | ||
271 | req->CardOffset = skt->win[wh].card_start; | ||
272 | return 0; | ||
273 | } /* pcmcia_get_mem_page */ | ||
274 | |||
275 | |||
232 | /** pccard_get_status | 276 | /** pccard_get_status |
233 | * | 277 | * |
234 | * Get the current socket state bits. We don't support the latched | 278 | * Get the current socket state bits. We don't support the latched |
@@ -431,7 +475,7 @@ static int bind_request(struct pcmcia_socket *s, bind_info_t *bind_info) | |||
431 | if (!s) | 475 | if (!s) |
432 | return -EINVAL; | 476 | return -EINVAL; |
433 | 477 | ||
434 | ds_dbg(2, "bind_request(%d, '%s')\n", s->sock, | 478 | pr_debug("bind_request(%d, '%s')\n", s->sock, |
435 | (char *)bind_info->dev_info); | 479 | (char *)bind_info->dev_info); |
436 | 480 | ||
437 | p_drv = get_pcmcia_driver(&bind_info->dev_info); | 481 | p_drv = get_pcmcia_driver(&bind_info->dev_info); |
@@ -623,7 +667,7 @@ static int ds_open(struct inode *inode, struct file *file) | |||
623 | static int warning_printed = 0; | 667 | static int warning_printed = 0; |
624 | int ret = 0; | 668 | int ret = 0; |
625 | 669 | ||
626 | ds_dbg(0, "ds_open(socket %d)\n", i); | 670 | pr_debug("ds_open(socket %d)\n", i); |
627 | 671 | ||
628 | lock_kernel(); | 672 | lock_kernel(); |
629 | s = pcmcia_get_socket_by_nr(i); | 673 | s = pcmcia_get_socket_by_nr(i); |
@@ -685,7 +729,7 @@ static int ds_release(struct inode *inode, struct file *file) | |||
685 | struct pcmcia_socket *s; | 729 | struct pcmcia_socket *s; |
686 | user_info_t *user, **link; | 730 | user_info_t *user, **link; |
687 | 731 | ||
688 | ds_dbg(0, "ds_release(socket %d)\n", iminor(inode)); | 732 | pr_debug("ds_release(socket %d)\n", iminor(inode)); |
689 | 733 | ||
690 | user = file->private_data; | 734 | user = file->private_data; |
691 | if (CHECK_USER(user)) | 735 | if (CHECK_USER(user)) |
@@ -719,7 +763,7 @@ static ssize_t ds_read(struct file *file, char __user *buf, | |||
719 | user_info_t *user; | 763 | user_info_t *user; |
720 | int ret; | 764 | int ret; |
721 | 765 | ||
722 | ds_dbg(2, "ds_read(socket %d)\n", iminor(file->f_path.dentry->d_inode)); | 766 | pr_debug("ds_read(socket %d)\n", iminor(file->f_path.dentry->d_inode)); |
723 | 767 | ||
724 | if (count < 4) | 768 | if (count < 4) |
725 | return -EINVAL; | 769 | return -EINVAL; |
@@ -744,7 +788,7 @@ static ssize_t ds_read(struct file *file, char __user *buf, | |||
744 | static ssize_t ds_write(struct file *file, const char __user *buf, | 788 | static ssize_t ds_write(struct file *file, const char __user *buf, |
745 | size_t count, loff_t *ppos) | 789 | size_t count, loff_t *ppos) |
746 | { | 790 | { |
747 | ds_dbg(2, "ds_write(socket %d)\n", iminor(file->f_path.dentry->d_inode)); | 791 | pr_debug("ds_write(socket %d)\n", iminor(file->f_path.dentry->d_inode)); |
748 | 792 | ||
749 | if (count != 4) | 793 | if (count != 4) |
750 | return -EINVAL; | 794 | return -EINVAL; |
@@ -762,7 +806,7 @@ static u_int ds_poll(struct file *file, poll_table *wait) | |||
762 | struct pcmcia_socket *s; | 806 | struct pcmcia_socket *s; |
763 | user_info_t *user; | 807 | user_info_t *user; |
764 | 808 | ||
765 | ds_dbg(2, "ds_poll(socket %d)\n", iminor(file->f_path.dentry->d_inode)); | 809 | pr_debug("ds_poll(socket %d)\n", iminor(file->f_path.dentry->d_inode)); |
766 | 810 | ||
767 | user = file->private_data; | 811 | user = file->private_data; |
768 | if (CHECK_USER(user)) | 812 | if (CHECK_USER(user)) |
@@ -790,7 +834,7 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
790 | ds_ioctl_arg_t *buf; | 834 | ds_ioctl_arg_t *buf; |
791 | user_info_t *user; | 835 | user_info_t *user; |
792 | 836 | ||
793 | ds_dbg(2, "ds_ioctl(socket %d, %#x, %#lx)\n", iminor(inode), cmd, arg); | 837 | pr_debug("ds_ioctl(socket %d, %#x, %#lx)\n", iminor(inode), cmd, arg); |
794 | 838 | ||
795 | user = file->private_data; | 839 | user = file->private_data; |
796 | if (CHECK_USER(user)) | 840 | if (CHECK_USER(user)) |
@@ -809,13 +853,13 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
809 | 853 | ||
810 | if (cmd & IOC_IN) { | 854 | if (cmd & IOC_IN) { |
811 | if (!access_ok(VERIFY_READ, uarg, size)) { | 855 | if (!access_ok(VERIFY_READ, uarg, size)) { |
812 | ds_dbg(3, "ds_ioctl(): verify_read = %d\n", -EFAULT); | 856 | pr_debug("ds_ioctl(): verify_read = %d\n", -EFAULT); |
813 | return -EFAULT; | 857 | return -EFAULT; |
814 | } | 858 | } |
815 | } | 859 | } |
816 | if (cmd & IOC_OUT) { | 860 | if (cmd & IOC_OUT) { |
817 | if (!access_ok(VERIFY_WRITE, uarg, size)) { | 861 | if (!access_ok(VERIFY_WRITE, uarg, size)) { |
818 | ds_dbg(3, "ds_ioctl(): verify_write = %d\n", -EFAULT); | 862 | pr_debug("ds_ioctl(): verify_write = %d\n", -EFAULT); |
819 | return -EFAULT; | 863 | return -EFAULT; |
820 | } | 864 | } |
821 | } | 865 | } |
@@ -927,15 +971,15 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
927 | goto free_out; | 971 | goto free_out; |
928 | break; | 972 | break; |
929 | case DS_GET_FIRST_WINDOW: | 973 | case DS_GET_FIRST_WINDOW: |
930 | ret = pcmcia_get_window(s, &buf->win_info.handle, 0, | 974 | ret = pcmcia_get_window(s, &buf->win_info.handle, 1, |
931 | &buf->win_info.window); | 975 | &buf->win_info.window); |
932 | break; | 976 | break; |
933 | case DS_GET_NEXT_WINDOW: | 977 | case DS_GET_NEXT_WINDOW: |
934 | ret = pcmcia_get_window(s, &buf->win_info.handle, | 978 | ret = pcmcia_get_window(s, &buf->win_info.handle, |
935 | buf->win_info.handle->index + 1, &buf->win_info.window); | 979 | buf->win_info.handle + 1, &buf->win_info.window); |
936 | break; | 980 | break; |
937 | case DS_GET_MEM_PAGE: | 981 | case DS_GET_MEM_PAGE: |
938 | ret = pcmcia_get_mem_page(buf->win_info.handle, | 982 | ret = pcmcia_get_mem_page(s, buf->win_info.handle, |
939 | &buf->win_info.map); | 983 | &buf->win_info.map); |
940 | break; | 984 | break; |
941 | case DS_REPLACE_CIS: | 985 | case DS_REPLACE_CIS: |
@@ -962,7 +1006,7 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
962 | } | 1006 | } |
963 | 1007 | ||
964 | if ((err == 0) && (ret != 0)) { | 1008 | if ((err == 0) && (ret != 0)) { |
965 | ds_dbg(2, "ds_ioctl: ret = %d\n", ret); | 1009 | pr_debug("ds_ioctl: ret = %d\n", ret); |
966 | switch (ret) { | 1010 | switch (ret) { |
967 | case -ENODEV: | 1011 | case -ENODEV: |
968 | case -EINVAL: | 1012 | case -EINVAL: |
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index d919e96c0afd..a8bf8c1b45ed 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
21 | #include <linux/pci.h> | 21 | #include <linux/pci.h> |
22 | #include <linux/device.h> | 22 | #include <linux/device.h> |
23 | #include <linux/netdevice.h> | ||
23 | 24 | ||
24 | #include <pcmcia/cs_types.h> | 25 | #include <pcmcia/cs_types.h> |
25 | #include <pcmcia/ss.h> | 26 | #include <pcmcia/ss.h> |
@@ -43,21 +44,6 @@ static u8 pcmcia_used_irq[NR_IRQS]; | |||
43 | #endif | 44 | #endif |
44 | 45 | ||
45 | 46 | ||
46 | #ifdef CONFIG_PCMCIA_DEBUG | ||
47 | extern int ds_pc_debug; | ||
48 | |||
49 | #define ds_dbg(skt, lvl, fmt, arg...) do { \ | ||
50 | if (ds_pc_debug >= lvl) \ | ||
51 | dev_printk(KERN_DEBUG, &skt->dev, \ | ||
52 | "pcmcia_resource: " fmt, \ | ||
53 | ## arg); \ | ||
54 | } while (0) | ||
55 | #else | ||
56 | #define ds_dbg(skt, lvl, fmt, arg...) do { } while (0) | ||
57 | #endif | ||
58 | |||
59 | |||
60 | |||
61 | /** alloc_io_space | 47 | /** alloc_io_space |
62 | * | 48 | * |
63 | * Special stuff for managing IO windows, because they are scarce | 49 | * Special stuff for managing IO windows, because they are scarce |
@@ -72,14 +58,14 @@ static int alloc_io_space(struct pcmcia_socket *s, u_int attr, | |||
72 | align = (*base) ? (lines ? 1<<lines : 0) : 1; | 58 | align = (*base) ? (lines ? 1<<lines : 0) : 1; |
73 | if (align && (align < num)) { | 59 | if (align && (align < num)) { |
74 | if (*base) { | 60 | if (*base) { |
75 | ds_dbg(s, 0, "odd IO request: num %#x align %#x\n", | 61 | dev_dbg(&s->dev, "odd IO request: num %#x align %#x\n", |
76 | num, align); | 62 | num, align); |
77 | align = 0; | 63 | align = 0; |
78 | } else | 64 | } else |
79 | while (align && (align < num)) align <<= 1; | 65 | while (align && (align < num)) align <<= 1; |
80 | } | 66 | } |
81 | if (*base & ~(align-1)) { | 67 | if (*base & ~(align-1)) { |
82 | ds_dbg(s, 0, "odd IO request: base %#x align %#x\n", | 68 | dev_dbg(&s->dev, "odd IO request: base %#x align %#x\n", |
83 | *base, align); | 69 | *base, align); |
84 | align = 0; | 70 | align = 0; |
85 | } | 71 | } |
@@ -173,8 +159,10 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, | |||
173 | s = p_dev->socket; | 159 | s = p_dev->socket; |
174 | c = p_dev->function_config; | 160 | c = p_dev->function_config; |
175 | 161 | ||
176 | if (!(c->state & CONFIG_LOCKED)) | 162 | if (!(c->state & CONFIG_LOCKED)) { |
163 | dev_dbg(&s->dev, "Configuration isnt't locked\n"); | ||
177 | return -EACCES; | 164 | return -EACCES; |
165 | } | ||
178 | 166 | ||
179 | addr = (c->ConfigBase + reg->Offset) >> 1; | 167 | addr = (c->ConfigBase + reg->Offset) >> 1; |
180 | 168 | ||
@@ -188,6 +176,7 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, | |||
188 | pcmcia_write_cis_mem(s, 1, addr, 1, &val); | 176 | pcmcia_write_cis_mem(s, 1, addr, 1, &val); |
189 | break; | 177 | break; |
190 | default: | 178 | default: |
179 | dev_dbg(&s->dev, "Invalid conf register request\n"); | ||
191 | return -EINVAL; | 180 | return -EINVAL; |
192 | break; | 181 | break; |
193 | } | 182 | } |
@@ -196,68 +185,21 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, | |||
196 | EXPORT_SYMBOL(pcmcia_access_configuration_register); | 185 | EXPORT_SYMBOL(pcmcia_access_configuration_register); |
197 | 186 | ||
198 | 187 | ||
199 | /** pcmcia_get_window | 188 | int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t wh, |
200 | */ | 189 | memreq_t *req) |
201 | int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, | ||
202 | int idx, win_req_t *req) | ||
203 | { | ||
204 | window_t *win; | ||
205 | int w; | ||
206 | |||
207 | if (!s || !(s->state & SOCKET_PRESENT)) | ||
208 | return -ENODEV; | ||
209 | for (w = idx; w < MAX_WIN; w++) | ||
210 | if (s->state & SOCKET_WIN_REQ(w)) | ||
211 | break; | ||
212 | if (w == MAX_WIN) | ||
213 | return -EINVAL; | ||
214 | win = &s->win[w]; | ||
215 | req->Base = win->ctl.res->start; | ||
216 | req->Size = win->ctl.res->end - win->ctl.res->start + 1; | ||
217 | req->AccessSpeed = win->ctl.speed; | ||
218 | req->Attributes = 0; | ||
219 | if (win->ctl.flags & MAP_ATTRIB) | ||
220 | req->Attributes |= WIN_MEMORY_TYPE_AM; | ||
221 | if (win->ctl.flags & MAP_ACTIVE) | ||
222 | req->Attributes |= WIN_ENABLE; | ||
223 | if (win->ctl.flags & MAP_16BIT) | ||
224 | req->Attributes |= WIN_DATA_WIDTH_16; | ||
225 | if (win->ctl.flags & MAP_USE_WAIT) | ||
226 | req->Attributes |= WIN_USE_WAIT; | ||
227 | *handle = win; | ||
228 | return 0; | ||
229 | } /* pcmcia_get_window */ | ||
230 | EXPORT_SYMBOL(pcmcia_get_window); | ||
231 | |||
232 | |||
233 | /** pcmcia_get_mem_page | ||
234 | * | ||
235 | * Change the card address of an already open memory window. | ||
236 | */ | ||
237 | int pcmcia_get_mem_page(window_handle_t win, memreq_t *req) | ||
238 | { | 190 | { |
239 | if ((win == NULL) || (win->magic != WINDOW_MAGIC)) | 191 | struct pcmcia_socket *s = p_dev->socket; |
240 | return -EINVAL; | ||
241 | req->Page = 0; | ||
242 | req->CardOffset = win->ctl.card_start; | ||
243 | return 0; | ||
244 | } /* pcmcia_get_mem_page */ | ||
245 | EXPORT_SYMBOL(pcmcia_get_mem_page); | ||
246 | |||
247 | 192 | ||
248 | int pcmcia_map_mem_page(window_handle_t win, memreq_t *req) | 193 | wh--; |
249 | { | 194 | if (wh >= MAX_WIN) |
250 | struct pcmcia_socket *s; | ||
251 | if ((win == NULL) || (win->magic != WINDOW_MAGIC)) | ||
252 | return -EINVAL; | 195 | return -EINVAL; |
253 | s = win->sock; | ||
254 | if (req->Page != 0) { | 196 | if (req->Page != 0) { |
255 | ds_dbg(s, 0, "failure: requested page is zero\n"); | 197 | dev_dbg(&s->dev, "failure: requested page is zero\n"); |
256 | return -EINVAL; | 198 | return -EINVAL; |
257 | } | 199 | } |
258 | win->ctl.card_start = req->CardOffset; | 200 | s->win[wh].card_start = req->CardOffset; |
259 | if (s->ops->set_mem_map(s, &win->ctl) != 0) { | 201 | if (s->ops->set_mem_map(s, &s->win[wh]) != 0) { |
260 | ds_dbg(s, 0, "failed to set_mem_map\n"); | 202 | dev_dbg(&s->dev, "failed to set_mem_map\n"); |
261 | return -EIO; | 203 | return -EIO; |
262 | } | 204 | } |
263 | return 0; | 205 | return 0; |
@@ -278,10 +220,14 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev, | |||
278 | s = p_dev->socket; | 220 | s = p_dev->socket; |
279 | c = p_dev->function_config; | 221 | c = p_dev->function_config; |
280 | 222 | ||
281 | if (!(s->state & SOCKET_PRESENT)) | 223 | if (!(s->state & SOCKET_PRESENT)) { |
224 | dev_dbg(&s->dev, "No card present\n"); | ||
282 | return -ENODEV; | 225 | return -ENODEV; |
283 | if (!(c->state & CONFIG_LOCKED)) | 226 | } |
227 | if (!(c->state & CONFIG_LOCKED)) { | ||
228 | dev_dbg(&s->dev, "Configuration isnt't locked\n"); | ||
284 | return -EACCES; | 229 | return -EACCES; |
230 | } | ||
285 | 231 | ||
286 | if (mod->Attributes & CONF_IRQ_CHANGE_VALID) { | 232 | if (mod->Attributes & CONF_IRQ_CHANGE_VALID) { |
287 | if (mod->Attributes & CONF_ENABLE_IRQ) { | 233 | if (mod->Attributes & CONF_ENABLE_IRQ) { |
@@ -295,7 +241,7 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev, | |||
295 | } | 241 | } |
296 | 242 | ||
297 | if (mod->Attributes & CONF_VCC_CHANGE_VALID) { | 243 | if (mod->Attributes & CONF_VCC_CHANGE_VALID) { |
298 | ds_dbg(s, 0, "changing Vcc is not allowed at this time\n"); | 244 | dev_dbg(&s->dev, "changing Vcc is not allowed at this time\n"); |
299 | return -EINVAL; | 245 | return -EINVAL; |
300 | } | 246 | } |
301 | 247 | ||
@@ -303,7 +249,7 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev, | |||
303 | if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) && | 249 | if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) && |
304 | (mod->Attributes & CONF_VPP2_CHANGE_VALID)) { | 250 | (mod->Attributes & CONF_VPP2_CHANGE_VALID)) { |
305 | if (mod->Vpp1 != mod->Vpp2) { | 251 | if (mod->Vpp1 != mod->Vpp2) { |
306 | ds_dbg(s, 0, "Vpp1 and Vpp2 must be the same\n"); | 252 | dev_dbg(&s->dev, "Vpp1 and Vpp2 must be the same\n"); |
307 | return -EINVAL; | 253 | return -EINVAL; |
308 | } | 254 | } |
309 | s->socket.Vpp = mod->Vpp1; | 255 | s->socket.Vpp = mod->Vpp1; |
@@ -314,7 +260,7 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev, | |||
314 | } | 260 | } |
315 | } else if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) || | 261 | } else if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) || |
316 | (mod->Attributes & CONF_VPP2_CHANGE_VALID)) { | 262 | (mod->Attributes & CONF_VPP2_CHANGE_VALID)) { |
317 | ds_dbg(s, 0, "changing Vcc is not allowed at this time\n"); | 263 | dev_dbg(&s->dev, "changing Vcc is not allowed at this time\n"); |
318 | return -EINVAL; | 264 | return -EINVAL; |
319 | } | 265 | } |
320 | 266 | ||
@@ -425,11 +371,11 @@ static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req) | |||
425 | if (c->state & CONFIG_LOCKED) | 371 | if (c->state & CONFIG_LOCKED) |
426 | return -EACCES; | 372 | return -EACCES; |
427 | if (c->irq.Attributes != req->Attributes) { | 373 | if (c->irq.Attributes != req->Attributes) { |
428 | ds_dbg(s, 0, "IRQ attributes must match assigned ones\n"); | 374 | dev_dbg(&s->dev, "IRQ attributes must match assigned ones\n"); |
429 | return -EINVAL; | 375 | return -EINVAL; |
430 | } | 376 | } |
431 | if (s->irq.AssignedIRQ != req->AssignedIRQ) { | 377 | if (s->irq.AssignedIRQ != req->AssignedIRQ) { |
432 | ds_dbg(s, 0, "IRQ must match assigned one\n"); | 378 | dev_dbg(&s->dev, "IRQ must match assigned one\n"); |
433 | return -EINVAL; | 379 | return -EINVAL; |
434 | } | 380 | } |
435 | if (--s->irq.Config == 0) { | 381 | if (--s->irq.Config == 0) { |
@@ -437,8 +383,8 @@ static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req) | |||
437 | s->irq.AssignedIRQ = 0; | 383 | s->irq.AssignedIRQ = 0; |
438 | } | 384 | } |
439 | 385 | ||
440 | if (req->Attributes & IRQ_HANDLE_PRESENT) { | 386 | if (req->Handler) { |
441 | free_irq(req->AssignedIRQ, req->Instance); | 387 | free_irq(req->AssignedIRQ, p_dev->priv); |
442 | } | 388 | } |
443 | 389 | ||
444 | #ifdef CONFIG_PCMCIA_PROBE | 390 | #ifdef CONFIG_PCMCIA_PROBE |
@@ -449,30 +395,34 @@ static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req) | |||
449 | } /* pcmcia_release_irq */ | 395 | } /* pcmcia_release_irq */ |
450 | 396 | ||
451 | 397 | ||
452 | int pcmcia_release_window(window_handle_t win) | 398 | int pcmcia_release_window(struct pcmcia_device *p_dev, window_handle_t wh) |
453 | { | 399 | { |
454 | struct pcmcia_socket *s; | 400 | struct pcmcia_socket *s = p_dev->socket; |
401 | pccard_mem_map *win; | ||
455 | 402 | ||
456 | if ((win == NULL) || (win->magic != WINDOW_MAGIC)) | 403 | wh--; |
404 | if (wh >= MAX_WIN) | ||
457 | return -EINVAL; | 405 | return -EINVAL; |
458 | s = win->sock; | 406 | |
459 | if (!(win->handle->_win & CLIENT_WIN_REQ(win->index))) | 407 | win = &s->win[wh]; |
408 | |||
409 | if (!(p_dev->_win & CLIENT_WIN_REQ(wh))) { | ||
410 | dev_dbg(&s->dev, "not releasing unknown window\n"); | ||
460 | return -EINVAL; | 411 | return -EINVAL; |
412 | } | ||
461 | 413 | ||
462 | /* Shut down memory window */ | 414 | /* Shut down memory window */ |
463 | win->ctl.flags &= ~MAP_ACTIVE; | 415 | win->flags &= ~MAP_ACTIVE; |
464 | s->ops->set_mem_map(s, &win->ctl); | 416 | s->ops->set_mem_map(s, win); |
465 | s->state &= ~SOCKET_WIN_REQ(win->index); | 417 | s->state &= ~SOCKET_WIN_REQ(wh); |
466 | 418 | ||
467 | /* Release system memory */ | 419 | /* Release system memory */ |
468 | if (win->ctl.res) { | 420 | if (win->res) { |
469 | release_resource(win->ctl.res); | 421 | release_resource(win->res); |
470 | kfree(win->ctl.res); | 422 | kfree(win->res); |
471 | win->ctl.res = NULL; | 423 | win->res = NULL; |
472 | } | 424 | } |
473 | win->handle->_win &= ~CLIENT_WIN_REQ(win->index); | 425 | p_dev->_win &= ~CLIENT_WIN_REQ(wh); |
474 | |||
475 | win->magic = 0; | ||
476 | 426 | ||
477 | return 0; | 427 | return 0; |
478 | } /* pcmcia_release_window */ | 428 | } /* pcmcia_release_window */ |
@@ -492,12 +442,14 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, | |||
492 | return -ENODEV; | 442 | return -ENODEV; |
493 | 443 | ||
494 | if (req->IntType & INT_CARDBUS) { | 444 | if (req->IntType & INT_CARDBUS) { |
495 | ds_dbg(p_dev->socket, 0, "IntType may not be INT_CARDBUS\n"); | 445 | dev_dbg(&s->dev, "IntType may not be INT_CARDBUS\n"); |
496 | return -EINVAL; | 446 | return -EINVAL; |
497 | } | 447 | } |
498 | c = p_dev->function_config; | 448 | c = p_dev->function_config; |
499 | if (c->state & CONFIG_LOCKED) | 449 | if (c->state & CONFIG_LOCKED) { |
450 | dev_dbg(&s->dev, "Configuration is locked\n"); | ||
500 | return -EACCES; | 451 | return -EACCES; |
452 | } | ||
501 | 453 | ||
502 | /* Do power control. We don't allow changes in Vcc. */ | 454 | /* Do power control. We don't allow changes in Vcc. */ |
503 | s->socket.Vpp = req->Vpp; | 455 | s->socket.Vpp = req->Vpp; |
@@ -609,40 +561,44 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req) | |||
609 | struct pcmcia_socket *s = p_dev->socket; | 561 | struct pcmcia_socket *s = p_dev->socket; |
610 | config_t *c; | 562 | config_t *c; |
611 | 563 | ||
612 | if (!(s->state & SOCKET_PRESENT)) | 564 | if (!(s->state & SOCKET_PRESENT)) { |
565 | dev_dbg(&s->dev, "No card present\n"); | ||
613 | return -ENODEV; | 566 | return -ENODEV; |
567 | } | ||
614 | 568 | ||
615 | if (!req) | 569 | if (!req) |
616 | return -EINVAL; | 570 | return -EINVAL; |
617 | c = p_dev->function_config; | 571 | c = p_dev->function_config; |
618 | if (c->state & CONFIG_LOCKED) | 572 | if (c->state & CONFIG_LOCKED) { |
573 | dev_dbg(&s->dev, "Configuration is locked\n"); | ||
619 | return -EACCES; | 574 | return -EACCES; |
575 | } | ||
620 | if (c->state & CONFIG_IO_REQ) { | 576 | if (c->state & CONFIG_IO_REQ) { |
621 | ds_dbg(s, 0, "IO already configured\n"); | 577 | dev_dbg(&s->dev, "IO already configured\n"); |
622 | return -EBUSY; | 578 | return -EBUSY; |
623 | } | 579 | } |
624 | if (req->Attributes1 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS)) { | 580 | if (req->Attributes1 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS)) { |
625 | ds_dbg(s, 0, "bad attribute setting for IO region 1\n"); | 581 | dev_dbg(&s->dev, "bad attribute setting for IO region 1\n"); |
626 | return -EINVAL; | 582 | return -EINVAL; |
627 | } | 583 | } |
628 | if ((req->NumPorts2 > 0) && | 584 | if ((req->NumPorts2 > 0) && |
629 | (req->Attributes2 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS))) { | 585 | (req->Attributes2 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS))) { |
630 | ds_dbg(s, 0, "bad attribute setting for IO region 2\n"); | 586 | dev_dbg(&s->dev, "bad attribute setting for IO region 2\n"); |
631 | return -EINVAL; | 587 | return -EINVAL; |
632 | } | 588 | } |
633 | 589 | ||
634 | ds_dbg(s, 1, "trying to allocate resource 1\n"); | 590 | dev_dbg(&s->dev, "trying to allocate resource 1\n"); |
635 | if (alloc_io_space(s, req->Attributes1, &req->BasePort1, | 591 | if (alloc_io_space(s, req->Attributes1, &req->BasePort1, |
636 | req->NumPorts1, req->IOAddrLines)) { | 592 | req->NumPorts1, req->IOAddrLines)) { |
637 | ds_dbg(s, 0, "allocation of resource 1 failed\n"); | 593 | dev_dbg(&s->dev, "allocation of resource 1 failed\n"); |
638 | return -EBUSY; | 594 | return -EBUSY; |
639 | } | 595 | } |
640 | 596 | ||
641 | if (req->NumPorts2) { | 597 | if (req->NumPorts2) { |
642 | ds_dbg(s, 1, "trying to allocate resource 2\n"); | 598 | dev_dbg(&s->dev, "trying to allocate resource 2\n"); |
643 | if (alloc_io_space(s, req->Attributes2, &req->BasePort2, | 599 | if (alloc_io_space(s, req->Attributes2, &req->BasePort2, |
644 | req->NumPorts2, req->IOAddrLines)) { | 600 | req->NumPorts2, req->IOAddrLines)) { |
645 | ds_dbg(s, 0, "allocation of resource 2 failed\n"); | 601 | dev_dbg(&s->dev, "allocation of resource 2 failed\n"); |
646 | release_io_space(s, req->BasePort1, req->NumPorts1); | 602 | release_io_space(s, req->BasePort1, req->NumPorts1); |
647 | return -EBUSY; | 603 | return -EBUSY; |
648 | } | 604 | } |
@@ -680,13 +636,17 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) | |||
680 | int ret = -EINVAL, irq = 0; | 636 | int ret = -EINVAL, irq = 0; |
681 | int type; | 637 | int type; |
682 | 638 | ||
683 | if (!(s->state & SOCKET_PRESENT)) | 639 | if (!(s->state & SOCKET_PRESENT)) { |
640 | dev_dbg(&s->dev, "No card present\n"); | ||
684 | return -ENODEV; | 641 | return -ENODEV; |
642 | } | ||
685 | c = p_dev->function_config; | 643 | c = p_dev->function_config; |
686 | if (c->state & CONFIG_LOCKED) | 644 | if (c->state & CONFIG_LOCKED) { |
645 | dev_dbg(&s->dev, "Configuration is locked\n"); | ||
687 | return -EACCES; | 646 | return -EACCES; |
647 | } | ||
688 | if (c->state & CONFIG_IRQ_REQ) { | 648 | if (c->state & CONFIG_IRQ_REQ) { |
689 | ds_dbg(s, 0, "IRQ already configured\n"); | 649 | dev_dbg(&s->dev, "IRQ already configured\n"); |
690 | return -EBUSY; | 650 | return -EBUSY; |
691 | } | 651 | } |
692 | 652 | ||
@@ -704,7 +664,7 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) | |||
704 | /* if the underlying IRQ infrastructure allows for it, only allocate | 664 | /* if the underlying IRQ infrastructure allows for it, only allocate |
705 | * the IRQ, but do not enable it | 665 | * the IRQ, but do not enable it |
706 | */ | 666 | */ |
707 | if (!(req->Attributes & IRQ_HANDLE_PRESENT)) | 667 | if (!(req->Handler)) |
708 | type |= IRQ_NOAUTOEN; | 668 | type |= IRQ_NOAUTOEN; |
709 | #endif /* IRQ_NOAUTOEN */ | 669 | #endif /* IRQ_NOAUTOEN */ |
710 | 670 | ||
@@ -714,7 +674,7 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) | |||
714 | } else { | 674 | } else { |
715 | int try; | 675 | int try; |
716 | u32 mask = s->irq_mask; | 676 | u32 mask = s->irq_mask; |
717 | void *data = &p_dev->dev.driver; /* something unique to this device */ | 677 | void *data = p_dev; /* something unique to this device */ |
718 | 678 | ||
719 | for (try = 0; try < 64; try++) { | 679 | for (try = 0; try < 64; try++) { |
720 | irq = try % 32; | 680 | irq = try % 32; |
@@ -731,12 +691,12 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) | |||
731 | * registering a dummy handle works, i.e. if the IRQ isn't | 691 | * registering a dummy handle works, i.e. if the IRQ isn't |
732 | * marked as used by the kernel resource management core */ | 692 | * marked as used by the kernel resource management core */ |
733 | ret = request_irq(irq, | 693 | ret = request_irq(irq, |
734 | (req->Attributes & IRQ_HANDLE_PRESENT) ? req->Handler : test_action, | 694 | (req->Handler) ? req->Handler : test_action, |
735 | type, | 695 | type, |
736 | p_dev->devname, | 696 | p_dev->devname, |
737 | (req->Attributes & IRQ_HANDLE_PRESENT) ? req->Instance : data); | 697 | (req->Handler) ? p_dev->priv : data); |
738 | if (!ret) { | 698 | if (!ret) { |
739 | if (!(req->Attributes & IRQ_HANDLE_PRESENT)) | 699 | if (!req->Handler) |
740 | free_irq(irq, data); | 700 | free_irq(irq, data); |
741 | break; | 701 | break; |
742 | } | 702 | } |
@@ -745,17 +705,22 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) | |||
745 | #endif | 705 | #endif |
746 | /* only assign PCI irq if no IRQ already assigned */ | 706 | /* only assign PCI irq if no IRQ already assigned */ |
747 | if (ret && !s->irq.AssignedIRQ) { | 707 | if (ret && !s->irq.AssignedIRQ) { |
748 | if (!s->pci_irq) | 708 | if (!s->pci_irq) { |
709 | dev_printk(KERN_INFO, &s->dev, "no IRQ found\n"); | ||
749 | return ret; | 710 | return ret; |
711 | } | ||
750 | type = IRQF_SHARED; | 712 | type = IRQF_SHARED; |
751 | irq = s->pci_irq; | 713 | irq = s->pci_irq; |
752 | } | 714 | } |
753 | 715 | ||
754 | if (ret && (req->Attributes & IRQ_HANDLE_PRESENT)) { | 716 | if (ret && req->Handler) { |
755 | ret = request_irq(irq, req->Handler, type, | 717 | ret = request_irq(irq, req->Handler, type, |
756 | p_dev->devname, req->Instance); | 718 | p_dev->devname, p_dev->priv); |
757 | if (ret) | 719 | if (ret) { |
720 | dev_printk(KERN_INFO, &s->dev, | ||
721 | "request_irq() failed\n"); | ||
758 | return ret; | 722 | return ret; |
723 | } | ||
759 | } | 724 | } |
760 | 725 | ||
761 | /* Make sure the fact the request type was overridden is passed back */ | 726 | /* Make sure the fact the request type was overridden is passed back */ |
@@ -787,17 +752,19 @@ EXPORT_SYMBOL(pcmcia_request_irq); | |||
787 | * Request_window() establishes a mapping between card memory space | 752 | * Request_window() establishes a mapping between card memory space |
788 | * and system memory space. | 753 | * and system memory space. |
789 | */ | 754 | */ |
790 | int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_handle_t *wh) | 755 | int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_handle_t *wh) |
791 | { | 756 | { |
792 | struct pcmcia_socket *s = (*p_dev)->socket; | 757 | struct pcmcia_socket *s = p_dev->socket; |
793 | window_t *win; | 758 | pccard_mem_map *win; |
794 | u_long align; | 759 | u_long align; |
795 | int w; | 760 | int w; |
796 | 761 | ||
797 | if (!(s->state & SOCKET_PRESENT)) | 762 | if (!(s->state & SOCKET_PRESENT)) { |
763 | dev_dbg(&s->dev, "No card present\n"); | ||
798 | return -ENODEV; | 764 | return -ENODEV; |
765 | } | ||
799 | if (req->Attributes & (WIN_PAGED | WIN_SHARED)) { | 766 | if (req->Attributes & (WIN_PAGED | WIN_SHARED)) { |
800 | ds_dbg(s, 0, "bad attribute setting for iomem region\n"); | 767 | dev_dbg(&s->dev, "bad attribute setting for iomem region\n"); |
801 | return -EINVAL; | 768 | return -EINVAL; |
802 | } | 769 | } |
803 | 770 | ||
@@ -808,12 +775,12 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h | |||
808 | (req->Attributes & WIN_STRICT_ALIGN)) ? | 775 | (req->Attributes & WIN_STRICT_ALIGN)) ? |
809 | req->Size : s->map_size); | 776 | req->Size : s->map_size); |
810 | if (req->Size & (s->map_size-1)) { | 777 | if (req->Size & (s->map_size-1)) { |
811 | ds_dbg(s, 0, "invalid map size\n"); | 778 | dev_dbg(&s->dev, "invalid map size\n"); |
812 | return -EINVAL; | 779 | return -EINVAL; |
813 | } | 780 | } |
814 | if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) || | 781 | if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) || |
815 | (req->Base & (align-1))) { | 782 | (req->Base & (align-1))) { |
816 | ds_dbg(s, 0, "invalid base address\n"); | 783 | dev_dbg(&s->dev, "invalid base address\n"); |
817 | return -EINVAL; | 784 | return -EINVAL; |
818 | } | 785 | } |
819 | if (req->Base) | 786 | if (req->Base) |
@@ -823,52 +790,48 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h | |||
823 | for (w = 0; w < MAX_WIN; w++) | 790 | for (w = 0; w < MAX_WIN; w++) |
824 | if (!(s->state & SOCKET_WIN_REQ(w))) break; | 791 | if (!(s->state & SOCKET_WIN_REQ(w))) break; |
825 | if (w == MAX_WIN) { | 792 | if (w == MAX_WIN) { |
826 | ds_dbg(s, 0, "all windows are used already\n"); | 793 | dev_dbg(&s->dev, "all windows are used already\n"); |
827 | return -EINVAL; | 794 | return -EINVAL; |
828 | } | 795 | } |
829 | 796 | ||
830 | win = &s->win[w]; | 797 | win = &s->win[w]; |
831 | win->magic = WINDOW_MAGIC; | ||
832 | win->index = w; | ||
833 | win->handle = *p_dev; | ||
834 | win->sock = s; | ||
835 | 798 | ||
836 | if (!(s->features & SS_CAP_STATIC_MAP)) { | 799 | if (!(s->features & SS_CAP_STATIC_MAP)) { |
837 | win->ctl.res = pcmcia_find_mem_region(req->Base, req->Size, align, | 800 | win->res = pcmcia_find_mem_region(req->Base, req->Size, align, |
838 | (req->Attributes & WIN_MAP_BELOW_1MB), s); | 801 | (req->Attributes & WIN_MAP_BELOW_1MB), s); |
839 | if (!win->ctl.res) { | 802 | if (!win->res) { |
840 | ds_dbg(s, 0, "allocating mem region failed\n"); | 803 | dev_dbg(&s->dev, "allocating mem region failed\n"); |
841 | return -EINVAL; | 804 | return -EINVAL; |
842 | } | 805 | } |
843 | } | 806 | } |
844 | (*p_dev)->_win |= CLIENT_WIN_REQ(w); | 807 | p_dev->_win |= CLIENT_WIN_REQ(w); |
845 | 808 | ||
846 | /* Configure the socket controller */ | 809 | /* Configure the socket controller */ |
847 | win->ctl.map = w+1; | 810 | win->map = w+1; |
848 | win->ctl.flags = 0; | 811 | win->flags = 0; |
849 | win->ctl.speed = req->AccessSpeed; | 812 | win->speed = req->AccessSpeed; |
850 | if (req->Attributes & WIN_MEMORY_TYPE) | 813 | if (req->Attributes & WIN_MEMORY_TYPE) |
851 | win->ctl.flags |= MAP_ATTRIB; | 814 | win->flags |= MAP_ATTRIB; |
852 | if (req->Attributes & WIN_ENABLE) | 815 | if (req->Attributes & WIN_ENABLE) |
853 | win->ctl.flags |= MAP_ACTIVE; | 816 | win->flags |= MAP_ACTIVE; |
854 | if (req->Attributes & WIN_DATA_WIDTH_16) | 817 | if (req->Attributes & WIN_DATA_WIDTH_16) |
855 | win->ctl.flags |= MAP_16BIT; | 818 | win->flags |= MAP_16BIT; |
856 | if (req->Attributes & WIN_USE_WAIT) | 819 | if (req->Attributes & WIN_USE_WAIT) |
857 | win->ctl.flags |= MAP_USE_WAIT; | 820 | win->flags |= MAP_USE_WAIT; |
858 | win->ctl.card_start = 0; | 821 | win->card_start = 0; |
859 | if (s->ops->set_mem_map(s, &win->ctl) != 0) { | 822 | if (s->ops->set_mem_map(s, win) != 0) { |
860 | ds_dbg(s, 0, "failed to set memory mapping\n"); | 823 | dev_dbg(&s->dev, "failed to set memory mapping\n"); |
861 | return -EIO; | 824 | return -EIO; |
862 | } | 825 | } |
863 | s->state |= SOCKET_WIN_REQ(w); | 826 | s->state |= SOCKET_WIN_REQ(w); |
864 | 827 | ||
865 | /* Return window handle */ | 828 | /* Return window handle */ |
866 | if (s->features & SS_CAP_STATIC_MAP) { | 829 | if (s->features & SS_CAP_STATIC_MAP) { |
867 | req->Base = win->ctl.static_start; | 830 | req->Base = win->static_start; |
868 | } else { | 831 | } else { |
869 | req->Base = win->ctl.res->start; | 832 | req->Base = win->res->start; |
870 | } | 833 | } |
871 | *wh = win; | 834 | *wh = w + 1; |
872 | 835 | ||
873 | return 0; | 836 | return 0; |
874 | } /* pcmcia_request_window */ | 837 | } /* pcmcia_request_window */ |
@@ -879,19 +842,46 @@ void pcmcia_disable_device(struct pcmcia_device *p_dev) { | |||
879 | pcmcia_release_io(p_dev, &p_dev->io); | 842 | pcmcia_release_io(p_dev, &p_dev->io); |
880 | pcmcia_release_irq(p_dev, &p_dev->irq); | 843 | pcmcia_release_irq(p_dev, &p_dev->irq); |
881 | if (p_dev->win) | 844 | if (p_dev->win) |
882 | pcmcia_release_window(p_dev->win); | 845 | pcmcia_release_window(p_dev, p_dev->win); |
883 | } | 846 | } |
884 | EXPORT_SYMBOL(pcmcia_disable_device); | 847 | EXPORT_SYMBOL(pcmcia_disable_device); |
885 | 848 | ||
886 | 849 | ||
887 | struct pcmcia_cfg_mem { | 850 | struct pcmcia_cfg_mem { |
888 | tuple_t tuple; | 851 | struct pcmcia_device *p_dev; |
852 | void *priv_data; | ||
853 | int (*conf_check) (struct pcmcia_device *p_dev, | ||
854 | cistpl_cftable_entry_t *cfg, | ||
855 | cistpl_cftable_entry_t *dflt, | ||
856 | unsigned int vcc, | ||
857 | void *priv_data); | ||
889 | cisparse_t parse; | 858 | cisparse_t parse; |
890 | u8 buf[256]; | ||
891 | cistpl_cftable_entry_t dflt; | 859 | cistpl_cftable_entry_t dflt; |
892 | }; | 860 | }; |
893 | 861 | ||
894 | /** | 862 | /** |
863 | * pcmcia_do_loop_config() - internal helper for pcmcia_loop_config() | ||
864 | * | ||
865 | * pcmcia_do_loop_config() is the internal callback for the call from | ||
866 | * pcmcia_loop_config() to pccard_loop_tuple(). Data is transferred | ||
867 | * by a struct pcmcia_cfg_mem. | ||
868 | */ | ||
869 | static int pcmcia_do_loop_config(tuple_t *tuple, cisparse_t *parse, void *priv) | ||
870 | { | ||
871 | cistpl_cftable_entry_t *cfg = &parse->cftable_entry; | ||
872 | struct pcmcia_cfg_mem *cfg_mem = priv; | ||
873 | |||
874 | /* default values */ | ||
875 | cfg_mem->p_dev->conf.ConfigIndex = cfg->index; | ||
876 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | ||
877 | cfg_mem->dflt = *cfg; | ||
878 | |||
879 | return cfg_mem->conf_check(cfg_mem->p_dev, cfg, &cfg_mem->dflt, | ||
880 | cfg_mem->p_dev->socket->socket.Vcc, | ||
881 | cfg_mem->priv_data); | ||
882 | } | ||
883 | |||
884 | /** | ||
895 | * pcmcia_loop_config() - loop over configuration options | 885 | * pcmcia_loop_config() - loop over configuration options |
896 | * @p_dev: the struct pcmcia_device which we need to loop for. | 886 | * @p_dev: the struct pcmcia_device which we need to loop for. |
897 | * @conf_check: function to call for each configuration option. | 887 | * @conf_check: function to call for each configuration option. |
@@ -913,48 +903,174 @@ int pcmcia_loop_config(struct pcmcia_device *p_dev, | |||
913 | void *priv_data) | 903 | void *priv_data) |
914 | { | 904 | { |
915 | struct pcmcia_cfg_mem *cfg_mem; | 905 | struct pcmcia_cfg_mem *cfg_mem; |
916 | |||
917 | tuple_t *tuple; | ||
918 | int ret; | 906 | int ret; |
919 | unsigned int vcc; | ||
920 | 907 | ||
921 | cfg_mem = kzalloc(sizeof(struct pcmcia_cfg_mem), GFP_KERNEL); | 908 | cfg_mem = kzalloc(sizeof(struct pcmcia_cfg_mem), GFP_KERNEL); |
922 | if (cfg_mem == NULL) | 909 | if (cfg_mem == NULL) |
923 | return -ENOMEM; | 910 | return -ENOMEM; |
924 | 911 | ||
925 | /* get the current Vcc setting */ | 912 | cfg_mem->p_dev = p_dev; |
926 | vcc = p_dev->socket->socket.Vcc; | 913 | cfg_mem->conf_check = conf_check; |
914 | cfg_mem->priv_data = priv_data; | ||
927 | 915 | ||
928 | tuple = &cfg_mem->tuple; | 916 | ret = pccard_loop_tuple(p_dev->socket, p_dev->func, |
929 | tuple->TupleData = cfg_mem->buf; | 917 | CISTPL_CFTABLE_ENTRY, &cfg_mem->parse, |
930 | tuple->TupleDataMax = 255; | 918 | cfg_mem, pcmcia_do_loop_config); |
931 | tuple->TupleOffset = 0; | ||
932 | tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
933 | tuple->Attributes = 0; | ||
934 | 919 | ||
935 | ret = pcmcia_get_first_tuple(p_dev, tuple); | 920 | kfree(cfg_mem); |
936 | while (!ret) { | 921 | return ret; |
937 | cistpl_cftable_entry_t *cfg = &cfg_mem->parse.cftable_entry; | 922 | } |
923 | EXPORT_SYMBOL(pcmcia_loop_config); | ||
924 | |||
925 | |||
926 | struct pcmcia_loop_mem { | ||
927 | struct pcmcia_device *p_dev; | ||
928 | void *priv_data; | ||
929 | int (*loop_tuple) (struct pcmcia_device *p_dev, | ||
930 | tuple_t *tuple, | ||
931 | void *priv_data); | ||
932 | }; | ||
933 | |||
934 | /** | ||
935 | * pcmcia_do_loop_tuple() - internal helper for pcmcia_loop_config() | ||
936 | * | ||
937 | * pcmcia_do_loop_tuple() is the internal callback for the call from | ||
938 | * pcmcia_loop_tuple() to pccard_loop_tuple(). Data is transferred | ||
939 | * by a struct pcmcia_cfg_mem. | ||
940 | */ | ||
941 | static int pcmcia_do_loop_tuple(tuple_t *tuple, cisparse_t *parse, void *priv) | ||
942 | { | ||
943 | struct pcmcia_loop_mem *loop = priv; | ||
944 | |||
945 | return loop->loop_tuple(loop->p_dev, tuple, loop->priv_data); | ||
946 | }; | ||
947 | |||
948 | /** | ||
949 | * pcmcia_loop_tuple() - loop over tuples in the CIS | ||
950 | * @p_dev: the struct pcmcia_device which we need to loop for. | ||
951 | * @code: which CIS code shall we look for? | ||
952 | * @priv_data: private data to be passed to the loop_tuple function. | ||
953 | * @loop_tuple: function to call for each CIS entry of type @function. IT | ||
954 | * gets passed the raw tuple and @priv_data. | ||
955 | * | ||
956 | * pcmcia_loop_tuple() loops over all CIS entries of type @function, and | ||
957 | * calls the @loop_tuple function for each entry. If the call to @loop_tuple | ||
958 | * returns 0, the loop exits. Returns 0 on success or errorcode otherwise. | ||
959 | */ | ||
960 | int pcmcia_loop_tuple(struct pcmcia_device *p_dev, cisdata_t code, | ||
961 | int (*loop_tuple) (struct pcmcia_device *p_dev, | ||
962 | tuple_t *tuple, | ||
963 | void *priv_data), | ||
964 | void *priv_data) | ||
965 | { | ||
966 | struct pcmcia_loop_mem loop = { | ||
967 | .p_dev = p_dev, | ||
968 | .loop_tuple = loop_tuple, | ||
969 | .priv_data = priv_data}; | ||
938 | 970 | ||
939 | if (pcmcia_get_tuple_data(p_dev, tuple)) | 971 | return pccard_loop_tuple(p_dev->socket, p_dev->func, code, NULL, |
940 | goto next_entry; | 972 | &loop, pcmcia_do_loop_tuple); |
973 | }; | ||
974 | EXPORT_SYMBOL(pcmcia_loop_tuple); | ||
941 | 975 | ||
942 | if (pcmcia_parse_tuple(tuple, &cfg_mem->parse)) | ||
943 | goto next_entry; | ||
944 | 976 | ||
945 | /* default values */ | 977 | struct pcmcia_loop_get { |
946 | p_dev->conf.ConfigIndex = cfg->index; | 978 | size_t len; |
947 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | 979 | cisdata_t **buf; |
948 | cfg_mem->dflt = *cfg; | 980 | }; |
949 | 981 | ||
950 | ret = conf_check(p_dev, cfg, &cfg_mem->dflt, vcc, priv_data); | 982 | /** |
951 | if (!ret) | 983 | * pcmcia_do_get_tuple() - internal helper for pcmcia_get_tuple() |
952 | break; | 984 | * |
985 | * pcmcia_do_get_tuple() is the internal callback for the call from | ||
986 | * pcmcia_get_tuple() to pcmcia_loop_tuple(). As we're only interested in | ||
987 | * the first tuple, return 0 unconditionally. Create a memory buffer large | ||
988 | * enough to hold the content of the tuple, and fill it with the tuple data. | ||
989 | * The caller is responsible to free the buffer. | ||
990 | */ | ||
991 | static int pcmcia_do_get_tuple(struct pcmcia_device *p_dev, tuple_t *tuple, | ||
992 | void *priv) | ||
993 | { | ||
994 | struct pcmcia_loop_get *get = priv; | ||
995 | |||
996 | *get->buf = kzalloc(tuple->TupleDataLen, GFP_KERNEL); | ||
997 | if (*get->buf) { | ||
998 | get->len = tuple->TupleDataLen; | ||
999 | memcpy(*get->buf, tuple->TupleData, tuple->TupleDataLen); | ||
1000 | } else | ||
1001 | dev_dbg(&p_dev->dev, "do_get_tuple: out of memory\n"); | ||
1002 | return 0; | ||
1003 | }; | ||
953 | 1004 | ||
954 | next_entry: | 1005 | /** |
955 | ret = pcmcia_get_next_tuple(p_dev, tuple); | 1006 | * pcmcia_get_tuple() - get first tuple from CIS |
1007 | * @p_dev: the struct pcmcia_device which we need to loop for. | ||
1008 | * @code: which CIS code shall we look for? | ||
1009 | * @buf: pointer to store the buffer to. | ||
1010 | * | ||
1011 | * pcmcia_get_tuple() gets the content of the first CIS entry of type @code. | ||
1012 | * It returns the buffer length (or zero). The caller is responsible to free | ||
1013 | * the buffer passed in @buf. | ||
1014 | */ | ||
1015 | size_t pcmcia_get_tuple(struct pcmcia_device *p_dev, cisdata_t code, | ||
1016 | unsigned char **buf) | ||
1017 | { | ||
1018 | struct pcmcia_loop_get get = { | ||
1019 | .len = 0, | ||
1020 | .buf = buf, | ||
1021 | }; | ||
1022 | |||
1023 | *get.buf = NULL; | ||
1024 | pcmcia_loop_tuple(p_dev, code, pcmcia_do_get_tuple, &get); | ||
1025 | |||
1026 | return get.len; | ||
1027 | }; | ||
1028 | EXPORT_SYMBOL(pcmcia_get_tuple); | ||
1029 | |||
1030 | |||
1031 | /** | ||
1032 | * pcmcia_do_get_mac() - internal helper for pcmcia_get_mac_from_cis() | ||
1033 | * | ||
1034 | * pcmcia_do_get_mac() is the internal callback for the call from | ||
1035 | * pcmcia_get_mac_from_cis() to pcmcia_loop_tuple(). We check whether the | ||
1036 | * tuple contains a proper LAN_NODE_ID of length 6, and copy the data | ||
1037 | * to struct net_device->dev_addr[i]. | ||
1038 | */ | ||
1039 | static int pcmcia_do_get_mac(struct pcmcia_device *p_dev, tuple_t *tuple, | ||
1040 | void *priv) | ||
1041 | { | ||
1042 | struct net_device *dev = priv; | ||
1043 | int i; | ||
1044 | |||
1045 | if (tuple->TupleData[0] != CISTPL_FUNCE_LAN_NODE_ID) | ||
1046 | return -EINVAL; | ||
1047 | if (tuple->TupleDataLen < ETH_ALEN + 2) { | ||
1048 | dev_warn(&p_dev->dev, "Invalid CIS tuple length for " | ||
1049 | "LAN_NODE_ID\n"); | ||
1050 | return -EINVAL; | ||
956 | } | 1051 | } |
957 | 1052 | ||
958 | return ret; | 1053 | if (tuple->TupleData[1] != ETH_ALEN) { |
959 | } | 1054 | dev_warn(&p_dev->dev, "Invalid header for LAN_NODE_ID\n"); |
960 | EXPORT_SYMBOL(pcmcia_loop_config); | 1055 | return -EINVAL; |
1056 | } | ||
1057 | for (i = 0; i < 6; i++) | ||
1058 | dev->dev_addr[i] = tuple->TupleData[i+2]; | ||
1059 | return 0; | ||
1060 | }; | ||
1061 | |||
1062 | /** | ||
1063 | * pcmcia_get_mac_from_cis() - read out MAC address from CISTPL_FUNCE | ||
1064 | * @p_dev: the struct pcmcia_device for which we want the address. | ||
1065 | * @dev: a properly prepared struct net_device to store the info to. | ||
1066 | * | ||
1067 | * pcmcia_get_mac_from_cis() reads out the hardware MAC address from | ||
1068 | * CISTPL_FUNCE and stores it into struct net_device *dev->dev_addr which | ||
1069 | * must be set up properly by the driver (see examples!). | ||
1070 | */ | ||
1071 | int pcmcia_get_mac_from_cis(struct pcmcia_device *p_dev, struct net_device *dev) | ||
1072 | { | ||
1073 | return pcmcia_loop_tuple(p_dev, CISTPL_FUNCE, pcmcia_do_get_mac, dev); | ||
1074 | }; | ||
1075 | EXPORT_SYMBOL(pcmcia_get_mac_from_cis); | ||
1076 | |||
diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c index 70a33468bcd0..e1741cd875aa 100644 --- a/drivers/pcmcia/pd6729.c +++ b/drivers/pcmcia/pd6729.c | |||
@@ -213,7 +213,8 @@ static irqreturn_t pd6729_interrupt(int irq, void *dev) | |||
213 | 213 | ||
214 | if (csc & I365_CSC_DETECT) { | 214 | if (csc & I365_CSC_DETECT) { |
215 | events |= SS_DETECT; | 215 | events |= SS_DETECT; |
216 | dprintk("Card detected in socket %i!\n", i); | 216 | dev_vdbg(&socket[i].socket.dev, |
217 | "Card detected in socket %i!\n", i); | ||
217 | } | 218 | } |
218 | 219 | ||
219 | if (indirect_read(&socket[i], I365_INTCTL) | 220 | if (indirect_read(&socket[i], I365_INTCTL) |
@@ -331,11 +332,11 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state) | |||
331 | reg = I365_PWR_NORESET; /* default: disable resetdrv on resume */ | 332 | reg = I365_PWR_NORESET; /* default: disable resetdrv on resume */ |
332 | 333 | ||
333 | if (state->flags & SS_PWR_AUTO) { | 334 | if (state->flags & SS_PWR_AUTO) { |
334 | dprintk("Auto power\n"); | 335 | dev_dbg(&sock->dev, "Auto power\n"); |
335 | reg |= I365_PWR_AUTO; /* automatic power mngmnt */ | 336 | reg |= I365_PWR_AUTO; /* automatic power mngmnt */ |
336 | } | 337 | } |
337 | if (state->flags & SS_OUTPUT_ENA) { | 338 | if (state->flags & SS_OUTPUT_ENA) { |
338 | dprintk("Power Enabled\n"); | 339 | dev_dbg(&sock->dev, "Power Enabled\n"); |
339 | reg |= I365_PWR_OUT; /* enable power */ | 340 | reg |= I365_PWR_OUT; /* enable power */ |
340 | } | 341 | } |
341 | 342 | ||
@@ -343,40 +344,44 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state) | |||
343 | case 0: | 344 | case 0: |
344 | break; | 345 | break; |
345 | case 33: | 346 | case 33: |
346 | dprintk("setting voltage to Vcc to 3.3V on socket %i\n", | 347 | dev_dbg(&sock->dev, |
348 | "setting voltage to Vcc to 3.3V on socket %i\n", | ||
347 | socket->number); | 349 | socket->number); |
348 | reg |= I365_VCC_5V; | 350 | reg |= I365_VCC_5V; |
349 | indirect_setbit(socket, PD67_MISC_CTL_1, PD67_MC1_VCC_3V); | 351 | indirect_setbit(socket, PD67_MISC_CTL_1, PD67_MC1_VCC_3V); |
350 | break; | 352 | break; |
351 | case 50: | 353 | case 50: |
352 | dprintk("setting voltage to Vcc to 5V on socket %i\n", | 354 | dev_dbg(&sock->dev, |
355 | "setting voltage to Vcc to 5V on socket %i\n", | ||
353 | socket->number); | 356 | socket->number); |
354 | reg |= I365_VCC_5V; | 357 | reg |= I365_VCC_5V; |
355 | indirect_resetbit(socket, PD67_MISC_CTL_1, PD67_MC1_VCC_3V); | 358 | indirect_resetbit(socket, PD67_MISC_CTL_1, PD67_MC1_VCC_3V); |
356 | break; | 359 | break; |
357 | default: | 360 | default: |
358 | dprintk("pd6729: pd6729_set_socket called with " | 361 | dev_dbg(&sock->dev, |
359 | "invalid VCC power value: %i\n", | 362 | "pd6729_set_socket called with invalid VCC power " |
360 | state->Vcc); | 363 | "value: %i\n", state->Vcc); |
361 | return -EINVAL; | 364 | return -EINVAL; |
362 | } | 365 | } |
363 | 366 | ||
364 | switch (state->Vpp) { | 367 | switch (state->Vpp) { |
365 | case 0: | 368 | case 0: |
366 | dprintk("not setting Vpp on socket %i\n", socket->number); | 369 | dev_dbg(&sock->dev, "not setting Vpp on socket %i\n", |
370 | socket->number); | ||
367 | break; | 371 | break; |
368 | case 33: | 372 | case 33: |
369 | case 50: | 373 | case 50: |
370 | dprintk("setting Vpp to Vcc for socket %i\n", socket->number); | 374 | dev_dbg(&sock->dev, "setting Vpp to Vcc for socket %i\n", |
375 | socket->number); | ||
371 | reg |= I365_VPP1_5V; | 376 | reg |= I365_VPP1_5V; |
372 | break; | 377 | break; |
373 | case 120: | 378 | case 120: |
374 | dprintk("setting Vpp to 12.0\n"); | 379 | dev_dbg(&sock->dev, "setting Vpp to 12.0\n"); |
375 | reg |= I365_VPP1_12V; | 380 | reg |= I365_VPP1_12V; |
376 | break; | 381 | break; |
377 | default: | 382 | default: |
378 | dprintk("pd6729: pd6729_set_socket called with invalid VPP power value: %i\n", | 383 | dev_dbg(&sock->dev, "pd6729: pd6729_set_socket called with " |
379 | state->Vpp); | 384 | "invalid VPP power value: %i\n", state->Vpp); |
380 | return -EINVAL; | 385 | return -EINVAL; |
381 | } | 386 | } |
382 | 387 | ||
@@ -438,7 +443,7 @@ static int pd6729_set_io_map(struct pcmcia_socket *sock, | |||
438 | 443 | ||
439 | /* Check error conditions */ | 444 | /* Check error conditions */ |
440 | if (map > 1) { | 445 | if (map > 1) { |
441 | dprintk("pd6729_set_io_map with invalid map"); | 446 | dev_dbg(&sock->dev, "pd6729_set_io_map with invalid map\n"); |
442 | return -EINVAL; | 447 | return -EINVAL; |
443 | } | 448 | } |
444 | 449 | ||
@@ -446,7 +451,7 @@ static int pd6729_set_io_map(struct pcmcia_socket *sock, | |||
446 | if (indirect_read(socket, I365_ADDRWIN) & I365_ENA_IO(map)) | 451 | if (indirect_read(socket, I365_ADDRWIN) & I365_ENA_IO(map)) |
447 | indirect_resetbit(socket, I365_ADDRWIN, I365_ENA_IO(map)); | 452 | indirect_resetbit(socket, I365_ADDRWIN, I365_ENA_IO(map)); |
448 | 453 | ||
449 | /* dprintk("set_io_map: Setting range to %x - %x\n", | 454 | /* dev_dbg(&sock->dev, "set_io_map: Setting range to %x - %x\n", |
450 | io->start, io->stop);*/ | 455 | io->start, io->stop);*/ |
451 | 456 | ||
452 | /* write the new values */ | 457 | /* write the new values */ |
@@ -478,12 +483,12 @@ static int pd6729_set_mem_map(struct pcmcia_socket *sock, | |||
478 | 483 | ||
479 | map = mem->map; | 484 | map = mem->map; |
480 | if (map > 4) { | 485 | if (map > 4) { |
481 | printk("pd6729_set_mem_map: invalid map"); | 486 | dev_warn(&sock->dev, "invalid map requested\n"); |
482 | return -EINVAL; | 487 | return -EINVAL; |
483 | } | 488 | } |
484 | 489 | ||
485 | if ((mem->res->start > mem->res->end) || (mem->speed > 1000)) { | 490 | if ((mem->res->start > mem->res->end) || (mem->speed > 1000)) { |
486 | printk("pd6729_set_mem_map: invalid address / speed"); | 491 | dev_warn(&sock->dev, "invalid invalid address / speed\n"); |
487 | return -EINVAL; | 492 | return -EINVAL; |
488 | } | 493 | } |
489 | 494 | ||
@@ -529,12 +534,12 @@ static int pd6729_set_mem_map(struct pcmcia_socket *sock, | |||
529 | if (mem->flags & MAP_WRPROT) | 534 | if (mem->flags & MAP_WRPROT) |
530 | i |= I365_MEM_WRPROT; | 535 | i |= I365_MEM_WRPROT; |
531 | if (mem->flags & MAP_ATTRIB) { | 536 | if (mem->flags & MAP_ATTRIB) { |
532 | /* dprintk("requesting attribute memory for socket %i\n", | 537 | /* dev_dbg(&sock->dev, "requesting attribute memory for " |
533 | socket->number);*/ | 538 | "socket %i\n", socket->number);*/ |
534 | i |= I365_MEM_REG; | 539 | i |= I365_MEM_REG; |
535 | } else { | 540 | } else { |
536 | /* dprintk("requesting normal memory for socket %i\n", | 541 | /* dev_dbg(&sock->dev, "requesting normal memory for " |
537 | socket->number);*/ | 542 | "socket %i\n", socket->number);*/ |
538 | } | 543 | } |
539 | indirect_write16(socket, base + I365_W_OFF, i); | 544 | indirect_write16(socket, base + I365_W_OFF, i); |
540 | 545 | ||
@@ -577,7 +582,7 @@ static struct pccard_operations pd6729_operations = { | |||
577 | 582 | ||
578 | static irqreturn_t pd6729_test(int irq, void *dev) | 583 | static irqreturn_t pd6729_test(int irq, void *dev) |
579 | { | 584 | { |
580 | dprintk("-> hit on irq %d\n", irq); | 585 | pr_devel("-> hit on irq %d\n", irq); |
581 | return IRQ_HANDLED; | 586 | return IRQ_HANDLED; |
582 | } | 587 | } |
583 | 588 | ||
@@ -642,13 +647,13 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, | |||
642 | goto err_out_free_mem; | 647 | goto err_out_free_mem; |
643 | 648 | ||
644 | if (!pci_resource_start(dev, 0)) { | 649 | if (!pci_resource_start(dev, 0)) { |
645 | printk(KERN_INFO "pd6729: refusing to load the driver " | 650 | dev_warn(&dev->dev, "refusing to load the driver as the " |
646 | "as the io_base is 0.\n"); | 651 | "io_base is NULL.\n"); |
647 | goto err_out_free_mem; | 652 | goto err_out_free_mem; |
648 | } | 653 | } |
649 | 654 | ||
650 | printk(KERN_INFO "pd6729: Cirrus PD6729 PCI to PCMCIA Bridge " | 655 | dev_info(&dev->dev, "Cirrus PD6729 PCI to PCMCIA Bridge at 0x%llx " |
651 | "at 0x%llx on irq %d\n", | 656 | "on irq %d\n", |
652 | (unsigned long long)pci_resource_start(dev, 0), dev->irq); | 657 | (unsigned long long)pci_resource_start(dev, 0), dev->irq); |
653 | /* | 658 | /* |
654 | * Since we have no memory BARs some firmware may not | 659 | * Since we have no memory BARs some firmware may not |
@@ -656,14 +661,14 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, | |||
656 | */ | 661 | */ |
657 | pci_read_config_byte(dev, PCI_COMMAND, &configbyte); | 662 | pci_read_config_byte(dev, PCI_COMMAND, &configbyte); |
658 | if (!(configbyte & PCI_COMMAND_MEMORY)) { | 663 | if (!(configbyte & PCI_COMMAND_MEMORY)) { |
659 | printk(KERN_DEBUG "pd6729: Enabling PCI_COMMAND_MEMORY.\n"); | 664 | dev_dbg(&dev->dev, "pd6729: Enabling PCI_COMMAND_MEMORY.\n"); |
660 | configbyte |= PCI_COMMAND_MEMORY; | 665 | configbyte |= PCI_COMMAND_MEMORY; |
661 | pci_write_config_byte(dev, PCI_COMMAND, configbyte); | 666 | pci_write_config_byte(dev, PCI_COMMAND, configbyte); |
662 | } | 667 | } |
663 | 668 | ||
664 | ret = pci_request_regions(dev, "pd6729"); | 669 | ret = pci_request_regions(dev, "pd6729"); |
665 | if (ret) { | 670 | if (ret) { |
666 | printk(KERN_INFO "pd6729: pci request region failed.\n"); | 671 | dev_warn(&dev->dev, "pci request region failed.\n"); |
667 | goto err_out_disable; | 672 | goto err_out_disable; |
668 | } | 673 | } |
669 | 674 | ||
@@ -672,7 +677,7 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, | |||
672 | 677 | ||
673 | mask = pd6729_isa_scan(); | 678 | mask = pd6729_isa_scan(); |
674 | if (irq_mode == 0 && mask == 0) { | 679 | if (irq_mode == 0 && mask == 0) { |
675 | printk(KERN_INFO "pd6729: no ISA interrupt is available.\n"); | 680 | dev_warn(&dev->dev, "no ISA interrupt is available.\n"); |
676 | goto err_out_free_res; | 681 | goto err_out_free_res; |
677 | } | 682 | } |
678 | 683 | ||
@@ -697,8 +702,8 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, | |||
697 | /* Register the interrupt handler */ | 702 | /* Register the interrupt handler */ |
698 | if ((ret = request_irq(dev->irq, pd6729_interrupt, IRQF_SHARED, | 703 | if ((ret = request_irq(dev->irq, pd6729_interrupt, IRQF_SHARED, |
699 | "pd6729", socket))) { | 704 | "pd6729", socket))) { |
700 | printk(KERN_ERR "pd6729: Failed to register irq %d, " | 705 | dev_err(&dev->dev, "Failed to register irq %d\n", |
701 | "aborting\n", dev->irq); | 706 | dev->irq); |
702 | goto err_out_free_res; | 707 | goto err_out_free_res; |
703 | } | 708 | } |
704 | } else { | 709 | } else { |
@@ -713,8 +718,7 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, | |||
713 | for (i = 0; i < MAX_SOCKETS; i++) { | 718 | for (i = 0; i < MAX_SOCKETS; i++) { |
714 | ret = pcmcia_register_socket(&socket[i].socket); | 719 | ret = pcmcia_register_socket(&socket[i].socket); |
715 | if (ret) { | 720 | if (ret) { |
716 | printk(KERN_INFO "pd6729: pcmcia_register_socket " | 721 | dev_warn(&dev->dev, "pcmcia_register_socket failed.\n"); |
717 | "failed.\n"); | ||
718 | for (j = 0; j < i ; j++) | 722 | for (j = 0; j < i ; j++) |
719 | pcmcia_unregister_socket(&socket[j].socket); | 723 | pcmcia_unregister_socket(&socket[j].socket); |
720 | goto err_out_free_res2; | 724 | goto err_out_free_res2; |
diff --git a/drivers/pcmcia/pd6729.h b/drivers/pcmcia/pd6729.h index f392e458cdfd..41418d394c55 100644 --- a/drivers/pcmcia/pd6729.h +++ b/drivers/pcmcia/pd6729.h | |||
@@ -1,13 +1,6 @@ | |||
1 | #ifndef _INCLUDE_GUARD_PD6729_H_ | 1 | #ifndef _INCLUDE_GUARD_PD6729_H_ |
2 | #define _INCLUDE_GUARD_PD6729_H_ | 2 | #define _INCLUDE_GUARD_PD6729_H_ |
3 | 3 | ||
4 | /* Debuging defines */ | ||
5 | #ifdef NOTRACE | ||
6 | #define dprintk(fmt, args...) printk(fmt , ## args) | ||
7 | #else | ||
8 | #define dprintk(fmt, args...) do {} while (0) | ||
9 | #endif | ||
10 | |||
11 | /* Flags for I365_GENCTL */ | 4 | /* Flags for I365_GENCTL */ |
12 | #define I365_DF_VS1 0x40 /* DF-step Voltage Sense */ | 5 | #define I365_DF_VS1 0x40 /* DF-step Voltage Sense */ |
13 | #define I365_DF_VS2 0x80 | 6 | #define I365_DF_VS2 0x80 |
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c index 0e35acb1366b..84dde7768ad5 100644 --- a/drivers/pcmcia/pxa2xx_base.c +++ b/drivers/pcmcia/pxa2xx_base.c | |||
@@ -228,9 +228,43 @@ static const char *skt_names[] = { | |||
228 | #define SKT_DEV_INFO_SIZE(n) \ | 228 | #define SKT_DEV_INFO_SIZE(n) \ |
229 | (sizeof(struct skt_dev_info) + (n)*sizeof(struct soc_pcmcia_socket)) | 229 | (sizeof(struct skt_dev_info) + (n)*sizeof(struct soc_pcmcia_socket)) |
230 | 230 | ||
231 | int pxa2xx_drv_pcmcia_add_one(struct soc_pcmcia_socket *skt) | ||
232 | { | ||
233 | skt->res_skt.start = _PCMCIA(skt->nr); | ||
234 | skt->res_skt.end = _PCMCIA(skt->nr) + PCMCIASp - 1; | ||
235 | skt->res_skt.name = skt_names[skt->nr]; | ||
236 | skt->res_skt.flags = IORESOURCE_MEM; | ||
237 | |||
238 | skt->res_io.start = _PCMCIAIO(skt->nr); | ||
239 | skt->res_io.end = _PCMCIAIO(skt->nr) + PCMCIAIOSp - 1; | ||
240 | skt->res_io.name = "io"; | ||
241 | skt->res_io.flags = IORESOURCE_MEM | IORESOURCE_BUSY; | ||
242 | |||
243 | skt->res_mem.start = _PCMCIAMem(skt->nr); | ||
244 | skt->res_mem.end = _PCMCIAMem(skt->nr) + PCMCIAMemSp - 1; | ||
245 | skt->res_mem.name = "memory"; | ||
246 | skt->res_mem.flags = IORESOURCE_MEM; | ||
247 | |||
248 | skt->res_attr.start = _PCMCIAAttr(skt->nr); | ||
249 | skt->res_attr.end = _PCMCIAAttr(skt->nr) + PCMCIAAttrSp - 1; | ||
250 | skt->res_attr.name = "attribute"; | ||
251 | skt->res_attr.flags = IORESOURCE_MEM; | ||
252 | |||
253 | return soc_pcmcia_add_one(skt); | ||
254 | } | ||
255 | |||
256 | void pxa2xx_drv_pcmcia_ops(struct pcmcia_low_level *ops) | ||
257 | { | ||
258 | /* Provide our PXA2xx specific timing routines. */ | ||
259 | ops->set_timing = pxa2xx_pcmcia_set_timing; | ||
260 | #ifdef CONFIG_CPU_FREQ | ||
261 | ops->frequency_change = pxa2xx_pcmcia_frequency_change; | ||
262 | #endif | ||
263 | } | ||
264 | |||
231 | int __pxa2xx_drv_pcmcia_probe(struct device *dev) | 265 | int __pxa2xx_drv_pcmcia_probe(struct device *dev) |
232 | { | 266 | { |
233 | int i, ret; | 267 | int i, ret = 0; |
234 | struct pcmcia_low_level *ops; | 268 | struct pcmcia_low_level *ops; |
235 | struct skt_dev_info *sinfo; | 269 | struct skt_dev_info *sinfo; |
236 | struct soc_pcmcia_socket *skt; | 270 | struct soc_pcmcia_socket *skt; |
@@ -240,6 +274,8 @@ int __pxa2xx_drv_pcmcia_probe(struct device *dev) | |||
240 | 274 | ||
241 | ops = (struct pcmcia_low_level *)dev->platform_data; | 275 | ops = (struct pcmcia_low_level *)dev->platform_data; |
242 | 276 | ||
277 | pxa2xx_drv_pcmcia_ops(ops); | ||
278 | |||
243 | sinfo = kzalloc(SKT_DEV_INFO_SIZE(ops->nr), GFP_KERNEL); | 279 | sinfo = kzalloc(SKT_DEV_INFO_SIZE(ops->nr), GFP_KERNEL); |
244 | if (!sinfo) | 280 | if (!sinfo) |
245 | return -ENOMEM; | 281 | return -ENOMEM; |
@@ -250,40 +286,25 @@ int __pxa2xx_drv_pcmcia_probe(struct device *dev) | |||
250 | for (i = 0; i < ops->nr; i++) { | 286 | for (i = 0; i < ops->nr; i++) { |
251 | skt = &sinfo->skt[i]; | 287 | skt = &sinfo->skt[i]; |
252 | 288 | ||
253 | skt->nr = ops->first + i; | 289 | skt->nr = ops->first + i; |
254 | skt->irq = NO_IRQ; | 290 | skt->ops = ops; |
255 | 291 | skt->socket.owner = ops->owner; | |
256 | skt->res_skt.start = _PCMCIA(skt->nr); | 292 | skt->socket.dev.parent = dev; |
257 | skt->res_skt.end = _PCMCIA(skt->nr) + PCMCIASp - 1; | 293 | skt->socket.pci_irq = NO_IRQ; |
258 | skt->res_skt.name = skt_names[skt->nr]; | ||
259 | skt->res_skt.flags = IORESOURCE_MEM; | ||
260 | |||
261 | skt->res_io.start = _PCMCIAIO(skt->nr); | ||
262 | skt->res_io.end = _PCMCIAIO(skt->nr) + PCMCIAIOSp - 1; | ||
263 | skt->res_io.name = "io"; | ||
264 | skt->res_io.flags = IORESOURCE_MEM | IORESOURCE_BUSY; | ||
265 | 294 | ||
266 | skt->res_mem.start = _PCMCIAMem(skt->nr); | 295 | ret = pxa2xx_drv_pcmcia_add_one(skt); |
267 | skt->res_mem.end = _PCMCIAMem(skt->nr) + PCMCIAMemSp - 1; | 296 | if (ret) |
268 | skt->res_mem.name = "memory"; | 297 | break; |
269 | skt->res_mem.flags = IORESOURCE_MEM; | ||
270 | |||
271 | skt->res_attr.start = _PCMCIAAttr(skt->nr); | ||
272 | skt->res_attr.end = _PCMCIAAttr(skt->nr) + PCMCIAAttrSp - 1; | ||
273 | skt->res_attr.name = "attribute"; | ||
274 | skt->res_attr.flags = IORESOURCE_MEM; | ||
275 | } | 298 | } |
276 | 299 | ||
277 | /* Provide our PXA2xx specific timing routines. */ | 300 | if (ret) { |
278 | ops->set_timing = pxa2xx_pcmcia_set_timing; | 301 | while (--i >= 0) |
279 | #ifdef CONFIG_CPU_FREQ | 302 | soc_pcmcia_remove_one(&sinfo->skt[i]); |
280 | ops->frequency_change = pxa2xx_pcmcia_frequency_change; | 303 | kfree(sinfo); |
281 | #endif | 304 | } else { |
282 | |||
283 | ret = soc_common_drv_pcmcia_probe(dev, ops, sinfo); | ||
284 | |||
285 | if (!ret) | ||
286 | pxa2xx_configure_sockets(dev); | 305 | pxa2xx_configure_sockets(dev); |
306 | dev_set_drvdata(dev, sinfo); | ||
307 | } | ||
287 | 308 | ||
288 | return ret; | 309 | return ret; |
289 | } | 310 | } |
@@ -297,7 +318,16 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev) | |||
297 | 318 | ||
298 | static int pxa2xx_drv_pcmcia_remove(struct platform_device *dev) | 319 | static int pxa2xx_drv_pcmcia_remove(struct platform_device *dev) |
299 | { | 320 | { |
300 | return soc_common_drv_pcmcia_remove(&dev->dev); | 321 | struct skt_dev_info *sinfo = platform_get_drvdata(dev); |
322 | int i; | ||
323 | |||
324 | platform_set_drvdata(dev, NULL); | ||
325 | |||
326 | for (i = 0; i < sinfo->nskt; i++) | ||
327 | soc_pcmcia_remove_one(&sinfo->skt[i]); | ||
328 | |||
329 | kfree(sinfo); | ||
330 | return 0; | ||
301 | } | 331 | } |
302 | 332 | ||
303 | static int pxa2xx_drv_pcmcia_suspend(struct device *dev) | 333 | static int pxa2xx_drv_pcmcia_suspend(struct device *dev) |
diff --git a/drivers/pcmcia/pxa2xx_base.h b/drivers/pcmcia/pxa2xx_base.h index 235d681652c3..cb5efaec886f 100644 --- a/drivers/pcmcia/pxa2xx_base.h +++ b/drivers/pcmcia/pxa2xx_base.h | |||
@@ -1,3 +1,6 @@ | |||
1 | /* temporary measure */ | 1 | /* temporary measure */ |
2 | extern int __pxa2xx_drv_pcmcia_probe(struct device *); | 2 | extern int __pxa2xx_drv_pcmcia_probe(struct device *); |
3 | 3 | ||
4 | int pxa2xx_drv_pcmcia_add_one(struct soc_pcmcia_socket *skt); | ||
5 | void pxa2xx_drv_pcmcia_ops(struct pcmcia_low_level *ops); | ||
6 | |||
diff --git a/drivers/pcmcia/pxa2xx_cm_x255.c b/drivers/pcmcia/pxa2xx_cm_x255.c index 5143a760153b..05913d0bbdbe 100644 --- a/drivers/pcmcia/pxa2xx_cm_x255.c +++ b/drivers/pcmcia/pxa2xx_cm_x255.c | |||
@@ -44,7 +44,7 @@ static int cmx255_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
44 | return ret; | 44 | return ret; |
45 | gpio_direction_output(GPIO_PCMCIA_RESET, 0); | 45 | gpio_direction_output(GPIO_PCMCIA_RESET, 0); |
46 | 46 | ||
47 | skt->irq = skt->nr == 0 ? PCMCIA_S0_RDYINT : PCMCIA_S1_RDYINT; | 47 | skt->socket.pci_irq = skt->nr == 0 ? PCMCIA_S0_RDYINT : PCMCIA_S1_RDYINT; |
48 | ret = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 48 | ret = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
49 | if (!ret) | 49 | if (!ret) |
50 | gpio_free(GPIO_PCMCIA_RESET); | 50 | gpio_free(GPIO_PCMCIA_RESET); |
diff --git a/drivers/pcmcia/pxa2xx_cm_x270.c b/drivers/pcmcia/pxa2xx_cm_x270.c index a7b943d01e34..5662646b84da 100644 --- a/drivers/pcmcia/pxa2xx_cm_x270.c +++ b/drivers/pcmcia/pxa2xx_cm_x270.c | |||
@@ -38,7 +38,7 @@ static int cmx270_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
38 | return ret; | 38 | return ret; |
39 | gpio_direction_output(GPIO_PCMCIA_RESET, 0); | 39 | gpio_direction_output(GPIO_PCMCIA_RESET, 0); |
40 | 40 | ||
41 | skt->irq = PCMCIA_S0_RDYINT; | 41 | skt->socket.pci_irq = PCMCIA_S0_RDYINT; |
42 | ret = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 42 | ret = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
43 | if (!ret) | 43 | if (!ret) |
44 | gpio_free(GPIO_PCMCIA_RESET); | 44 | gpio_free(GPIO_PCMCIA_RESET); |
diff --git a/drivers/pcmcia/pxa2xx_e740.c b/drivers/pcmcia/pxa2xx_e740.c index d09c0dc4a31a..8bfbd4dca131 100644 --- a/drivers/pcmcia/pxa2xx_e740.c +++ b/drivers/pcmcia/pxa2xx_e740.c | |||
@@ -38,7 +38,7 @@ static struct pcmcia_irqs cd_irqs[] = { | |||
38 | 38 | ||
39 | static int e740_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | 39 | static int e740_pcmcia_hw_init(struct soc_pcmcia_socket *skt) |
40 | { | 40 | { |
41 | skt->irq = skt->nr == 0 ? IRQ_GPIO(GPIO_E740_PCMCIA_RDY0) : | 41 | skt->socket.pci_irq = skt->nr == 0 ? IRQ_GPIO(GPIO_E740_PCMCIA_RDY0) : |
42 | IRQ_GPIO(GPIO_E740_PCMCIA_RDY1); | 42 | IRQ_GPIO(GPIO_E740_PCMCIA_RDY1); |
43 | 43 | ||
44 | return soc_pcmcia_request_irqs(skt, &cd_irqs[skt->nr], 1); | 44 | return soc_pcmcia_request_irqs(skt, &cd_irqs[skt->nr], 1); |
diff --git a/drivers/pcmcia/pxa2xx_lubbock.c b/drivers/pcmcia/pxa2xx_lubbock.c index 6cbb1b1f7cfd..b9f8c8fb42bd 100644 --- a/drivers/pcmcia/pxa2xx_lubbock.c +++ b/drivers/pcmcia/pxa2xx_lubbock.c | |||
@@ -32,6 +32,7 @@ static int | |||
32 | lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | 32 | lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, |
33 | const socket_state_t *state) | 33 | const socket_state_t *state) |
34 | { | 34 | { |
35 | struct sa1111_pcmcia_socket *s = to_skt(skt); | ||
35 | unsigned int pa_dwr_mask, pa_dwr_set, misc_mask, misc_set; | 36 | unsigned int pa_dwr_mask, pa_dwr_set, misc_mask, misc_set; |
36 | int ret = 0; | 37 | int ret = 0; |
37 | 38 | ||
@@ -149,7 +150,7 @@ lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | |||
149 | 150 | ||
150 | if (ret == 0) { | 151 | if (ret == 0) { |
151 | lubbock_set_misc_wr(misc_mask, misc_set); | 152 | lubbock_set_misc_wr(misc_mask, misc_set); |
152 | sa1111_set_io(SA1111_DEV(skt->dev), pa_dwr_mask, pa_dwr_set); | 153 | sa1111_set_io(s->dev, pa_dwr_mask, pa_dwr_set); |
153 | } | 154 | } |
154 | 155 | ||
155 | #if 1 | 156 | #if 1 |
@@ -175,7 +176,7 @@ lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | |||
175 | * Switch to 5V, Configure socket with 5V voltage | 176 | * Switch to 5V, Configure socket with 5V voltage |
176 | */ | 177 | */ |
177 | lubbock_set_misc_wr(misc_mask, 0); | 178 | lubbock_set_misc_wr(misc_mask, 0); |
178 | sa1111_set_io(SA1111_DEV(skt->dev), pa_dwr_mask, 0); | 179 | sa1111_set_io(s->dev, pa_dwr_mask, 0); |
179 | 180 | ||
180 | /* | 181 | /* |
181 | * It takes about 100ms to turn off Vcc. | 182 | * It takes about 100ms to turn off Vcc. |
@@ -200,12 +201,8 @@ lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | |||
200 | 201 | ||
201 | static struct pcmcia_low_level lubbock_pcmcia_ops = { | 202 | static struct pcmcia_low_level lubbock_pcmcia_ops = { |
202 | .owner = THIS_MODULE, | 203 | .owner = THIS_MODULE, |
203 | .hw_init = sa1111_pcmcia_hw_init, | ||
204 | .hw_shutdown = sa1111_pcmcia_hw_shutdown, | ||
205 | .socket_state = sa1111_pcmcia_socket_state, | ||
206 | .configure_socket = lubbock_pcmcia_configure_socket, | 204 | .configure_socket = lubbock_pcmcia_configure_socket, |
207 | .socket_init = sa1111_pcmcia_socket_init, | 205 | .socket_init = sa1111_pcmcia_socket_init, |
208 | .socket_suspend = sa1111_pcmcia_socket_suspend, | ||
209 | .first = 0, | 206 | .first = 0, |
210 | .nr = 2, | 207 | .nr = 2, |
211 | }; | 208 | }; |
@@ -228,8 +225,9 @@ int pcmcia_lubbock_init(struct sa1111_dev *sadev) | |||
228 | /* Set CF Socket 1 power to standby mode. */ | 225 | /* Set CF Socket 1 power to standby mode. */ |
229 | lubbock_set_misc_wr((1 << 15) | (1 << 14), 0); | 226 | lubbock_set_misc_wr((1 << 15) | (1 << 14), 0); |
230 | 227 | ||
231 | sadev->dev.platform_data = &lubbock_pcmcia_ops; | 228 | pxa2xx_drv_pcmcia_ops(&lubbock_pcmcia_ops); |
232 | ret = __pxa2xx_drv_pcmcia_probe(&sadev->dev); | 229 | ret = sa1111_pcmcia_add(sadev, &lubbock_pcmcia_ops, |
230 | pxa2xx_drv_pcmcia_add_one); | ||
233 | } | 231 | } |
234 | 232 | ||
235 | return ret; | 233 | return ret; |
diff --git a/drivers/pcmcia/pxa2xx_mainstone.c b/drivers/pcmcia/pxa2xx_mainstone.c index 1138551ba8f6..92016fe932b4 100644 --- a/drivers/pcmcia/pxa2xx_mainstone.c +++ b/drivers/pcmcia/pxa2xx_mainstone.c | |||
@@ -44,7 +44,7 @@ static int mst_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
44 | * before we enable them as outputs. | 44 | * before we enable them as outputs. |
45 | */ | 45 | */ |
46 | 46 | ||
47 | skt->irq = (skt->nr == 0) ? MAINSTONE_S0_IRQ : MAINSTONE_S1_IRQ; | 47 | skt->socket.pci_irq = (skt->nr == 0) ? MAINSTONE_S0_IRQ : MAINSTONE_S1_IRQ; |
48 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 48 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
49 | } | 49 | } |
50 | 50 | ||
diff --git a/drivers/pcmcia/pxa2xx_palmld.c b/drivers/pcmcia/pxa2xx_palmld.c index 5ba9b3664a00..6fb6f7f0672e 100644 --- a/drivers/pcmcia/pxa2xx_palmld.c +++ b/drivers/pcmcia/pxa2xx_palmld.c | |||
@@ -45,7 +45,7 @@ static int palmld_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
45 | if (ret) | 45 | if (ret) |
46 | goto err4; | 46 | goto err4; |
47 | 47 | ||
48 | skt->irq = IRQ_GPIO(GPIO_NR_PALMLD_PCMCIA_READY); | 48 | skt->socket.pci_irq = IRQ_GPIO(GPIO_NR_PALMLD_PCMCIA_READY); |
49 | return 0; | 49 | return 0; |
50 | 50 | ||
51 | err4: | 51 | err4: |
diff --git a/drivers/pcmcia/pxa2xx_palmtx.c b/drivers/pcmcia/pxa2xx_palmtx.c index e07b5c51ec5b..b07b247a399f 100644 --- a/drivers/pcmcia/pxa2xx_palmtx.c +++ b/drivers/pcmcia/pxa2xx_palmtx.c | |||
@@ -53,7 +53,7 @@ static int palmtx_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
53 | if (ret) | 53 | if (ret) |
54 | goto err5; | 54 | goto err5; |
55 | 55 | ||
56 | skt->irq = gpio_to_irq(GPIO_NR_PALMTX_PCMCIA_READY); | 56 | skt->socket.pci_irq = gpio_to_irq(GPIO_NR_PALMTX_PCMCIA_READY); |
57 | return 0; | 57 | return 0; |
58 | 58 | ||
59 | err5: | 59 | err5: |
diff --git a/drivers/pcmcia/pxa2xx_sharpsl.c b/drivers/pcmcia/pxa2xx_sharpsl.c index bc43f78f6f0b..0ea3b29440e6 100644 --- a/drivers/pcmcia/pxa2xx_sharpsl.c +++ b/drivers/pcmcia/pxa2xx_sharpsl.c | |||
@@ -66,7 +66,7 @@ static int sharpsl_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | skt->irq = SCOOP_DEV[skt->nr].irq; | 69 | skt->socket.pci_irq = SCOOP_DEV[skt->nr].irq; |
70 | 70 | ||
71 | return 0; | 71 | return 0; |
72 | } | 72 | } |
diff --git a/drivers/pcmcia/pxa2xx_trizeps4.c b/drivers/pcmcia/pxa2xx_trizeps4.c index e0e5cb339b4a..b7e596620db1 100644 --- a/drivers/pcmcia/pxa2xx_trizeps4.c +++ b/drivers/pcmcia/pxa2xx_trizeps4.c | |||
@@ -53,7 +53,7 @@ static int trizeps_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
53 | gpio_free(GPIO_PRDY); | 53 | gpio_free(GPIO_PRDY); |
54 | return -EINVAL; | 54 | return -EINVAL; |
55 | } | 55 | } |
56 | skt->irq = IRQ_GPIO(GPIO_PRDY); | 56 | skt->socket.pci_irq = IRQ_GPIO(GPIO_PRDY); |
57 | break; | 57 | break; |
58 | 58 | ||
59 | #ifndef CONFIG_MACH_TRIZEPS_CONXS | 59 | #ifndef CONFIG_MACH_TRIZEPS_CONXS |
@@ -63,7 +63,7 @@ static int trizeps_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
63 | break; | 63 | break; |
64 | } | 64 | } |
65 | /* release the reset of this card */ | 65 | /* release the reset of this card */ |
66 | pr_debug("%s: sock %d irq %d\n", __func__, skt->nr, skt->irq); | 66 | pr_debug("%s: sock %d irq %d\n", __func__, skt->nr, skt->socket.pci_irq); |
67 | 67 | ||
68 | /* supplementory irqs for the socket */ | 68 | /* supplementory irqs for the socket */ |
69 | for (i = 0; i < ARRAY_SIZE(irqs); i++) { | 69 | for (i = 0; i < ARRAY_SIZE(irqs); i++) { |
diff --git a/drivers/pcmcia/pxa2xx_viper.c b/drivers/pcmcia/pxa2xx_viper.c index 17871360fe99..27be2e154df2 100644 --- a/drivers/pcmcia/pxa2xx_viper.c +++ b/drivers/pcmcia/pxa2xx_viper.c | |||
@@ -40,7 +40,7 @@ static int viper_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
40 | { | 40 | { |
41 | unsigned long flags; | 41 | unsigned long flags; |
42 | 42 | ||
43 | skt->irq = gpio_to_irq(VIPER_CF_RDY_GPIO); | 43 | skt->socket.pci_irq = gpio_to_irq(VIPER_CF_RDY_GPIO); |
44 | 44 | ||
45 | if (gpio_request(VIPER_CF_CD_GPIO, "CF detect")) | 45 | if (gpio_request(VIPER_CF_CD_GPIO, "CF detect")) |
46 | goto err_request_cd; | 46 | goto err_request_cd; |
diff --git a/drivers/pcmcia/rsrc_mgr.c b/drivers/pcmcia/rsrc_mgr.c index e592e0e0d7ed..de0e770ce6a3 100644 --- a/drivers/pcmcia/rsrc_mgr.c +++ b/drivers/pcmcia/rsrc_mgr.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <pcmcia/cs_types.h> | 18 | #include <pcmcia/cs_types.h> |
19 | #include <pcmcia/ss.h> | 19 | #include <pcmcia/ss.h> |
20 | #include <pcmcia/cs.h> | 20 | #include <pcmcia/cs.h> |
21 | #include <pcmcia/cistpl.h> | ||
21 | #include "cs_internal.h" | 22 | #include "cs_internal.h" |
22 | 23 | ||
23 | 24 | ||
diff --git a/drivers/pcmcia/sa1100_assabet.c b/drivers/pcmcia/sa1100_assabet.c index ac8aa09ba0da..fd013a1ef47a 100644 --- a/drivers/pcmcia/sa1100_assabet.c +++ b/drivers/pcmcia/sa1100_assabet.c | |||
@@ -27,7 +27,7 @@ static struct pcmcia_irqs irqs[] = { | |||
27 | 27 | ||
28 | static int assabet_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | 28 | static int assabet_pcmcia_hw_init(struct soc_pcmcia_socket *skt) |
29 | { | 29 | { |
30 | skt->irq = ASSABET_IRQ_GPIO_CF_IRQ; | 30 | skt->socket.pci_irq = ASSABET_IRQ_GPIO_CF_IRQ; |
31 | 31 | ||
32 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 32 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
33 | } | 33 | } |
diff --git a/drivers/pcmcia/sa1100_badge4.c b/drivers/pcmcia/sa1100_badge4.c index 1ca9737ea79e..1ce53f493bef 100644 --- a/drivers/pcmcia/sa1100_badge4.c +++ b/drivers/pcmcia/sa1100_badge4.c | |||
@@ -127,13 +127,10 @@ badge4_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state | |||
127 | 127 | ||
128 | static struct pcmcia_low_level badge4_pcmcia_ops = { | 128 | static struct pcmcia_low_level badge4_pcmcia_ops = { |
129 | .owner = THIS_MODULE, | 129 | .owner = THIS_MODULE, |
130 | .hw_init = sa1111_pcmcia_hw_init, | ||
131 | .hw_shutdown = sa1111_pcmcia_hw_shutdown, | ||
132 | .socket_state = sa1111_pcmcia_socket_state, | ||
133 | .configure_socket = badge4_pcmcia_configure_socket, | 130 | .configure_socket = badge4_pcmcia_configure_socket, |
134 | |||
135 | .socket_init = sa1111_pcmcia_socket_init, | 131 | .socket_init = sa1111_pcmcia_socket_init, |
136 | .socket_suspend = sa1111_pcmcia_socket_suspend, | 132 | .first = 0, |
133 | .nr = 2, | ||
137 | }; | 134 | }; |
138 | 135 | ||
139 | int pcmcia_badge4_init(struct device *dev) | 136 | int pcmcia_badge4_init(struct device *dev) |
@@ -146,7 +143,9 @@ int pcmcia_badge4_init(struct device *dev) | |||
146 | __func__, | 143 | __func__, |
147 | badge4_pcmvcc, badge4_pcmvpp, badge4_cfvcc); | 144 | badge4_pcmvcc, badge4_pcmvpp, badge4_cfvcc); |
148 | 145 | ||
149 | ret = sa11xx_drv_pcmcia_probe(dev, &badge4_pcmcia_ops, 0, 2); | 146 | sa11xx_drv_pcmcia_ops(&badge4_pcmcia_ops); |
147 | ret = sa1111_pcmcia_add(dev, &badge4_pcmcia_ops, | ||
148 | sa11xx_drv_pcmcia_add_one); | ||
150 | } | 149 | } |
151 | 150 | ||
152 | return ret; | 151 | return ret; |
diff --git a/drivers/pcmcia/sa1100_cerf.c b/drivers/pcmcia/sa1100_cerf.c index 63e6bc431a0d..9bf088b17275 100644 --- a/drivers/pcmcia/sa1100_cerf.c +++ b/drivers/pcmcia/sa1100_cerf.c | |||
@@ -27,7 +27,7 @@ static struct pcmcia_irqs irqs[] = { | |||
27 | 27 | ||
28 | static int cerf_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | 28 | static int cerf_pcmcia_hw_init(struct soc_pcmcia_socket *skt) |
29 | { | 29 | { |
30 | skt->irq = CERF_IRQ_GPIO_CF_IRQ; | 30 | skt->socket.pci_irq = CERF_IRQ_GPIO_CF_IRQ; |
31 | 31 | ||
32 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 32 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
33 | } | 33 | } |
diff --git a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c index 2d0e99751530..8db86b90c200 100644 --- a/drivers/pcmcia/sa1100_generic.c +++ b/drivers/pcmcia/sa1100_generic.c | |||
@@ -51,7 +51,7 @@ static int (*sa11x0_pcmcia_hw_init[])(struct device *dev) = { | |||
51 | #ifdef CONFIG_SA1100_CERF | 51 | #ifdef CONFIG_SA1100_CERF |
52 | pcmcia_cerf_init, | 52 | pcmcia_cerf_init, |
53 | #endif | 53 | #endif |
54 | #ifdef CONFIG_SA1100_H3600 | 54 | #if defined(CONFIG_SA1100_H3100) || defined(CONFIG_SA1100_H3600) |
55 | pcmcia_h3600_init, | 55 | pcmcia_h3600_init, |
56 | #endif | 56 | #endif |
57 | #ifdef CONFIG_SA1100_SHANNON | 57 | #ifdef CONFIG_SA1100_SHANNON |
@@ -83,7 +83,16 @@ static int sa11x0_drv_pcmcia_probe(struct platform_device *dev) | |||
83 | 83 | ||
84 | static int sa11x0_drv_pcmcia_remove(struct platform_device *dev) | 84 | static int sa11x0_drv_pcmcia_remove(struct platform_device *dev) |
85 | { | 85 | { |
86 | return soc_common_drv_pcmcia_remove(&dev->dev); | 86 | struct skt_dev_info *sinfo = platform_get_drvdata(dev); |
87 | int i; | ||
88 | |||
89 | platform_set_drvdata(dev, NULL); | ||
90 | |||
91 | for (i = 0; i < sinfo->nskt; i++) | ||
92 | soc_pcmcia_remove_one(&sinfo->skt[i]); | ||
93 | |||
94 | kfree(sinfo); | ||
95 | return 0; | ||
87 | } | 96 | } |
88 | 97 | ||
89 | static int sa11x0_drv_pcmcia_suspend(struct platform_device *dev, | 98 | static int sa11x0_drv_pcmcia_suspend(struct platform_device *dev, |
diff --git a/drivers/pcmcia/sa1100_h3600.c b/drivers/pcmcia/sa1100_h3600.c index 0cc3748f3758..56329ad575a9 100644 --- a/drivers/pcmcia/sa1100_h3600.c +++ b/drivers/pcmcia/sa1100_h3600.c | |||
@@ -10,47 +10,139 @@ | |||
10 | #include <linux/interrupt.h> | 10 | #include <linux/interrupt.h> |
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/delay.h> | 12 | #include <linux/delay.h> |
13 | #include <linux/gpio.h> | ||
13 | 14 | ||
14 | #include <mach/hardware.h> | 15 | #include <mach/hardware.h> |
15 | #include <asm/irq.h> | 16 | #include <asm/irq.h> |
16 | #include <asm/mach-types.h> | 17 | #include <asm/mach-types.h> |
17 | #include <mach/h3600.h> | 18 | #include <mach/h3xxx.h> |
18 | 19 | ||
19 | #include "sa1100_generic.h" | 20 | #include "sa1100_generic.h" |
20 | 21 | ||
21 | static struct pcmcia_irqs irqs[] = { | 22 | static struct pcmcia_irqs irqs[] = { |
22 | { 0, IRQ_GPIO_H3600_PCMCIA_CD0, "PCMCIA CD0" }, | 23 | { .sock = 0, .str = "PCMCIA CD0" }, /* .irq will be filled later */ |
23 | { 1, IRQ_GPIO_H3600_PCMCIA_CD1, "PCMCIA CD1" } | 24 | { .sock = 1, .str = "PCMCIA CD1" } |
24 | }; | 25 | }; |
25 | 26 | ||
26 | static int h3600_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | 27 | static int h3600_pcmcia_hw_init(struct soc_pcmcia_socket *skt) |
27 | { | 28 | { |
28 | skt->irq = skt->nr ? IRQ_GPIO_H3600_PCMCIA_IRQ1 | 29 | int err; |
29 | : IRQ_GPIO_H3600_PCMCIA_IRQ0; | ||
30 | 30 | ||
31 | switch (skt->nr) { | ||
32 | case 0: | ||
33 | err = gpio_request(H3XXX_GPIO_PCMCIA_IRQ0, "PCMCIA IRQ0"); | ||
34 | if (err) | ||
35 | goto err00; | ||
36 | err = gpio_direction_input(H3XXX_GPIO_PCMCIA_IRQ0); | ||
37 | if (err) | ||
38 | goto err01; | ||
39 | skt->socket.pci_irq = gpio_to_irq(H3XXX_GPIO_PCMCIA_IRQ0); | ||
40 | |||
41 | err = gpio_request(H3XXX_GPIO_PCMCIA_CD0, "PCMCIA CD0"); | ||
42 | if (err) | ||
43 | goto err01; | ||
44 | err = gpio_direction_input(H3XXX_GPIO_PCMCIA_CD0); | ||
45 | if (err) | ||
46 | goto err02; | ||
47 | irqs[0].irq = gpio_to_irq(H3XXX_GPIO_PCMCIA_CD0); | ||
48 | |||
49 | err = gpio_request(H3XXX_EGPIO_OPT_NVRAM_ON, "OPT NVRAM ON"); | ||
50 | if (err) | ||
51 | goto err02; | ||
52 | err = gpio_direction_output(H3XXX_EGPIO_OPT_NVRAM_ON, 0); | ||
53 | if (err) | ||
54 | goto err03; | ||
55 | err = gpio_request(H3XXX_EGPIO_OPT_ON, "OPT ON"); | ||
56 | if (err) | ||
57 | goto err03; | ||
58 | err = gpio_direction_output(H3XXX_EGPIO_OPT_ON, 0); | ||
59 | if (err) | ||
60 | goto err04; | ||
61 | err = gpio_request(H3XXX_EGPIO_OPT_RESET, "OPT RESET"); | ||
62 | if (err) | ||
63 | goto err04; | ||
64 | err = gpio_direction_output(H3XXX_EGPIO_OPT_RESET, 0); | ||
65 | if (err) | ||
66 | goto err05; | ||
67 | err = gpio_request(H3XXX_EGPIO_CARD_RESET, "PCMCIA CARD RESET"); | ||
68 | if (err) | ||
69 | goto err05; | ||
70 | err = gpio_direction_output(H3XXX_EGPIO_CARD_RESET, 0); | ||
71 | if (err) | ||
72 | goto err06; | ||
73 | err = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | ||
74 | if (err) | ||
75 | goto err06; | ||
76 | break; | ||
77 | case 1: | ||
78 | err = gpio_request(H3XXX_GPIO_PCMCIA_IRQ1, "PCMCIA IRQ1"); | ||
79 | if (err) | ||
80 | goto err10; | ||
81 | err = gpio_direction_input(H3XXX_GPIO_PCMCIA_IRQ1); | ||
82 | if (err) | ||
83 | goto err11; | ||
84 | skt->socket.pci_irq = gpio_to_irq(H3XXX_GPIO_PCMCIA_IRQ1); | ||
85 | |||
86 | err = gpio_request(H3XXX_GPIO_PCMCIA_CD1, "PCMCIA CD1"); | ||
87 | if (err) | ||
88 | goto err11; | ||
89 | err = gpio_direction_input(H3XXX_GPIO_PCMCIA_CD1); | ||
90 | if (err) | ||
91 | goto err12; | ||
92 | irqs[1].irq = gpio_to_irq(H3XXX_GPIO_PCMCIA_CD1); | ||
93 | |||
94 | err = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | ||
95 | if (err) | ||
96 | goto err12; | ||
97 | break; | ||
98 | } | ||
99 | return 0; | ||
31 | 100 | ||
32 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 101 | err06: gpio_free(H3XXX_EGPIO_CARD_RESET); |
102 | err05: gpio_free(H3XXX_EGPIO_OPT_RESET); | ||
103 | err04: gpio_free(H3XXX_EGPIO_OPT_ON); | ||
104 | err03: gpio_free(H3XXX_EGPIO_OPT_NVRAM_ON); | ||
105 | err02: gpio_free(H3XXX_GPIO_PCMCIA_CD0); | ||
106 | err01: gpio_free(H3XXX_GPIO_PCMCIA_IRQ0); | ||
107 | err00: return err; | ||
108 | |||
109 | err12: gpio_free(H3XXX_GPIO_PCMCIA_CD0); | ||
110 | err11: gpio_free(H3XXX_GPIO_PCMCIA_IRQ0); | ||
111 | err10: return err; | ||
33 | } | 112 | } |
34 | 113 | ||
35 | static void h3600_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) | 114 | static void h3600_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) |
36 | { | 115 | { |
37 | soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 116 | soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
38 | 117 | ||
39 | /* Disable CF bus: */ | 118 | switch (skt->nr) { |
40 | assign_h3600_egpio(IPAQ_EGPIO_OPT_NVRAM_ON, 0); | 119 | case 0: |
41 | assign_h3600_egpio(IPAQ_EGPIO_OPT_ON, 0); | 120 | /* Disable CF bus: */ |
42 | assign_h3600_egpio(IPAQ_EGPIO_OPT_RESET, 1); | 121 | gpio_set_value(H3XXX_EGPIO_OPT_NVRAM_ON, 0); |
122 | gpio_set_value(H3XXX_EGPIO_OPT_ON, 0); | ||
123 | gpio_set_value(H3XXX_EGPIO_OPT_RESET, 1); | ||
124 | |||
125 | gpio_free(H3XXX_EGPIO_CARD_RESET); | ||
126 | gpio_free(H3XXX_EGPIO_OPT_RESET); | ||
127 | gpio_free(H3XXX_EGPIO_OPT_ON); | ||
128 | gpio_free(H3XXX_EGPIO_OPT_NVRAM_ON); | ||
129 | gpio_free(H3XXX_GPIO_PCMCIA_CD0); | ||
130 | gpio_free(H3XXX_GPIO_PCMCIA_IRQ0); | ||
131 | break; | ||
132 | case 1: | ||
133 | gpio_free(H3XXX_GPIO_PCMCIA_CD1); | ||
134 | gpio_free(H3XXX_GPIO_PCMCIA_IRQ1); | ||
135 | break; | ||
136 | } | ||
43 | } | 137 | } |
44 | 138 | ||
45 | static void | 139 | static void |
46 | h3600_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state) | 140 | h3600_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state) |
47 | { | 141 | { |
48 | unsigned long levels = GPLR; | ||
49 | |||
50 | switch (skt->nr) { | 142 | switch (skt->nr) { |
51 | case 0: | 143 | case 0: |
52 | state->detect = levels & GPIO_H3600_PCMCIA_CD0 ? 0 : 1; | 144 | state->detect = !gpio_get_value(H3XXX_GPIO_PCMCIA_CD0); |
53 | state->ready = levels & GPIO_H3600_PCMCIA_IRQ0 ? 1 : 0; | 145 | state->ready = !!gpio_get_value(H3XXX_GPIO_PCMCIA_IRQ0); |
54 | state->bvd1 = 0; | 146 | state->bvd1 = 0; |
55 | state->bvd2 = 0; | 147 | state->bvd2 = 0; |
56 | state->wrprot = 0; /* Not available on H3600. */ | 148 | state->wrprot = 0; /* Not available on H3600. */ |
@@ -59,8 +151,8 @@ h3600_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *st | |||
59 | break; | 151 | break; |
60 | 152 | ||
61 | case 1: | 153 | case 1: |
62 | state->detect = levels & GPIO_H3600_PCMCIA_CD1 ? 0 : 1; | 154 | state->detect = !gpio_get_value(H3XXX_GPIO_PCMCIA_CD1); |
63 | state->ready = levels & GPIO_H3600_PCMCIA_IRQ1 ? 1 : 0; | 155 | state->ready = !!gpio_get_value(H3XXX_GPIO_PCMCIA_IRQ1); |
64 | state->bvd1 = 0; | 156 | state->bvd1 = 0; |
65 | state->bvd2 = 0; | 157 | state->bvd2 = 0; |
66 | state->wrprot = 0; /* Not available on H3600. */ | 158 | state->wrprot = 0; /* Not available on H3600. */ |
@@ -79,7 +171,7 @@ h3600_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_ | |||
79 | return -1; | 171 | return -1; |
80 | } | 172 | } |
81 | 173 | ||
82 | assign_h3600_egpio(IPAQ_EGPIO_CARD_RESET, !!(state->flags & SS_RESET)); | 174 | gpio_set_value(H3XXX_EGPIO_CARD_RESET, !!(state->flags & SS_RESET)); |
83 | 175 | ||
84 | /* Silently ignore Vpp, output enable, speaker enable. */ | 176 | /* Silently ignore Vpp, output enable, speaker enable. */ |
85 | 177 | ||
@@ -89,9 +181,9 @@ h3600_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_ | |||
89 | static void h3600_pcmcia_socket_init(struct soc_pcmcia_socket *skt) | 181 | static void h3600_pcmcia_socket_init(struct soc_pcmcia_socket *skt) |
90 | { | 182 | { |
91 | /* Enable CF bus: */ | 183 | /* Enable CF bus: */ |
92 | assign_h3600_egpio(IPAQ_EGPIO_OPT_NVRAM_ON, 1); | 184 | gpio_set_value(H3XXX_EGPIO_OPT_NVRAM_ON, 1); |
93 | assign_h3600_egpio(IPAQ_EGPIO_OPT_ON, 1); | 185 | gpio_set_value(H3XXX_EGPIO_OPT_ON, 1); |
94 | assign_h3600_egpio(IPAQ_EGPIO_OPT_RESET, 0); | 186 | gpio_set_value(H3XXX_EGPIO_OPT_RESET, 0); |
95 | 187 | ||
96 | msleep(10); | 188 | msleep(10); |
97 | 189 | ||
@@ -109,10 +201,10 @@ static void h3600_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) | |||
109 | * socket 0 then socket 1. | 201 | * socket 0 then socket 1. |
110 | */ | 202 | */ |
111 | if (skt->nr == 1) { | 203 | if (skt->nr == 1) { |
112 | assign_h3600_egpio(IPAQ_EGPIO_OPT_ON, 0); | 204 | gpio_set_value(H3XXX_EGPIO_OPT_ON, 0); |
113 | assign_h3600_egpio(IPAQ_EGPIO_OPT_NVRAM_ON, 0); | 205 | gpio_set_value(H3XXX_EGPIO_OPT_NVRAM_ON, 0); |
114 | /* hmm, does this suck power? */ | 206 | /* hmm, does this suck power? */ |
115 | assign_h3600_egpio(IPAQ_EGPIO_OPT_RESET, 1); | 207 | gpio_set_value(H3XXX_EGPIO_OPT_RESET, 1); |
116 | } | 208 | } |
117 | } | 209 | } |
118 | 210 | ||
@@ -131,7 +223,7 @@ int __init pcmcia_h3600_init(struct device *dev) | |||
131 | { | 223 | { |
132 | int ret = -ENODEV; | 224 | int ret = -ENODEV; |
133 | 225 | ||
134 | if (machine_is_h3600()) | 226 | if (machine_is_h3600() || machine_is_h3100()) |
135 | ret = sa11xx_drv_pcmcia_probe(dev, &h3600_pcmcia_ops, 0, 2); | 227 | ret = sa11xx_drv_pcmcia_probe(dev, &h3600_pcmcia_ops, 0, 2); |
136 | 228 | ||
137 | return ret; | 229 | return ret; |
diff --git a/drivers/pcmcia/sa1100_jornada720.c b/drivers/pcmcia/sa1100_jornada720.c index 7eedb42f800c..6bcabee6bde4 100644 --- a/drivers/pcmcia/sa1100_jornada720.c +++ b/drivers/pcmcia/sa1100_jornada720.c | |||
@@ -22,25 +22,10 @@ | |||
22 | #define SOCKET1_POWER (GPIO_GPIO1 | GPIO_GPIO3) | 22 | #define SOCKET1_POWER (GPIO_GPIO1 | GPIO_GPIO3) |
23 | #define SOCKET1_3V GPIO_GPIO3 | 23 | #define SOCKET1_3V GPIO_GPIO3 |
24 | 24 | ||
25 | static int jornada720_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | ||
26 | { | ||
27 | unsigned int pin = GPIO_A0 | GPIO_A1 | GPIO_A2 | GPIO_A3; | ||
28 | |||
29 | /* | ||
30 | * What is all this crap for? | ||
31 | */ | ||
32 | GRER |= 0x00000002; | ||
33 | /* Set GPIO_A<3:1> to be outputs for PCMCIA/CF power controller: */ | ||
34 | sa1111_set_io_dir(SA1111_DEV(skt->dev), pin, 0, 0); | ||
35 | sa1111_set_io(SA1111_DEV(skt->dev), pin, 0); | ||
36 | sa1111_set_sleep_io(SA1111_DEV(skt->dev), pin, 0); | ||
37 | |||
38 | return sa1111_pcmcia_hw_init(skt); | ||
39 | } | ||
40 | |||
41 | static int | 25 | static int |
42 | jornada720_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) | 26 | jornada720_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) |
43 | { | 27 | { |
28 | struct sa1111_pcmcia_socket *s = to_skt(skt); | ||
44 | unsigned int pa_dwr_mask, pa_dwr_set; | 29 | unsigned int pa_dwr_mask, pa_dwr_set; |
45 | int ret; | 30 | int ret; |
46 | 31 | ||
@@ -97,7 +82,7 @@ jornada720_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_s | |||
97 | unsigned long flags; | 82 | unsigned long flags; |
98 | 83 | ||
99 | local_irq_save(flags); | 84 | local_irq_save(flags); |
100 | sa1111_set_io(SA1111_DEV(skt->dev), pa_dwr_mask, pa_dwr_set); | 85 | sa1111_set_io(s->dev, pa_dwr_mask, pa_dwr_set); |
101 | local_irq_restore(flags); | 86 | local_irq_restore(flags); |
102 | } | 87 | } |
103 | 88 | ||
@@ -106,21 +91,30 @@ jornada720_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_s | |||
106 | 91 | ||
107 | static struct pcmcia_low_level jornada720_pcmcia_ops = { | 92 | static struct pcmcia_low_level jornada720_pcmcia_ops = { |
108 | .owner = THIS_MODULE, | 93 | .owner = THIS_MODULE, |
109 | .hw_init = jornada720_pcmcia_hw_init, | ||
110 | .hw_shutdown = sa1111_pcmcia_hw_shutdown, | ||
111 | .socket_state = sa1111_pcmcia_socket_state, | ||
112 | .configure_socket = jornada720_pcmcia_configure_socket, | 94 | .configure_socket = jornada720_pcmcia_configure_socket, |
113 | |||
114 | .socket_init = sa1111_pcmcia_socket_init, | 95 | .socket_init = sa1111_pcmcia_socket_init, |
115 | .socket_suspend = sa1111_pcmcia_socket_suspend, | 96 | .first = 0, |
97 | .nr = 2, | ||
116 | }; | 98 | }; |
117 | 99 | ||
118 | int __devinit pcmcia_jornada720_init(struct device *dev) | 100 | int __devinit pcmcia_jornada720_init(struct device *dev) |
119 | { | 101 | { |
120 | int ret = -ENODEV; | 102 | int ret = -ENODEV; |
121 | 103 | ||
122 | if (machine_is_jornada720()) | 104 | if (machine_is_jornada720()) { |
123 | ret = sa11xx_drv_pcmcia_probe(dev, &jornada720_pcmcia_ops, 0, 2); | 105 | unsigned int pin = GPIO_A0 | GPIO_A1 | GPIO_A2 | GPIO_A3; |
106 | |||
107 | GRER |= 0x00000002; | ||
108 | |||
109 | /* Set GPIO_A<3:1> to be outputs for PCMCIA/CF power controller: */ | ||
110 | sa1111_set_io_dir(dev, pin, 0, 0); | ||
111 | sa1111_set_io(dev, pin, 0); | ||
112 | sa1111_set_sleep_io(dev, pin, 0); | ||
113 | |||
114 | sa11xx_drv_pcmcia_ops(&jornada720_pcmcia_ops); | ||
115 | ret = sa1111_pcmcia_add(dev, &jornada720_pcmcia_ops, | ||
116 | sa11xx_drv_pcmcia_add_one); | ||
117 | } | ||
124 | 118 | ||
125 | return ret; | 119 | return ret; |
126 | } | 120 | } |
diff --git a/drivers/pcmcia/sa1100_neponset.c b/drivers/pcmcia/sa1100_neponset.c index 0c76d337815b..c95639b5f2a0 100644 --- a/drivers/pcmcia/sa1100_neponset.c +++ b/drivers/pcmcia/sa1100_neponset.c | |||
@@ -43,6 +43,7 @@ | |||
43 | static int | 43 | static int |
44 | neponset_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) | 44 | neponset_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) |
45 | { | 45 | { |
46 | struct sa1111_pcmcia_socket *s = to_skt(skt); | ||
46 | unsigned int ncr_mask, ncr_set, pa_dwr_mask, pa_dwr_set; | 47 | unsigned int ncr_mask, ncr_set, pa_dwr_mask, pa_dwr_set; |
47 | int ret; | 48 | int ret; |
48 | 49 | ||
@@ -99,7 +100,7 @@ neponset_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_sta | |||
99 | NCR_0 = (NCR_0 & ~ncr_mask) | ncr_set; | 100 | NCR_0 = (NCR_0 & ~ncr_mask) | ncr_set; |
100 | 101 | ||
101 | local_irq_restore(flags); | 102 | local_irq_restore(flags); |
102 | sa1111_set_io(SA1111_DEV(skt->dev), pa_dwr_mask, pa_dwr_set); | 103 | sa1111_set_io(s->dev, pa_dwr_mask, pa_dwr_set); |
103 | } | 104 | } |
104 | 105 | ||
105 | return 0; | 106 | return 0; |
@@ -115,12 +116,10 @@ static void neponset_pcmcia_socket_init(struct soc_pcmcia_socket *skt) | |||
115 | 116 | ||
116 | static struct pcmcia_low_level neponset_pcmcia_ops = { | 117 | static struct pcmcia_low_level neponset_pcmcia_ops = { |
117 | .owner = THIS_MODULE, | 118 | .owner = THIS_MODULE, |
118 | .hw_init = sa1111_pcmcia_hw_init, | ||
119 | .hw_shutdown = sa1111_pcmcia_hw_shutdown, | ||
120 | .socket_state = sa1111_pcmcia_socket_state, | ||
121 | .configure_socket = neponset_pcmcia_configure_socket, | 119 | .configure_socket = neponset_pcmcia_configure_socket, |
122 | .socket_init = neponset_pcmcia_socket_init, | 120 | .socket_init = neponset_pcmcia_socket_init, |
123 | .socket_suspend = sa1111_pcmcia_socket_suspend, | 121 | .first = 0, |
122 | .nr = 2, | ||
124 | }; | 123 | }; |
125 | 124 | ||
126 | int pcmcia_neponset_init(struct sa1111_dev *sadev) | 125 | int pcmcia_neponset_init(struct sa1111_dev *sadev) |
@@ -135,7 +134,9 @@ int pcmcia_neponset_init(struct sa1111_dev *sadev) | |||
135 | sa1111_set_io_dir(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0); | 134 | sa1111_set_io_dir(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0); |
136 | sa1111_set_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); | 135 | sa1111_set_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); |
137 | sa1111_set_sleep_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); | 136 | sa1111_set_sleep_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); |
138 | ret = sa11xx_drv_pcmcia_probe(&sadev->dev, &neponset_pcmcia_ops, 0, 2); | 137 | sa11xx_drv_pcmcia_ops(&neponset_pcmcia_ops); |
138 | ret = sa1111_pcmcia_add(sadev, &neponset_pcmcia_ops, | ||
139 | sa11xx_drv_pcmcia_add_one); | ||
139 | } | 140 | } |
140 | 141 | ||
141 | return ret; | 142 | return ret; |
diff --git a/drivers/pcmcia/sa1100_shannon.c b/drivers/pcmcia/sa1100_shannon.c index 46d8c1977c2a..c4d51867a050 100644 --- a/drivers/pcmcia/sa1100_shannon.c +++ b/drivers/pcmcia/sa1100_shannon.c | |||
@@ -28,7 +28,7 @@ static int shannon_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
28 | GAFR &= ~(SHANNON_GPIO_EJECT_0 | SHANNON_GPIO_EJECT_1 | | 28 | GAFR &= ~(SHANNON_GPIO_EJECT_0 | SHANNON_GPIO_EJECT_1 | |
29 | SHANNON_GPIO_RDY_0 | SHANNON_GPIO_RDY_1); | 29 | SHANNON_GPIO_RDY_0 | SHANNON_GPIO_RDY_1); |
30 | 30 | ||
31 | skt->irq = skt->nr ? SHANNON_IRQ_GPIO_RDY_1 : SHANNON_IRQ_GPIO_RDY_0; | 31 | skt->socket.pci_irq = skt->nr ? SHANNON_IRQ_GPIO_RDY_1 : SHANNON_IRQ_GPIO_RDY_0; |
32 | 32 | ||
33 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 33 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
34 | } | 34 | } |
diff --git a/drivers/pcmcia/sa1100_simpad.c b/drivers/pcmcia/sa1100_simpad.c index 33a08ae09fdf..05bd504e6f18 100644 --- a/drivers/pcmcia/sa1100_simpad.c +++ b/drivers/pcmcia/sa1100_simpad.c | |||
@@ -28,7 +28,7 @@ static int simpad_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
28 | 28 | ||
29 | clear_cs3_bit(VCC_3V_EN|VCC_5V_EN|EN0|EN1); | 29 | clear_cs3_bit(VCC_3V_EN|VCC_5V_EN|EN0|EN1); |
30 | 30 | ||
31 | skt->irq = IRQ_GPIO_CF_IRQ; | 31 | skt->socket.pci_irq = IRQ_GPIO_CF_IRQ; |
32 | 32 | ||
33 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 33 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
34 | } | 34 | } |
diff --git a/drivers/pcmcia/sa1111_generic.c b/drivers/pcmcia/sa1111_generic.c index 4be4e172ffa1..de6bc333d299 100644 --- a/drivers/pcmcia/sa1111_generic.c +++ b/drivers/pcmcia/sa1111_generic.c | |||
@@ -28,23 +28,20 @@ static struct pcmcia_irqs irqs[] = { | |||
28 | { 1, IRQ_S1_BVD1_STSCHG, "SA1111 CF BVD1" }, | 28 | { 1, IRQ_S1_BVD1_STSCHG, "SA1111 CF BVD1" }, |
29 | }; | 29 | }; |
30 | 30 | ||
31 | int sa1111_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | 31 | static int sa1111_pcmcia_hw_init(struct soc_pcmcia_socket *skt) |
32 | { | 32 | { |
33 | if (skt->irq == NO_IRQ) | ||
34 | skt->irq = skt->nr ? IRQ_S1_READY_NINT : IRQ_S0_READY_NINT; | ||
35 | |||
36 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 33 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
37 | } | 34 | } |
38 | 35 | ||
39 | void sa1111_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) | 36 | static void sa1111_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) |
40 | { | 37 | { |
41 | soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 38 | soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
42 | } | 39 | } |
43 | 40 | ||
44 | void sa1111_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state) | 41 | void sa1111_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state) |
45 | { | 42 | { |
46 | struct sa1111_dev *sadev = SA1111_DEV(skt->dev); | 43 | struct sa1111_pcmcia_socket *s = to_skt(skt); |
47 | unsigned long status = sa1111_readl(sadev->mapbase + SA1111_PCSR); | 44 | unsigned long status = sa1111_readl(s->dev->mapbase + SA1111_PCSR); |
48 | 45 | ||
49 | switch (skt->nr) { | 46 | switch (skt->nr) { |
50 | case 0: | 47 | case 0: |
@@ -71,7 +68,7 @@ void sa1111_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_sta | |||
71 | 68 | ||
72 | int sa1111_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) | 69 | int sa1111_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) |
73 | { | 70 | { |
74 | struct sa1111_dev *sadev = SA1111_DEV(skt->dev); | 71 | struct sa1111_pcmcia_socket *s = to_skt(skt); |
75 | unsigned int pccr_skt_mask, pccr_set_mask, val; | 72 | unsigned int pccr_skt_mask, pccr_set_mask, val; |
76 | unsigned long flags; | 73 | unsigned long flags; |
77 | 74 | ||
@@ -100,10 +97,10 @@ int sa1111_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_s | |||
100 | pccr_set_mask |= PCCR_S0_FLT|PCCR_S1_FLT; | 97 | pccr_set_mask |= PCCR_S0_FLT|PCCR_S1_FLT; |
101 | 98 | ||
102 | local_irq_save(flags); | 99 | local_irq_save(flags); |
103 | val = sa1111_readl(sadev->mapbase + SA1111_PCCR); | 100 | val = sa1111_readl(s->dev->mapbase + SA1111_PCCR); |
104 | val &= ~pccr_skt_mask; | 101 | val &= ~pccr_skt_mask; |
105 | val |= pccr_set_mask & pccr_skt_mask; | 102 | val |= pccr_set_mask & pccr_skt_mask; |
106 | sa1111_writel(val, sadev->mapbase + SA1111_PCCR); | 103 | sa1111_writel(val, s->dev->mapbase + SA1111_PCCR); |
107 | local_irq_restore(flags); | 104 | local_irq_restore(flags); |
108 | 105 | ||
109 | return 0; | 106 | return 0; |
@@ -114,15 +111,51 @@ void sa1111_pcmcia_socket_init(struct soc_pcmcia_socket *skt) | |||
114 | soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 111 | soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
115 | } | 112 | } |
116 | 113 | ||
117 | void sa1111_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) | 114 | static void sa1111_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) |
118 | { | 115 | { |
119 | soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 116 | soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
120 | } | 117 | } |
121 | 118 | ||
119 | int sa1111_pcmcia_add(struct sa1111_dev *dev, struct pcmcia_low_level *ops, | ||
120 | int (*add)(struct soc_pcmcia_socket *)) | ||
121 | { | ||
122 | struct sa1111_pcmcia_socket *s; | ||
123 | int i, ret = 0; | ||
124 | |||
125 | ops->hw_init = sa1111_pcmcia_hw_init; | ||
126 | ops->hw_shutdown = sa1111_pcmcia_hw_shutdown; | ||
127 | ops->socket_state = sa1111_pcmcia_socket_state; | ||
128 | ops->socket_suspend = sa1111_pcmcia_socket_suspend; | ||
129 | |||
130 | for (i = 0; i < ops->nr; i++) { | ||
131 | s = kzalloc(sizeof(*s), GFP_KERNEL); | ||
132 | if (!s) | ||
133 | return -ENOMEM; | ||
134 | |||
135 | s->soc.nr = ops->first + i; | ||
136 | s->soc.ops = ops; | ||
137 | s->soc.socket.owner = ops->owner; | ||
138 | s->soc.socket.dev.parent = &dev->dev; | ||
139 | s->soc.socket.pci_irq = s->soc.nr ? IRQ_S1_READY_NINT : IRQ_S0_READY_NINT; | ||
140 | s->dev = dev; | ||
141 | |||
142 | ret = add(&s->soc); | ||
143 | if (ret == 0) { | ||
144 | s->next = dev_get_drvdata(&dev->dev); | ||
145 | dev_set_drvdata(&dev->dev, s); | ||
146 | } else | ||
147 | kfree(s); | ||
148 | } | ||
149 | |||
150 | return ret; | ||
151 | } | ||
152 | |||
122 | static int pcmcia_probe(struct sa1111_dev *dev) | 153 | static int pcmcia_probe(struct sa1111_dev *dev) |
123 | { | 154 | { |
124 | void __iomem *base; | 155 | void __iomem *base; |
125 | 156 | ||
157 | dev_set_drvdata(&dev->dev, NULL); | ||
158 | |||
126 | if (!request_mem_region(dev->res.start, 512, | 159 | if (!request_mem_region(dev->res.start, 512, |
127 | SA1111_DRIVER_NAME(dev))) | 160 | SA1111_DRIVER_NAME(dev))) |
128 | return -EBUSY; | 161 | return -EBUSY; |
@@ -152,7 +185,15 @@ static int pcmcia_probe(struct sa1111_dev *dev) | |||
152 | 185 | ||
153 | static int __devexit pcmcia_remove(struct sa1111_dev *dev) | 186 | static int __devexit pcmcia_remove(struct sa1111_dev *dev) |
154 | { | 187 | { |
155 | soc_common_drv_pcmcia_remove(&dev->dev); | 188 | struct sa1111_pcmcia_socket *next, *s = dev_get_drvdata(&dev->dev); |
189 | |||
190 | dev_set_drvdata(&dev->dev, NULL); | ||
191 | |||
192 | for (; next = s->next, s; s = next) { | ||
193 | soc_pcmcia_remove_one(&s->soc); | ||
194 | kfree(s); | ||
195 | } | ||
196 | |||
156 | release_mem_region(dev->res.start, 512); | 197 | release_mem_region(dev->res.start, 512); |
157 | return 0; | 198 | return 0; |
158 | } | 199 | } |
diff --git a/drivers/pcmcia/sa1111_generic.h b/drivers/pcmcia/sa1111_generic.h index 10ced4a210d7..02dc8577cdaf 100644 --- a/drivers/pcmcia/sa1111_generic.h +++ b/drivers/pcmcia/sa1111_generic.h | |||
@@ -1,12 +1,23 @@ | |||
1 | #include "soc_common.h" | 1 | #include "soc_common.h" |
2 | #include "sa11xx_base.h" | 2 | #include "sa11xx_base.h" |
3 | 3 | ||
4 | extern int sa1111_pcmcia_hw_init(struct soc_pcmcia_socket *); | 4 | struct sa1111_pcmcia_socket { |
5 | extern void sa1111_pcmcia_hw_shutdown(struct soc_pcmcia_socket *); | 5 | struct soc_pcmcia_socket soc; |
6 | struct sa1111_dev *dev; | ||
7 | struct sa1111_pcmcia_socket *next; | ||
8 | }; | ||
9 | |||
10 | static inline struct sa1111_pcmcia_socket *to_skt(struct soc_pcmcia_socket *s) | ||
11 | { | ||
12 | return container_of(s, struct sa1111_pcmcia_socket, soc); | ||
13 | } | ||
14 | |||
15 | int sa1111_pcmcia_add(struct sa1111_dev *dev, struct pcmcia_low_level *ops, | ||
16 | int (*add)(struct soc_pcmcia_socket *)); | ||
17 | |||
6 | extern void sa1111_pcmcia_socket_state(struct soc_pcmcia_socket *, struct pcmcia_state *); | 18 | extern void sa1111_pcmcia_socket_state(struct soc_pcmcia_socket *, struct pcmcia_state *); |
7 | extern int sa1111_pcmcia_configure_socket(struct soc_pcmcia_socket *, const socket_state_t *); | 19 | extern int sa1111_pcmcia_configure_socket(struct soc_pcmcia_socket *, const socket_state_t *); |
8 | extern void sa1111_pcmcia_socket_init(struct soc_pcmcia_socket *); | 20 | extern void sa1111_pcmcia_socket_init(struct soc_pcmcia_socket *); |
9 | extern void sa1111_pcmcia_socket_suspend(struct soc_pcmcia_socket *); | ||
10 | 21 | ||
11 | extern int pcmcia_badge4_init(struct device *); | 22 | extern int pcmcia_badge4_init(struct device *); |
12 | extern int pcmcia_jornada720_init(struct device *); | 23 | extern int pcmcia_jornada720_init(struct device *); |
diff --git a/drivers/pcmcia/sa11xx_base.c b/drivers/pcmcia/sa11xx_base.c index e15d59f2d8a9..fc9a6527019b 100644 --- a/drivers/pcmcia/sa11xx_base.c +++ b/drivers/pcmcia/sa11xx_base.c | |||
@@ -171,12 +171,58 @@ static const char *skt_names[] = { | |||
171 | #define SKT_DEV_INFO_SIZE(n) \ | 171 | #define SKT_DEV_INFO_SIZE(n) \ |
172 | (sizeof(struct skt_dev_info) + (n)*sizeof(struct soc_pcmcia_socket)) | 172 | (sizeof(struct skt_dev_info) + (n)*sizeof(struct soc_pcmcia_socket)) |
173 | 173 | ||
174 | int sa11xx_drv_pcmcia_add_one(struct soc_pcmcia_socket *skt) | ||
175 | { | ||
176 | skt->res_skt.start = _PCMCIA(skt->nr); | ||
177 | skt->res_skt.end = _PCMCIA(skt->nr) + PCMCIASp - 1; | ||
178 | skt->res_skt.name = skt_names[skt->nr]; | ||
179 | skt->res_skt.flags = IORESOURCE_MEM; | ||
180 | |||
181 | skt->res_io.start = _PCMCIAIO(skt->nr); | ||
182 | skt->res_io.end = _PCMCIAIO(skt->nr) + PCMCIAIOSp - 1; | ||
183 | skt->res_io.name = "io"; | ||
184 | skt->res_io.flags = IORESOURCE_MEM | IORESOURCE_BUSY; | ||
185 | |||
186 | skt->res_mem.start = _PCMCIAMem(skt->nr); | ||
187 | skt->res_mem.end = _PCMCIAMem(skt->nr) + PCMCIAMemSp - 1; | ||
188 | skt->res_mem.name = "memory"; | ||
189 | skt->res_mem.flags = IORESOURCE_MEM; | ||
190 | |||
191 | skt->res_attr.start = _PCMCIAAttr(skt->nr); | ||
192 | skt->res_attr.end = _PCMCIAAttr(skt->nr) + PCMCIAAttrSp - 1; | ||
193 | skt->res_attr.name = "attribute"; | ||
194 | skt->res_attr.flags = IORESOURCE_MEM; | ||
195 | |||
196 | return soc_pcmcia_add_one(skt); | ||
197 | } | ||
198 | EXPORT_SYMBOL(sa11xx_drv_pcmcia_add_one); | ||
199 | |||
200 | void sa11xx_drv_pcmcia_ops(struct pcmcia_low_level *ops) | ||
201 | { | ||
202 | /* | ||
203 | * set default MECR calculation if the board specific | ||
204 | * code did not specify one... | ||
205 | */ | ||
206 | if (!ops->get_timing) | ||
207 | ops->get_timing = sa1100_pcmcia_default_mecr_timing; | ||
208 | |||
209 | /* Provide our SA11x0 specific timing routines. */ | ||
210 | ops->set_timing = sa1100_pcmcia_set_timing; | ||
211 | ops->show_timing = sa1100_pcmcia_show_timing; | ||
212 | #ifdef CONFIG_CPU_FREQ | ||
213 | ops->frequency_change = sa1100_pcmcia_frequency_change; | ||
214 | #endif | ||
215 | } | ||
216 | EXPORT_SYMBOL(sa11xx_drv_pcmcia_ops); | ||
217 | |||
174 | int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, | 218 | int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, |
175 | int first, int nr) | 219 | int first, int nr) |
176 | { | 220 | { |
177 | struct skt_dev_info *sinfo; | 221 | struct skt_dev_info *sinfo; |
178 | struct soc_pcmcia_socket *skt; | 222 | struct soc_pcmcia_socket *skt; |
179 | int i; | 223 | int i, ret = 0; |
224 | |||
225 | sa11xx_drv_pcmcia_ops(ops); | ||
180 | 226 | ||
181 | sinfo = kzalloc(SKT_DEV_INFO_SIZE(nr), GFP_KERNEL); | 227 | sinfo = kzalloc(SKT_DEV_INFO_SIZE(nr), GFP_KERNEL); |
182 | if (!sinfo) | 228 | if (!sinfo) |
@@ -188,45 +234,26 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, | |||
188 | for (i = 0; i < nr; i++) { | 234 | for (i = 0; i < nr; i++) { |
189 | skt = &sinfo->skt[i]; | 235 | skt = &sinfo->skt[i]; |
190 | 236 | ||
191 | skt->nr = first + i; | 237 | skt->nr = first + i; |
192 | skt->irq = NO_IRQ; | 238 | skt->ops = ops; |
193 | 239 | skt->socket.owner = ops->owner; | |
194 | skt->res_skt.start = _PCMCIA(skt->nr); | 240 | skt->socket.dev.parent = dev; |
195 | skt->res_skt.end = _PCMCIA(skt->nr) + PCMCIASp - 1; | 241 | skt->socket.pci_irq = NO_IRQ; |
196 | skt->res_skt.name = skt_names[skt->nr]; | ||
197 | skt->res_skt.flags = IORESOURCE_MEM; | ||
198 | |||
199 | skt->res_io.start = _PCMCIAIO(skt->nr); | ||
200 | skt->res_io.end = _PCMCIAIO(skt->nr) + PCMCIAIOSp - 1; | ||
201 | skt->res_io.name = "io"; | ||
202 | skt->res_io.flags = IORESOURCE_MEM | IORESOURCE_BUSY; | ||
203 | 242 | ||
204 | skt->res_mem.start = _PCMCIAMem(skt->nr); | 243 | ret = sa11xx_drv_pcmcia_add_one(skt); |
205 | skt->res_mem.end = _PCMCIAMem(skt->nr) + PCMCIAMemSp - 1; | 244 | if (ret) |
206 | skt->res_mem.name = "memory"; | 245 | break; |
207 | skt->res_mem.flags = IORESOURCE_MEM; | ||
208 | |||
209 | skt->res_attr.start = _PCMCIAAttr(skt->nr); | ||
210 | skt->res_attr.end = _PCMCIAAttr(skt->nr) + PCMCIAAttrSp - 1; | ||
211 | skt->res_attr.name = "attribute"; | ||
212 | skt->res_attr.flags = IORESOURCE_MEM; | ||
213 | } | 246 | } |
214 | 247 | ||
215 | /* | 248 | if (ret) { |
216 | * set default MECR calculation if the board specific | 249 | while (--i >= 0) |
217 | * code did not specify one... | 250 | soc_pcmcia_remove_one(&sinfo->skt[i]); |
218 | */ | 251 | kfree(sinfo); |
219 | if (!ops->get_timing) | 252 | } else { |
220 | ops->get_timing = sa1100_pcmcia_default_mecr_timing; | 253 | dev_set_drvdata(dev, sinfo); |
221 | 254 | } | |
222 | /* Provide our SA11x0 specific timing routines. */ | ||
223 | ops->set_timing = sa1100_pcmcia_set_timing; | ||
224 | ops->show_timing = sa1100_pcmcia_show_timing; | ||
225 | #ifdef CONFIG_CPU_FREQ | ||
226 | ops->frequency_change = sa1100_pcmcia_frequency_change; | ||
227 | #endif | ||
228 | 255 | ||
229 | return soc_common_drv_pcmcia_probe(dev, ops, sinfo); | 256 | return ret; |
230 | } | 257 | } |
231 | EXPORT_SYMBOL(sa11xx_drv_pcmcia_probe); | 258 | EXPORT_SYMBOL(sa11xx_drv_pcmcia_probe); |
232 | 259 | ||
diff --git a/drivers/pcmcia/sa11xx_base.h b/drivers/pcmcia/sa11xx_base.h index 7bc208280527..3d76d720f463 100644 --- a/drivers/pcmcia/sa11xx_base.h +++ b/drivers/pcmcia/sa11xx_base.h | |||
@@ -118,6 +118,8 @@ static inline unsigned int sa1100_pcmcia_cmd_time(unsigned int cpu_clock_khz, | |||
118 | } | 118 | } |
119 | 119 | ||
120 | 120 | ||
121 | int sa11xx_drv_pcmcia_add_one(struct soc_pcmcia_socket *skt); | ||
122 | void sa11xx_drv_pcmcia_ops(struct pcmcia_low_level *ops); | ||
121 | extern int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr); | 123 | extern int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr); |
122 | 124 | ||
123 | #endif /* !defined(_PCMCIA_SA1100_H) */ | 125 | #endif /* !defined(_PCMCIA_SA1100_H) */ |
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c index ef7e9e58782b..6f1a86b43c60 100644 --- a/drivers/pcmcia/soc_common.c +++ b/drivers/pcmcia/soc_common.c | |||
@@ -144,10 +144,10 @@ soc_common_pcmcia_config_skt(struct soc_pcmcia_socket *skt, socket_state_t *stat | |||
144 | */ | 144 | */ |
145 | if (skt->irq_state != 1 && state->io_irq) { | 145 | if (skt->irq_state != 1 && state->io_irq) { |
146 | skt->irq_state = 1; | 146 | skt->irq_state = 1; |
147 | set_irq_type(skt->irq, IRQ_TYPE_EDGE_FALLING); | 147 | set_irq_type(skt->socket.pci_irq, IRQ_TYPE_EDGE_FALLING); |
148 | } else if (skt->irq_state == 1 && state->io_irq == 0) { | 148 | } else if (skt->irq_state == 1 && state->io_irq == 0) { |
149 | skt->irq_state = 0; | 149 | skt->irq_state = 0; |
150 | set_irq_type(skt->irq, IRQ_TYPE_NONE); | 150 | set_irq_type(skt->socket.pci_irq, IRQ_TYPE_NONE); |
151 | } | 151 | } |
152 | 152 | ||
153 | skt->cs_state = *state; | 153 | skt->cs_state = *state; |
@@ -492,7 +492,8 @@ static ssize_t show_status(struct device *dev, struct device_attribute *attr, ch | |||
492 | 492 | ||
493 | p+=sprintf(p, "Vcc : %d\n", skt->cs_state.Vcc); | 493 | p+=sprintf(p, "Vcc : %d\n", skt->cs_state.Vcc); |
494 | p+=sprintf(p, "Vpp : %d\n", skt->cs_state.Vpp); | 494 | p+=sprintf(p, "Vpp : %d\n", skt->cs_state.Vpp); |
495 | p+=sprintf(p, "IRQ : %d (%d)\n", skt->cs_state.io_irq, skt->irq); | 495 | p+=sprintf(p, "IRQ : %d (%d)\n", skt->cs_state.io_irq, |
496 | skt->socket.pci_irq); | ||
496 | if (skt->ops->show_timing) | 497 | if (skt->ops->show_timing) |
497 | p+=skt->ops->show_timing(skt, p); | 498 | p+=skt->ops->show_timing(skt, p); |
498 | 499 | ||
@@ -574,7 +575,7 @@ void soc_pcmcia_enable_irqs(struct soc_pcmcia_socket *skt, | |||
574 | EXPORT_SYMBOL(soc_pcmcia_enable_irqs); | 575 | EXPORT_SYMBOL(soc_pcmcia_enable_irqs); |
575 | 576 | ||
576 | 577 | ||
577 | LIST_HEAD(soc_pcmcia_sockets); | 578 | static LIST_HEAD(soc_pcmcia_sockets); |
578 | static DEFINE_MUTEX(soc_pcmcia_sockets_lock); | 579 | static DEFINE_MUTEX(soc_pcmcia_sockets_lock); |
579 | 580 | ||
580 | #ifdef CONFIG_CPU_FREQ | 581 | #ifdef CONFIG_CPU_FREQ |
@@ -609,177 +610,137 @@ static int soc_pcmcia_cpufreq_register(void) | |||
609 | "notifier for PCMCIA (%d)\n", ret); | 610 | "notifier for PCMCIA (%d)\n", ret); |
610 | return ret; | 611 | return ret; |
611 | } | 612 | } |
613 | fs_initcall(soc_pcmcia_cpufreq_register); | ||
612 | 614 | ||
613 | static void soc_pcmcia_cpufreq_unregister(void) | 615 | static void soc_pcmcia_cpufreq_unregister(void) |
614 | { | 616 | { |
615 | cpufreq_unregister_notifier(&soc_pcmcia_notifier_block, CPUFREQ_TRANSITION_NOTIFIER); | 617 | cpufreq_unregister_notifier(&soc_pcmcia_notifier_block, CPUFREQ_TRANSITION_NOTIFIER); |
616 | } | 618 | } |
619 | module_exit(soc_pcmcia_cpufreq_unregister); | ||
617 | 620 | ||
618 | #else | ||
619 | static int soc_pcmcia_cpufreq_register(void) { return 0; } | ||
620 | static void soc_pcmcia_cpufreq_unregister(void) {} | ||
621 | #endif | 621 | #endif |
622 | 622 | ||
623 | int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, | 623 | void soc_pcmcia_remove_one(struct soc_pcmcia_socket *skt) |
624 | struct skt_dev_info *sinfo) | ||
625 | { | 624 | { |
626 | struct soc_pcmcia_socket *skt; | ||
627 | int ret, i; | ||
628 | |||
629 | mutex_lock(&soc_pcmcia_sockets_lock); | 625 | mutex_lock(&soc_pcmcia_sockets_lock); |
626 | del_timer_sync(&skt->poll_timer); | ||
630 | 627 | ||
631 | /* | 628 | pcmcia_unregister_socket(&skt->socket); |
632 | * Initialise the per-socket structure. | ||
633 | */ | ||
634 | for (i = 0; i < sinfo->nskt; i++) { | ||
635 | skt = &sinfo->skt[i]; | ||
636 | 629 | ||
637 | skt->socket.ops = &soc_common_pcmcia_operations; | 630 | flush_scheduled_work(); |
638 | skt->socket.owner = ops->owner; | ||
639 | skt->socket.dev.parent = dev; | ||
640 | 631 | ||
641 | init_timer(&skt->poll_timer); | 632 | skt->ops->hw_shutdown(skt); |
642 | skt->poll_timer.function = soc_common_pcmcia_poll_event; | ||
643 | skt->poll_timer.data = (unsigned long)skt; | ||
644 | skt->poll_timer.expires = jiffies + SOC_PCMCIA_POLL_PERIOD; | ||
645 | 633 | ||
646 | skt->dev = dev; | 634 | soc_common_pcmcia_config_skt(skt, &dead_socket); |
647 | skt->ops = ops; | ||
648 | 635 | ||
649 | ret = request_resource(&iomem_resource, &skt->res_skt); | 636 | list_del(&skt->node); |
650 | if (ret) | 637 | mutex_unlock(&soc_pcmcia_sockets_lock); |
651 | goto out_err_1; | ||
652 | 638 | ||
653 | ret = request_resource(&skt->res_skt, &skt->res_io); | 639 | iounmap(skt->virt_io); |
654 | if (ret) | 640 | skt->virt_io = NULL; |
655 | goto out_err_2; | 641 | release_resource(&skt->res_attr); |
642 | release_resource(&skt->res_mem); | ||
643 | release_resource(&skt->res_io); | ||
644 | release_resource(&skt->res_skt); | ||
645 | } | ||
646 | EXPORT_SYMBOL(soc_pcmcia_remove_one); | ||
656 | 647 | ||
657 | ret = request_resource(&skt->res_skt, &skt->res_mem); | 648 | int soc_pcmcia_add_one(struct soc_pcmcia_socket *skt) |
658 | if (ret) | 649 | { |
659 | goto out_err_3; | 650 | int ret; |
660 | 651 | ||
661 | ret = request_resource(&skt->res_skt, &skt->res_attr); | 652 | init_timer(&skt->poll_timer); |
662 | if (ret) | 653 | skt->poll_timer.function = soc_common_pcmcia_poll_event; |
663 | goto out_err_4; | 654 | skt->poll_timer.data = (unsigned long)skt; |
655 | skt->poll_timer.expires = jiffies + SOC_PCMCIA_POLL_PERIOD; | ||
664 | 656 | ||
665 | skt->virt_io = ioremap(skt->res_io.start, 0x10000); | 657 | ret = request_resource(&iomem_resource, &skt->res_skt); |
666 | if (skt->virt_io == NULL) { | 658 | if (ret) |
667 | ret = -ENOMEM; | 659 | goto out_err_1; |
668 | goto out_err_5; | ||
669 | } | ||
670 | 660 | ||
671 | if (list_empty(&soc_pcmcia_sockets)) | 661 | ret = request_resource(&skt->res_skt, &skt->res_io); |
672 | soc_pcmcia_cpufreq_register(); | 662 | if (ret) |
663 | goto out_err_2; | ||
673 | 664 | ||
674 | list_add(&skt->node, &soc_pcmcia_sockets); | 665 | ret = request_resource(&skt->res_skt, &skt->res_mem); |
666 | if (ret) | ||
667 | goto out_err_3; | ||
675 | 668 | ||
676 | /* | 669 | ret = request_resource(&skt->res_skt, &skt->res_attr); |
677 | * We initialize default socket timing here, because | 670 | if (ret) |
678 | * we are not guaranteed to see a SetIOMap operation at | 671 | goto out_err_4; |
679 | * runtime. | ||
680 | */ | ||
681 | ops->set_timing(skt); | ||
682 | 672 | ||
683 | ret = ops->hw_init(skt); | 673 | skt->virt_io = ioremap(skt->res_io.start, 0x10000); |
684 | if (ret) | 674 | if (skt->virt_io == NULL) { |
685 | goto out_err_6; | 675 | ret = -ENOMEM; |
676 | goto out_err_5; | ||
677 | } | ||
686 | 678 | ||
687 | skt->socket.features = SS_CAP_STATIC_MAP|SS_CAP_PCCARD; | 679 | mutex_lock(&soc_pcmcia_sockets_lock); |
688 | skt->socket.resource_ops = &pccard_static_ops; | ||
689 | skt->socket.irq_mask = 0; | ||
690 | skt->socket.map_size = PAGE_SIZE; | ||
691 | skt->socket.pci_irq = skt->irq; | ||
692 | skt->socket.io_offset = (unsigned long)skt->virt_io; | ||
693 | 680 | ||
694 | skt->status = soc_common_pcmcia_skt_state(skt); | 681 | list_add(&skt->node, &soc_pcmcia_sockets); |
695 | 682 | ||
696 | ret = pcmcia_register_socket(&skt->socket); | 683 | /* |
697 | if (ret) | 684 | * We initialize default socket timing here, because |
698 | goto out_err_7; | 685 | * we are not guaranteed to see a SetIOMap operation at |
686 | * runtime. | ||
687 | */ | ||
688 | skt->ops->set_timing(skt); | ||
699 | 689 | ||
700 | WARN_ON(skt->socket.sock != i); | 690 | ret = skt->ops->hw_init(skt); |
691 | if (ret) | ||
692 | goto out_err_6; | ||
701 | 693 | ||
702 | add_timer(&skt->poll_timer); | 694 | skt->socket.ops = &soc_common_pcmcia_operations; |
695 | skt->socket.features = SS_CAP_STATIC_MAP|SS_CAP_PCCARD; | ||
696 | skt->socket.resource_ops = &pccard_static_ops; | ||
697 | skt->socket.irq_mask = 0; | ||
698 | skt->socket.map_size = PAGE_SIZE; | ||
699 | skt->socket.io_offset = (unsigned long)skt->virt_io; | ||
703 | 700 | ||
704 | ret = device_create_file(&skt->socket.dev, &dev_attr_status); | 701 | skt->status = soc_common_pcmcia_skt_state(skt); |
705 | if (ret) | ||
706 | goto out_err_8; | ||
707 | } | ||
708 | 702 | ||
709 | dev_set_drvdata(dev, sinfo); | 703 | ret = pcmcia_register_socket(&skt->socket); |
710 | ret = 0; | 704 | if (ret) |
711 | goto out; | 705 | goto out_err_7; |
712 | 706 | ||
713 | do { | 707 | add_timer(&skt->poll_timer); |
714 | skt = &sinfo->skt[i]; | 708 | |
709 | mutex_unlock(&soc_pcmcia_sockets_lock); | ||
710 | |||
711 | ret = device_create_file(&skt->socket.dev, &dev_attr_status); | ||
712 | if (ret) | ||
713 | goto out_err_8; | ||
714 | |||
715 | return ret; | ||
715 | 716 | ||
716 | device_remove_file(&skt->socket.dev, &dev_attr_status); | ||
717 | out_err_8: | 717 | out_err_8: |
718 | del_timer_sync(&skt->poll_timer); | 718 | mutex_lock(&soc_pcmcia_sockets_lock); |
719 | pcmcia_unregister_socket(&skt->socket); | 719 | del_timer_sync(&skt->poll_timer); |
720 | pcmcia_unregister_socket(&skt->socket); | ||
720 | 721 | ||
721 | out_err_7: | 722 | out_err_7: |
722 | flush_scheduled_work(); | 723 | flush_scheduled_work(); |
723 | 724 | ||
724 | ops->hw_shutdown(skt); | 725 | skt->ops->hw_shutdown(skt); |
725 | out_err_6: | 726 | out_err_6: |
726 | list_del(&skt->node); | 727 | list_del(&skt->node); |
727 | iounmap(skt->virt_io); | 728 | mutex_unlock(&soc_pcmcia_sockets_lock); |
729 | iounmap(skt->virt_io); | ||
728 | out_err_5: | 730 | out_err_5: |
729 | release_resource(&skt->res_attr); | 731 | release_resource(&skt->res_attr); |
730 | out_err_4: | 732 | out_err_4: |
731 | release_resource(&skt->res_mem); | 733 | release_resource(&skt->res_mem); |
732 | out_err_3: | 734 | out_err_3: |
733 | release_resource(&skt->res_io); | 735 | release_resource(&skt->res_io); |
734 | out_err_2: | 736 | out_err_2: |
735 | release_resource(&skt->res_skt); | 737 | release_resource(&skt->res_skt); |
736 | out_err_1: | 738 | out_err_1: |
737 | i--; | ||
738 | } while (i > 0); | ||
739 | 739 | ||
740 | kfree(sinfo); | ||
741 | |||
742 | out: | ||
743 | mutex_unlock(&soc_pcmcia_sockets_lock); | ||
744 | return ret; | 740 | return ret; |
745 | } | 741 | } |
742 | EXPORT_SYMBOL(soc_pcmcia_add_one); | ||
746 | 743 | ||
747 | int soc_common_drv_pcmcia_remove(struct device *dev) | 744 | MODULE_AUTHOR("John Dorsey <john+@cs.cmu.edu>"); |
748 | { | 745 | MODULE_DESCRIPTION("Linux PCMCIA Card Services: Common SoC support"); |
749 | struct skt_dev_info *sinfo = dev_get_drvdata(dev); | 746 | MODULE_LICENSE("Dual MPL/GPL"); |
750 | int i; | ||
751 | |||
752 | dev_set_drvdata(dev, NULL); | ||
753 | |||
754 | mutex_lock(&soc_pcmcia_sockets_lock); | ||
755 | for (i = 0; i < sinfo->nskt; i++) { | ||
756 | struct soc_pcmcia_socket *skt = &sinfo->skt[i]; | ||
757 | |||
758 | del_timer_sync(&skt->poll_timer); | ||
759 | |||
760 | pcmcia_unregister_socket(&skt->socket); | ||
761 | |||
762 | flush_scheduled_work(); | ||
763 | |||
764 | skt->ops->hw_shutdown(skt); | ||
765 | |||
766 | soc_common_pcmcia_config_skt(skt, &dead_socket); | ||
767 | |||
768 | list_del(&skt->node); | ||
769 | iounmap(skt->virt_io); | ||
770 | skt->virt_io = NULL; | ||
771 | release_resource(&skt->res_attr); | ||
772 | release_resource(&skt->res_mem); | ||
773 | release_resource(&skt->res_io); | ||
774 | release_resource(&skt->res_skt); | ||
775 | } | ||
776 | if (list_empty(&soc_pcmcia_sockets)) | ||
777 | soc_pcmcia_cpufreq_unregister(); | ||
778 | |||
779 | mutex_unlock(&soc_pcmcia_sockets_lock); | ||
780 | |||
781 | kfree(sinfo); | ||
782 | |||
783 | return 0; | ||
784 | } | ||
785 | EXPORT_SYMBOL(soc_common_drv_pcmcia_remove); | ||
diff --git a/drivers/pcmcia/soc_common.h b/drivers/pcmcia/soc_common.h index 290e143839ee..e40824ce6b0b 100644 --- a/drivers/pcmcia/soc_common.h +++ b/drivers/pcmcia/soc_common.h | |||
@@ -30,14 +30,12 @@ struct soc_pcmcia_socket { | |||
30 | /* | 30 | /* |
31 | * Info from low level handler | 31 | * Info from low level handler |
32 | */ | 32 | */ |
33 | struct device *dev; | ||
34 | unsigned int nr; | 33 | unsigned int nr; |
35 | unsigned int irq; | ||
36 | 34 | ||
37 | /* | 35 | /* |
38 | * Core PCMCIA state | 36 | * Core PCMCIA state |
39 | */ | 37 | */ |
40 | struct pcmcia_low_level *ops; | 38 | const struct pcmcia_low_level *ops; |
41 | 39 | ||
42 | unsigned int status; | 40 | unsigned int status; |
43 | socket_state_t cs_state; | 41 | socket_state_t cs_state; |
@@ -135,10 +133,8 @@ extern void soc_pcmcia_enable_irqs(struct soc_pcmcia_socket *skt, struct pcmcia_ | |||
135 | extern void soc_common_pcmcia_get_timing(struct soc_pcmcia_socket *, struct soc_pcmcia_timing *); | 133 | extern void soc_common_pcmcia_get_timing(struct soc_pcmcia_socket *, struct soc_pcmcia_timing *); |
136 | 134 | ||
137 | 135 | ||
138 | extern struct list_head soc_pcmcia_sockets; | 136 | void soc_pcmcia_remove_one(struct soc_pcmcia_socket *skt); |
139 | 137 | int soc_pcmcia_add_one(struct soc_pcmcia_socket *skt); | |
140 | extern int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, struct skt_dev_info *sinfo); | ||
141 | extern int soc_common_drv_pcmcia_remove(struct device *dev); | ||
142 | 138 | ||
143 | 139 | ||
144 | #ifdef CONFIG_PCMCIA_DEBUG | 140 | #ifdef CONFIG_PCMCIA_DEBUG |
diff --git a/drivers/pcmcia/tcic.c b/drivers/pcmcia/tcic.c index 6918849d511e..12c49ee135e1 100644 --- a/drivers/pcmcia/tcic.c +++ b/drivers/pcmcia/tcic.c | |||
@@ -55,21 +55,6 @@ | |||
55 | #include <pcmcia/ss.h> | 55 | #include <pcmcia/ss.h> |
56 | #include "tcic.h" | 56 | #include "tcic.h" |
57 | 57 | ||
58 | #ifdef CONFIG_PCMCIA_DEBUG | ||
59 | static int pc_debug; | ||
60 | |||
61 | module_param(pc_debug, int, 0644); | ||
62 | static const char version[] = | ||
63 | "tcic.c 1.111 2000/02/15 04:13:12 (David Hinds)"; | ||
64 | |||
65 | #define debug(lvl, fmt, arg...) do { \ | ||
66 | if (pc_debug > (lvl)) \ | ||
67 | printk(KERN_DEBUG "tcic: " fmt , ## arg); \ | ||
68 | } while (0) | ||
69 | #else | ||
70 | #define debug(lvl, fmt, arg...) do { } while (0) | ||
71 | #endif | ||
72 | |||
73 | MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>"); | 58 | MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>"); |
74 | MODULE_DESCRIPTION("Databook TCIC-2 PCMCIA socket driver"); | 59 | MODULE_DESCRIPTION("Databook TCIC-2 PCMCIA socket driver"); |
75 | MODULE_LICENSE("Dual MPL/GPL"); | 60 | MODULE_LICENSE("Dual MPL/GPL"); |
@@ -574,7 +559,7 @@ static irqreturn_t tcic_interrupt(int irq, void *dev) | |||
574 | } else | 559 | } else |
575 | active = 1; | 560 | active = 1; |
576 | 561 | ||
577 | debug(2, "tcic_interrupt()\n"); | 562 | pr_debug("tcic_interrupt()\n"); |
578 | 563 | ||
579 | for (i = 0; i < sockets; i++) { | 564 | for (i = 0; i < sockets; i++) { |
580 | psock = socket_table[i].psock; | 565 | psock = socket_table[i].psock; |
@@ -611,13 +596,13 @@ static irqreturn_t tcic_interrupt(int irq, void *dev) | |||
611 | } | 596 | } |
612 | active = 0; | 597 | active = 0; |
613 | 598 | ||
614 | debug(2, "interrupt done\n"); | 599 | pr_debug("interrupt done\n"); |
615 | return IRQ_HANDLED; | 600 | return IRQ_HANDLED; |
616 | } /* tcic_interrupt */ | 601 | } /* tcic_interrupt */ |
617 | 602 | ||
618 | static void tcic_timer(u_long data) | 603 | static void tcic_timer(u_long data) |
619 | { | 604 | { |
620 | debug(2, "tcic_timer()\n"); | 605 | pr_debug("tcic_timer()\n"); |
621 | tcic_timer_pending = 0; | 606 | tcic_timer_pending = 0; |
622 | tcic_interrupt(0, NULL); | 607 | tcic_interrupt(0, NULL); |
623 | } /* tcic_timer */ | 608 | } /* tcic_timer */ |
@@ -644,7 +629,7 @@ static int tcic_get_status(struct pcmcia_socket *sock, u_int *value) | |||
644 | reg = tcic_getb(TCIC_PWR); | 629 | reg = tcic_getb(TCIC_PWR); |
645 | if (reg & (TCIC_PWR_VCC(psock)|TCIC_PWR_VPP(psock))) | 630 | if (reg & (TCIC_PWR_VCC(psock)|TCIC_PWR_VPP(psock))) |
646 | *value |= SS_POWERON; | 631 | *value |= SS_POWERON; |
647 | debug(1, "GetStatus(%d) = %#2.2x\n", psock, *value); | 632 | dev_dbg(&sock->dev, "GetStatus(%d) = %#2.2x\n", psock, *value); |
648 | return 0; | 633 | return 0; |
649 | } /* tcic_get_status */ | 634 | } /* tcic_get_status */ |
650 | 635 | ||
@@ -656,7 +641,7 @@ static int tcic_set_socket(struct pcmcia_socket *sock, socket_state_t *state) | |||
656 | u_char reg; | 641 | u_char reg; |
657 | u_short scf1, scf2; | 642 | u_short scf1, scf2; |
658 | 643 | ||
659 | debug(1, "SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " | 644 | dev_dbg(&sock->dev, "SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " |
660 | "io_irq %d, csc_mask %#2.2x)\n", psock, state->flags, | 645 | "io_irq %d, csc_mask %#2.2x)\n", psock, state->flags, |
661 | state->Vcc, state->Vpp, state->io_irq, state->csc_mask); | 646 | state->Vcc, state->Vpp, state->io_irq, state->csc_mask); |
662 | tcic_setw(TCIC_ADDR+2, (psock << TCIC_SS_SHFT) | TCIC_ADR2_INDREG); | 647 | tcic_setw(TCIC_ADDR+2, (psock << TCIC_SS_SHFT) | TCIC_ADR2_INDREG); |
@@ -731,7 +716,7 @@ static int tcic_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io) | |||
731 | u_int addr; | 716 | u_int addr; |
732 | u_short base, len, ioctl; | 717 | u_short base, len, ioctl; |
733 | 718 | ||
734 | debug(1, "SetIOMap(%d, %d, %#2.2x, %d ns, " | 719 | dev_dbg(&sock->dev, "SetIOMap(%d, %d, %#2.2x, %d ns, " |
735 | "%#llx-%#llx)\n", psock, io->map, io->flags, io->speed, | 720 | "%#llx-%#llx)\n", psock, io->map, io->flags, io->speed, |
736 | (unsigned long long)io->start, (unsigned long long)io->stop); | 721 | (unsigned long long)io->start, (unsigned long long)io->stop); |
737 | if ((io->map > 1) || (io->start > 0xffff) || (io->stop > 0xffff) || | 722 | if ((io->map > 1) || (io->start > 0xffff) || (io->stop > 0xffff) || |
@@ -768,7 +753,7 @@ static int tcic_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *m | |||
768 | u_short addr, ctl; | 753 | u_short addr, ctl; |
769 | u_long base, len, mmap; | 754 | u_long base, len, mmap; |
770 | 755 | ||
771 | debug(1, "SetMemMap(%d, %d, %#2.2x, %d ns, " | 756 | dev_dbg(&sock->dev, "SetMemMap(%d, %d, %#2.2x, %d ns, " |
772 | "%#llx-%#llx, %#x)\n", psock, mem->map, mem->flags, | 757 | "%#llx-%#llx, %#x)\n", psock, mem->map, mem->flags, |
773 | mem->speed, (unsigned long long)mem->res->start, | 758 | mem->speed, (unsigned long long)mem->res->start, |
774 | (unsigned long long)mem->res->end, mem->card_start); | 759 | (unsigned long long)mem->res->end, mem->card_start); |
diff --git a/drivers/pcmcia/topic.h b/drivers/pcmcia/topic.h index edccfa5bb400..615a45a8fe86 100644 --- a/drivers/pcmcia/topic.h +++ b/drivers/pcmcia/topic.h | |||
@@ -114,22 +114,17 @@ static void topic97_zoom_video(struct pcmcia_socket *sock, int onoff) | |||
114 | reg_zv |= TOPIC97_ZV_CONTROL_ENABLE; | 114 | reg_zv |= TOPIC97_ZV_CONTROL_ENABLE; |
115 | config_writeb(socket, TOPIC97_ZOOM_VIDEO_CONTROL, reg_zv); | 115 | config_writeb(socket, TOPIC97_ZOOM_VIDEO_CONTROL, reg_zv); |
116 | 116 | ||
117 | reg = config_readb(socket, TOPIC97_MISC2); | ||
118 | reg |= TOPIC97_MISC2_ZV_ENABLE; | ||
119 | config_writeb(socket, TOPIC97_MISC2, reg); | ||
120 | |||
121 | /* not sure this is needed, doc is unclear */ | ||
122 | #if 0 | ||
123 | reg = config_readb(socket, TOPIC97_AUDIO_VIDEO_SWITCH); | 117 | reg = config_readb(socket, TOPIC97_AUDIO_VIDEO_SWITCH); |
124 | reg |= TOPIC97_AVS_AUDIO_CONTROL | TOPIC97_AVS_VIDEO_CONTROL; | 118 | reg |= TOPIC97_AVS_AUDIO_CONTROL | TOPIC97_AVS_VIDEO_CONTROL; |
125 | config_writeb(socket, TOPIC97_AUDIO_VIDEO_SWITCH, reg); | 119 | config_writeb(socket, TOPIC97_AUDIO_VIDEO_SWITCH, reg); |
126 | #endif | 120 | } else { |
127 | } | ||
128 | else { | ||
129 | reg_zv &= ~TOPIC97_ZV_CONTROL_ENABLE; | 121 | reg_zv &= ~TOPIC97_ZV_CONTROL_ENABLE; |
130 | config_writeb(socket, TOPIC97_ZOOM_VIDEO_CONTROL, reg_zv); | 122 | config_writeb(socket, TOPIC97_ZOOM_VIDEO_CONTROL, reg_zv); |
131 | } | ||
132 | 123 | ||
124 | reg = config_readb(socket, TOPIC97_AUDIO_VIDEO_SWITCH); | ||
125 | reg &= ~(TOPIC97_AVS_AUDIO_CONTROL | TOPIC97_AVS_VIDEO_CONTROL); | ||
126 | config_writeb(socket, TOPIC97_AUDIO_VIDEO_SWITCH, reg); | ||
127 | } | ||
133 | } | 128 | } |
134 | 129 | ||
135 | static int topic97_override(struct yenta_socket *socket) | 130 | static int topic97_override(struct yenta_socket *socket) |