1 // SPDX-License-Identifier: GPL-2.0-or-later
4 Driver for the Marvell 8385 based compact flash WLAN cards.
6 (C) 2007 by Holger Schurig <hs4233@mail.mn-solutions.de>
11 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
13 #include <linux/module.h>
14 #include <linux/slab.h>
15 #include <linux/delay.h>
16 #include <linux/moduleparam.h>
17 #include <linux/firmware.h>
18 #include <linux/netdevice.h>
20 #include <pcmcia/cistpl.h>
21 #include <pcmcia/ds.h>
25 #define DRV_NAME "libertas_cs"
32 /********************************************************************/
34 /********************************************************************/
36 MODULE_AUTHOR("Holger Schurig <hs4233@mail.mn-solutions.de>");
37 MODULE_DESCRIPTION("Driver for Marvell 83xx compact flash WLAN cards");
38 MODULE_LICENSE("GPL");
42 /********************************************************************/
44 /********************************************************************/
47 struct pcmcia_device *p_dev;
48 struct lbs_private *priv;
62 static const struct lbs_fw_table fw_table[] = {
63 { MODEL_8305, "libertas/cf8305.bin", NULL },
64 { MODEL_8305, "libertas_cs_helper.fw", NULL },
65 { MODEL_8381, "libertas/cf8381_helper.bin", "libertas/cf8381.bin" },
66 { MODEL_8381, "libertas_cs_helper.fw", "libertas_cs.fw" },
67 { MODEL_8385, "libertas/cf8385_helper.bin", "libertas/cf8385.bin" },
68 { MODEL_8385, "libertas_cs_helper.fw", "libertas_cs.fw" },
71 MODULE_FIRMWARE("libertas/cf8305.bin");
72 MODULE_FIRMWARE("libertas/cf8381_helper.bin");
73 MODULE_FIRMWARE("libertas/cf8381.bin");
74 MODULE_FIRMWARE("libertas/cf8385_helper.bin");
75 MODULE_FIRMWARE("libertas/cf8385.bin");
76 MODULE_FIRMWARE("libertas_cs_helper.fw");
77 MODULE_FIRMWARE("libertas_cs.fw");
80 /********************************************************************/
82 /********************************************************************/
84 /* This define enables wrapper functions which allow you
85 to dump all register accesses. You normally won't this,
86 except for development */
87 /* #define DEBUG_IO */
90 static int debug_output = 0;
92 /* This way the compiler optimizes the printk's away */
93 #define debug_output 0
96 static inline unsigned int if_cs_read8(struct if_cs_card *card, uint reg)
98 unsigned int val = ioread8(card->iobase + reg);
100 printk(KERN_INFO "inb %08x<%02x\n", reg, val);
103 static inline unsigned int if_cs_read16(struct if_cs_card *card, uint reg)
105 unsigned int val = ioread16(card->iobase + reg);
107 printk(KERN_INFO "inw %08x<%04x\n", reg, val);
110 static inline void if_cs_read16_rep(
111 struct if_cs_card *card,
117 printk(KERN_INFO "insw %08x<(0x%lx words)\n",
119 ioread16_rep(card->iobase + reg, buf, count);
122 static inline void if_cs_write8(struct if_cs_card *card, uint reg, u8 val)
125 printk(KERN_INFO "outb %08x>%02x\n", reg, val);
126 iowrite8(val, card->iobase + reg);
129 static inline void if_cs_write16(struct if_cs_card *card, uint reg, u16 val)
132 printk(KERN_INFO "outw %08x>%04x\n", reg, val);
133 iowrite16(val, card->iobase + reg);
136 static inline void if_cs_write16_rep(
137 struct if_cs_card *card,
143 printk(KERN_INFO "outsw %08x>(0x%lx words)\n",
145 iowrite16_rep(card->iobase + reg, buf, count);
150 * I know that polling/delaying is frowned upon. However, this procedure
151 * with polling is needed while downloading the firmware. At this stage,
152 * the hardware does unfortunately not create any interrupts.
154 * Fortunately, this function is never used once the firmware is in
157 * As a reference, see the "Firmware Specification v5.1", page 18
158 * and 19. I did not follow their suggested timing to the word,
159 * but this works nice & fast anyway.
161 static int if_cs_poll_while_fw_download(struct if_cs_card *card, uint addr, u8 reg)
165 for (i = 0; i < 100000; i++) {
166 u8 val = if_cs_read8(card, addr);
177 * First the bitmasks for the host/card interrupt/status registers:
179 #define IF_CS_BIT_TX 0x0001
180 #define IF_CS_BIT_RX 0x0002
181 #define IF_CS_BIT_COMMAND 0x0004
182 #define IF_CS_BIT_RESP 0x0008
183 #define IF_CS_BIT_EVENT 0x0010
184 #define IF_CS_BIT_MASK 0x001f
189 * It's not really clear to me what the host status register is for. It
190 * needs to be set almost in union with "host int cause". The following
191 * bits from above are used:
193 * IF_CS_BIT_TX driver downloaded a data packet
194 * IF_CS_BIT_RX driver got a data packet
195 * IF_CS_BIT_COMMAND driver downloaded a command
196 * IF_CS_BIT_RESP not used (has some meaning with powerdown)
197 * IF_CS_BIT_EVENT driver read a host event
199 #define IF_CS_HOST_STATUS 0x00000000
202 * With the host int cause register can the host (that is, Linux) cause
203 * an interrupt in the firmware, to tell the firmware about those events:
205 * IF_CS_BIT_TX a data packet has been downloaded
206 * IF_CS_BIT_RX a received data packet has retrieved
207 * IF_CS_BIT_COMMAND a firmware block or a command has been downloaded
208 * IF_CS_BIT_RESP not used (has some meaning with powerdown)
209 * IF_CS_BIT_EVENT a host event (link lost etc) has been retrieved
211 #define IF_CS_HOST_INT_CAUSE 0x00000002
214 * The host int mask register is used to enable/disable interrupt. However,
215 * I have the suspicion that disabled interrupts are lost.
217 #define IF_CS_HOST_INT_MASK 0x00000004
220 * Used to send or receive data packets:
222 #define IF_CS_WRITE 0x00000016
223 #define IF_CS_WRITE_LEN 0x00000014
224 #define IF_CS_READ 0x00000010
225 #define IF_CS_READ_LEN 0x00000024
228 * Used to send commands (and to send firmware block) and to
229 * receive command responses:
231 #define IF_CS_CMD 0x0000001A
232 #define IF_CS_CMD_LEN 0x00000018
233 #define IF_CS_RESP 0x00000012
234 #define IF_CS_RESP_LEN 0x00000030
237 * The card status registers shows what the card/firmware actually
240 * IF_CS_BIT_TX you may send a data packet
241 * IF_CS_BIT_RX you may retrieve a data packet
242 * IF_CS_BIT_COMMAND you may send a command
243 * IF_CS_BIT_RESP you may retrieve a command response
244 * IF_CS_BIT_EVENT the card has a event for use (link lost, snr low etc)
246 * When reading this register several times, you will get back the same
247 * results --- with one exception: the IF_CS_BIT_EVENT clear itself
250 * Not that we don't rely on BIT_RX,_BIT_RESP or BIT_EVENT because
251 * we handle this via the card int cause register.
253 #define IF_CS_CARD_STATUS 0x00000020
254 #define IF_CS_CARD_STATUS_MASK 0x7f00
257 * The card int cause register is used by the card/firmware to notify us
258 * about the following events:
260 * IF_CS_BIT_TX a data packet has successfully been sentx
261 * IF_CS_BIT_RX a data packet has been received and can be retrieved
262 * IF_CS_BIT_COMMAND not used
263 * IF_CS_BIT_RESP the firmware has a command response for us
264 * IF_CS_BIT_EVENT the card has a event for use (link lost, snr low etc)
266 #define IF_CS_CARD_INT_CAUSE 0x00000022
269 * This is used to for handshaking with the card's bootloader/helper image
270 * to synchronize downloading of firmware blocks.
272 #define IF_CS_SQ_READ_LOW 0x00000028
273 #define IF_CS_SQ_HELPER_OK 0x10
276 * The scratch register tells us ...
278 * IF_CS_SCRATCH_BOOT_OK the bootloader runs
279 * IF_CS_SCRATCH_HELPER_OK the helper firmware already runs
281 #define IF_CS_SCRATCH 0x0000003F
282 #define IF_CS_SCRATCH_BOOT_OK 0x00
283 #define IF_CS_SCRATCH_HELPER_OK 0x5a
286 * Used to detect ancient chips:
288 #define IF_CS_PRODUCT_ID 0x0000001C
289 #define IF_CS_CF8385_B1_REV 0x12
290 #define IF_CS_CF8381_B3_REV 0x04
291 #define IF_CS_CF8305_B1_REV 0x03
294 * Used to detect other cards than CF8385 since their revisions of silicon
295 * doesn't match those from CF8385, eg. CF8381 B3 works with this driver.
297 #define CF8305_MANFID 0x02db
298 #define CF8305_CARDID 0x8103
299 #define CF8381_MANFID 0x02db
300 #define CF8381_CARDID 0x6064
301 #define CF8385_MANFID 0x02df
302 #define CF8385_CARDID 0x8103
305 * FIXME: just use the 'driver_info' field of 'struct pcmcia_device_id' when
306 * that gets fixed. Currently there's no way to access it from the probe hook.
308 static inline u32 get_model(u16 manf_id, u16 card_id)
310 /* NOTE: keep in sync with if_cs_ids */
311 if (manf_id == CF8305_MANFID && card_id == CF8305_CARDID)
313 else if (manf_id == CF8381_MANFID && card_id == CF8381_CARDID)
315 else if (manf_id == CF8385_MANFID && card_id == CF8385_CARDID)
317 return MODEL_UNKNOWN;
320 /********************************************************************/
321 /* I/O and interrupt handling */
322 /********************************************************************/
324 static inline void if_cs_enable_ints(struct if_cs_card *card)
326 if_cs_write16(card, IF_CS_HOST_INT_MASK, 0);
329 static inline void if_cs_disable_ints(struct if_cs_card *card)
331 if_cs_write16(card, IF_CS_HOST_INT_MASK, IF_CS_BIT_MASK);
335 * Called from if_cs_host_to_card to send a command to the hardware
337 static int if_cs_send_cmd(struct lbs_private *priv, u8 *buf, u16 nb)
339 struct if_cs_card *card = (struct if_cs_card *)priv->card;
343 if_cs_disable_ints(card);
345 /* Is hardware ready? */
347 u16 status = if_cs_read16(card, IF_CS_CARD_STATUS);
348 if (status & IF_CS_BIT_COMMAND)
351 netdev_err(priv->dev, "card not ready for commands\n");
357 if_cs_write16(card, IF_CS_CMD_LEN, nb);
359 if_cs_write16_rep(card, IF_CS_CMD, buf, nb / 2);
360 /* Are we supposed to transfer an odd amount of bytes? */
362 if_cs_write8(card, IF_CS_CMD, buf[nb-1]);
364 /* "Assert the download over interrupt command in the Host
365 * status register" */
366 if_cs_write16(card, IF_CS_HOST_STATUS, IF_CS_BIT_COMMAND);
368 /* "Assert the download over interrupt command in the Card
369 * interrupt case register" */
370 if_cs_write16(card, IF_CS_HOST_INT_CAUSE, IF_CS_BIT_COMMAND);
374 if_cs_enable_ints(card);
379 * Called from if_cs_host_to_card to send a data to the hardware
381 static void if_cs_send_data(struct lbs_private *priv, u8 *buf, u16 nb)
383 struct if_cs_card *card = (struct if_cs_card *)priv->card;
386 if_cs_disable_ints(card);
388 status = if_cs_read16(card, IF_CS_CARD_STATUS);
389 BUG_ON((status & IF_CS_BIT_TX) == 0);
391 if_cs_write16(card, IF_CS_WRITE_LEN, nb);
393 /* write even number of bytes, then odd byte if necessary */
394 if_cs_write16_rep(card, IF_CS_WRITE, buf, nb / 2);
396 if_cs_write8(card, IF_CS_WRITE, buf[nb-1]);
398 if_cs_write16(card, IF_CS_HOST_STATUS, IF_CS_BIT_TX);
399 if_cs_write16(card, IF_CS_HOST_INT_CAUSE, IF_CS_BIT_TX);
400 if_cs_enable_ints(card);
404 * Get the command result out of the card.
406 static int if_cs_receive_cmdres(struct lbs_private *priv, u8 *data, u32 *len)
412 /* is hardware ready? */
413 status = if_cs_read16(priv->card, IF_CS_CARD_STATUS);
414 if ((status & IF_CS_BIT_RESP) == 0) {
415 netdev_err(priv->dev, "no cmd response in card\n");
420 *len = if_cs_read16(priv->card, IF_CS_RESP_LEN);
421 if ((*len == 0) || (*len > LBS_CMD_BUFFER_SIZE)) {
422 netdev_err(priv->dev,
423 "card cmd buffer has invalid # of bytes (%d)\n",
428 /* read even number of bytes, then odd byte if necessary */
429 if_cs_read16_rep(priv->card, IF_CS_RESP, data, *len/sizeof(u16));
431 data[*len-1] = if_cs_read8(priv->card, IF_CS_RESP);
433 /* This is a workaround for a firmware that reports too much
438 /* Clear this flag again */
439 spin_lock_irqsave(&priv->driver_lock, flags);
440 priv->dnld_sent = DNLD_RES_RECEIVED;
441 spin_unlock_irqrestore(&priv->driver_lock, flags);
447 static struct sk_buff *if_cs_receive_data(struct lbs_private *priv)
449 struct sk_buff *skb = NULL;
453 len = if_cs_read16(priv->card, IF_CS_READ_LEN);
454 if (len == 0 || len > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE) {
455 netdev_err(priv->dev,
456 "card data buffer has invalid # of bytes (%d)\n",
458 priv->dev->stats.rx_dropped++;
462 skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE + 2);
466 skb_reserve(skb, 2);/* 16 byte align */
469 /* read even number of bytes, then odd byte if necessary */
470 if_cs_read16_rep(priv->card, IF_CS_READ, data, len/sizeof(u16));
472 data[len-1] = if_cs_read8(priv->card, IF_CS_READ);
475 if_cs_write16(priv->card, IF_CS_HOST_STATUS, IF_CS_BIT_RX);
476 if_cs_write16(priv->card, IF_CS_HOST_INT_CAUSE, IF_CS_BIT_RX);
482 static irqreturn_t if_cs_interrupt(int irq, void *data)
484 struct if_cs_card *card = data;
485 struct lbs_private *priv = card->priv;
488 /* Ask card interrupt cause register if there is something for us */
489 cause = if_cs_read16(card, IF_CS_CARD_INT_CAUSE);
490 lbs_deb_cs("cause 0x%04x\n", cause);
497 if (cause == 0xffff) {
498 /* Read in junk, the card has probably been removed */
499 card->priv->surpriseremoved = 1;
503 if (cause & IF_CS_BIT_RX) {
505 lbs_deb_cs("rx packet\n");
506 skb = if_cs_receive_data(priv);
508 lbs_process_rxed_packet(priv, skb);
511 if (cause & IF_CS_BIT_TX) {
512 lbs_deb_cs("tx done\n");
513 lbs_host_to_card_done(priv);
516 if (cause & IF_CS_BIT_RESP) {
520 lbs_deb_cs("cmd resp\n");
521 spin_lock_irqsave(&priv->driver_lock, flags);
522 i = (priv->resp_idx == 0) ? 1 : 0;
523 spin_unlock_irqrestore(&priv->driver_lock, flags);
525 BUG_ON(priv->resp_len[i]);
526 if_cs_receive_cmdres(priv, priv->resp_buf[i],
529 spin_lock_irqsave(&priv->driver_lock, flags);
530 lbs_notify_command_response(priv, i);
531 spin_unlock_irqrestore(&priv->driver_lock, flags);
534 if (cause & IF_CS_BIT_EVENT) {
535 u16 status = if_cs_read16(priv->card, IF_CS_CARD_STATUS);
536 if_cs_write16(priv->card, IF_CS_HOST_INT_CAUSE,
538 lbs_queue_event(priv, (status & IF_CS_CARD_STATUS_MASK) >> 8);
541 /* Clear interrupt cause */
542 if_cs_write16(card, IF_CS_CARD_INT_CAUSE, cause & IF_CS_BIT_MASK);
550 /********************************************************************/
552 /********************************************************************/
555 * Tries to program the helper firmware.
557 * Return 0 on success
559 static int if_cs_prog_helper(struct if_cs_card *card, const struct firmware *fw)
566 * This is the only place where an unaligned register access happens on
567 * the CF8305 card, therefore for the sake of speed of the driver, we do
568 * the alignment correction here.
570 if (card->align_regs)
571 scratch = if_cs_read16(card, IF_CS_SCRATCH) >> 8;
573 scratch = if_cs_read8(card, IF_CS_SCRATCH);
575 /* "If the value is 0x5a, the firmware is already
576 * downloaded successfully"
578 if (scratch == IF_CS_SCRATCH_HELPER_OK)
581 /* "If the value is != 00, it is invalid value of register */
582 if (scratch != IF_CS_SCRATCH_BOOT_OK) {
587 lbs_deb_cs("helper size %td\n", fw->size);
589 /* "Set the 5 bytes of the helper image to 0" */
590 /* Not needed, this contains an ARM branch instruction */
593 /* "the number of bytes to send is 256" */
595 int remain = fw->size - sent;
601 * "write the number of bytes to be sent to the I/O Command
602 * write length register"
604 if_cs_write16(card, IF_CS_CMD_LEN, count);
606 /* "write this to I/O Command port register as 16 bit writes */
608 if_cs_write16_rep(card, IF_CS_CMD,
613 * "Assert the download over interrupt command in the Host
616 if_cs_write8(card, IF_CS_HOST_STATUS, IF_CS_BIT_COMMAND);
619 * "Assert the download over interrupt command in the Card
620 * interrupt case register"
622 if_cs_write16(card, IF_CS_HOST_INT_CAUSE, IF_CS_BIT_COMMAND);
625 * "The host polls the Card Status register ... for 50 ms before
626 * declaring a failure"
628 ret = if_cs_poll_while_fw_download(card, IF_CS_CARD_STATUS,
631 pr_err("can't download helper at 0x%x, ret %d\n",
647 static int if_cs_prog_real(struct if_cs_card *card, const struct firmware *fw)
654 lbs_deb_cs("fw size %td\n", fw->size);
656 ret = if_cs_poll_while_fw_download(card, IF_CS_SQ_READ_LOW,
659 pr_err("helper firmware doesn't answer\n");
663 for (sent = 0; sent < fw->size; sent += len) {
664 len = if_cs_read16(card, IF_CS_SQ_READ_LOW);
667 pr_info("odd, need to retry this firmware block\n");
673 pr_err("could not download firmware\n");
682 if_cs_write16(card, IF_CS_CMD_LEN, len);
684 if_cs_write16_rep(card, IF_CS_CMD,
687 if_cs_write8(card, IF_CS_HOST_STATUS, IF_CS_BIT_COMMAND);
688 if_cs_write16(card, IF_CS_HOST_INT_CAUSE, IF_CS_BIT_COMMAND);
690 ret = if_cs_poll_while_fw_download(card, IF_CS_CARD_STATUS,
693 pr_err("can't download firmware at 0x%x\n", sent);
698 ret = if_cs_poll_while_fw_download(card, IF_CS_SCRATCH, 0x5a);
700 pr_err("firmware download failed\n");
706 static void if_cs_prog_firmware(struct lbs_private *priv, int ret,
707 const struct firmware *helper,
708 const struct firmware *mainfw)
710 struct if_cs_card *card = priv->card;
713 pr_err("failed to find firmware (%d)\n", ret);
717 /* Load the firmware */
718 ret = if_cs_prog_helper(card, helper);
719 if (ret == 0 && (card->model != MODEL_8305))
720 ret = if_cs_prog_real(card, mainfw);
724 /* Now actually get the IRQ */
725 ret = request_irq(card->p_dev->irq, if_cs_interrupt,
726 IRQF_SHARED, DRV_NAME, card);
728 pr_err("error in request_irq\n");
733 * Clear any interrupt cause that happened while sending
734 * firmware/initializing card
736 if_cs_write16(card, IF_CS_CARD_INT_CAUSE, IF_CS_BIT_MASK);
737 if_cs_enable_ints(card);
739 /* And finally bring the card up */
741 if (lbs_start_card(priv) != 0) {
742 pr_err("could not activate card\n");
743 free_irq(card->p_dev->irq, card);
748 /********************************************************************/
749 /* Callback functions for libertas.ko */
750 /********************************************************************/
752 /* Send commands or data packets to the card */
753 static int if_cs_host_to_card(struct lbs_private *priv,
762 priv->dnld_sent = DNLD_DATA_SENT;
763 if_cs_send_data(priv, buf, nb);
767 priv->dnld_sent = DNLD_CMD_SENT;
768 ret = if_cs_send_cmd(priv, buf, nb);
771 netdev_err(priv->dev, "%s: unsupported type %d\n",
779 static void if_cs_release(struct pcmcia_device *p_dev)
781 struct if_cs_card *card = p_dev->priv;
783 free_irq(p_dev->irq, card);
784 pcmcia_disable_device(p_dev);
786 ioport_unmap(card->iobase);
790 static int if_cs_ioprobe(struct pcmcia_device *p_dev, void *priv_data)
792 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
793 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
795 if (p_dev->resource[1]->end) {
796 pr_err("wrong CIS (check number of IO windows)\n");
800 /* This reserves IO space but doesn't actually enable it */
801 return pcmcia_request_io(p_dev);
804 static int if_cs_probe(struct pcmcia_device *p_dev)
807 unsigned int prod_id;
808 struct lbs_private *priv;
809 struct if_cs_card *card;
811 card = kzalloc(sizeof(struct if_cs_card), GFP_KERNEL);
818 p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
820 if (pcmcia_loop_config(p_dev, if_cs_ioprobe, NULL)) {
821 pr_err("error in pcmcia_loop_config\n");
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.
833 /* Initialize io access */
834 card->iobase = ioport_map(p_dev->resource[0]->start,
835 resource_size(p_dev->resource[0]));
837 pr_err("error in ioport_map\n");
842 ret = pcmcia_enable_device(p_dev);
844 pr_err("error in pcmcia_enable_device\n");
848 /* Finally, report what we've done */
849 lbs_deb_cs("irq %d, io %pR", p_dev->irq, p_dev->resource[0]);
852 * Most of the libertas cards can do unaligned register access, but some
853 * weird ones cannot. That's especially true for the CF8305 card.
855 card->align_regs = false;
857 card->model = get_model(p_dev->manf_id, p_dev->card_id);
858 if (card->model == MODEL_UNKNOWN) {
859 pr_err("unsupported manf_id 0x%04x / card_id 0x%04x\n",
860 p_dev->manf_id, p_dev->card_id);
865 /* Check if we have a current silicon */
866 prod_id = if_cs_read8(card, IF_CS_PRODUCT_ID);
867 if (card->model == MODEL_8305) {
868 card->align_regs = true;
869 if (prod_id < IF_CS_CF8305_B1_REV) {
870 pr_err("8305 rev B0 and older are not supported\n");
876 if ((card->model == MODEL_8381) && prod_id < IF_CS_CF8381_B3_REV) {
877 pr_err("8381 rev B2 and older are not supported\n");
882 if ((card->model == MODEL_8385) && prod_id < IF_CS_CF8385_B1_REV) {
883 pr_err("8385 rev B0 and older are not supported\n");
888 /* Make this card known to the libertas driver */
889 priv = lbs_add_card(card, &p_dev->dev);
895 /* Set up fields in lbs_private */
898 priv->hw_host_to_card = if_cs_host_to_card;
899 priv->enter_deep_sleep = NULL;
900 priv->exit_deep_sleep = NULL;
901 priv->reset_deep_sleep_wakeup = NULL;
904 ret = lbs_get_firmware_async(priv, &p_dev->dev, card->model, fw_table,
905 if_cs_prog_firmware);
907 pr_err("failed to find firmware (%d)\n", ret);
914 lbs_remove_card(priv);
916 ioport_unmap(card->iobase);
918 pcmcia_disable_device(p_dev);
924 static void if_cs_detach(struct pcmcia_device *p_dev)
926 struct if_cs_card *card = p_dev->priv;
928 lbs_stop_card(card->priv);
929 lbs_remove_card(card->priv);
930 if_cs_disable_ints(card);
931 if_cs_release(p_dev);
937 /********************************************************************/
938 /* Module initialization */
939 /********************************************************************/
941 static const struct pcmcia_device_id if_cs_ids[] = {
942 PCMCIA_DEVICE_MANF_CARD(CF8305_MANFID, CF8305_CARDID),
943 PCMCIA_DEVICE_MANF_CARD(CF8381_MANFID, CF8381_CARDID),
944 PCMCIA_DEVICE_MANF_CARD(CF8385_MANFID, CF8385_CARDID),
945 /* NOTE: keep in sync with get_model() */
948 MODULE_DEVICE_TABLE(pcmcia, if_cs_ids);
950 static struct pcmcia_driver lbs_driver = {
951 .owner = THIS_MODULE,
953 .probe = if_cs_probe,
954 .remove = if_cs_detach,
955 .id_table = if_cs_ids,
957 module_pcmcia_driver(lbs_driver);