Commit | Line | Data |
---|---|---|
27590d06 HS |
1 | /* |
2 | ||
3 | Driver for the Marvell 8385 based compact flash WLAN cards. | |
4 | ||
5 | (C) 2007 by Holger Schurig <hs4233@mail.mn-solutions.de> | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 2 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program; see the file COPYING. If not, write to | |
19 | the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, | |
20 | Boston, MA 02110-1301, USA. | |
21 | ||
22 | */ | |
23 | ||
24 | #include <linux/module.h> | |
5a0e3ad6 | 25 | #include <linux/slab.h> |
27590d06 HS |
26 | #include <linux/delay.h> |
27 | #include <linux/moduleparam.h> | |
28 | #include <linux/firmware.h> | |
29 | #include <linux/netdevice.h> | |
30 | ||
27590d06 HS |
31 | #include <pcmcia/cistpl.h> |
32 | #include <pcmcia/ds.h> | |
33 | ||
34 | #include <linux/io.h> | |
35 | ||
36 | #define DRV_NAME "libertas_cs" | |
37 | ||
38 | #include "decl.h" | |
39 | #include "defs.h" | |
40 | #include "dev.h" | |
41 | ||
42 | ||
43 | /********************************************************************/ | |
44 | /* Module stuff */ | |
45 | /********************************************************************/ | |
46 | ||
47 | MODULE_AUTHOR("Holger Schurig <hs4233@mail.mn-solutions.de>"); | |
48 | MODULE_DESCRIPTION("Driver for Marvell 83xx compact flash WLAN cards"); | |
49 | MODULE_LICENSE("GPL"); | |
50 | ||
51 | ||
52 | ||
53 | /********************************************************************/ | |
54 | /* Data structures */ | |
55 | /********************************************************************/ | |
56 | ||
57 | struct if_cs_card { | |
58 | struct pcmcia_device *p_dev; | |
69f9032d | 59 | struct lbs_private *priv; |
27590d06 | 60 | void __iomem *iobase; |
9d45368a | 61 | bool align_regs; |
82222e9b | 62 | u32 model; |
27590d06 HS |
63 | }; |
64 | ||
65 | ||
82222e9b DW |
66 | enum { |
67 | MODEL_UNKNOWN = 0x00, | |
68 | MODEL_8305 = 0x01, | |
69 | MODEL_8381 = 0x02, | |
70 | MODEL_8385 = 0x03 | |
71 | }; | |
72 | ||
73 | static const struct lbs_fw_table fw_table[] = { | |
74 | { MODEL_8305, "libertas/cf8305.bin", NULL }, | |
75 | { MODEL_8305, "libertas_cs_helper.fw", NULL }, | |
76 | { MODEL_8381, "libertas/cf8381_helper.bin", "libertas/cf8381.bin" }, | |
77 | { MODEL_8381, "libertas_cs_helper.fw", "libertas_cs.fw" }, | |
78 | { MODEL_8385, "libertas/cf8385_helper.bin", "libertas/cf8385.bin" }, | |
79 | { MODEL_8385, "libertas_cs_helper.fw", "libertas_cs.fw" }, | |
80 | { 0, NULL, NULL } | |
81 | }; | |
82 | MODULE_FIRMWARE("libertas/cf8305.bin"); | |
83 | MODULE_FIRMWARE("libertas/cf8381_helper.bin"); | |
84 | MODULE_FIRMWARE("libertas/cf8381.bin"); | |
85 | MODULE_FIRMWARE("libertas/cf8385_helper.bin"); | |
86 | MODULE_FIRMWARE("libertas/cf8385.bin"); | |
87 | MODULE_FIRMWARE("libertas_cs_helper.fw"); | |
88 | MODULE_FIRMWARE("libertas_cs.fw"); | |
89 | ||
27590d06 HS |
90 | |
91 | /********************************************************************/ | |
92 | /* Hardware access */ | |
93 | /********************************************************************/ | |
94 | ||
95 | /* This define enables wrapper functions which allow you | |
96 | to dump all register accesses. You normally won't this, | |
97 | except for development */ | |
98 | /* #define DEBUG_IO */ | |
99 | ||
100 | #ifdef DEBUG_IO | |
101 | static int debug_output = 0; | |
102 | #else | |
103 | /* This way the compiler optimizes the printk's away */ | |
104 | #define debug_output 0 | |
105 | #endif | |
106 | ||
107 | static inline unsigned int if_cs_read8(struct if_cs_card *card, uint reg) | |
108 | { | |
109 | unsigned int val = ioread8(card->iobase + reg); | |
110 | if (debug_output) | |
7919b89c | 111 | printk(KERN_INFO "inb %08x<%02x\n", reg, val); |
27590d06 HS |
112 | return val; |
113 | } | |
114 | static inline unsigned int if_cs_read16(struct if_cs_card *card, uint reg) | |
115 | { | |
116 | unsigned int val = ioread16(card->iobase + reg); | |
117 | if (debug_output) | |
7919b89c | 118 | printk(KERN_INFO "inw %08x<%04x\n", reg, val); |
27590d06 HS |
119 | return val; |
120 | } | |
121 | static inline void if_cs_read16_rep( | |
122 | struct if_cs_card *card, | |
123 | uint reg, | |
124 | void *buf, | |
125 | unsigned long count) | |
126 | { | |
127 | if (debug_output) | |
7919b89c | 128 | printk(KERN_INFO "insw %08x<(0x%lx words)\n", |
27590d06 HS |
129 | reg, count); |
130 | ioread16_rep(card->iobase + reg, buf, count); | |
131 | } | |
132 | ||
133 | static inline void if_cs_write8(struct if_cs_card *card, uint reg, u8 val) | |
134 | { | |
135 | if (debug_output) | |
7919b89c | 136 | printk(KERN_INFO "outb %08x>%02x\n", reg, val); |
27590d06 HS |
137 | iowrite8(val, card->iobase + reg); |
138 | } | |
139 | ||
140 | static inline void if_cs_write16(struct if_cs_card *card, uint reg, u16 val) | |
141 | { | |
142 | if (debug_output) | |
7919b89c | 143 | printk(KERN_INFO "outw %08x>%04x\n", reg, val); |
27590d06 HS |
144 | iowrite16(val, card->iobase + reg); |
145 | } | |
146 | ||
147 | static inline void if_cs_write16_rep( | |
148 | struct if_cs_card *card, | |
149 | uint reg, | |
6dfff895 | 150 | const void *buf, |
27590d06 HS |
151 | unsigned long count) |
152 | { | |
153 | if (debug_output) | |
7919b89c | 154 | printk(KERN_INFO "outsw %08x>(0x%lx words)\n", |
27590d06 HS |
155 | reg, count); |
156 | iowrite16_rep(card->iobase + reg, buf, count); | |
157 | } | |
158 | ||
159 | ||
160 | /* | |
161 | * I know that polling/delaying is frowned upon. However, this procedure | |
162 | * with polling is needed while downloading the firmware. At this stage, | |
163 | * the hardware does unfortunately not create any interrupts. | |
164 | * | |
165 | * Fortunately, this function is never used once the firmware is in | |
166 | * the card. :-) | |
167 | * | |
168 | * As a reference, see the "Firmware Specification v5.1", page 18 | |
169 | * and 19. I did not follow their suggested timing to the word, | |
170 | * but this works nice & fast anyway. | |
171 | */ | |
172 | static int if_cs_poll_while_fw_download(struct if_cs_card *card, uint addr, u8 reg) | |
173 | { | |
174 | int i; | |
175 | ||
93416c87 | 176 | for (i = 0; i < 100000; i++) { |
27590d06 HS |
177 | u8 val = if_cs_read8(card, addr); |
178 | if (val == reg) | |
1fac36ee | 179 | return 0; |
93416c87 | 180 | udelay(5); |
27590d06 HS |
181 | } |
182 | return -ETIME; | |
183 | } | |
184 | ||
185 | ||
186 | ||
53143256 HS |
187 | /* |
188 | * First the bitmasks for the host/card interrupt/status registers: | |
189 | */ | |
78cf0747 HS |
190 | #define IF_CS_BIT_TX 0x0001 |
191 | #define IF_CS_BIT_RX 0x0002 | |
192 | #define IF_CS_BIT_COMMAND 0x0004 | |
193 | #define IF_CS_BIT_RESP 0x0008 | |
194 | #define IF_CS_BIT_EVENT 0x0010 | |
195 | #define IF_CS_BIT_MASK 0x001f | |
27590d06 | 196 | |
53143256 HS |
197 | |
198 | ||
199 | /* | |
200 | * It's not really clear to me what the host status register is for. It | |
201 | * needs to be set almost in union with "host int cause". The following | |
202 | * bits from above are used: | |
203 | * | |
204 | * IF_CS_BIT_TX driver downloaded a data packet | |
205 | * IF_CS_BIT_RX driver got a data packet | |
206 | * IF_CS_BIT_COMMAND driver downloaded a command | |
207 | * IF_CS_BIT_RESP not used (has some meaning with powerdown) | |
208 | * IF_CS_BIT_EVENT driver read a host event | |
209 | */ | |
78cf0747 | 210 | #define IF_CS_HOST_STATUS 0x00000000 |
27590d06 | 211 | |
53143256 HS |
212 | /* |
213 | * With the host int cause register can the host (that is, Linux) cause | |
214 | * an interrupt in the firmware, to tell the firmware about those events: | |
215 | * | |
216 | * IF_CS_BIT_TX a data packet has been downloaded | |
217 | * IF_CS_BIT_RX a received data packet has retrieved | |
218 | * IF_CS_BIT_COMMAND a firmware block or a command has been downloaded | |
219 | * IF_CS_BIT_RESP not used (has some meaning with powerdown) | |
220 | * IF_CS_BIT_EVENT a host event (link lost etc) has been retrieved | |
221 | */ | |
78cf0747 | 222 | #define IF_CS_HOST_INT_CAUSE 0x00000002 |
27590d06 | 223 | |
53143256 HS |
224 | /* |
225 | * The host int mask register is used to enable/disable interrupt. However, | |
226 | * I have the suspicion that disabled interrupts are lost. | |
227 | */ | |
78cf0747 | 228 | #define IF_CS_HOST_INT_MASK 0x00000004 |
27590d06 | 229 | |
53143256 HS |
230 | /* |
231 | * Used to send or receive data packets: | |
232 | */ | |
a78a8325 HS |
233 | #define IF_CS_WRITE 0x00000016 |
234 | #define IF_CS_WRITE_LEN 0x00000014 | |
78cf0747 HS |
235 | #define IF_CS_READ 0x00000010 |
236 | #define IF_CS_READ_LEN 0x00000024 | |
27590d06 | 237 | |
53143256 HS |
238 | /* |
239 | * Used to send commands (and to send firmware block) and to | |
240 | * receive command responses: | |
241 | */ | |
a78a8325 HS |
242 | #define IF_CS_CMD 0x0000001A |
243 | #define IF_CS_CMD_LEN 0x00000018 | |
244 | #define IF_CS_RESP 0x00000012 | |
245 | #define IF_CS_RESP_LEN 0x00000030 | |
27590d06 | 246 | |
53143256 HS |
247 | /* |
248 | * The card status registers shows what the card/firmware actually | |
249 | * accepts: | |
250 | * | |
251 | * IF_CS_BIT_TX you may send a data packet | |
252 | * IF_CS_BIT_RX you may retrieve a data packet | |
253 | * IF_CS_BIT_COMMAND you may send a command | |
254 | * IF_CS_BIT_RESP you may retrieve a command response | |
255 | * IF_CS_BIT_EVENT the card has a event for use (link lost, snr low etc) | |
256 | * | |
257 | * When reading this register several times, you will get back the same | |
258 | * results --- with one exception: the IF_CS_BIT_EVENT clear itself | |
259 | * automatically. | |
260 | * | |
261 | * Not that we don't rely on BIT_RX,_BIT_RESP or BIT_EVENT because | |
262 | * we handle this via the card int cause register. | |
263 | */ | |
78cf0747 HS |
264 | #define IF_CS_CARD_STATUS 0x00000020 |
265 | #define IF_CS_CARD_STATUS_MASK 0x7f00 | |
27590d06 | 266 | |
53143256 HS |
267 | /* |
268 | * The card int cause register is used by the card/firmware to notify us | |
269 | * about the following events: | |
270 | * | |
271 | * IF_CS_BIT_TX a data packet has successfully been sentx | |
272 | * IF_CS_BIT_RX a data packet has been received and can be retrieved | |
273 | * IF_CS_BIT_COMMAND not used | |
274 | * IF_CS_BIT_RESP the firmware has a command response for us | |
275 | * IF_CS_BIT_EVENT the card has a event for use (link lost, snr low etc) | |
276 | */ | |
78cf0747 | 277 | #define IF_CS_CARD_INT_CAUSE 0x00000022 |
27590d06 | 278 | |
53143256 HS |
279 | /* |
280 | * This is used to for handshaking with the card's bootloader/helper image | |
281 | * to synchronize downloading of firmware blocks. | |
282 | */ | |
a78a8325 HS |
283 | #define IF_CS_SQ_READ_LOW 0x00000028 |
284 | #define IF_CS_SQ_HELPER_OK 0x10 | |
27590d06 | 285 | |
53143256 HS |
286 | /* |
287 | * The scratch register tells us ... | |
288 | * | |
289 | * IF_CS_SCRATCH_BOOT_OK the bootloader runs | |
290 | * IF_CS_SCRATCH_HELPER_OK the helper firmware already runs | |
291 | */ | |
27590d06 | 292 | #define IF_CS_SCRATCH 0x0000003F |
53143256 HS |
293 | #define IF_CS_SCRATCH_BOOT_OK 0x00 |
294 | #define IF_CS_SCRATCH_HELPER_OK 0x5a | |
27590d06 | 295 | |
4c55523e HS |
296 | /* |
297 | * Used to detect ancient chips: | |
298 | */ | |
299 | #define IF_CS_PRODUCT_ID 0x0000001C | |
300 | #define IF_CS_CF8385_B1_REV 0x12 | |
dc7d243d | 301 | #define IF_CS_CF8381_B3_REV 0x04 |
9d45368a | 302 | #define IF_CS_CF8305_B1_REV 0x03 |
4c55523e | 303 | |
dc7d243d MV |
304 | /* |
305 | * Used to detect other cards than CF8385 since their revisions of silicon | |
306 | * doesn't match those from CF8385, eg. CF8381 B3 works with this driver. | |
307 | */ | |
9d45368a MV |
308 | #define CF8305_MANFID 0x02db |
309 | #define CF8305_CARDID 0x8103 | |
dc7d243d MV |
310 | #define CF8381_MANFID 0x02db |
311 | #define CF8381_CARDID 0x6064 | |
312 | #define CF8385_MANFID 0x02df | |
313 | #define CF8385_CARDID 0x8103 | |
314 | ||
8973a6e7 RD |
315 | /* |
316 | * FIXME: just use the 'driver_info' field of 'struct pcmcia_device_id' when | |
82222e9b DW |
317 | * that gets fixed. Currently there's no way to access it from the probe hook. |
318 | */ | |
319 | static inline u32 get_model(u16 manf_id, u16 card_id) | |
dc7d243d | 320 | { |
82222e9b DW |
321 | /* NOTE: keep in sync with if_cs_ids */ |
322 | if (manf_id == CF8305_MANFID && card_id == CF8305_CARDID) | |
323 | return MODEL_8305; | |
324 | else if (manf_id == CF8381_MANFID && card_id == CF8381_CARDID) | |
325 | return MODEL_8381; | |
326 | else if (manf_id == CF8385_MANFID && card_id == CF8385_CARDID) | |
327 | return MODEL_8385; | |
328 | return MODEL_UNKNOWN; | |
dc7d243d | 329 | } |
27590d06 | 330 | |
27590d06 | 331 | /********************************************************************/ |
43d01c56 | 332 | /* I/O and interrupt handling */ |
27590d06 HS |
333 | /********************************************************************/ |
334 | ||
43d01c56 HS |
335 | static inline void if_cs_enable_ints(struct if_cs_card *card) |
336 | { | |
337 | lbs_deb_enter(LBS_DEB_CS); | |
78cf0747 | 338 | if_cs_write16(card, IF_CS_HOST_INT_MASK, 0); |
43d01c56 HS |
339 | } |
340 | ||
341 | static inline void if_cs_disable_ints(struct if_cs_card *card) | |
342 | { | |
343 | lbs_deb_enter(LBS_DEB_CS); | |
78cf0747 | 344 | if_cs_write16(card, IF_CS_HOST_INT_MASK, IF_CS_BIT_MASK); |
43d01c56 HS |
345 | } |
346 | ||
27590d06 HS |
347 | /* |
348 | * Called from if_cs_host_to_card to send a command to the hardware | |
349 | */ | |
69f9032d | 350 | static int if_cs_send_cmd(struct lbs_private *priv, u8 *buf, u16 nb) |
27590d06 HS |
351 | { |
352 | struct if_cs_card *card = (struct if_cs_card *)priv->card; | |
353 | int ret = -1; | |
354 | int loops = 0; | |
355 | ||
356 | lbs_deb_enter(LBS_DEB_CS); | |
43d01c56 | 357 | if_cs_disable_ints(card); |
27590d06 HS |
358 | |
359 | /* Is hardware ready? */ | |
360 | while (1) { | |
a78a8325 HS |
361 | u16 status = if_cs_read16(card, IF_CS_CARD_STATUS); |
362 | if (status & IF_CS_BIT_COMMAND) | |
27590d06 HS |
363 | break; |
364 | if (++loops > 100) { | |
365 | lbs_pr_err("card not ready for commands\n"); | |
366 | goto done; | |
367 | } | |
368 | mdelay(1); | |
369 | } | |
370 | ||
a78a8325 | 371 | if_cs_write16(card, IF_CS_CMD_LEN, nb); |
27590d06 | 372 | |
a78a8325 | 373 | if_cs_write16_rep(card, IF_CS_CMD, buf, nb / 2); |
27590d06 HS |
374 | /* Are we supposed to transfer an odd amount of bytes? */ |
375 | if (nb & 1) | |
a78a8325 | 376 | if_cs_write8(card, IF_CS_CMD, buf[nb-1]); |
27590d06 HS |
377 | |
378 | /* "Assert the download over interrupt command in the Host | |
379 | * status register" */ | |
78cf0747 | 380 | if_cs_write16(card, IF_CS_HOST_STATUS, IF_CS_BIT_COMMAND); |
27590d06 HS |
381 | |
382 | /* "Assert the download over interrupt command in the Card | |
383 | * interrupt case register" */ | |
78cf0747 | 384 | if_cs_write16(card, IF_CS_HOST_INT_CAUSE, IF_CS_BIT_COMMAND); |
27590d06 HS |
385 | ret = 0; |
386 | ||
387 | done: | |
43d01c56 | 388 | if_cs_enable_ints(card); |
27590d06 HS |
389 | lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret); |
390 | return ret; | |
391 | } | |
392 | ||
27590d06 HS |
393 | /* |
394 | * Called from if_cs_host_to_card to send a data to the hardware | |
395 | */ | |
69f9032d | 396 | static void if_cs_send_data(struct lbs_private *priv, u8 *buf, u16 nb) |
27590d06 HS |
397 | { |
398 | struct if_cs_card *card = (struct if_cs_card *)priv->card; | |
43d01c56 | 399 | u16 status; |
27590d06 HS |
400 | |
401 | lbs_deb_enter(LBS_DEB_CS); | |
43d01c56 HS |
402 | if_cs_disable_ints(card); |
403 | ||
78cf0747 HS |
404 | status = if_cs_read16(card, IF_CS_CARD_STATUS); |
405 | BUG_ON((status & IF_CS_BIT_TX) == 0); | |
27590d06 | 406 | |
a78a8325 | 407 | if_cs_write16(card, IF_CS_WRITE_LEN, nb); |
27590d06 HS |
408 | |
409 | /* write even number of bytes, then odd byte if necessary */ | |
a78a8325 | 410 | if_cs_write16_rep(card, IF_CS_WRITE, buf, nb / 2); |
27590d06 | 411 | if (nb & 1) |
a78a8325 | 412 | if_cs_write8(card, IF_CS_WRITE, buf[nb-1]); |
27590d06 | 413 | |
78cf0747 HS |
414 | if_cs_write16(card, IF_CS_HOST_STATUS, IF_CS_BIT_TX); |
415 | if_cs_write16(card, IF_CS_HOST_INT_CAUSE, IF_CS_BIT_TX); | |
43d01c56 | 416 | if_cs_enable_ints(card); |
27590d06 HS |
417 | |
418 | lbs_deb_leave(LBS_DEB_CS); | |
419 | } | |
420 | ||
27590d06 HS |
421 | /* |
422 | * Get the command result out of the card. | |
423 | */ | |
69f9032d | 424 | static int if_cs_receive_cmdres(struct lbs_private *priv, u8 *data, u32 *len) |
27590d06 | 425 | { |
7919b89c | 426 | unsigned long flags; |
27590d06 | 427 | int ret = -1; |
78cf0747 | 428 | u16 status; |
27590d06 HS |
429 | |
430 | lbs_deb_enter(LBS_DEB_CS); | |
431 | ||
432 | /* is hardware ready? */ | |
78cf0747 HS |
433 | status = if_cs_read16(priv->card, IF_CS_CARD_STATUS); |
434 | if ((status & IF_CS_BIT_RESP) == 0) { | |
435 | lbs_pr_err("no cmd response in card\n"); | |
436 | *len = 0; | |
27590d06 HS |
437 | goto out; |
438 | } | |
439 | ||
a78a8325 | 440 | *len = if_cs_read16(priv->card, IF_CS_RESP_LEN); |
ddac4526 | 441 | if ((*len == 0) || (*len > LBS_CMD_BUFFER_SIZE)) { |
27590d06 HS |
442 | lbs_pr_err("card cmd buffer has invalid # of bytes (%d)\n", *len); |
443 | goto out; | |
444 | } | |
445 | ||
446 | /* read even number of bytes, then odd byte if necessary */ | |
a78a8325 | 447 | if_cs_read16_rep(priv->card, IF_CS_RESP, data, *len/sizeof(u16)); |
27590d06 | 448 | if (*len & 1) |
a78a8325 | 449 | data[*len-1] = if_cs_read8(priv->card, IF_CS_RESP); |
27590d06 | 450 | |
09d4fad6 HS |
451 | /* This is a workaround for a firmware that reports too much |
452 | * bytes */ | |
453 | *len -= 8; | |
27590d06 | 454 | ret = 0; |
7919b89c HS |
455 | |
456 | /* Clear this flag again */ | |
457 | spin_lock_irqsave(&priv->driver_lock, flags); | |
458 | priv->dnld_sent = DNLD_RES_RECEIVED; | |
459 | spin_unlock_irqrestore(&priv->driver_lock, flags); | |
460 | ||
27590d06 HS |
461 | out: |
462 | lbs_deb_leave_args(LBS_DEB_CS, "ret %d, len %d", ret, *len); | |
463 | return ret; | |
464 | } | |
465 | ||
69f9032d | 466 | static struct sk_buff *if_cs_receive_data(struct lbs_private *priv) |
27590d06 HS |
467 | { |
468 | struct sk_buff *skb = NULL; | |
469 | u16 len; | |
470 | u8 *data; | |
471 | ||
472 | lbs_deb_enter(LBS_DEB_CS); | |
473 | ||
78cf0747 | 474 | len = if_cs_read16(priv->card, IF_CS_READ_LEN); |
27590d06 HS |
475 | if (len == 0 || len > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE) { |
476 | lbs_pr_err("card data buffer has invalid # of bytes (%d)\n", len); | |
bbfc6b78 | 477 | priv->dev->stats.rx_dropped++; |
27590d06 HS |
478 | goto dat_err; |
479 | } | |
480 | ||
f31ce76b | 481 | skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE + 2); |
27590d06 HS |
482 | if (!skb) |
483 | goto out; | |
f31ce76b VD |
484 | skb_put(skb, len); |
485 | skb_reserve(skb, 2);/* 16 byte align */ | |
486 | data = skb->data; | |
27590d06 HS |
487 | |
488 | /* read even number of bytes, then odd byte if necessary */ | |
78cf0747 | 489 | if_cs_read16_rep(priv->card, IF_CS_READ, data, len/sizeof(u16)); |
27590d06 | 490 | if (len & 1) |
78cf0747 | 491 | data[len-1] = if_cs_read8(priv->card, IF_CS_READ); |
27590d06 HS |
492 | |
493 | dat_err: | |
78cf0747 HS |
494 | if_cs_write16(priv->card, IF_CS_HOST_STATUS, IF_CS_BIT_RX); |
495 | if_cs_write16(priv->card, IF_CS_HOST_INT_CAUSE, IF_CS_BIT_RX); | |
27590d06 HS |
496 | |
497 | out: | |
498 | lbs_deb_leave_args(LBS_DEB_CS, "ret %p", skb); | |
499 | return skb; | |
500 | } | |
501 | ||
7919b89c HS |
502 | static irqreturn_t if_cs_interrupt(int irq, void *data) |
503 | { | |
504 | struct if_cs_card *card = data; | |
505 | struct lbs_private *priv = card->priv; | |
506 | u16 cause; | |
507 | ||
508 | lbs_deb_enter(LBS_DEB_CS); | |
509 | ||
43d01c56 | 510 | /* Ask card interrupt cause register if there is something for us */ |
78cf0747 | 511 | cause = if_cs_read16(card, IF_CS_CARD_INT_CAUSE); |
30735561 HS |
512 | lbs_deb_cs("cause 0x%04x\n", cause); |
513 | ||
7919b89c HS |
514 | if (cause == 0) { |
515 | /* Not for us */ | |
516 | return IRQ_NONE; | |
517 | } | |
518 | ||
519 | if (cause == 0xffff) { | |
520 | /* Read in junk, the card has probably been removed */ | |
521 | card->priv->surpriseremoved = 1; | |
522 | return IRQ_HANDLED; | |
523 | } | |
524 | ||
78cf0747 | 525 | if (cause & IF_CS_BIT_RX) { |
7919b89c HS |
526 | struct sk_buff *skb; |
527 | lbs_deb_cs("rx packet\n"); | |
528 | skb = if_cs_receive_data(priv); | |
529 | if (skb) | |
530 | lbs_process_rxed_packet(priv, skb); | |
531 | } | |
532 | ||
78cf0747 | 533 | if (cause & IF_CS_BIT_TX) { |
43d01c56 | 534 | lbs_deb_cs("tx done\n"); |
7919b89c HS |
535 | lbs_host_to_card_done(priv); |
536 | } | |
537 | ||
78cf0747 | 538 | if (cause & IF_CS_BIT_RESP) { |
7919b89c HS |
539 | unsigned long flags; |
540 | u8 i; | |
541 | ||
43d01c56 | 542 | lbs_deb_cs("cmd resp\n"); |
7919b89c HS |
543 | spin_lock_irqsave(&priv->driver_lock, flags); |
544 | i = (priv->resp_idx == 0) ? 1 : 0; | |
545 | spin_unlock_irqrestore(&priv->driver_lock, flags); | |
546 | ||
547 | BUG_ON(priv->resp_len[i]); | |
548 | if_cs_receive_cmdres(priv, priv->resp_buf[i], | |
549 | &priv->resp_len[i]); | |
550 | ||
551 | spin_lock_irqsave(&priv->driver_lock, flags); | |
552 | lbs_notify_command_response(priv, i); | |
553 | spin_unlock_irqrestore(&priv->driver_lock, flags); | |
554 | } | |
555 | ||
78cf0747 | 556 | if (cause & IF_CS_BIT_EVENT) { |
a78a8325 | 557 | u16 status = if_cs_read16(priv->card, IF_CS_CARD_STATUS); |
78cf0747 HS |
558 | if_cs_write16(priv->card, IF_CS_HOST_INT_CAUSE, |
559 | IF_CS_BIT_EVENT); | |
a78a8325 | 560 | lbs_queue_event(priv, (status & IF_CS_CARD_STATUS_MASK) >> 8); |
7919b89c HS |
561 | } |
562 | ||
30735561 HS |
563 | /* Clear interrupt cause */ |
564 | if_cs_write16(card, IF_CS_CARD_INT_CAUSE, cause & IF_CS_BIT_MASK); | |
565 | ||
43d01c56 | 566 | lbs_deb_leave(LBS_DEB_CS); |
7919b89c HS |
567 | return IRQ_HANDLED; |
568 | } | |
569 | ||
570 | ||
571 | ||
572 | ||
27590d06 HS |
573 | /********************************************************************/ |
574 | /* Firmware */ | |
575 | /********************************************************************/ | |
576 | ||
577 | /* | |
578 | * Tries to program the helper firmware. | |
579 | * | |
580 | * Return 0 on success | |
581 | */ | |
82222e9b | 582 | static int if_cs_prog_helper(struct if_cs_card *card, const struct firmware *fw) |
27590d06 HS |
583 | { |
584 | int ret = 0; | |
585 | int sent = 0; | |
586 | u8 scratch; | |
27590d06 HS |
587 | |
588 | lbs_deb_enter(LBS_DEB_CS); | |
589 | ||
9d45368a MV |
590 | /* |
591 | * This is the only place where an unaligned register access happens on | |
592 | * the CF8305 card, therefore for the sake of speed of the driver, we do | |
593 | * the alignment correction here. | |
594 | */ | |
595 | if (card->align_regs) | |
596 | scratch = if_cs_read16(card, IF_CS_SCRATCH) >> 8; | |
597 | else | |
598 | scratch = if_cs_read8(card, IF_CS_SCRATCH); | |
27590d06 HS |
599 | |
600 | /* "If the value is 0x5a, the firmware is already | |
601 | * downloaded successfully" | |
602 | */ | |
53143256 | 603 | if (scratch == IF_CS_SCRATCH_HELPER_OK) |
27590d06 HS |
604 | goto done; |
605 | ||
606 | /* "If the value is != 00, it is invalid value of register */ | |
53143256 | 607 | if (scratch != IF_CS_SCRATCH_BOOT_OK) { |
27590d06 HS |
608 | ret = -ENODEV; |
609 | goto done; | |
610 | } | |
611 | ||
4ecd41bd | 612 | lbs_deb_cs("helper size %td\n", fw->size); |
27590d06 HS |
613 | |
614 | /* "Set the 5 bytes of the helper image to 0" */ | |
615 | /* Not needed, this contains an ARM branch instruction */ | |
616 | ||
617 | for (;;) { | |
618 | /* "the number of bytes to send is 256" */ | |
619 | int count = 256; | |
620 | int remain = fw->size - sent; | |
621 | ||
622 | if (remain < count) | |
623 | count = remain; | |
27590d06 | 624 | |
8973a6e7 RD |
625 | /* |
626 | * "write the number of bytes to be sent to the I/O Command | |
627 | * write length register" | |
628 | */ | |
a78a8325 | 629 | if_cs_write16(card, IF_CS_CMD_LEN, count); |
27590d06 HS |
630 | |
631 | /* "write this to I/O Command port register as 16 bit writes */ | |
632 | if (count) | |
a78a8325 | 633 | if_cs_write16_rep(card, IF_CS_CMD, |
27590d06 HS |
634 | &fw->data[sent], |
635 | count >> 1); | |
636 | ||
8973a6e7 RD |
637 | /* |
638 | * "Assert the download over interrupt command in the Host | |
639 | * status register" | |
640 | */ | |
78cf0747 | 641 | if_cs_write8(card, IF_CS_HOST_STATUS, IF_CS_BIT_COMMAND); |
27590d06 | 642 | |
8973a6e7 RD |
643 | /* |
644 | * "Assert the download over interrupt command in the Card | |
645 | * interrupt case register" | |
646 | */ | |
78cf0747 | 647 | if_cs_write16(card, IF_CS_HOST_INT_CAUSE, IF_CS_BIT_COMMAND); |
27590d06 | 648 | |
8973a6e7 RD |
649 | /* |
650 | * "The host polls the Card Status register ... for 50 ms before | |
651 | * declaring a failure" | |
652 | */ | |
78cf0747 HS |
653 | ret = if_cs_poll_while_fw_download(card, IF_CS_CARD_STATUS, |
654 | IF_CS_BIT_COMMAND); | |
27590d06 HS |
655 | if (ret < 0) { |
656 | lbs_pr_err("can't download helper at 0x%x, ret %d\n", | |
657 | sent, ret); | |
82222e9b | 658 | goto done; |
27590d06 HS |
659 | } |
660 | ||
661 | if (count == 0) | |
662 | break; | |
663 | ||
664 | sent += count; | |
665 | } | |
666 | ||
27590d06 HS |
667 | done: |
668 | lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret); | |
669 | return ret; | |
670 | } | |
671 | ||
672 | ||
82222e9b | 673 | static int if_cs_prog_real(struct if_cs_card *card, const struct firmware *fw) |
27590d06 | 674 | { |
27590d06 HS |
675 | int ret = 0; |
676 | int retry = 0; | |
677 | int len = 0; | |
678 | int sent; | |
679 | ||
680 | lbs_deb_enter(LBS_DEB_CS); | |
681 | ||
4ecd41bd | 682 | lbs_deb_cs("fw size %td\n", fw->size); |
27590d06 | 683 | |
a78a8325 HS |
684 | ret = if_cs_poll_while_fw_download(card, IF_CS_SQ_READ_LOW, |
685 | IF_CS_SQ_HELPER_OK); | |
27590d06 | 686 | if (ret < 0) { |
27590d06 | 687 | lbs_pr_err("helper firmware doesn't answer\n"); |
82222e9b | 688 | goto done; |
27590d06 HS |
689 | } |
690 | ||
691 | for (sent = 0; sent < fw->size; sent += len) { | |
a78a8325 | 692 | len = if_cs_read16(card, IF_CS_SQ_READ_LOW); |
27590d06 HS |
693 | if (len & 1) { |
694 | retry++; | |
695 | lbs_pr_info("odd, need to retry this firmware block\n"); | |
696 | } else { | |
697 | retry = 0; | |
698 | } | |
699 | ||
700 | if (retry > 20) { | |
701 | lbs_pr_err("could not download firmware\n"); | |
702 | ret = -ENODEV; | |
82222e9b | 703 | goto done; |
27590d06 HS |
704 | } |
705 | if (retry) { | |
706 | sent -= len; | |
707 | } | |
708 | ||
709 | ||
a78a8325 | 710 | if_cs_write16(card, IF_CS_CMD_LEN, len); |
27590d06 | 711 | |
a78a8325 | 712 | if_cs_write16_rep(card, IF_CS_CMD, |
27590d06 HS |
713 | &fw->data[sent], |
714 | (len+1) >> 1); | |
78cf0747 HS |
715 | if_cs_write8(card, IF_CS_HOST_STATUS, IF_CS_BIT_COMMAND); |
716 | if_cs_write16(card, IF_CS_HOST_INT_CAUSE, IF_CS_BIT_COMMAND); | |
27590d06 | 717 | |
78cf0747 HS |
718 | ret = if_cs_poll_while_fw_download(card, IF_CS_CARD_STATUS, |
719 | IF_CS_BIT_COMMAND); | |
27590d06 HS |
720 | if (ret < 0) { |
721 | lbs_pr_err("can't download firmware at 0x%x\n", sent); | |
82222e9b | 722 | goto done; |
27590d06 HS |
723 | } |
724 | } | |
725 | ||
726 | ret = if_cs_poll_while_fw_download(card, IF_CS_SCRATCH, 0x5a); | |
9a52028e | 727 | if (ret < 0) |
27590d06 | 728 | lbs_pr_err("firmware download failed\n"); |
27590d06 | 729 | |
27590d06 HS |
730 | done: |
731 | lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret); | |
732 | return ret; | |
733 | } | |
734 | ||
735 | ||
736 | ||
737 | /********************************************************************/ | |
738 | /* Callback functions for libertas.ko */ | |
739 | /********************************************************************/ | |
740 | ||
27590d06 | 741 | /* Send commands or data packets to the card */ |
69f9032d HS |
742 | static int if_cs_host_to_card(struct lbs_private *priv, |
743 | u8 type, | |
744 | u8 *buf, | |
745 | u16 nb) | |
27590d06 HS |
746 | { |
747 | int ret = -1; | |
748 | ||
749 | lbs_deb_enter_args(LBS_DEB_CS, "type %d, bytes %d", type, nb); | |
750 | ||
751 | switch (type) { | |
752 | case MVMS_DAT: | |
6f05cbe5 | 753 | priv->dnld_sent = DNLD_DATA_SENT; |
27590d06 HS |
754 | if_cs_send_data(priv, buf, nb); |
755 | ret = 0; | |
756 | break; | |
757 | case MVMS_CMD: | |
6f05cbe5 | 758 | priv->dnld_sent = DNLD_CMD_SENT; |
27590d06 HS |
759 | ret = if_cs_send_cmd(priv, buf, nb); |
760 | break; | |
761 | default: | |
c94c93da | 762 | lbs_pr_err("%s: unsupported type %d\n", __func__, type); |
27590d06 HS |
763 | } |
764 | ||
765 | lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret); | |
766 | return ret; | |
767 | } | |
768 | ||
769 | ||
27590d06 HS |
770 | static void if_cs_release(struct pcmcia_device *p_dev) |
771 | { | |
772 | struct if_cs_card *card = p_dev->priv; | |
773 | ||
774 | lbs_deb_enter(LBS_DEB_CS); | |
775 | ||
eb14120f | 776 | free_irq(p_dev->irq, card); |
fdfb92ea | 777 | pcmcia_disable_device(p_dev); |
27590d06 HS |
778 | if (card->iobase) |
779 | ioport_unmap(card->iobase); | |
780 | ||
781 | lbs_deb_leave(LBS_DEB_CS); | |
782 | } | |
783 | ||
784 | ||
00990e7c | 785 | static int if_cs_ioprobe(struct pcmcia_device *p_dev, void *priv_data) |
aaa8cfda | 786 | { |
00990e7c | 787 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
90abdc3b | 788 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; |
aaa8cfda | 789 | |
00990e7c | 790 | if (p_dev->resource[1]->end) { |
aaa8cfda DB |
791 | lbs_pr_err("wrong CIS (check number of IO windows)\n"); |
792 | return -ENODEV; | |
793 | } | |
794 | ||
795 | /* This reserves IO space but doesn't actually enable it */ | |
90abdc3b | 796 | return pcmcia_request_io(p_dev); |
aaa8cfda DB |
797 | } |
798 | ||
27590d06 HS |
799 | static int if_cs_probe(struct pcmcia_device *p_dev) |
800 | { | |
801 | int ret = -ENOMEM; | |
dc7d243d | 802 | unsigned int prod_id; |
69f9032d | 803 | struct lbs_private *priv; |
27590d06 | 804 | struct if_cs_card *card; |
82222e9b DW |
805 | const struct firmware *helper = NULL; |
806 | const struct firmware *mainfw = NULL; | |
27590d06 HS |
807 | |
808 | lbs_deb_enter(LBS_DEB_CS); | |
809 | ||
810 | card = kzalloc(sizeof(struct if_cs_card), GFP_KERNEL); | |
811 | if (!card) { | |
812 | lbs_pr_err("error in kzalloc\n"); | |
813 | goto out; | |
814 | } | |
815 | card->p_dev = p_dev; | |
816 | p_dev->priv = card; | |
817 | ||
00990e7c DB |
818 | p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; |
819 | ||
aaa8cfda DB |
820 | if (pcmcia_loop_config(p_dev, if_cs_ioprobe, NULL)) { |
821 | lbs_pr_err("error in pcmcia_loop_config\n"); | |
27590d06 HS |
822 | goto out1; |
823 | } | |
27590d06 | 824 | |
27590d06 HS |
825 | /* |
826 | * Allocate an interrupt line. Note that this does not assign | |
827 | * a handler to the interrupt, unless the 'Handler' member of | |
828 | * the irq structure is initialized. | |
829 | */ | |
eb14120f DB |
830 | if (!p_dev->irq) |
831 | goto out1; | |
27590d06 HS |
832 | |
833 | /* Initialize io access */ | |
9a017a91 DB |
834 | card->iobase = ioport_map(p_dev->resource[0]->start, |
835 | resource_size(p_dev->resource[0])); | |
27590d06 HS |
836 | if (!card->iobase) { |
837 | lbs_pr_err("error in ioport_map\n"); | |
838 | ret = -EIO; | |
839 | goto out1; | |
840 | } | |
841 | ||
1ac71e5a | 842 | ret = pcmcia_enable_device(p_dev); |
27590d06 | 843 | if (ret) { |
1ac71e5a | 844 | lbs_pr_err("error in pcmcia_enable_device\n"); |
27590d06 HS |
845 | goto out2; |
846 | } | |
847 | ||
848 | /* Finally, report what we've done */ | |
9a017a91 | 849 | lbs_deb_cs("irq %d, io %pR", p_dev->irq, p_dev->resource[0]); |
27590d06 | 850 | |
9d45368a MV |
851 | /* |
852 | * Most of the libertas cards can do unaligned register access, but some | |
8973a6e7 | 853 | * weird ones cannot. That's especially true for the CF8305 card. |
9d45368a MV |
854 | */ |
855 | card->align_regs = 0; | |
856 | ||
82222e9b DW |
857 | card->model = get_model(p_dev->manf_id, p_dev->card_id); |
858 | if (card->model == MODEL_UNKNOWN) { | |
859 | lbs_pr_err("unsupported manf_id 0x%04x / card_id 0x%04x\n", | |
860 | p_dev->manf_id, p_dev->card_id); | |
861 | goto out2; | |
862 | } | |
863 | ||
4c55523e | 864 | /* Check if we have a current silicon */ |
dc7d243d | 865 | prod_id = if_cs_read8(card, IF_CS_PRODUCT_ID); |
82222e9b | 866 | if (card->model == MODEL_8305) { |
9d45368a MV |
867 | card->align_regs = 1; |
868 | if (prod_id < IF_CS_CF8305_B1_REV) { | |
82222e9b | 869 | lbs_pr_err("8305 rev B0 and older are not supported\n"); |
9d45368a MV |
870 | ret = -ENODEV; |
871 | goto out2; | |
872 | } | |
873 | } | |
874 | ||
82222e9b DW |
875 | if ((card->model == MODEL_8381) && prod_id < IF_CS_CF8381_B3_REV) { |
876 | lbs_pr_err("8381 rev B2 and older are not supported\n"); | |
dc7d243d MV |
877 | ret = -ENODEV; |
878 | goto out2; | |
879 | } | |
880 | ||
82222e9b DW |
881 | if ((card->model == MODEL_8385) && prod_id < IF_CS_CF8385_B1_REV) { |
882 | lbs_pr_err("8385 rev B0 and older are not supported\n"); | |
4c55523e HS |
883 | ret = -ENODEV; |
884 | goto out2; | |
885 | } | |
27590d06 | 886 | |
82222e9b DW |
887 | ret = lbs_get_firmware(&p_dev->dev, NULL, NULL, card->model, |
888 | &fw_table[0], &helper, &mainfw); | |
889 | if (ret) { | |
890 | lbs_pr_err("failed to find firmware (%d)\n", ret); | |
891 | goto out2; | |
892 | } | |
893 | ||
27590d06 | 894 | /* Load the firmware early, before calling into libertas.ko */ |
82222e9b DW |
895 | ret = if_cs_prog_helper(card, helper); |
896 | if (ret == 0 && (card->model != MODEL_8305)) | |
897 | ret = if_cs_prog_real(card, mainfw); | |
27590d06 HS |
898 | if (ret) |
899 | goto out2; | |
900 | ||
901 | /* Make this card known to the libertas driver */ | |
10078321 | 902 | priv = lbs_add_card(card, &p_dev->dev); |
27590d06 HS |
903 | if (!priv) { |
904 | ret = -ENOMEM; | |
905 | goto out2; | |
906 | } | |
907 | ||
7919b89c | 908 | /* Finish setting up fields in lbs_private */ |
954ee164 | 909 | card->priv = priv; |
27590d06 | 910 | priv->card = card; |
7919b89c | 911 | priv->hw_host_to_card = if_cs_host_to_card; |
49125454 AK |
912 | priv->enter_deep_sleep = NULL; |
913 | priv->exit_deep_sleep = NULL; | |
914 | priv->reset_deep_sleep_wakeup = NULL; | |
aa21c004 | 915 | priv->fw_ready = 1; |
954ee164 | 916 | |
27590d06 | 917 | /* Now actually get the IRQ */ |
eb14120f | 918 | ret = request_irq(p_dev->irq, if_cs_interrupt, |
27590d06 HS |
919 | IRQF_SHARED, DRV_NAME, card); |
920 | if (ret) { | |
921 | lbs_pr_err("error in request_irq\n"); | |
922 | goto out3; | |
923 | } | |
924 | ||
8973a6e7 RD |
925 | /* |
926 | * Clear any interrupt cause that happened while sending | |
927 | * firmware/initializing card | |
928 | */ | |
78cf0747 | 929 | if_cs_write16(card, IF_CS_CARD_INT_CAUSE, IF_CS_BIT_MASK); |
28de0b36 RM |
930 | if_cs_enable_ints(card); |
931 | ||
27590d06 | 932 | /* And finally bring the card up */ |
10078321 | 933 | if (lbs_start_card(priv) != 0) { |
27590d06 HS |
934 | lbs_pr_err("could not activate card\n"); |
935 | goto out3; | |
936 | } | |
937 | ||
938 | ret = 0; | |
939 | goto out; | |
940 | ||
941 | out3: | |
10078321 | 942 | lbs_remove_card(priv); |
27590d06 HS |
943 | out2: |
944 | ioport_unmap(card->iobase); | |
945 | out1: | |
946 | pcmcia_disable_device(p_dev); | |
947 | out: | |
82222e9b DW |
948 | if (helper) |
949 | release_firmware(helper); | |
950 | if (mainfw) | |
951 | release_firmware(mainfw); | |
952 | ||
27590d06 HS |
953 | lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret); |
954 | return ret; | |
955 | } | |
956 | ||
957 | ||
27590d06 HS |
958 | static void if_cs_detach(struct pcmcia_device *p_dev) |
959 | { | |
960 | struct if_cs_card *card = p_dev->priv; | |
961 | ||
962 | lbs_deb_enter(LBS_DEB_CS); | |
963 | ||
10078321 HS |
964 | lbs_stop_card(card->priv); |
965 | lbs_remove_card(card->priv); | |
28de0b36 | 966 | if_cs_disable_ints(card); |
27590d06 HS |
967 | if_cs_release(p_dev); |
968 | kfree(card); | |
969 | ||
970 | lbs_deb_leave(LBS_DEB_CS); | |
971 | } | |
972 | ||
973 | ||
974 | ||
975 | /********************************************************************/ | |
976 | /* Module initialization */ | |
977 | /********************************************************************/ | |
978 | ||
979 | static struct pcmcia_device_id if_cs_ids[] = { | |
9d45368a | 980 | PCMCIA_DEVICE_MANF_CARD(CF8305_MANFID, CF8305_CARDID), |
dc7d243d MV |
981 | PCMCIA_DEVICE_MANF_CARD(CF8381_MANFID, CF8381_CARDID), |
982 | PCMCIA_DEVICE_MANF_CARD(CF8385_MANFID, CF8385_CARDID), | |
82222e9b | 983 | /* NOTE: keep in sync with get_model() */ |
27590d06 HS |
984 | PCMCIA_DEVICE_NULL, |
985 | }; | |
986 | MODULE_DEVICE_TABLE(pcmcia, if_cs_ids); | |
987 | ||
988 | ||
10078321 | 989 | static struct pcmcia_driver lbs_driver = { |
27590d06 | 990 | .owner = THIS_MODULE, |
2e9b981a | 991 | .name = DRV_NAME, |
27590d06 HS |
992 | .probe = if_cs_probe, |
993 | .remove = if_cs_detach, | |
994 | .id_table = if_cs_ids, | |
995 | }; | |
996 | ||
997 | ||
998 | static int __init if_cs_init(void) | |
999 | { | |
1000 | int ret; | |
1001 | ||
1002 | lbs_deb_enter(LBS_DEB_CS); | |
10078321 | 1003 | ret = pcmcia_register_driver(&lbs_driver); |
27590d06 HS |
1004 | lbs_deb_leave(LBS_DEB_CS); |
1005 | return ret; | |
1006 | } | |
1007 | ||
1008 | ||
1009 | static void __exit if_cs_exit(void) | |
1010 | { | |
1011 | lbs_deb_enter(LBS_DEB_CS); | |
10078321 | 1012 | pcmcia_unregister_driver(&lbs_driver); |
27590d06 HS |
1013 | lbs_deb_leave(LBS_DEB_CS); |
1014 | } | |
1015 | ||
1016 | ||
1017 | module_init(if_cs_init); | |
1018 | module_exit(if_cs_exit); |