blob: 7f521d4ac657e13764e9917fd45f393b0933eee3 [file] [log] [blame]
Bing Zhao789221e2009-06-02 14:29:36 -07001/**
2 * Marvell BT-over-SDIO driver: SDIO interface related functions.
3 *
4 * Copyright (C) 2009, Marvell International Ltd.
5 *
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.
13 *
14 *
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.
19 **/
20
21#include <linux/firmware.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090022#include <linux/slab.h>
Bing Zhao789221e2009-06-02 14:29:36 -070023
24#include <linux/mmc/sdio_ids.h>
25#include <linux/mmc/sdio_func.h>
26
27#include <net/bluetooth/bluetooth.h>
28#include <net/bluetooth/hci_core.h>
29
30#include "btmrvl_drv.h"
31#include "btmrvl_sdio.h"
32
33#define VERSION "1.0"
34
Bing Zhao789221e2009-06-02 14:29:36 -070035/* The btmrvl_sdio_remove() callback function is called
36 * when user removes this module from kernel space or ejects
37 * the card from the slot. The driver handles these 2 cases
38 * differently.
39 * If the user is removing the module, a MODULE_SHUTDOWN_REQ
40 * command is sent to firmware and interrupt will be disabled.
41 * If the card is removed, there is no need to send command
42 * or disable interrupt.
43 *
44 * The variable 'user_rmmod' is used to distinguish these two
45 * scenarios. This flag is initialized as FALSE in case the card
46 * is removed, and will be set to TRUE for module removal when
47 * module_exit function is called.
48 */
49static u8 user_rmmod;
Amitkumar Karward1d10d72010-05-27 16:38:37 -070050static u8 sdio_ireg;
Bing Zhao789221e2009-06-02 14:29:36 -070051
Kevin Gan9f72c1d2011-04-08 18:19:33 -070052static const struct btmrvl_sdio_card_reg btmrvl_reg_8688 = {
53 .cfg = 0x03,
54 .host_int_mask = 0x04,
55 .host_intstatus = 0x05,
56 .card_status = 0x20,
57 .sq_read_base_addr_a0 = 0x10,
58 .sq_read_base_addr_a1 = 0x11,
59 .card_fw_status0 = 0x40,
60 .card_fw_status1 = 0x41,
61 .card_rx_len = 0x42,
62 .card_rx_unit = 0x43,
63 .io_port_0 = 0x00,
64 .io_port_1 = 0x01,
65 .io_port_2 = 0x02,
66};
67static const struct btmrvl_sdio_card_reg btmrvl_reg_8787 = {
68 .cfg = 0x00,
69 .host_int_mask = 0x02,
70 .host_intstatus = 0x03,
71 .card_status = 0x30,
72 .sq_read_base_addr_a0 = 0x40,
73 .sq_read_base_addr_a1 = 0x41,
74 .card_revision = 0x5c,
75 .card_fw_status0 = 0x60,
76 .card_fw_status1 = 0x61,
77 .card_rx_len = 0x62,
78 .card_rx_unit = 0x63,
79 .io_port_0 = 0x78,
80 .io_port_1 = 0x79,
81 .io_port_2 = 0x7a,
82};
83
Marcel Holtmanndcf47f32009-06-09 16:21:58 +020084static const struct btmrvl_sdio_device btmrvl_sdio_sd6888 = {
85 .helper = "sd8688_helper.bin",
86 .firmware = "sd8688.bin",
Kevin Gan9f72c1d2011-04-08 18:19:33 -070087 .reg = &btmrvl_reg_8688,
88 .sd_blksz_fw_dl = 64,
89};
90
91static const struct btmrvl_sdio_device btmrvl_sdio_sd8787 = {
92 .helper = NULL,
93 .firmware = "mrvl/sd8787_uapsta.bin",
94 .reg = &btmrvl_reg_8787,
95 .sd_blksz_fw_dl = 256,
Marcel Holtmanndcf47f32009-06-09 16:21:58 +020096};
97
Bing Zhao789221e2009-06-02 14:29:36 -070098static const struct sdio_device_id btmrvl_sdio_ids[] = {
Marcel Holtmanndcf47f32009-06-09 16:21:58 +020099 /* Marvell SD8688 Bluetooth device */
100 { SDIO_DEVICE(SDIO_VENDOR_ID_MARVELL, 0x9105),
101 .driver_data = (unsigned long) &btmrvl_sdio_sd6888 },
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700102 /* Marvell SD8787 Bluetooth device */
103 { SDIO_DEVICE(SDIO_VENDOR_ID_MARVELL, 0x911A),
104 .driver_data = (unsigned long) &btmrvl_sdio_sd8787 },
Marcel Holtmanndcf47f32009-06-09 16:21:58 +0200105
106 { } /* Terminating entry */
Bing Zhao789221e2009-06-02 14:29:36 -0700107};
108
109MODULE_DEVICE_TABLE(sdio, btmrvl_sdio_ids);
110
Bing Zhao789221e2009-06-02 14:29:36 -0700111static int btmrvl_sdio_get_rx_unit(struct btmrvl_sdio_card *card)
112{
113 u8 reg;
114 int ret;
115
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700116 reg = sdio_readb(card->func, card->reg->card_rx_unit, &ret);
Bing Zhao789221e2009-06-02 14:29:36 -0700117 if (!ret)
118 card->rx_unit = reg;
119
Bing Zhao789221e2009-06-02 14:29:36 -0700120 return ret;
121}
122
123static int btmrvl_sdio_read_fw_status(struct btmrvl_sdio_card *card, u16 *dat)
124{
Bing Zhao789221e2009-06-02 14:29:36 -0700125 u8 fws0, fws1;
Marcel Holtmann93742532009-06-13 07:40:18 +0200126 int ret;
Bing Zhao789221e2009-06-02 14:29:36 -0700127
128 *dat = 0;
129
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700130 fws0 = sdio_readb(card->func, card->reg->card_fw_status0, &ret);
Kulikov Vasiliy278be272010-07-05 12:01:22 +0400131 if (ret)
132 return -EIO;
Bing Zhao789221e2009-06-02 14:29:36 -0700133
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700134 fws1 = sdio_readb(card->func, card->reg->card_fw_status1, &ret);
Marcel Holtmann93742532009-06-13 07:40:18 +0200135 if (ret)
Bing Zhao789221e2009-06-02 14:29:36 -0700136 return -EIO;
Bing Zhao789221e2009-06-02 14:29:36 -0700137
138 *dat = (((u16) fws1) << 8) | fws0;
139
Bing Zhao789221e2009-06-02 14:29:36 -0700140 return 0;
141}
142
143static int btmrvl_sdio_read_rx_len(struct btmrvl_sdio_card *card, u16 *dat)
144{
Bing Zhao789221e2009-06-02 14:29:36 -0700145 u8 reg;
Marcel Holtmann93742532009-06-13 07:40:18 +0200146 int ret;
Bing Zhao789221e2009-06-02 14:29:36 -0700147
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700148 reg = sdio_readb(card->func, card->reg->card_rx_len, &ret);
Bing Zhao789221e2009-06-02 14:29:36 -0700149 if (!ret)
150 *dat = (u16) reg << card->rx_unit;
151
Bing Zhao789221e2009-06-02 14:29:36 -0700152 return ret;
153}
154
155static int btmrvl_sdio_enable_host_int_mask(struct btmrvl_sdio_card *card,
Marcel Holtmanndcf47f32009-06-09 16:21:58 +0200156 u8 mask)
Bing Zhao789221e2009-06-02 14:29:36 -0700157{
158 int ret;
159
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700160 sdio_writeb(card->func, mask, card->reg->host_int_mask, &ret);
Bing Zhao789221e2009-06-02 14:29:36 -0700161 if (ret) {
162 BT_ERR("Unable to enable the host interrupt!");
163 ret = -EIO;
164 }
165
Bing Zhao789221e2009-06-02 14:29:36 -0700166 return ret;
167}
168
169static int btmrvl_sdio_disable_host_int_mask(struct btmrvl_sdio_card *card,
Marcel Holtmanndcf47f32009-06-09 16:21:58 +0200170 u8 mask)
Bing Zhao789221e2009-06-02 14:29:36 -0700171{
Bing Zhao789221e2009-06-02 14:29:36 -0700172 u8 host_int_mask;
Marcel Holtmann93742532009-06-13 07:40:18 +0200173 int ret;
Bing Zhao789221e2009-06-02 14:29:36 -0700174
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700175 host_int_mask = sdio_readb(card->func, card->reg->host_int_mask, &ret);
Marcel Holtmann93742532009-06-13 07:40:18 +0200176 if (ret)
177 return -EIO;
Bing Zhao789221e2009-06-02 14:29:36 -0700178
179 host_int_mask &= ~mask;
180
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700181 sdio_writeb(card->func, host_int_mask, card->reg->host_int_mask, &ret);
Bing Zhao789221e2009-06-02 14:29:36 -0700182 if (ret < 0) {
183 BT_ERR("Unable to disable the host interrupt!");
Marcel Holtmann93742532009-06-13 07:40:18 +0200184 return -EIO;
Bing Zhao789221e2009-06-02 14:29:36 -0700185 }
186
Marcel Holtmann93742532009-06-13 07:40:18 +0200187 return 0;
Bing Zhao789221e2009-06-02 14:29:36 -0700188}
189
190static int btmrvl_sdio_poll_card_status(struct btmrvl_sdio_card *card, u8 bits)
191{
192 unsigned int tries;
Bing Zhao789221e2009-06-02 14:29:36 -0700193 u8 status;
Marcel Holtmann93742532009-06-13 07:40:18 +0200194 int ret;
Bing Zhao789221e2009-06-02 14:29:36 -0700195
196 for (tries = 0; tries < MAX_POLL_TRIES * 1000; tries++) {
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700197 status = sdio_readb(card->func, card->reg->card_status, &ret);
Bing Zhao789221e2009-06-02 14:29:36 -0700198 if (ret)
199 goto failed;
200 if ((status & bits) == bits)
Marcel Holtmann93742532009-06-13 07:40:18 +0200201 return ret;
Bing Zhao789221e2009-06-02 14:29:36 -0700202
203 udelay(1);
204 }
205
206 ret = -ETIMEDOUT;
207
208failed:
209 BT_ERR("FAILED! ret=%d", ret);
210
Bing Zhao789221e2009-06-02 14:29:36 -0700211 return ret;
212}
213
214static int btmrvl_sdio_verify_fw_download(struct btmrvl_sdio_card *card,
Marcel Holtmanndcf47f32009-06-09 16:21:58 +0200215 int pollnum)
Bing Zhao789221e2009-06-02 14:29:36 -0700216{
217 int ret = -ETIMEDOUT;
218 u16 firmwarestat;
219 unsigned int tries;
220
Bing Zhao789221e2009-06-02 14:29:36 -0700221 /* Wait for firmware to become ready */
222 for (tries = 0; tries < pollnum; tries++) {
223 if (btmrvl_sdio_read_fw_status(card, &firmwarestat) < 0)
224 continue;
225
226 if (firmwarestat == FIRMWARE_READY) {
227 ret = 0;
228 break;
229 } else {
230 msleep(10);
231 }
232 }
233
Bing Zhao789221e2009-06-02 14:29:36 -0700234 return ret;
235}
236
237static int btmrvl_sdio_download_helper(struct btmrvl_sdio_card *card)
238{
239 const struct firmware *fw_helper = NULL;
240 const u8 *helper = NULL;
241 int ret;
242 void *tmphlprbuf = NULL;
243 int tmphlprbufsz, hlprblknow, helperlen;
244 u8 *helperbuf;
245 u32 tx_len;
246
Bing Zhao789221e2009-06-02 14:29:36 -0700247 ret = request_firmware(&fw_helper, card->helper,
Marcel Holtmanndcf47f32009-06-09 16:21:58 +0200248 &card->func->dev);
Bing Zhao789221e2009-06-02 14:29:36 -0700249 if ((ret < 0) || !fw_helper) {
250 BT_ERR("request_firmware(helper) failed, error code = %d",
Marcel Holtmanndcf47f32009-06-09 16:21:58 +0200251 ret);
Bing Zhao789221e2009-06-02 14:29:36 -0700252 ret = -ENOENT;
253 goto done;
254 }
255
256 helper = fw_helper->data;
257 helperlen = fw_helper->size;
258
259 BT_DBG("Downloading helper image (%d bytes), block size %d bytes",
Marcel Holtmanndcf47f32009-06-09 16:21:58 +0200260 helperlen, SDIO_BLOCK_SIZE);
Bing Zhao789221e2009-06-02 14:29:36 -0700261
262 tmphlprbufsz = ALIGN_SZ(BTM_UPLD_SIZE, BTSDIO_DMA_ALIGN);
263
Julia Lawallf8df39f2010-05-13 22:02:03 +0200264 tmphlprbuf = kzalloc(tmphlprbufsz, GFP_KERNEL);
Bing Zhao789221e2009-06-02 14:29:36 -0700265 if (!tmphlprbuf) {
266 BT_ERR("Unable to allocate buffer for helper."
267 " Terminating download");
268 ret = -ENOMEM;
269 goto done;
270 }
271
Bing Zhao789221e2009-06-02 14:29:36 -0700272 helperbuf = (u8 *) ALIGN_ADDR(tmphlprbuf, BTSDIO_DMA_ALIGN);
273
274 /* Perform helper data transfer */
275 tx_len = (FIRMWARE_TRANSFER_NBLOCK * SDIO_BLOCK_SIZE)
276 - SDIO_HEADER_LEN;
277 hlprblknow = 0;
278
279 do {
280 ret = btmrvl_sdio_poll_card_status(card,
281 CARD_IO_READY | DN_LD_CARD_RDY);
282 if (ret < 0) {
283 BT_ERR("Helper download poll status timeout @ %d",
284 hlprblknow);
285 goto done;
286 }
287
288 /* Check if there is more data? */
289 if (hlprblknow >= helperlen)
290 break;
291
292 if (helperlen - hlprblknow < tx_len)
293 tx_len = helperlen - hlprblknow;
294
295 /* Little-endian */
296 helperbuf[0] = ((tx_len & 0x000000ff) >> 0);
297 helperbuf[1] = ((tx_len & 0x0000ff00) >> 8);
298 helperbuf[2] = ((tx_len & 0x00ff0000) >> 16);
299 helperbuf[3] = ((tx_len & 0xff000000) >> 24);
300
301 memcpy(&helperbuf[SDIO_HEADER_LEN], &helper[hlprblknow],
302 tx_len);
303
304 /* Now send the data */
Marcel Holtmanndcf47f32009-06-09 16:21:58 +0200305 ret = sdio_writesb(card->func, card->ioport, helperbuf,
306 FIRMWARE_TRANSFER_NBLOCK * SDIO_BLOCK_SIZE);
Bing Zhao789221e2009-06-02 14:29:36 -0700307 if (ret < 0) {
308 BT_ERR("IO error during helper download @ %d",
309 hlprblknow);
310 goto done;
311 }
312
313 hlprblknow += tx_len;
314 } while (true);
315
316 BT_DBG("Transferring helper image EOF block");
317
318 memset(helperbuf, 0x0, SDIO_BLOCK_SIZE);
319
320 ret = sdio_writesb(card->func, card->ioport, helperbuf,
Marcel Holtmanndcf47f32009-06-09 16:21:58 +0200321 SDIO_BLOCK_SIZE);
Bing Zhao789221e2009-06-02 14:29:36 -0700322 if (ret < 0) {
323 BT_ERR("IO error in writing helper image EOF block");
324 goto done;
325 }
326
327 ret = 0;
328
329done:
330 kfree(tmphlprbuf);
331 if (fw_helper)
332 release_firmware(fw_helper);
333
Bing Zhao789221e2009-06-02 14:29:36 -0700334 return ret;
335}
336
337static int btmrvl_sdio_download_fw_w_helper(struct btmrvl_sdio_card *card)
338{
339 const struct firmware *fw_firmware = NULL;
340 const u8 *firmware = NULL;
341 int firmwarelen, tmpfwbufsz, ret;
342 unsigned int tries, offset;
343 u8 base0, base1;
344 void *tmpfwbuf = NULL;
345 u8 *fwbuf;
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700346 u16 len, blksz_dl = card->sd_blksz_fw_dl;
Bing Zhao789221e2009-06-02 14:29:36 -0700347 int txlen = 0, tx_blocks = 0, count = 0;
348
Bing Zhao789221e2009-06-02 14:29:36 -0700349 ret = request_firmware(&fw_firmware, card->firmware,
Marcel Holtmanndcf47f32009-06-09 16:21:58 +0200350 &card->func->dev);
Bing Zhao789221e2009-06-02 14:29:36 -0700351 if ((ret < 0) || !fw_firmware) {
352 BT_ERR("request_firmware(firmware) failed, error code = %d",
Marcel Holtmanndcf47f32009-06-09 16:21:58 +0200353 ret);
Bing Zhao789221e2009-06-02 14:29:36 -0700354 ret = -ENOENT;
355 goto done;
356 }
357
358 firmware = fw_firmware->data;
359 firmwarelen = fw_firmware->size;
360
361 BT_DBG("Downloading FW image (%d bytes)", firmwarelen);
362
363 tmpfwbufsz = ALIGN_SZ(BTM_UPLD_SIZE, BTSDIO_DMA_ALIGN);
Julia Lawallf8df39f2010-05-13 22:02:03 +0200364 tmpfwbuf = kzalloc(tmpfwbufsz, GFP_KERNEL);
Bing Zhao789221e2009-06-02 14:29:36 -0700365 if (!tmpfwbuf) {
366 BT_ERR("Unable to allocate buffer for firmware."
367 " Terminating download");
368 ret = -ENOMEM;
369 goto done;
370 }
371
Bing Zhao789221e2009-06-02 14:29:36 -0700372 /* Ensure aligned firmware buffer */
373 fwbuf = (u8 *) ALIGN_ADDR(tmpfwbuf, BTSDIO_DMA_ALIGN);
374
375 /* Perform firmware data transfer */
376 offset = 0;
377 do {
378 ret = btmrvl_sdio_poll_card_status(card,
Marcel Holtmanndcf47f32009-06-09 16:21:58 +0200379 CARD_IO_READY | DN_LD_CARD_RDY);
Bing Zhao789221e2009-06-02 14:29:36 -0700380 if (ret < 0) {
381 BT_ERR("FW download with helper poll status"
Marcel Holtmanndcf47f32009-06-09 16:21:58 +0200382 " timeout @ %d", offset);
Bing Zhao789221e2009-06-02 14:29:36 -0700383 goto done;
384 }
385
386 /* Check if there is more data ? */
387 if (offset >= firmwarelen)
388 break;
389
390 for (tries = 0; tries < MAX_POLL_TRIES; tries++) {
391 base0 = sdio_readb(card->func,
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700392 card->reg->sq_read_base_addr_a0, &ret);
Bing Zhao789221e2009-06-02 14:29:36 -0700393 if (ret) {
394 BT_ERR("BASE0 register read failed:"
395 " base0 = 0x%04X(%d)."
396 " Terminating download",
397 base0, base0);
398 ret = -EIO;
399 goto done;
400 }
401 base1 = sdio_readb(card->func,
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700402 card->reg->sq_read_base_addr_a1, &ret);
Bing Zhao789221e2009-06-02 14:29:36 -0700403 if (ret) {
404 BT_ERR("BASE1 register read failed:"
405 " base1 = 0x%04X(%d)."
406 " Terminating download",
407 base1, base1);
408 ret = -EIO;
409 goto done;
410 }
411
412 len = (((u16) base1) << 8) | base0;
413 if (len)
414 break;
415
416 udelay(10);
417 }
418
419 if (!len)
420 break;
421 else if (len > BTM_UPLD_SIZE) {
422 BT_ERR("FW download failure @%d, invalid length %d",
Marcel Holtmanndcf47f32009-06-09 16:21:58 +0200423 offset, len);
Bing Zhao789221e2009-06-02 14:29:36 -0700424 ret = -EINVAL;
425 goto done;
426 }
427
428 txlen = len;
429
430 if (len & BIT(0)) {
431 count++;
432 if (count > MAX_WRITE_IOMEM_RETRY) {
433 BT_ERR("FW download failure @%d, "
434 "over max retry count", offset);
435 ret = -EIO;
436 goto done;
437 }
438 BT_ERR("FW CRC error indicated by the helper: "
439 "len = 0x%04X, txlen = %d", len, txlen);
440 len &= ~BIT(0);
441 /* Set txlen to 0 so as to resend from same offset */
442 txlen = 0;
443 } else {
444 count = 0;
445
446 /* Last block ? */
447 if (firmwarelen - offset < txlen)
448 txlen = firmwarelen - offset;
449
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700450 tx_blocks = (txlen + blksz_dl - 1) / blksz_dl;
Bing Zhao789221e2009-06-02 14:29:36 -0700451
452 memcpy(fwbuf, &firmware[offset], txlen);
453 }
454
455 ret = sdio_writesb(card->func, card->ioport, fwbuf,
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700456 tx_blocks * blksz_dl);
Bing Zhao789221e2009-06-02 14:29:36 -0700457
458 if (ret < 0) {
459 BT_ERR("FW download, writesb(%d) failed @%d",
Marcel Holtmanndcf47f32009-06-09 16:21:58 +0200460 count, offset);
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700461 sdio_writeb(card->func, HOST_CMD53_FIN,
462 card->reg->cfg, &ret);
Bing Zhao789221e2009-06-02 14:29:36 -0700463 if (ret)
464 BT_ERR("writeb failed (CFG)");
465 }
466
467 offset += txlen;
468 } while (true);
469
470 BT_DBG("FW download over, size %d bytes", offset);
471
472 ret = 0;
473
474done:
475 kfree(tmpfwbuf);
476
477 if (fw_firmware)
478 release_firmware(fw_firmware);
479
Bing Zhao789221e2009-06-02 14:29:36 -0700480 return ret;
481}
482
483static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv)
484{
485 u16 buf_len = 0;
486 int ret, buf_block_len, blksz;
487 struct sk_buff *skb = NULL;
488 u32 type;
489 u8 *payload = NULL;
490 struct hci_dev *hdev = priv->btmrvl_dev.hcidev;
491 struct btmrvl_sdio_card *card = priv->btmrvl_dev.card;
492
Bing Zhao789221e2009-06-02 14:29:36 -0700493 if (!card || !card->func) {
494 BT_ERR("card or function is NULL!");
495 ret = -EINVAL;
496 goto exit;
497 }
498
499 /* Read the length of data to be transferred */
500 ret = btmrvl_sdio_read_rx_len(card, &buf_len);
501 if (ret < 0) {
502 BT_ERR("read rx_len failed");
503 ret = -EIO;
504 goto exit;
505 }
506
507 blksz = SDIO_BLOCK_SIZE;
508 buf_block_len = (buf_len + blksz - 1) / blksz;
509
510 if (buf_len <= SDIO_HEADER_LEN
Marcel Holtmanndcf47f32009-06-09 16:21:58 +0200511 || (buf_block_len * blksz) > ALLOC_BUF_SIZE) {
Bing Zhao789221e2009-06-02 14:29:36 -0700512 BT_ERR("invalid packet length: %d", buf_len);
513 ret = -EINVAL;
514 goto exit;
515 }
516
517 /* Allocate buffer */
518 skb = bt_skb_alloc(buf_block_len * blksz + BTSDIO_DMA_ALIGN,
Marcel Holtmanndcf47f32009-06-09 16:21:58 +0200519 GFP_ATOMIC);
Bing Zhao789221e2009-06-02 14:29:36 -0700520 if (skb == NULL) {
521 BT_ERR("No free skb");
522 goto exit;
523 }
524
Bing Zhao3318b232009-07-08 11:44:14 -0700525 if ((unsigned long) skb->data & (BTSDIO_DMA_ALIGN - 1)) {
526 skb_put(skb, (unsigned long) skb->data &
527 (BTSDIO_DMA_ALIGN - 1));
528 skb_pull(skb, (unsigned long) skb->data &
529 (BTSDIO_DMA_ALIGN - 1));
Bing Zhao789221e2009-06-02 14:29:36 -0700530 }
531
Bing Zhao3318b232009-07-08 11:44:14 -0700532 payload = skb->data;
Bing Zhao789221e2009-06-02 14:29:36 -0700533
534 ret = sdio_readsb(card->func, payload, card->ioport,
535 buf_block_len * blksz);
536 if (ret < 0) {
537 BT_ERR("readsb failed: %d", ret);
538 ret = -EIO;
539 goto exit;
540 }
541
542 /* This is SDIO specific header length: byte[2][1][0], type: byte[3]
543 * (HCI_COMMAND = 1, ACL_DATA = 2, SCO_DATA = 3, 0xFE = Vendor)
544 */
545
546 buf_len = payload[0];
547 buf_len |= (u16) payload[1] << 8;
548 type = payload[3];
549
550 switch (type) {
551 case HCI_ACLDATA_PKT:
552 case HCI_SCODATA_PKT:
553 case HCI_EVENT_PKT:
554 bt_cb(skb)->pkt_type = type;
555 skb->dev = (void *)hdev;
556 skb_put(skb, buf_len);
557 skb_pull(skb, SDIO_HEADER_LEN);
558
559 if (type == HCI_EVENT_PKT)
560 btmrvl_check_evtpkt(priv, skb);
561
562 hci_recv_frame(skb);
563 hdev->stat.byte_rx += buf_len;
564 break;
565
566 case MRVL_VENDOR_PKT:
567 bt_cb(skb)->pkt_type = HCI_VENDOR_PKT;
568 skb->dev = (void *)hdev;
569 skb_put(skb, buf_len);
570 skb_pull(skb, SDIO_HEADER_LEN);
571
572 if (btmrvl_process_event(priv, skb))
573 hci_recv_frame(skb);
574
575 hdev->stat.byte_rx += buf_len;
576 break;
577
578 default:
André Goddard Rosaaf901ca2009-11-14 13:09:05 -0200579 BT_ERR("Unknown packet type:%d", type);
Bing Zhao789221e2009-06-02 14:29:36 -0700580 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, payload,
Marcel Holtmanndcf47f32009-06-09 16:21:58 +0200581 blksz * buf_block_len);
Bing Zhao789221e2009-06-02 14:29:36 -0700582
583 kfree_skb(skb);
584 skb = NULL;
585 break;
586 }
587
588exit:
589 if (ret) {
590 hdev->stat.err_rx++;
591 if (skb)
592 kfree_skb(skb);
593 }
594
Bing Zhao789221e2009-06-02 14:29:36 -0700595 return ret;
596}
597
Amitkumar Karward1d10d72010-05-27 16:38:37 -0700598static int btmrvl_sdio_process_int_status(struct btmrvl_private *priv)
Bing Zhao789221e2009-06-02 14:29:36 -0700599{
Amitkumar Karward1d10d72010-05-27 16:38:37 -0700600 ulong flags;
601 u8 ireg;
Bing Zhao789221e2009-06-02 14:29:36 -0700602 struct btmrvl_sdio_card *card = priv->btmrvl_dev.card;
603
Amitkumar Karward1d10d72010-05-27 16:38:37 -0700604 spin_lock_irqsave(&priv->driver_lock, flags);
605 ireg = sdio_ireg;
606 sdio_ireg = 0;
607 spin_unlock_irqrestore(&priv->driver_lock, flags);
Bing Zhao789221e2009-06-02 14:29:36 -0700608
Amitkumar Karward1d10d72010-05-27 16:38:37 -0700609 sdio_claim_host(card->func);
610 if (ireg & DN_LD_HOST_INT_STATUS) {
Bing Zhao789221e2009-06-02 14:29:36 -0700611 if (priv->btmrvl_dev.tx_dnld_rdy)
612 BT_DBG("tx_done already received: "
Amitkumar Karward1d10d72010-05-27 16:38:37 -0700613 " int_status=0x%x", ireg);
Bing Zhao789221e2009-06-02 14:29:36 -0700614 else
615 priv->btmrvl_dev.tx_dnld_rdy = true;
616 }
617
Amitkumar Karward1d10d72010-05-27 16:38:37 -0700618 if (ireg & UP_LD_HOST_INT_STATUS)
Bing Zhao789221e2009-06-02 14:29:36 -0700619 btmrvl_sdio_card_to_host(priv);
620
Amitkumar Karward1d10d72010-05-27 16:38:37 -0700621 sdio_release_host(card->func);
Bing Zhao789221e2009-06-02 14:29:36 -0700622
Amitkumar Karward1d10d72010-05-27 16:38:37 -0700623 return 0;
Bing Zhao789221e2009-06-02 14:29:36 -0700624}
625
626static void btmrvl_sdio_interrupt(struct sdio_func *func)
627{
628 struct btmrvl_private *priv;
Bing Zhao789221e2009-06-02 14:29:36 -0700629 struct btmrvl_sdio_card *card;
Amitkumar Karward1d10d72010-05-27 16:38:37 -0700630 ulong flags;
Bing Zhao789221e2009-06-02 14:29:36 -0700631 u8 ireg = 0;
Amitkumar Karward1d10d72010-05-27 16:38:37 -0700632 int ret;
Bing Zhao789221e2009-06-02 14:29:36 -0700633
Bing Zhao789221e2009-06-02 14:29:36 -0700634 card = sdio_get_drvdata(func);
Amitkumar Karward1d10d72010-05-27 16:38:37 -0700635 if (!card || !card->priv) {
636 BT_ERR("sbi_interrupt(%p) card or priv is "
637 "NULL, card=%p\n", func, card);
638 return;
Bing Zhao789221e2009-06-02 14:29:36 -0700639 }
Amitkumar Karward1d10d72010-05-27 16:38:37 -0700640
641 priv = card->priv;
642
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700643 ireg = sdio_readb(card->func, card->reg->host_intstatus, &ret);
Amitkumar Karward1d10d72010-05-27 16:38:37 -0700644 if (ret) {
645 BT_ERR("sdio_readb: read int status register failed");
646 return;
647 }
648
649 if (ireg != 0) {
650 /*
651 * DN_LD_HOST_INT_STATUS and/or UP_LD_HOST_INT_STATUS
652 * Clear the interrupt status register and re-enable the
653 * interrupt.
654 */
655 BT_DBG("ireg = 0x%x", ireg);
656
657 sdio_writeb(card->func, ~(ireg) & (DN_LD_HOST_INT_STATUS |
658 UP_LD_HOST_INT_STATUS),
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700659 card->reg->host_intstatus, &ret);
Amitkumar Karward1d10d72010-05-27 16:38:37 -0700660 if (ret) {
661 BT_ERR("sdio_writeb: clear int status register failed");
662 return;
663 }
664 }
665
666 spin_lock_irqsave(&priv->driver_lock, flags);
667 sdio_ireg |= ireg;
668 spin_unlock_irqrestore(&priv->driver_lock, flags);
669
670 btmrvl_interrupt(priv);
Bing Zhao789221e2009-06-02 14:29:36 -0700671}
672
673static int btmrvl_sdio_register_dev(struct btmrvl_sdio_card *card)
674{
Bing Zhao789221e2009-06-02 14:29:36 -0700675 struct sdio_func *func;
Marcel Holtmanndcf47f32009-06-09 16:21:58 +0200676 u8 reg;
677 int ret = 0;
Bing Zhao789221e2009-06-02 14:29:36 -0700678
Bing Zhao789221e2009-06-02 14:29:36 -0700679 if (!card || !card->func) {
680 BT_ERR("Error: card or function is NULL!");
681 ret = -EINVAL;
682 goto failed;
683 }
684
685 func = card->func;
686
Bing Zhao789221e2009-06-02 14:29:36 -0700687 sdio_claim_host(func);
688
689 ret = sdio_enable_func(func);
690 if (ret) {
691 BT_ERR("sdio_enable_func() failed: ret=%d", ret);
692 ret = -EIO;
693 goto release_host;
694 }
695
696 ret = sdio_claim_irq(func, btmrvl_sdio_interrupt);
697 if (ret) {
698 BT_ERR("sdio_claim_irq failed: ret=%d", ret);
699 ret = -EIO;
700 goto disable_func;
701 }
702
703 ret = sdio_set_block_size(card->func, SDIO_BLOCK_SIZE);
704 if (ret) {
705 BT_ERR("cannot set SDIO block size");
706 ret = -EIO;
707 goto release_irq;
708 }
709
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700710 reg = sdio_readb(func, card->reg->io_port_0, &ret);
Bing Zhao789221e2009-06-02 14:29:36 -0700711 if (ret < 0) {
712 ret = -EIO;
713 goto release_irq;
714 }
715
716 card->ioport = reg;
717
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700718 reg = sdio_readb(func, card->reg->io_port_1, &ret);
Bing Zhao789221e2009-06-02 14:29:36 -0700719 if (ret < 0) {
720 ret = -EIO;
721 goto release_irq;
722 }
723
724 card->ioport |= (reg << 8);
725
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700726 reg = sdio_readb(func, card->reg->io_port_2, &ret);
Bing Zhao789221e2009-06-02 14:29:36 -0700727 if (ret < 0) {
728 ret = -EIO;
729 goto release_irq;
730 }
731
732 card->ioport |= (reg << 16);
733
734 BT_DBG("SDIO FUNC%d IO port: 0x%x", func->num, card->ioport);
735
736 sdio_set_drvdata(func, card);
737
738 sdio_release_host(func);
739
Bing Zhao789221e2009-06-02 14:29:36 -0700740 return 0;
741
742release_irq:
743 sdio_release_irq(func);
744
745disable_func:
746 sdio_disable_func(func);
747
748release_host:
749 sdio_release_host(func);
750
751failed:
Bing Zhao789221e2009-06-02 14:29:36 -0700752 return ret;
753}
754
755static int btmrvl_sdio_unregister_dev(struct btmrvl_sdio_card *card)
756{
Bing Zhao789221e2009-06-02 14:29:36 -0700757 if (card && card->func) {
758 sdio_claim_host(card->func);
759 sdio_release_irq(card->func);
760 sdio_disable_func(card->func);
761 sdio_release_host(card->func);
762 sdio_set_drvdata(card->func, NULL);
763 }
764
Bing Zhao789221e2009-06-02 14:29:36 -0700765 return 0;
766}
767
768static int btmrvl_sdio_enable_host_int(struct btmrvl_sdio_card *card)
769{
770 int ret;
771
Marcel Holtmann93742532009-06-13 07:40:18 +0200772 if (!card || !card->func)
Bing Zhao789221e2009-06-02 14:29:36 -0700773 return -EINVAL;
Bing Zhao789221e2009-06-02 14:29:36 -0700774
775 sdio_claim_host(card->func);
776
777 ret = btmrvl_sdio_enable_host_int_mask(card, HIM_ENABLE);
778
779 btmrvl_sdio_get_rx_unit(card);
780
781 sdio_release_host(card->func);
782
Bing Zhao789221e2009-06-02 14:29:36 -0700783 return ret;
784}
785
786static int btmrvl_sdio_disable_host_int(struct btmrvl_sdio_card *card)
787{
788 int ret;
789
Marcel Holtmann93742532009-06-13 07:40:18 +0200790 if (!card || !card->func)
Bing Zhao789221e2009-06-02 14:29:36 -0700791 return -EINVAL;
Bing Zhao789221e2009-06-02 14:29:36 -0700792
793 sdio_claim_host(card->func);
794
795 ret = btmrvl_sdio_disable_host_int_mask(card, HIM_DISABLE);
796
797 sdio_release_host(card->func);
798
Bing Zhao789221e2009-06-02 14:29:36 -0700799 return ret;
800}
801
802static int btmrvl_sdio_host_to_card(struct btmrvl_private *priv,
803 u8 *payload, u16 nb)
804{
805 struct btmrvl_sdio_card *card = priv->btmrvl_dev.card;
806 int ret = 0;
807 int buf_block_len;
808 int blksz;
809 int i = 0;
810 u8 *buf = NULL;
811 void *tmpbuf = NULL;
812 int tmpbufsz;
813
Bing Zhao789221e2009-06-02 14:29:36 -0700814 if (!card || !card->func) {
815 BT_ERR("card or function is NULL!");
Bing Zhao789221e2009-06-02 14:29:36 -0700816 return -EINVAL;
817 }
818
819 buf = payload;
Bing Zhao3318b232009-07-08 11:44:14 -0700820 if ((unsigned long) payload & (BTSDIO_DMA_ALIGN - 1)) {
Bing Zhao789221e2009-06-02 14:29:36 -0700821 tmpbufsz = ALIGN_SZ(nb, BTSDIO_DMA_ALIGN);
Julia Lawall59598092009-08-06 22:05:18 +0200822 tmpbuf = kzalloc(tmpbufsz, GFP_KERNEL);
823 if (!tmpbuf)
824 return -ENOMEM;
Bing Zhao789221e2009-06-02 14:29:36 -0700825 buf = (u8 *) ALIGN_ADDR(tmpbuf, BTSDIO_DMA_ALIGN);
826 memcpy(buf, payload, nb);
827 }
828
829 blksz = SDIO_BLOCK_SIZE;
830 buf_block_len = (nb + blksz - 1) / blksz;
831
832 sdio_claim_host(card->func);
833
834 do {
835 /* Transfer data to card */
836 ret = sdio_writesb(card->func, card->ioport, buf,
837 buf_block_len * blksz);
838 if (ret < 0) {
839 i++;
840 BT_ERR("i=%d writesb failed: %d", i, ret);
841 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
842 payload, nb);
843 ret = -EIO;
844 if (i > MAX_WRITE_IOMEM_RETRY)
845 goto exit;
846 }
847 } while (ret);
848
849 priv->btmrvl_dev.tx_dnld_rdy = false;
850
851exit:
852 sdio_release_host(card->func);
Yoichi Yuasa88d1a0c2010-02-04 09:55:51 +0900853 kfree(tmpbuf);
Bing Zhao789221e2009-06-02 14:29:36 -0700854
Bing Zhao789221e2009-06-02 14:29:36 -0700855 return ret;
856}
857
858static int btmrvl_sdio_download_fw(struct btmrvl_sdio_card *card)
859{
860 int ret = 0;
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700861 u8 fws0;
862 int pollnum = MAX_POLL_TRIES;
Bing Zhao789221e2009-06-02 14:29:36 -0700863
Bing Zhao789221e2009-06-02 14:29:36 -0700864 if (!card || !card->func) {
865 BT_ERR("card or function is NULL!");
Bing Zhao789221e2009-06-02 14:29:36 -0700866 return -EINVAL;
867 }
868 sdio_claim_host(card->func);
869
870 if (!btmrvl_sdio_verify_fw_download(card, 1)) {
871 BT_DBG("Firmware already downloaded!");
872 goto done;
873 }
874
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700875 /* Check if other function driver is downloading the firmware */
876 fws0 = sdio_readb(card->func, card->reg->card_fw_status0, &ret);
Bing Zhao789221e2009-06-02 14:29:36 -0700877 if (ret) {
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700878 BT_ERR("Failed to read FW downloading status!");
Bing Zhao789221e2009-06-02 14:29:36 -0700879 ret = -EIO;
880 goto done;
881 }
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700882 if (fws0) {
883 BT_DBG("BT not the winner (%#x). Skip FW downloading", fws0);
Bing Zhao789221e2009-06-02 14:29:36 -0700884
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700885 /* Give other function more time to download the firmware */
886 pollnum *= 10;
887 } else {
888 if (card->helper) {
889 ret = btmrvl_sdio_download_helper(card);
890 if (ret) {
891 BT_ERR("Failed to download helper!");
892 ret = -EIO;
893 goto done;
894 }
895 }
896
897 if (btmrvl_sdio_download_fw_w_helper(card)) {
898 BT_ERR("Failed to download firmware!");
899 ret = -EIO;
900 goto done;
901 }
Bing Zhao789221e2009-06-02 14:29:36 -0700902 }
903
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700904 if (btmrvl_sdio_verify_fw_download(card, pollnum)) {
Bing Zhao789221e2009-06-02 14:29:36 -0700905 BT_ERR("FW failed to be active in time!");
906 ret = -ETIMEDOUT;
907 goto done;
908 }
909
910done:
911 sdio_release_host(card->func);
912
Bing Zhao789221e2009-06-02 14:29:36 -0700913 return ret;
914}
915
916static int btmrvl_sdio_wakeup_fw(struct btmrvl_private *priv)
917{
918 struct btmrvl_sdio_card *card = priv->btmrvl_dev.card;
919 int ret = 0;
920
Bing Zhao789221e2009-06-02 14:29:36 -0700921 if (!card || !card->func) {
922 BT_ERR("card or function is NULL!");
Bing Zhao789221e2009-06-02 14:29:36 -0700923 return -EINVAL;
924 }
925
926 sdio_claim_host(card->func);
927
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700928 sdio_writeb(card->func, HOST_POWER_UP, card->reg->cfg, &ret);
Bing Zhao789221e2009-06-02 14:29:36 -0700929
930 sdio_release_host(card->func);
931
932 BT_DBG("wake up firmware");
933
Bing Zhao789221e2009-06-02 14:29:36 -0700934 return ret;
935}
936
937static int btmrvl_sdio_probe(struct sdio_func *func,
Marcel Holtmanndcf47f32009-06-09 16:21:58 +0200938 const struct sdio_device_id *id)
Bing Zhao789221e2009-06-02 14:29:36 -0700939{
940 int ret = 0;
941 struct btmrvl_private *priv = NULL;
942 struct btmrvl_sdio_card *card = NULL;
943
Bing Zhao789221e2009-06-02 14:29:36 -0700944 BT_INFO("vendor=0x%x, device=0x%x, class=%d, fn=%d",
945 id->vendor, id->device, id->class, func->num);
946
947 card = kzalloc(sizeof(*card), GFP_KERNEL);
948 if (!card) {
949 ret = -ENOMEM;
950 goto done;
951 }
952
953 card->func = func;
954
Marcel Holtmanndcf47f32009-06-09 16:21:58 +0200955 if (id->driver_data) {
956 struct btmrvl_sdio_device *data = (void *) id->driver_data;
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700957 card->helper = data->helper;
Marcel Holtmanndcf47f32009-06-09 16:21:58 +0200958 card->firmware = data->firmware;
Kevin Gan9f72c1d2011-04-08 18:19:33 -0700959 card->reg = data->reg;
960 card->sd_blksz_fw_dl = data->sd_blksz_fw_dl;
Marcel Holtmanndcf47f32009-06-09 16:21:58 +0200961 }
962
Bing Zhao789221e2009-06-02 14:29:36 -0700963 if (btmrvl_sdio_register_dev(card) < 0) {
964 BT_ERR("Failed to register BT device!");
965 ret = -ENODEV;
966 goto free_card;
967 }
968
969 /* Disable the interrupts on the card */
970 btmrvl_sdio_disable_host_int(card);
971
972 if (btmrvl_sdio_download_fw(card)) {
973 BT_ERR("Downloading firmware failed!");
974 ret = -ENODEV;
975 goto unreg_dev;
976 }
977
978 msleep(100);
979
980 btmrvl_sdio_enable_host_int(card);
981
982 priv = btmrvl_add_card(card);
983 if (!priv) {
984 BT_ERR("Initializing card failed!");
985 ret = -ENODEV;
986 goto disable_host_int;
987 }
988
989 card->priv = priv;
990
991 /* Initialize the interface specific function pointers */
992 priv->hw_host_to_card = btmrvl_sdio_host_to_card;
993 priv->hw_wakeup_firmware = btmrvl_sdio_wakeup_fw;
Amitkumar Karward1d10d72010-05-27 16:38:37 -0700994 priv->hw_process_int_status = btmrvl_sdio_process_int_status;
Bing Zhao789221e2009-06-02 14:29:36 -0700995
Bing Zhao64061602010-03-03 14:37:36 -0800996 if (btmrvl_register_hdev(priv)) {
997 BT_ERR("Register hdev failed!");
998 ret = -ENODEV;
999 goto disable_host_int;
1000 }
1001
Amitkumar Karwar32fd6392009-09-30 11:18:30 -07001002 priv->btmrvl_dev.psmode = 1;
1003 btmrvl_enable_ps(priv);
Bing Zhao789221e2009-06-02 14:29:36 -07001004
Bing Zhao789221e2009-06-02 14:29:36 -07001005 return 0;
1006
1007disable_host_int:
1008 btmrvl_sdio_disable_host_int(card);
1009unreg_dev:
1010 btmrvl_sdio_unregister_dev(card);
1011free_card:
1012 kfree(card);
1013done:
Bing Zhao789221e2009-06-02 14:29:36 -07001014 return ret;
1015}
1016
1017static void btmrvl_sdio_remove(struct sdio_func *func)
1018{
1019 struct btmrvl_sdio_card *card;
1020
Bing Zhao789221e2009-06-02 14:29:36 -07001021 if (func) {
1022 card = sdio_get_drvdata(func);
1023 if (card) {
1024 /* Send SHUTDOWN command & disable interrupt
1025 * if user removes the module.
1026 */
1027 if (user_rmmod) {
1028 btmrvl_send_module_cfg_cmd(card->priv,
1029 MODULE_SHUTDOWN_REQ);
1030 btmrvl_sdio_disable_host_int(card);
1031 }
1032 BT_DBG("unregester dev");
1033 btmrvl_sdio_unregister_dev(card);
1034 btmrvl_remove_card(card->priv);
1035 kfree(card);
1036 }
1037 }
Bing Zhao789221e2009-06-02 14:29:36 -07001038}
1039
1040static struct sdio_driver bt_mrvl_sdio = {
1041 .name = "btmrvl_sdio",
1042 .id_table = btmrvl_sdio_ids,
1043 .probe = btmrvl_sdio_probe,
1044 .remove = btmrvl_sdio_remove,
1045};
1046
Peter Huewe8e5b2302009-12-22 09:34:20 +01001047static int __init btmrvl_sdio_init_module(void)
Bing Zhao789221e2009-06-02 14:29:36 -07001048{
Bing Zhao789221e2009-06-02 14:29:36 -07001049 if (sdio_register_driver(&bt_mrvl_sdio) != 0) {
1050 BT_ERR("SDIO Driver Registration Failed");
Bing Zhao789221e2009-06-02 14:29:36 -07001051 return -ENODEV;
1052 }
1053
1054 /* Clear the flag in case user removes the card. */
1055 user_rmmod = 0;
1056
Bing Zhao789221e2009-06-02 14:29:36 -07001057 return 0;
1058}
1059
Peter Huewe8e5b2302009-12-22 09:34:20 +01001060static void __exit btmrvl_sdio_exit_module(void)
Bing Zhao789221e2009-06-02 14:29:36 -07001061{
Bing Zhao789221e2009-06-02 14:29:36 -07001062 /* Set the flag as user is removing this module. */
1063 user_rmmod = 1;
1064
1065 sdio_unregister_driver(&bt_mrvl_sdio);
Bing Zhao789221e2009-06-02 14:29:36 -07001066}
1067
1068module_init(btmrvl_sdio_init_module);
1069module_exit(btmrvl_sdio_exit_module);
1070
1071MODULE_AUTHOR("Marvell International Ltd.");
Marcel Holtmann9666fb32009-06-09 21:45:04 +02001072MODULE_DESCRIPTION("Marvell BT-over-SDIO driver ver " VERSION);
Bing Zhao789221e2009-06-02 14:29:36 -07001073MODULE_VERSION(VERSION);
1074MODULE_LICENSE("GPL v2");
Ben Hutchings28614532009-11-07 21:41:18 +00001075MODULE_FIRMWARE("sd8688_helper.bin");
1076MODULE_FIRMWARE("sd8688.bin");
Kevin Gan9f72c1d2011-04-08 18:19:33 -07001077MODULE_FIRMWARE("mrvl/sd8787_uapsta.bin");