2 * Marvell BT-over-SDIO driver: SDIO interface related functions.
4 * Copyright (C) 2009, Marvell International Ltd.
6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
8 * (the "License"). You may use, redistribute and/or modify this File in
9 * accordance with the terms and conditions of the License, a copy of which
10 * is available by writing to the Free Software Foundation, Inc.,
11 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
12 * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
15 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
17 * ARE EXPRESSLY DISCLAIMED. The License provides additional details about
18 * this warranty disclaimer.
21 #include <linux/firmware.h>
22 #include <linux/slab.h>
24 #include <linux/mmc/sdio_ids.h>
25 #include <linux/mmc/sdio_func.h>
26 #include <linux/module.h>
28 #include <net/bluetooth/bluetooth.h>
29 #include <net/bluetooth/hci_core.h>
31 #include "btmrvl_drv.h"
32 #include "btmrvl_sdio.h"
36 /* The btmrvl_sdio_remove() callback function is called
37 * when user removes this module from kernel space or ejects
38 * the card from the slot. The driver handles these 2 cases
40 * If the user is removing the module, a MODULE_SHUTDOWN_REQ
41 * command is sent to firmware and interrupt will be disabled.
42 * If the card is removed, there is no need to send command
43 * or disable interrupt.
45 * The variable 'user_rmmod' is used to distinguish these two
46 * scenarios. This flag is initialized as FALSE in case the card
47 * is removed, and will be set to TRUE for module removal when
48 * module_exit function is called.
53 static const struct btmrvl_sdio_card_reg btmrvl_reg_8688
= {
55 .host_int_mask
= 0x04,
56 .host_intstatus
= 0x05,
58 .sq_read_base_addr_a0
= 0x10,
59 .sq_read_base_addr_a1
= 0x11,
60 .card_fw_status0
= 0x40,
61 .card_fw_status1
= 0x41,
68 static const struct btmrvl_sdio_card_reg btmrvl_reg_8787
= {
70 .host_int_mask
= 0x02,
71 .host_intstatus
= 0x03,
73 .sq_read_base_addr_a0
= 0x40,
74 .sq_read_base_addr_a1
= 0x41,
75 .card_revision
= 0x5c,
76 .card_fw_status0
= 0x60,
77 .card_fw_status1
= 0x61,
85 static const struct btmrvl_sdio_device btmrvl_sdio_sd8688
= {
86 .helper
= "sd8688_helper.bin",
87 .firmware
= "sd8688.bin",
88 .reg
= &btmrvl_reg_8688
,
92 static const struct btmrvl_sdio_device btmrvl_sdio_sd8787
= {
94 .firmware
= "mrvl/sd8787_uapsta.bin",
95 .reg
= &btmrvl_reg_8787
,
96 .sd_blksz_fw_dl
= 256,
99 static const struct sdio_device_id btmrvl_sdio_ids
[] = {
100 /* Marvell SD8688 Bluetooth device */
101 { SDIO_DEVICE(SDIO_VENDOR_ID_MARVELL
, 0x9105),
102 .driver_data
= (unsigned long) &btmrvl_sdio_sd8688
},
103 /* Marvell SD8787 Bluetooth device */
104 { SDIO_DEVICE(SDIO_VENDOR_ID_MARVELL
, 0x911A),
105 .driver_data
= (unsigned long) &btmrvl_sdio_sd8787
},
107 { } /* Terminating entry */
110 MODULE_DEVICE_TABLE(sdio
, btmrvl_sdio_ids
);
112 static int btmrvl_sdio_get_rx_unit(struct btmrvl_sdio_card
*card
)
117 reg
= sdio_readb(card
->func
, card
->reg
->card_rx_unit
, &ret
);
124 static int btmrvl_sdio_read_fw_status(struct btmrvl_sdio_card
*card
, u16
*dat
)
131 fws0
= sdio_readb(card
->func
, card
->reg
->card_fw_status0
, &ret
);
135 fws1
= sdio_readb(card
->func
, card
->reg
->card_fw_status1
, &ret
);
139 *dat
= (((u16
) fws1
) << 8) | fws0
;
144 static int btmrvl_sdio_read_rx_len(struct btmrvl_sdio_card
*card
, u16
*dat
)
149 reg
= sdio_readb(card
->func
, card
->reg
->card_rx_len
, &ret
);
151 *dat
= (u16
) reg
<< card
->rx_unit
;
156 static int btmrvl_sdio_enable_host_int_mask(struct btmrvl_sdio_card
*card
,
161 sdio_writeb(card
->func
, mask
, card
->reg
->host_int_mask
, &ret
);
163 BT_ERR("Unable to enable the host interrupt!");
170 static int btmrvl_sdio_disable_host_int_mask(struct btmrvl_sdio_card
*card
,
176 host_int_mask
= sdio_readb(card
->func
, card
->reg
->host_int_mask
, &ret
);
180 host_int_mask
&= ~mask
;
182 sdio_writeb(card
->func
, host_int_mask
, card
->reg
->host_int_mask
, &ret
);
184 BT_ERR("Unable to disable the host interrupt!");
191 static int btmrvl_sdio_poll_card_status(struct btmrvl_sdio_card
*card
, u8 bits
)
197 for (tries
= 0; tries
< MAX_POLL_TRIES
* 1000; tries
++) {
198 status
= sdio_readb(card
->func
, card
->reg
->card_status
, &ret
);
201 if ((status
& bits
) == bits
)
210 BT_ERR("FAILED! ret=%d", ret
);
215 static int btmrvl_sdio_verify_fw_download(struct btmrvl_sdio_card
*card
,
218 int ret
= -ETIMEDOUT
;
222 /* Wait for firmware to become ready */
223 for (tries
= 0; tries
< pollnum
; tries
++) {
224 if (btmrvl_sdio_read_fw_status(card
, &firmwarestat
) < 0)
227 if (firmwarestat
== FIRMWARE_READY
) {
238 static int btmrvl_sdio_download_helper(struct btmrvl_sdio_card
*card
)
240 const struct firmware
*fw_helper
= NULL
;
241 const u8
*helper
= NULL
;
243 void *tmphlprbuf
= NULL
;
244 int tmphlprbufsz
, hlprblknow
, helperlen
;
248 ret
= request_firmware(&fw_helper
, card
->helper
,
250 if ((ret
< 0) || !fw_helper
) {
251 BT_ERR("request_firmware(helper) failed, error code = %d",
257 helper
= fw_helper
->data
;
258 helperlen
= fw_helper
->size
;
260 BT_DBG("Downloading helper image (%d bytes), block size %d bytes",
261 helperlen
, SDIO_BLOCK_SIZE
);
263 tmphlprbufsz
= ALIGN_SZ(BTM_UPLD_SIZE
, BTSDIO_DMA_ALIGN
);
265 tmphlprbuf
= kzalloc(tmphlprbufsz
, GFP_KERNEL
);
267 BT_ERR("Unable to allocate buffer for helper."
268 " Terminating download");
273 helperbuf
= (u8
*) ALIGN_ADDR(tmphlprbuf
, BTSDIO_DMA_ALIGN
);
275 /* Perform helper data transfer */
276 tx_len
= (FIRMWARE_TRANSFER_NBLOCK
* SDIO_BLOCK_SIZE
)
281 ret
= btmrvl_sdio_poll_card_status(card
,
282 CARD_IO_READY
| DN_LD_CARD_RDY
);
284 BT_ERR("Helper download poll status timeout @ %d",
289 /* Check if there is more data? */
290 if (hlprblknow
>= helperlen
)
293 if (helperlen
- hlprblknow
< tx_len
)
294 tx_len
= helperlen
- hlprblknow
;
297 helperbuf
[0] = ((tx_len
& 0x000000ff) >> 0);
298 helperbuf
[1] = ((tx_len
& 0x0000ff00) >> 8);
299 helperbuf
[2] = ((tx_len
& 0x00ff0000) >> 16);
300 helperbuf
[3] = ((tx_len
& 0xff000000) >> 24);
302 memcpy(&helperbuf
[SDIO_HEADER_LEN
], &helper
[hlprblknow
],
305 /* Now send the data */
306 ret
= sdio_writesb(card
->func
, card
->ioport
, helperbuf
,
307 FIRMWARE_TRANSFER_NBLOCK
* SDIO_BLOCK_SIZE
);
309 BT_ERR("IO error during helper download @ %d",
314 hlprblknow
+= tx_len
;
317 BT_DBG("Transferring helper image EOF block");
319 memset(helperbuf
, 0x0, SDIO_BLOCK_SIZE
);
321 ret
= sdio_writesb(card
->func
, card
->ioport
, helperbuf
,
324 BT_ERR("IO error in writing helper image EOF block");
333 release_firmware(fw_helper
);
338 static int btmrvl_sdio_download_fw_w_helper(struct btmrvl_sdio_card
*card
)
340 const struct firmware
*fw_firmware
= NULL
;
341 const u8
*firmware
= NULL
;
342 int firmwarelen
, tmpfwbufsz
, ret
;
343 unsigned int tries
, offset
;
345 void *tmpfwbuf
= NULL
;
347 u16 len
, blksz_dl
= card
->sd_blksz_fw_dl
;
348 int txlen
= 0, tx_blocks
= 0, count
= 0;
350 ret
= request_firmware(&fw_firmware
, card
->firmware
,
352 if ((ret
< 0) || !fw_firmware
) {
353 BT_ERR("request_firmware(firmware) failed, error code = %d",
359 firmware
= fw_firmware
->data
;
360 firmwarelen
= fw_firmware
->size
;
362 BT_DBG("Downloading FW image (%d bytes)", firmwarelen
);
364 tmpfwbufsz
= ALIGN_SZ(BTM_UPLD_SIZE
, BTSDIO_DMA_ALIGN
);
365 tmpfwbuf
= kzalloc(tmpfwbufsz
, GFP_KERNEL
);
367 BT_ERR("Unable to allocate buffer for firmware."
368 " Terminating download");
373 /* Ensure aligned firmware buffer */
374 fwbuf
= (u8
*) ALIGN_ADDR(tmpfwbuf
, BTSDIO_DMA_ALIGN
);
376 /* Perform firmware data transfer */
379 ret
= btmrvl_sdio_poll_card_status(card
,
380 CARD_IO_READY
| DN_LD_CARD_RDY
);
382 BT_ERR("FW download with helper poll status"
383 " timeout @ %d", offset
);
387 /* Check if there is more data ? */
388 if (offset
>= firmwarelen
)
391 for (tries
= 0; tries
< MAX_POLL_TRIES
; tries
++) {
392 base0
= sdio_readb(card
->func
,
393 card
->reg
->sq_read_base_addr_a0
, &ret
);
395 BT_ERR("BASE0 register read failed:"
396 " base0 = 0x%04X(%d)."
397 " Terminating download",
402 base1
= sdio_readb(card
->func
,
403 card
->reg
->sq_read_base_addr_a1
, &ret
);
405 BT_ERR("BASE1 register read failed:"
406 " base1 = 0x%04X(%d)."
407 " Terminating download",
413 len
= (((u16
) base1
) << 8) | base0
;
422 else if (len
> BTM_UPLD_SIZE
) {
423 BT_ERR("FW download failure @%d, invalid length %d",
433 if (count
> MAX_WRITE_IOMEM_RETRY
) {
434 BT_ERR("FW download failure @%d, "
435 "over max retry count", offset
);
439 BT_ERR("FW CRC error indicated by the helper: "
440 "len = 0x%04X, txlen = %d", len
, txlen
);
442 /* Set txlen to 0 so as to resend from same offset */
448 if (firmwarelen
- offset
< txlen
)
449 txlen
= firmwarelen
- offset
;
451 tx_blocks
= (txlen
+ blksz_dl
- 1) / blksz_dl
;
453 memcpy(fwbuf
, &firmware
[offset
], txlen
);
456 ret
= sdio_writesb(card
->func
, card
->ioport
, fwbuf
,
457 tx_blocks
* blksz_dl
);
460 BT_ERR("FW download, writesb(%d) failed @%d",
462 sdio_writeb(card
->func
, HOST_CMD53_FIN
,
463 card
->reg
->cfg
, &ret
);
465 BT_ERR("writeb failed (CFG)");
471 BT_DBG("FW download over, size %d bytes", offset
);
479 release_firmware(fw_firmware
);
484 static int btmrvl_sdio_card_to_host(struct btmrvl_private
*priv
)
487 int ret
, buf_block_len
, blksz
;
488 struct sk_buff
*skb
= NULL
;
491 struct hci_dev
*hdev
= priv
->btmrvl_dev
.hcidev
;
492 struct btmrvl_sdio_card
*card
= priv
->btmrvl_dev
.card
;
494 if (!card
|| !card
->func
) {
495 BT_ERR("card or function is NULL!");
500 /* Read the length of data to be transferred */
501 ret
= btmrvl_sdio_read_rx_len(card
, &buf_len
);
503 BT_ERR("read rx_len failed");
508 blksz
= SDIO_BLOCK_SIZE
;
509 buf_block_len
= (buf_len
+ blksz
- 1) / blksz
;
511 if (buf_len
<= SDIO_HEADER_LEN
512 || (buf_block_len
* blksz
) > ALLOC_BUF_SIZE
) {
513 BT_ERR("invalid packet length: %d", buf_len
);
518 /* Allocate buffer */
519 skb
= bt_skb_alloc(buf_block_len
* blksz
+ BTSDIO_DMA_ALIGN
,
522 BT_ERR("No free skb");
526 if ((unsigned long) skb
->data
& (BTSDIO_DMA_ALIGN
- 1)) {
527 skb_put(skb
, (unsigned long) skb
->data
&
528 (BTSDIO_DMA_ALIGN
- 1));
529 skb_pull(skb
, (unsigned long) skb
->data
&
530 (BTSDIO_DMA_ALIGN
- 1));
535 ret
= sdio_readsb(card
->func
, payload
, card
->ioport
,
536 buf_block_len
* blksz
);
538 BT_ERR("readsb failed: %d", ret
);
543 /* This is SDIO specific header length: byte[2][1][0], type: byte[3]
544 * (HCI_COMMAND = 1, ACL_DATA = 2, SCO_DATA = 3, 0xFE = Vendor)
547 buf_len
= payload
[0];
548 buf_len
|= (u16
) payload
[1] << 8;
552 case HCI_ACLDATA_PKT
:
553 case HCI_SCODATA_PKT
:
555 bt_cb(skb
)->pkt_type
= type
;
556 skb
->dev
= (void *)hdev
;
557 skb_put(skb
, buf_len
);
558 skb_pull(skb
, SDIO_HEADER_LEN
);
560 if (type
== HCI_EVENT_PKT
)
561 btmrvl_check_evtpkt(priv
, skb
);
564 hdev
->stat
.byte_rx
+= buf_len
;
567 case MRVL_VENDOR_PKT
:
568 bt_cb(skb
)->pkt_type
= HCI_VENDOR_PKT
;
569 skb
->dev
= (void *)hdev
;
570 skb_put(skb
, buf_len
);
571 skb_pull(skb
, SDIO_HEADER_LEN
);
573 if (btmrvl_process_event(priv
, skb
))
576 hdev
->stat
.byte_rx
+= buf_len
;
580 BT_ERR("Unknown packet type:%d", type
);
581 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET
, payload
,
582 blksz
* buf_block_len
);
599 static int btmrvl_sdio_process_int_status(struct btmrvl_private
*priv
)
603 struct btmrvl_sdio_card
*card
= priv
->btmrvl_dev
.card
;
605 spin_lock_irqsave(&priv
->driver_lock
, flags
);
608 spin_unlock_irqrestore(&priv
->driver_lock
, flags
);
610 sdio_claim_host(card
->func
);
611 if (ireg
& DN_LD_HOST_INT_STATUS
) {
612 if (priv
->btmrvl_dev
.tx_dnld_rdy
)
613 BT_DBG("tx_done already received: "
614 " int_status=0x%x", ireg
);
616 priv
->btmrvl_dev
.tx_dnld_rdy
= true;
619 if (ireg
& UP_LD_HOST_INT_STATUS
)
620 btmrvl_sdio_card_to_host(priv
);
622 sdio_release_host(card
->func
);
627 static void btmrvl_sdio_interrupt(struct sdio_func
*func
)
629 struct btmrvl_private
*priv
;
630 struct btmrvl_sdio_card
*card
;
635 card
= sdio_get_drvdata(func
);
636 if (!card
|| !card
->priv
) {
637 BT_ERR("sbi_interrupt(%p) card or priv is "
638 "NULL, card=%p\n", func
, card
);
644 ireg
= sdio_readb(card
->func
, card
->reg
->host_intstatus
, &ret
);
646 BT_ERR("sdio_readb: read int status register failed");
652 * DN_LD_HOST_INT_STATUS and/or UP_LD_HOST_INT_STATUS
653 * Clear the interrupt status register and re-enable the
656 BT_DBG("ireg = 0x%x", ireg
);
658 sdio_writeb(card
->func
, ~(ireg
) & (DN_LD_HOST_INT_STATUS
|
659 UP_LD_HOST_INT_STATUS
),
660 card
->reg
->host_intstatus
, &ret
);
662 BT_ERR("sdio_writeb: clear int status register failed");
667 spin_lock_irqsave(&priv
->driver_lock
, flags
);
669 spin_unlock_irqrestore(&priv
->driver_lock
, flags
);
671 btmrvl_interrupt(priv
);
674 static int btmrvl_sdio_register_dev(struct btmrvl_sdio_card
*card
)
676 struct sdio_func
*func
;
680 if (!card
|| !card
->func
) {
681 BT_ERR("Error: card or function is NULL!");
688 sdio_claim_host(func
);
690 ret
= sdio_enable_func(func
);
692 BT_ERR("sdio_enable_func() failed: ret=%d", ret
);
697 ret
= sdio_claim_irq(func
, btmrvl_sdio_interrupt
);
699 BT_ERR("sdio_claim_irq failed: ret=%d", ret
);
704 ret
= sdio_set_block_size(card
->func
, SDIO_BLOCK_SIZE
);
706 BT_ERR("cannot set SDIO block size");
711 reg
= sdio_readb(func
, card
->reg
->io_port_0
, &ret
);
719 reg
= sdio_readb(func
, card
->reg
->io_port_1
, &ret
);
725 card
->ioport
|= (reg
<< 8);
727 reg
= sdio_readb(func
, card
->reg
->io_port_2
, &ret
);
733 card
->ioport
|= (reg
<< 16);
735 BT_DBG("SDIO FUNC%d IO port: 0x%x", func
->num
, card
->ioport
);
737 sdio_set_drvdata(func
, card
);
739 sdio_release_host(func
);
744 sdio_release_irq(func
);
747 sdio_disable_func(func
);
750 sdio_release_host(func
);
756 static int btmrvl_sdio_unregister_dev(struct btmrvl_sdio_card
*card
)
758 if (card
&& card
->func
) {
759 sdio_claim_host(card
->func
);
760 sdio_release_irq(card
->func
);
761 sdio_disable_func(card
->func
);
762 sdio_release_host(card
->func
);
763 sdio_set_drvdata(card
->func
, NULL
);
769 static int btmrvl_sdio_enable_host_int(struct btmrvl_sdio_card
*card
)
773 if (!card
|| !card
->func
)
776 sdio_claim_host(card
->func
);
778 ret
= btmrvl_sdio_enable_host_int_mask(card
, HIM_ENABLE
);
780 btmrvl_sdio_get_rx_unit(card
);
782 sdio_release_host(card
->func
);
787 static int btmrvl_sdio_disable_host_int(struct btmrvl_sdio_card
*card
)
791 if (!card
|| !card
->func
)
794 sdio_claim_host(card
->func
);
796 ret
= btmrvl_sdio_disable_host_int_mask(card
, HIM_DISABLE
);
798 sdio_release_host(card
->func
);
803 static int btmrvl_sdio_host_to_card(struct btmrvl_private
*priv
,
806 struct btmrvl_sdio_card
*card
= priv
->btmrvl_dev
.card
;
815 if (!card
|| !card
->func
) {
816 BT_ERR("card or function is NULL!");
821 if ((unsigned long) payload
& (BTSDIO_DMA_ALIGN
- 1)) {
822 tmpbufsz
= ALIGN_SZ(nb
, BTSDIO_DMA_ALIGN
);
823 tmpbuf
= kzalloc(tmpbufsz
, GFP_KERNEL
);
826 buf
= (u8
*) ALIGN_ADDR(tmpbuf
, BTSDIO_DMA_ALIGN
);
827 memcpy(buf
, payload
, nb
);
830 blksz
= SDIO_BLOCK_SIZE
;
831 buf_block_len
= (nb
+ blksz
- 1) / blksz
;
833 sdio_claim_host(card
->func
);
836 /* Transfer data to card */
837 ret
= sdio_writesb(card
->func
, card
->ioport
, buf
,
838 buf_block_len
* blksz
);
841 BT_ERR("i=%d writesb failed: %d", i
, ret
);
842 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET
,
845 if (i
> MAX_WRITE_IOMEM_RETRY
)
850 priv
->btmrvl_dev
.tx_dnld_rdy
= false;
853 sdio_release_host(card
->func
);
859 static int btmrvl_sdio_download_fw(struct btmrvl_sdio_card
*card
)
863 int pollnum
= MAX_POLL_TRIES
;
865 if (!card
|| !card
->func
) {
866 BT_ERR("card or function is NULL!");
869 sdio_claim_host(card
->func
);
871 if (!btmrvl_sdio_verify_fw_download(card
, 1)) {
872 BT_DBG("Firmware already downloaded!");
876 /* Check if other function driver is downloading the firmware */
877 fws0
= sdio_readb(card
->func
, card
->reg
->card_fw_status0
, &ret
);
879 BT_ERR("Failed to read FW downloading status!");
884 BT_DBG("BT not the winner (%#x). Skip FW downloading", fws0
);
886 /* Give other function more time to download the firmware */
890 ret
= btmrvl_sdio_download_helper(card
);
892 BT_ERR("Failed to download helper!");
898 if (btmrvl_sdio_download_fw_w_helper(card
)) {
899 BT_ERR("Failed to download firmware!");
905 if (btmrvl_sdio_verify_fw_download(card
, pollnum
)) {
906 BT_ERR("FW failed to be active in time!");
912 sdio_release_host(card
->func
);
917 static int btmrvl_sdio_wakeup_fw(struct btmrvl_private
*priv
)
919 struct btmrvl_sdio_card
*card
= priv
->btmrvl_dev
.card
;
922 if (!card
|| !card
->func
) {
923 BT_ERR("card or function is NULL!");
927 sdio_claim_host(card
->func
);
929 sdio_writeb(card
->func
, HOST_POWER_UP
, card
->reg
->cfg
, &ret
);
931 sdio_release_host(card
->func
);
933 BT_DBG("wake up firmware");
938 static int btmrvl_sdio_probe(struct sdio_func
*func
,
939 const struct sdio_device_id
*id
)
942 struct btmrvl_private
*priv
= NULL
;
943 struct btmrvl_sdio_card
*card
= NULL
;
945 BT_INFO("vendor=0x%x, device=0x%x, class=%d, fn=%d",
946 id
->vendor
, id
->device
, id
->class, func
->num
);
948 card
= kzalloc(sizeof(*card
), GFP_KERNEL
);
956 if (id
->driver_data
) {
957 struct btmrvl_sdio_device
*data
= (void *) id
->driver_data
;
958 card
->helper
= data
->helper
;
959 card
->firmware
= data
->firmware
;
960 card
->reg
= data
->reg
;
961 card
->sd_blksz_fw_dl
= data
->sd_blksz_fw_dl
;
964 if (btmrvl_sdio_register_dev(card
) < 0) {
965 BT_ERR("Failed to register BT device!");
970 /* Disable the interrupts on the card */
971 btmrvl_sdio_disable_host_int(card
);
973 if (btmrvl_sdio_download_fw(card
)) {
974 BT_ERR("Downloading firmware failed!");
981 btmrvl_sdio_enable_host_int(card
);
983 priv
= btmrvl_add_card(card
);
985 BT_ERR("Initializing card failed!");
987 goto disable_host_int
;
992 /* Initialize the interface specific function pointers */
993 priv
->hw_host_to_card
= btmrvl_sdio_host_to_card
;
994 priv
->hw_wakeup_firmware
= btmrvl_sdio_wakeup_fw
;
995 priv
->hw_process_int_status
= btmrvl_sdio_process_int_status
;
997 if (btmrvl_register_hdev(priv
)) {
998 BT_ERR("Register hdev failed!");
1000 goto disable_host_int
;
1003 priv
->btmrvl_dev
.psmode
= 1;
1004 btmrvl_enable_ps(priv
);
1009 btmrvl_sdio_disable_host_int(card
);
1011 btmrvl_sdio_unregister_dev(card
);
1018 static void btmrvl_sdio_remove(struct sdio_func
*func
)
1020 struct btmrvl_sdio_card
*card
;
1023 card
= sdio_get_drvdata(func
);
1025 /* Send SHUTDOWN command & disable interrupt
1026 * if user removes the module.
1029 btmrvl_send_module_cfg_cmd(card
->priv
,
1030 MODULE_SHUTDOWN_REQ
);
1031 btmrvl_sdio_disable_host_int(card
);
1033 BT_DBG("unregester dev");
1034 btmrvl_sdio_unregister_dev(card
);
1035 btmrvl_remove_card(card
->priv
);
1041 static struct sdio_driver bt_mrvl_sdio
= {
1042 .name
= "btmrvl_sdio",
1043 .id_table
= btmrvl_sdio_ids
,
1044 .probe
= btmrvl_sdio_probe
,
1045 .remove
= btmrvl_sdio_remove
,
1048 static int __init
btmrvl_sdio_init_module(void)
1050 if (sdio_register_driver(&bt_mrvl_sdio
) != 0) {
1051 BT_ERR("SDIO Driver Registration Failed");
1055 /* Clear the flag in case user removes the card. */
1061 static void __exit
btmrvl_sdio_exit_module(void)
1063 /* Set the flag as user is removing this module. */
1066 sdio_unregister_driver(&bt_mrvl_sdio
);
1069 module_init(btmrvl_sdio_init_module
);
1070 module_exit(btmrvl_sdio_exit_module
);
1072 MODULE_AUTHOR("Marvell International Ltd.");
1073 MODULE_DESCRIPTION("Marvell BT-over-SDIO driver ver " VERSION
);
1074 MODULE_VERSION(VERSION
);
1075 MODULE_LICENSE("GPL v2");
1076 MODULE_FIRMWARE("sd8688_helper.bin");
1077 MODULE_FIRMWARE("sd8688.bin");
1078 MODULE_FIRMWARE("mrvl/sd8787_uapsta.bin");