2 * Copyright (c) 2014 Redpine Signals Inc.
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 #include <linux/module.h>
20 #include "rsi_common.h"
24 /* Default operating mode is wlan STA + BT */
25 static u16 dev_oper_mode
= DEV_OPMODE_STA_BT_DUAL
;
26 module_param(dev_oper_mode
, ushort
, 0444);
27 MODULE_PARM_DESC(dev_oper_mode
,
28 "1[Wi-Fi], 4[BT], 8[BT LE], 5[Wi-Fi STA + BT classic]\n"
29 "9[Wi-Fi STA + BT LE], 13[Wi-Fi STA + BT classic + BT LE]\n"
30 "6[AP + BT classic], 14[AP + BT classic + BT LE]");
33 * rsi_sdio_set_cmd52_arg() - This function prepares cmd 52 read/write arg.
35 * @func: function number
36 * @raw: indicates whether to perform read after write
37 * @address: address to which to read/write
38 * @writedata: data to write
42 static u32
rsi_sdio_set_cmd52_arg(bool rw
,
48 return ((rw
& 1) << 31) | ((func
& 0x7) << 28) |
49 ((raw
& 1) << 27) | (1 << 26) |
50 ((address
& 0x1FFFF) << 9) | (1 << 8) |
55 * rsi_cmd52writebyte() - This function issues cmd52 byte write onto the card.
56 * @card: Pointer to the mmc_card.
57 * @address: Address to write.
58 * @byte: Data to write.
60 * Return: Write status.
62 static int rsi_cmd52writebyte(struct mmc_card
*card
,
66 struct mmc_command io_cmd
;
69 memset(&io_cmd
, 0, sizeof(io_cmd
));
70 arg
= rsi_sdio_set_cmd52_arg(1, 0, 0, address
, byte
);
71 io_cmd
.opcode
= SD_IO_RW_DIRECT
;
73 io_cmd
.flags
= MMC_RSP_R5
| MMC_CMD_AC
;
75 return mmc_wait_for_cmd(card
->host
, &io_cmd
, 0);
79 * rsi_cmd52readbyte() - This function issues cmd52 byte read onto the card.
80 * @card: Pointer to the mmc_card.
81 * @address: Address to read from.
82 * @byte: Variable to store read value.
84 * Return: Read status.
86 static int rsi_cmd52readbyte(struct mmc_card
*card
,
90 struct mmc_command io_cmd
;
94 memset(&io_cmd
, 0, sizeof(io_cmd
));
95 arg
= rsi_sdio_set_cmd52_arg(0, 0, 0, address
, 0);
96 io_cmd
.opcode
= SD_IO_RW_DIRECT
;
98 io_cmd
.flags
= MMC_RSP_R5
| MMC_CMD_AC
;
100 err
= mmc_wait_for_cmd(card
->host
, &io_cmd
, 0);
101 if ((!err
) && (byte
))
102 *byte
= io_cmd
.resp
[0] & 0xFF;
107 * rsi_issue_sdiocommand() - This function issues sdio commands.
108 * @func: Pointer to the sdio_func structure.
109 * @opcode: Opcode value.
110 * @arg: Arguments to pass.
111 * @flags: Flags which are set.
112 * @resp: Pointer to store response.
114 * Return: err: command status as 0 or -1.
116 static int rsi_issue_sdiocommand(struct sdio_func
*func
,
122 struct mmc_command cmd
;
123 struct mmc_host
*host
;
126 host
= func
->card
->host
;
128 memset(&cmd
, 0, sizeof(struct mmc_command
));
132 err
= mmc_wait_for_cmd(host
, &cmd
, 3);
134 if ((!err
) && (resp
))
141 * rsi_handle_interrupt() - This function is called upon the occurrence
143 * @function: Pointer to the sdio_func structure.
147 static void rsi_handle_interrupt(struct sdio_func
*function
)
149 struct rsi_hw
*adapter
= sdio_get_drvdata(function
);
150 struct rsi_91x_sdiodev
*dev
=
151 (struct rsi_91x_sdiodev
*)adapter
->rsi_dev
;
153 if (adapter
->priv
->fsm_state
== FSM_FW_NOT_LOADED
)
156 rsi_set_event(&dev
->rx_thread
.event
);
160 * rsi_reset_card() - This function resets and re-initializes the card.
161 * @pfunction: Pointer to the sdio_func structure.
165 static void rsi_reset_card(struct sdio_func
*pfunction
)
169 struct mmc_card
*card
= pfunction
->card
;
170 struct mmc_host
*host
= card
->host
;
175 /* Reset 9110 chip */
176 ret
= rsi_cmd52writebyte(pfunction
->card
,
180 /* Card will not send any response as it is getting reset immediately
181 * Hence expect a timeout status from host controller
183 if (ret
!= -ETIMEDOUT
)
184 rsi_dbg(ERR_ZONE
, "%s: Reset failed : %d\n", __func__
, ret
);
186 /* Wait for few milli seconds to get rid of residue charges if any */
189 /* Initialize the SDIO card */
190 host
->ios
.chip_select
= MMC_CS_DONTCARE
;
191 host
->ios
.bus_mode
= MMC_BUSMODE_OPENDRAIN
;
192 host
->ios
.power_mode
= MMC_POWER_UP
;
193 host
->ios
.bus_width
= MMC_BUS_WIDTH_1
;
194 host
->ios
.timing
= MMC_TIMING_LEGACY
;
195 host
->ops
->set_ios(host
, &host
->ios
);
198 * This delay should be sufficient to allow the power supply
199 * to reach the minimum voltage.
203 host
->ios
.clock
= host
->f_min
;
204 host
->ios
.power_mode
= MMC_POWER_ON
;
205 host
->ops
->set_ios(host
, &host
->ios
);
208 * This delay must be at least 74 clock sizes, or 1 ms, or the
209 * time required to reach a stable voltage.
213 /* Issue CMD0. Goto idle state */
214 host
->ios
.chip_select
= MMC_CS_HIGH
;
215 host
->ops
->set_ios(host
, &host
->ios
);
217 err
= rsi_issue_sdiocommand(pfunction
,
220 (MMC_RSP_NONE
| MMC_CMD_BC
),
222 host
->ios
.chip_select
= MMC_CS_DONTCARE
;
223 host
->ops
->set_ios(host
, &host
->ios
);
225 host
->use_spi_crc
= 0;
228 rsi_dbg(ERR_ZONE
, "%s: CMD0 failed : %d\n", __func__
, err
);
230 /* Issue CMD5, arg = 0 */
231 err
= rsi_issue_sdiocommand(pfunction
, SD_IO_SEND_OP_COND
, 0,
232 (MMC_RSP_R4
| MMC_CMD_BCR
), &resp
);
234 rsi_dbg(ERR_ZONE
, "%s: CMD5 failed : %d\n",
237 /* Issue CMD5, arg = ocr. Wait till card is ready */
238 for (i
= 0; i
< 100; i
++) {
239 err
= rsi_issue_sdiocommand(pfunction
, SD_IO_SEND_OP_COND
,
241 (MMC_RSP_R4
| MMC_CMD_BCR
), &resp
);
243 rsi_dbg(ERR_ZONE
, "%s: CMD5 failed : %d\n",
248 if (resp
& MMC_CARD_BUSY
)
253 if ((i
== 100) || (err
)) {
254 rsi_dbg(ERR_ZONE
, "%s: card in not ready : %d %d\n",
259 /* Issue CMD3, get RCA */
260 err
= rsi_issue_sdiocommand(pfunction
,
261 SD_SEND_RELATIVE_ADDR
,
263 (MMC_RSP_R6
| MMC_CMD_BCR
),
266 rsi_dbg(ERR_ZONE
, "%s: CMD3 failed : %d\n", __func__
, err
);
270 host
->ios
.bus_mode
= MMC_BUSMODE_PUSHPULL
;
271 host
->ops
->set_ios(host
, &host
->ios
);
273 /* Issue CMD7, select card */
274 err
= rsi_issue_sdiocommand(pfunction
,
277 (MMC_RSP_R1
| MMC_CMD_AC
),
280 rsi_dbg(ERR_ZONE
, "%s: CMD7 failed : %d\n", __func__
, err
);
284 /* Enable high speed */
285 if (card
->host
->caps
& MMC_CAP_SD_HIGHSPEED
) {
286 rsi_dbg(ERR_ZONE
, "%s: Set high speed mode\n", __func__
);
287 err
= rsi_cmd52readbyte(card
, SDIO_CCCR_SPEED
, &cmd52_resp
);
289 rsi_dbg(ERR_ZONE
, "%s: CCCR speed reg read failed: %d\n",
292 err
= rsi_cmd52writebyte(card
,
294 (cmd52_resp
| SDIO_SPEED_EHS
));
297 "%s: CCR speed regwrite failed %d\n",
301 host
->ios
.timing
= MMC_TIMING_SD_HS
;
302 host
->ops
->set_ios(host
, &host
->ios
);
307 if (mmc_card_hs(card
))
310 clock
= card
->cis
.max_dtr
;
312 if (clock
> host
->f_max
)
315 host
->ios
.clock
= clock
;
316 host
->ops
->set_ios(host
, &host
->ios
);
318 if (card
->host
->caps
& MMC_CAP_4_BIT_DATA
) {
319 /* CMD52: Set bus width & disable card detect resistor */
320 err
= rsi_cmd52writebyte(card
,
322 (SDIO_BUS_CD_DISABLE
|
323 SDIO_BUS_WIDTH_4BIT
));
325 rsi_dbg(ERR_ZONE
, "%s: Set bus mode failed : %d\n",
329 host
->ios
.bus_width
= MMC_BUS_WIDTH_4
;
330 host
->ops
->set_ios(host
, &host
->ios
);
335 * rsi_setclock() - This function sets the clock frequency.
336 * @adapter: Pointer to the adapter structure.
337 * @freq: Clock frequency.
341 static void rsi_setclock(struct rsi_hw
*adapter
, u32 freq
)
343 struct rsi_91x_sdiodev
*dev
=
344 (struct rsi_91x_sdiodev
*)adapter
->rsi_dev
;
345 struct mmc_host
*host
= dev
->pfunction
->card
->host
;
349 if (clock
> host
->f_max
)
351 host
->ios
.clock
= clock
;
352 host
->ops
->set_ios(host
, &host
->ios
);
356 * rsi_setblocklength() - This function sets the host block length.
357 * @adapter: Pointer to the adapter structure.
358 * @length: Block length to be set.
360 * Return: status: 0 on success, -1 on failure.
362 static int rsi_setblocklength(struct rsi_hw
*adapter
, u32 length
)
364 struct rsi_91x_sdiodev
*dev
=
365 (struct rsi_91x_sdiodev
*)adapter
->rsi_dev
;
367 rsi_dbg(INIT_ZONE
, "%s: Setting the block length\n", __func__
);
369 status
= sdio_set_block_size(dev
->pfunction
, length
);
370 dev
->pfunction
->max_blksize
= 256;
371 adapter
->block_size
= dev
->pfunction
->max_blksize
;
374 "%s: Operational blk length is %d\n", __func__
, length
);
379 * rsi_setupcard() - This function queries and sets the card's features.
380 * @adapter: Pointer to the adapter structure.
382 * Return: status: 0 on success, -1 on failure.
384 static int rsi_setupcard(struct rsi_hw
*adapter
)
386 struct rsi_91x_sdiodev
*dev
=
387 (struct rsi_91x_sdiodev
*)adapter
->rsi_dev
;
390 rsi_setclock(adapter
, 50000);
392 dev
->tx_blk_size
= 256;
393 status
= rsi_setblocklength(adapter
, dev
->tx_blk_size
);
396 "%s: Unable to set block length\n", __func__
);
401 * rsi_sdio_read_register() - This function reads one byte of information
403 * @adapter: Pointer to the adapter structure.
404 * @addr: Address of the register.
405 * @data: Pointer to the data that stores the data read.
407 * Return: 0 on success, -1 on failure.
409 int rsi_sdio_read_register(struct rsi_hw
*adapter
,
413 struct rsi_91x_sdiodev
*dev
=
414 (struct rsi_91x_sdiodev
*)adapter
->rsi_dev
;
418 if (likely(dev
->sdio_irq_task
!= current
))
419 sdio_claim_host(dev
->pfunction
);
422 *data
= sdio_f0_readb(dev
->pfunction
, addr
, &status
);
424 *data
= sdio_readb(dev
->pfunction
, addr
, &status
);
426 if (likely(dev
->sdio_irq_task
!= current
))
427 sdio_release_host(dev
->pfunction
);
433 * rsi_sdio_write_register() - This function writes one byte of information
435 * @adapter: Pointer to the adapter structure.
436 * @function: Function Number.
437 * @addr: Address of the register.
438 * @data: Pointer to the data tha has to be written.
440 * Return: 0 on success, -1 on failure.
442 int rsi_sdio_write_register(struct rsi_hw
*adapter
,
447 struct rsi_91x_sdiodev
*dev
=
448 (struct rsi_91x_sdiodev
*)adapter
->rsi_dev
;
451 if (likely(dev
->sdio_irq_task
!= current
))
452 sdio_claim_host(dev
->pfunction
);
455 sdio_f0_writeb(dev
->pfunction
, *data
, addr
, &status
);
457 sdio_writeb(dev
->pfunction
, *data
, addr
, &status
);
459 if (likely(dev
->sdio_irq_task
!= current
))
460 sdio_release_host(dev
->pfunction
);
466 * rsi_sdio_ack_intr() - This function acks the interrupt received.
467 * @adapter: Pointer to the adapter structure.
468 * @int_bit: Interrupt bit to write into register.
472 void rsi_sdio_ack_intr(struct rsi_hw
*adapter
, u8 int_bit
)
475 status
= rsi_sdio_write_register(adapter
,
477 (SDIO_FUN1_INTR_CLR_REG
|
478 RSI_SD_REQUEST_MASTER
),
481 rsi_dbg(ERR_ZONE
, "%s: unable to send ack\n", __func__
);
487 * rsi_sdio_read_register_multiple() - This function read multiple bytes of
488 * information from the SD card.
489 * @adapter: Pointer to the adapter structure.
490 * @addr: Address of the register.
491 * @count: Number of multiple bytes to be read.
492 * @data: Pointer to the read data.
494 * Return: 0 on success, -1 on failure.
496 static int rsi_sdio_read_register_multiple(struct rsi_hw
*adapter
,
501 struct rsi_91x_sdiodev
*dev
=
502 (struct rsi_91x_sdiodev
*)adapter
->rsi_dev
;
505 if (likely(dev
->sdio_irq_task
!= current
))
506 sdio_claim_host(dev
->pfunction
);
508 status
= sdio_readsb(dev
->pfunction
, data
, addr
, count
);
510 if (likely(dev
->sdio_irq_task
!= current
))
511 sdio_release_host(dev
->pfunction
);
514 rsi_dbg(ERR_ZONE
, "%s: Synch Cmd53 read failed\n", __func__
);
519 * rsi_sdio_write_register_multiple() - This function writes multiple bytes of
520 * information to the SD card.
521 * @adapter: Pointer to the adapter structure.
522 * @addr: Address of the register.
523 * @data: Pointer to the data that has to be written.
524 * @count: Number of multiple bytes to be written.
526 * Return: 0 on success, -1 on failure.
528 int rsi_sdio_write_register_multiple(struct rsi_hw
*adapter
,
533 struct rsi_91x_sdiodev
*dev
=
534 (struct rsi_91x_sdiodev
*)adapter
->rsi_dev
;
537 if (dev
->write_fail
> 1) {
538 rsi_dbg(ERR_ZONE
, "%s: Stopping card writes\n", __func__
);
540 } else if (dev
->write_fail
== 1) {
542 * Assuming it is a CRC failure, we want to allow another
545 rsi_dbg(ERR_ZONE
, "%s: Continue card writes\n", __func__
);
549 if (likely(dev
->sdio_irq_task
!= current
))
550 sdio_claim_host(dev
->pfunction
);
552 status
= sdio_writesb(dev
->pfunction
, addr
, data
, count
);
554 if (likely(dev
->sdio_irq_task
!= current
))
555 sdio_release_host(dev
->pfunction
);
558 rsi_dbg(ERR_ZONE
, "%s: Synch Cmd53 write failed %d\n",
562 memcpy(dev
->prev_desc
, data
, FRAME_DESC_SZ
);
567 static int rsi_sdio_load_data_master_write(struct rsi_hw
*adapter
,
573 u32 num_blocks
, offset
, i
;
574 u16 msb_address
, lsb_address
;
578 num_blocks
= instructions_sz
/ block_size
;
579 msb_address
= base_address
>> 16;
581 rsi_dbg(INFO_ZONE
, "ins_size: %d, num_blocks: %d\n",
582 instructions_sz
, num_blocks
);
584 temp_buf
= kmalloc(block_size
, GFP_KERNEL
);
588 /* Loading DM ms word in the sdio slave */
589 status
= rsi_sdio_master_access_msword(adapter
, msb_address
);
591 rsi_dbg(ERR_ZONE
, "%s: Unable to set ms word reg\n", __func__
);
595 for (offset
= 0, i
= 0; i
< num_blocks
; i
++, offset
+= block_size
) {
596 memcpy(temp_buf
, ta_firmware
+ offset
, block_size
);
597 lsb_address
= (u16
)base_address
;
598 status
= rsi_sdio_write_register_multiple
600 lsb_address
| RSI_SD_REQUEST_MASTER
,
601 temp_buf
, block_size
);
603 rsi_dbg(ERR_ZONE
, "%s: failed to write\n", __func__
);
606 rsi_dbg(INFO_ZONE
, "%s: loading block: %d\n", __func__
, i
);
607 base_address
+= block_size
;
609 if ((base_address
>> 16) != msb_address
) {
612 /* Loading DM ms word in the sdio slave */
613 status
= rsi_sdio_master_access_msword(adapter
,
617 "%s: Unable to set ms word reg\n",
624 if (instructions_sz
% block_size
) {
625 memset(temp_buf
, 0, block_size
);
626 memcpy(temp_buf
, ta_firmware
+ offset
,
627 instructions_sz
% block_size
);
628 lsb_address
= (u16
)base_address
;
629 status
= rsi_sdio_write_register_multiple
631 lsb_address
| RSI_SD_REQUEST_MASTER
,
633 instructions_sz
% block_size
);
637 "Written Last Block in Address 0x%x Successfully\n",
638 offset
| RSI_SD_REQUEST_MASTER
);
647 #define FLASH_SIZE_ADDR 0x04000016
648 static int rsi_sdio_master_reg_read(struct rsi_hw
*adapter
, u32 addr
,
649 u32
*read_buf
, u16 size
)
651 u32 addr_on_bus
, *data
;
655 data
= kzalloc(RSI_MASTER_REG_BUF_SIZE
, GFP_KERNEL
);
659 ms_addr
= (addr
>> 16);
660 status
= rsi_sdio_master_access_msword(adapter
, ms_addr
);
663 "%s: Unable to set ms word to common reg\n",
669 addr_on_bus
= (addr
& 0xFF000000);
670 if ((addr_on_bus
== (FLASH_SIZE_ADDR
& 0xFF000000)) ||
671 (addr_on_bus
== 0x0))
672 addr_on_bus
= (addr
& ~(0x3));
676 /* Bring TA out of reset */
677 status
= rsi_sdio_read_register_multiple
679 (addr_on_bus
| RSI_SD_REQUEST_MASTER
),
682 rsi_dbg(ERR_ZONE
, "%s: AHB register read failed\n", __func__
);
686 if ((addr
& 0x3) == 0)
689 *read_buf
= (*data
>> 16);
690 *read_buf
= (*read_buf
& 0xFFFF);
691 } else if (size
== 1) {
692 if ((addr
& 0x3) == 0)
694 else if ((addr
& 0x3) == 1)
695 *read_buf
= (*data
>> 8);
696 else if ((addr
& 0x3) == 2)
697 *read_buf
= (*data
>> 16);
699 *read_buf
= (*data
>> 24);
700 *read_buf
= (*read_buf
& 0xFF);
710 static int rsi_sdio_master_reg_write(struct rsi_hw
*adapter
,
712 unsigned long data
, u16 size
)
714 unsigned long *data_aligned
;
717 data_aligned
= kzalloc(RSI_MASTER_REG_BUF_SIZE
, GFP_KERNEL
);
722 *data_aligned
= ((data
<< 16) | (data
& 0xFFFF));
723 } else if (size
== 1) {
724 u32 temp_data
= data
& 0xFF;
726 *data_aligned
= ((temp_data
<< 24) | (temp_data
<< 16) |
727 (temp_data
<< 8) | temp_data
);
729 *data_aligned
= data
;
733 status
= rsi_sdio_master_access_msword(adapter
, (addr
>> 16));
736 "%s: Unable to set ms word to common reg\n",
741 addr
= addr
& 0xFFFF;
743 /* Bring TA out of reset */
744 status
= rsi_sdio_write_register_multiple
746 (addr
| RSI_SD_REQUEST_MASTER
),
747 (u8
*)data_aligned
, size
);
750 "%s: Unable to do AHB reg write\n", __func__
);
757 * rsi_sdio_host_intf_write_pkt() - This function writes the packet to device.
758 * @adapter: Pointer to the adapter structure.
759 * @pkt: Pointer to the data to be written on to the device.
760 * @len: length of the data to be written on to the device.
762 * Return: 0 on success, -1 on failure.
764 static int rsi_sdio_host_intf_write_pkt(struct rsi_hw
*adapter
,
768 struct rsi_91x_sdiodev
*dev
=
769 (struct rsi_91x_sdiodev
*)adapter
->rsi_dev
;
770 u32 block_size
= dev
->tx_blk_size
;
771 u32 num_blocks
, address
, length
;
775 queueno
= ((pkt
[1] >> 4) & 0xf);
776 if (queueno
== RSI_BT_MGMT_Q
|| queueno
== RSI_BT_DATA_Q
)
779 num_blocks
= len
/ block_size
;
781 if (len
% block_size
)
784 address
= (num_blocks
* block_size
| (queueno
<< 12));
785 length
= num_blocks
* block_size
;
787 status
= rsi_sdio_write_register_multiple(adapter
,
792 rsi_dbg(ERR_ZONE
, "%s: Unable to write onto the card: %d\n",
794 rsi_dbg(DATA_TX_ZONE
, "%s: Successfully written onto card\n", __func__
);
799 * rsi_sdio_host_intf_read_pkt() - This function reads the packet
801 * @adapter: Pointer to the adapter data structure.
802 * @pkt: Pointer to the packet data to be read from the the device.
803 * @length: Length of the data to be read from the device.
805 * Return: 0 on success, -1 on failure.
807 int rsi_sdio_host_intf_read_pkt(struct rsi_hw
*adapter
,
811 int status
= -EINVAL
;
814 rsi_dbg(ERR_ZONE
, "%s: Pkt size is zero\n", __func__
);
818 status
= rsi_sdio_read_register_multiple(adapter
,
821 length
); /*num of bytes*/
824 rsi_dbg(ERR_ZONE
, "%s: Failed to read frame: %d\n", __func__
,
830 * rsi_init_sdio_interface() - This function does init specific to SDIO.
832 * @adapter: Pointer to the adapter data structure.
833 * @pfunction: Pointer to the sdio_func structure.
835 * Return: 0 on success, -1 on failure.
837 static int rsi_init_sdio_interface(struct rsi_hw
*adapter
,
838 struct sdio_func
*pfunction
)
840 struct rsi_91x_sdiodev
*rsi_91x_dev
;
843 rsi_91x_dev
= kzalloc(sizeof(*rsi_91x_dev
), GFP_KERNEL
);
847 adapter
->rsi_dev
= rsi_91x_dev
;
849 sdio_claim_host(pfunction
);
851 pfunction
->enable_timeout
= 100;
852 status
= sdio_enable_func(pfunction
);
854 rsi_dbg(ERR_ZONE
, "%s: Failed to enable interface\n", __func__
);
855 sdio_release_host(pfunction
);
859 rsi_dbg(INIT_ZONE
, "%s: Enabled the interface\n", __func__
);
861 rsi_91x_dev
->pfunction
= pfunction
;
862 adapter
->device
= &pfunction
->dev
;
864 sdio_set_drvdata(pfunction
, adapter
);
866 status
= rsi_setupcard(adapter
);
868 rsi_dbg(ERR_ZONE
, "%s: Failed to setup card\n", __func__
);
872 rsi_dbg(INIT_ZONE
, "%s: Setup card successfully\n", __func__
);
874 status
= rsi_init_sdio_slave_regs(adapter
);
876 rsi_dbg(ERR_ZONE
, "%s: Failed to init slave regs\n", __func__
);
879 sdio_release_host(pfunction
);
881 adapter
->determine_event_timeout
= rsi_sdio_determine_event_timeout
;
882 adapter
->check_hw_queue_status
= rsi_sdio_check_buffer_status
;
884 #ifdef CONFIG_RSI_DEBUGFS
885 adapter
->num_debugfs_entries
= MAX_DEBUGFS_ENTRIES
;
889 sdio_disable_func(pfunction
);
890 sdio_release_host(pfunction
);
894 static int rsi_sdio_reinit_device(struct rsi_hw
*adapter
)
896 struct rsi_91x_sdiodev
*sdev
= adapter
->rsi_dev
;
897 struct sdio_func
*pfunction
= sdev
->pfunction
;
900 for (ii
= 0; ii
< NUM_SOFT_QUEUES
; ii
++)
901 skb_queue_purge(&adapter
->priv
->tx_queue
[ii
]);
903 /* Initialize device again */
904 sdio_claim_host(pfunction
);
906 sdio_release_irq(pfunction
);
907 rsi_reset_card(pfunction
);
909 sdio_enable_func(pfunction
);
910 rsi_setupcard(adapter
);
911 rsi_init_sdio_slave_regs(adapter
);
912 sdio_claim_irq(pfunction
, rsi_handle_interrupt
);
913 rsi_hal_device_init(adapter
);
915 sdio_release_host(pfunction
);
920 static int rsi_sdio_ta_reset(struct rsi_hw
*adapter
)
926 data
= kzalloc(RSI_9116_REG_SIZE
, GFP_KERNEL
);
930 status
= rsi_sdio_master_access_msword(adapter
, TA_BASE_ADDR
);
933 "Unable to set ms word to common reg\n");
937 rsi_dbg(INIT_ZONE
, "%s: Bring TA out of reset\n", __func__
);
938 put_unaligned_le32(TA_HOLD_THREAD_VALUE
, data
);
939 addr
= TA_HOLD_THREAD_REG
| RSI_SD_REQUEST_MASTER
;
940 status
= rsi_sdio_write_register_multiple(adapter
, addr
,
944 rsi_dbg(ERR_ZONE
, "Unable to hold TA threads\n");
948 put_unaligned_le32(TA_SOFT_RST_CLR
, data
);
949 addr
= TA_SOFT_RESET_REG
| RSI_SD_REQUEST_MASTER
;
950 status
= rsi_sdio_write_register_multiple(adapter
, addr
,
954 rsi_dbg(ERR_ZONE
, "Unable to get TA out of reset\n");
958 put_unaligned_le32(TA_PC_ZERO
, data
);
959 addr
= TA_TH0_PC_REG
| RSI_SD_REQUEST_MASTER
;
960 status
= rsi_sdio_write_register_multiple(adapter
, addr
,
964 rsi_dbg(ERR_ZONE
, "Unable to Reset TA PC value\n");
969 put_unaligned_le32(TA_RELEASE_THREAD_VALUE
, data
);
970 addr
= TA_RELEASE_THREAD_REG
| RSI_SD_REQUEST_MASTER
;
971 status
= rsi_sdio_write_register_multiple(adapter
, addr
,
975 rsi_dbg(ERR_ZONE
, "Unable to release TA threads\n");
979 status
= rsi_sdio_master_access_msword(adapter
, MISC_CFG_BASE_ADDR
);
981 rsi_dbg(ERR_ZONE
, "Unable to set ms word to common reg\n");
984 rsi_dbg(INIT_ZONE
, "***** TA Reset done *****\n");
991 static struct rsi_host_intf_ops sdio_host_intf_ops
= {
992 .write_pkt
= rsi_sdio_host_intf_write_pkt
,
993 .read_pkt
= rsi_sdio_host_intf_read_pkt
,
994 .master_access_msword
= rsi_sdio_master_access_msword
,
995 .read_reg_multiple
= rsi_sdio_read_register_multiple
,
996 .write_reg_multiple
= rsi_sdio_write_register_multiple
,
997 .master_reg_read
= rsi_sdio_master_reg_read
,
998 .master_reg_write
= rsi_sdio_master_reg_write
,
999 .load_data_master_write
= rsi_sdio_load_data_master_write
,
1000 .reinit_device
= rsi_sdio_reinit_device
,
1001 .ta_reset
= rsi_sdio_ta_reset
,
1005 * rsi_probe() - This function is called by kernel when the driver provided
1006 * Vendor and device IDs are matched. All the initialization
1007 * work is done here.
1008 * @pfunction: Pointer to the sdio_func structure.
1009 * @id: Pointer to sdio_device_id structure.
1011 * Return: 0 on success, 1 on failure.
1013 static int rsi_probe(struct sdio_func
*pfunction
,
1014 const struct sdio_device_id
*id
)
1016 struct rsi_hw
*adapter
;
1017 struct rsi_91x_sdiodev
*sdev
;
1018 int status
= -EINVAL
;
1020 rsi_dbg(INIT_ZONE
, "%s: Init function called\n", __func__
);
1022 adapter
= rsi_91x_init(dev_oper_mode
);
1024 rsi_dbg(ERR_ZONE
, "%s: Failed to init os intf ops\n",
1028 adapter
->rsi_host_intf
= RSI_HOST_INTF_SDIO
;
1029 adapter
->host_intf_ops
= &sdio_host_intf_ops
;
1031 if (rsi_init_sdio_interface(adapter
, pfunction
)) {
1032 rsi_dbg(ERR_ZONE
, "%s: Failed to init sdio interface\n",
1035 goto fail_free_adapter
;
1038 if (pfunction
->device
== SDIO_DEVICE_ID_RSI_9113
) {
1039 rsi_dbg(ERR_ZONE
, "%s: 9113 module detected\n", __func__
);
1040 adapter
->device_model
= RSI_DEV_9113
;
1041 } else if (pfunction
->device
== SDIO_DEVICE_ID_RSI_9116
) {
1042 rsi_dbg(ERR_ZONE
, "%s: 9116 module detected\n", __func__
);
1043 adapter
->device_model
= RSI_DEV_9116
;
1046 "%s: Unsupported RSI device id 0x%x\n", __func__
,
1048 goto fail_free_adapter
;
1051 sdev
= (struct rsi_91x_sdiodev
*)adapter
->rsi_dev
;
1052 rsi_init_event(&sdev
->rx_thread
.event
);
1053 status
= rsi_create_kthread(adapter
->priv
, &sdev
->rx_thread
,
1054 rsi_sdio_rx_thread
, "SDIO-RX-Thread");
1056 rsi_dbg(ERR_ZONE
, "%s: Unable to init rx thrd\n", __func__
);
1057 goto fail_kill_thread
;
1060 sdio_claim_host(pfunction
);
1061 if (sdio_claim_irq(pfunction
, rsi_handle_interrupt
)) {
1062 rsi_dbg(ERR_ZONE
, "%s: Failed to request IRQ\n", __func__
);
1063 sdio_release_host(pfunction
);
1065 goto fail_claim_irq
;
1067 sdio_release_host(pfunction
);
1068 rsi_dbg(INIT_ZONE
, "%s: Registered Interrupt handler\n", __func__
);
1070 if (rsi_hal_device_init(adapter
)) {
1071 rsi_dbg(ERR_ZONE
, "%s: Failed in device init\n", __func__
);
1075 rsi_dbg(INFO_ZONE
, "===> RSI Device Init Done <===\n");
1077 if (rsi_sdio_master_access_msword(adapter
, MISC_CFG_BASE_ADDR
)) {
1078 rsi_dbg(ERR_ZONE
, "%s: Unable to set ms word reg\n", __func__
);
1083 adapter
->priv
->hibernate_resume
= false;
1084 adapter
->priv
->reinit_hw
= false;
1088 sdio_claim_host(pfunction
);
1089 sdio_release_irq(pfunction
);
1090 sdio_release_host(pfunction
);
1092 rsi_kill_thread(&sdev
->rx_thread
);
1094 sdio_claim_host(pfunction
);
1095 sdio_disable_func(pfunction
);
1096 sdio_release_host(pfunction
);
1098 rsi_91x_deinit(adapter
);
1099 rsi_dbg(ERR_ZONE
, "%s: Failed in probe...Exiting\n", __func__
);
1103 static void ulp_read_write(struct rsi_hw
*adapter
, u16 addr
, u32 data
,
1106 rsi_sdio_master_reg_write(adapter
, RSI_GSPI_DATA_REG1
,
1107 ((addr
<< 6) | ((data
>> 16) & 0xffff)), 2);
1108 rsi_sdio_master_reg_write(adapter
, RSI_GSPI_DATA_REG0
,
1109 (data
& 0xffff), 2);
1110 rsi_sdio_master_reg_write(adapter
, RSI_GSPI_CTRL_REG0
,
1111 RSI_GSPI_CTRL_REG0_VALUE
, 2);
1112 rsi_sdio_master_reg_write(adapter
, RSI_GSPI_CTRL_REG1
,
1113 ((len_in_bits
- 1) | RSI_GSPI_TRIG
), 2);
1117 /*This function resets and re-initializes the chip.*/
1118 static void rsi_reset_chip(struct rsi_hw
*adapter
)
1121 u8 sdio_interrupt_status
= 0;
1125 data
= kzalloc(sizeof(u32
), GFP_KERNEL
);
1129 rsi_dbg(INFO_ZONE
, "Writing disable to wakeup register\n");
1130 ret
= rsi_sdio_write_register(adapter
, 0, SDIO_WAKEUP_REG
, &request
);
1133 "%s: Failed to write SDIO wakeup register\n", __func__
);
1137 ret
= rsi_sdio_read_register(adapter
, RSI_FN1_INT_REGISTER
,
1138 &sdio_interrupt_status
);
1140 rsi_dbg(ERR_ZONE
, "%s: Failed to Read Intr Status Register\n",
1144 rsi_dbg(INFO_ZONE
, "%s: Intr Status Register value = %d\n",
1145 __func__
, sdio_interrupt_status
);
1147 /* Put Thread-Arch processor on hold */
1148 if (rsi_sdio_master_access_msword(adapter
, TA_BASE_ADDR
)) {
1150 "%s: Unable to set ms word to common reg\n",
1155 put_unaligned_le32(TA_HOLD_THREAD_VALUE
, data
);
1156 if (rsi_sdio_write_register_multiple(adapter
, TA_HOLD_THREAD_REG
|
1157 RSI_SD_REQUEST_MASTER
,
1160 "%s: Unable to hold Thread-Arch processor threads\n",
1165 /* This msleep will ensure Thread-Arch processor to go to hold
1166 * and any pending dma transfers to rf spi in device to finish.
1169 if (adapter
->device_model
!= RSI_DEV_9116
) {
1170 ulp_read_write(adapter
, RSI_ULP_RESET_REG
, RSI_ULP_WRITE_0
, 32);
1171 ulp_read_write(adapter
,
1172 RSI_WATCH_DOG_TIMER_1
, RSI_ULP_WRITE_2
, 32);
1173 ulp_read_write(adapter
, RSI_WATCH_DOG_TIMER_2
, RSI_ULP_WRITE_0
,
1175 ulp_read_write(adapter
, RSI_WATCH_DOG_DELAY_TIMER_1
,
1176 RSI_ULP_WRITE_50
, 32);
1177 ulp_read_write(adapter
, RSI_WATCH_DOG_DELAY_TIMER_2
,
1178 RSI_ULP_WRITE_0
, 32);
1179 ulp_read_write(adapter
, RSI_WATCH_DOG_TIMER_ENABLE
,
1180 RSI_ULP_TIMER_ENABLE
, 32);
1182 if ((rsi_sdio_master_reg_write(adapter
,
1183 NWP_WWD_INTERRUPT_TIMER
,
1184 NWP_WWD_INT_TIMER_CLKS
,
1185 RSI_9116_REG_SIZE
)) < 0) {
1186 rsi_dbg(ERR_ZONE
, "Failed to write to intr timer\n");
1188 if ((rsi_sdio_master_reg_write(adapter
,
1189 NWP_WWD_SYSTEM_RESET_TIMER
,
1190 NWP_WWD_SYS_RESET_TIMER_CLKS
,
1191 RSI_9116_REG_SIZE
)) < 0) {
1193 "Failed to write to system reset timer\n");
1195 if ((rsi_sdio_master_reg_write(adapter
,
1196 NWP_WWD_MODE_AND_RSTART
,
1197 NWP_WWD_TIMER_DISABLE
,
1198 RSI_9116_REG_SIZE
)) < 0) {
1200 "Failed to write to mode and restart\n");
1202 rsi_dbg(ERR_ZONE
, "***** Watch Dog Reset Successful *****\n");
1204 /* This msleep will be sufficient for the ulp
1205 * read write operations to complete for chip reset.
1214 * rsi_disconnect() - This function performs the reverse of the probe function.
1215 * @pfunction: Pointer to the sdio_func structure.
1219 static void rsi_disconnect(struct sdio_func
*pfunction
)
1221 struct rsi_hw
*adapter
= sdio_get_drvdata(pfunction
);
1222 struct rsi_91x_sdiodev
*dev
;
1227 dev
= (struct rsi_91x_sdiodev
*)adapter
->rsi_dev
;
1229 rsi_kill_thread(&dev
->rx_thread
);
1230 sdio_claim_host(pfunction
);
1231 sdio_release_irq(pfunction
);
1232 sdio_release_host(pfunction
);
1235 rsi_mac80211_detach(adapter
);
1238 if (IS_ENABLED(CONFIG_RSI_COEX
) && adapter
->priv
->coex_mode
> 1 &&
1239 adapter
->priv
->bt_adapter
) {
1240 rsi_bt_ops
.detach(adapter
->priv
->bt_adapter
);
1241 adapter
->priv
->bt_adapter
= NULL
;
1245 rsi_reset_chip(adapter
);
1247 /* Resetting to take care of the case, where-in driver is re-loaded */
1248 sdio_claim_host(pfunction
);
1249 rsi_reset_card(pfunction
);
1250 sdio_disable_func(pfunction
);
1251 sdio_release_host(pfunction
);
1252 dev
->write_fail
= 2;
1253 rsi_91x_deinit(adapter
);
1254 rsi_dbg(ERR_ZONE
, "##### RSI SDIO device disconnected #####\n");
1259 static int rsi_set_sdio_pm_caps(struct rsi_hw
*adapter
)
1261 struct rsi_91x_sdiodev
*dev
=
1262 (struct rsi_91x_sdiodev
*)adapter
->rsi_dev
;
1263 struct sdio_func
*func
= dev
->pfunction
;
1266 ret
= sdio_set_host_pm_flags(func
, MMC_PM_KEEP_POWER
);
1268 rsi_dbg(ERR_ZONE
, "Set sdio keep pwr flag failed: %d\n", ret
);
1273 static int rsi_sdio_disable_interrupts(struct sdio_func
*pfunc
)
1275 struct rsi_hw
*adapter
= sdio_get_drvdata(pfunc
);
1276 u8 isr_status
= 0, data
= 0;
1280 rsi_dbg(INFO_ZONE
, "Waiting for interrupts to be cleared..");
1283 rsi_sdio_read_register(adapter
, RSI_FN1_INT_REGISTER
,
1285 rsi_dbg(INFO_ZONE
, ".");
1286 } while ((isr_status
) && (jiffies_to_msecs(jiffies
- t1
) < 20));
1287 rsi_dbg(INFO_ZONE
, "Interrupts cleared\n");
1289 sdio_claim_host(pfunc
);
1290 ret
= rsi_cmd52readbyte(pfunc
->card
, RSI_INT_ENABLE_REGISTER
, &data
);
1293 "%s: Failed to read int enable register\n",
1298 data
&= RSI_INT_ENABLE_MASK
;
1299 ret
= rsi_cmd52writebyte(pfunc
->card
, RSI_INT_ENABLE_REGISTER
, data
);
1302 "%s: Failed to write to int enable register\n",
1306 ret
= rsi_cmd52readbyte(pfunc
->card
, RSI_INT_ENABLE_REGISTER
, &data
);
1309 "%s: Failed to read int enable register\n",
1313 rsi_dbg(INFO_ZONE
, "int enable reg content = %x\n", data
);
1316 sdio_release_host(pfunc
);
1320 static int rsi_sdio_enable_interrupts(struct sdio_func
*pfunc
)
1324 struct rsi_hw
*adapter
= sdio_get_drvdata(pfunc
);
1325 struct rsi_common
*common
= adapter
->priv
;
1327 sdio_claim_host(pfunc
);
1328 ret
= rsi_cmd52readbyte(pfunc
->card
, RSI_INT_ENABLE_REGISTER
, &data
);
1331 "%s: Failed to read int enable register\n", __func__
);
1335 data
|= ~RSI_INT_ENABLE_MASK
& 0xff;
1337 ret
= rsi_cmd52writebyte(pfunc
->card
, RSI_INT_ENABLE_REGISTER
, data
);
1340 "%s: Failed to write to int enable register\n",
1345 if ((common
->wow_flags
& RSI_WOW_ENABLED
) &&
1346 (common
->wow_flags
& RSI_WOW_NO_CONNECTION
))
1348 "##### Device can not wake up through WLAN\n");
1350 ret
= rsi_cmd52readbyte(pfunc
->card
, RSI_INT_ENABLE_REGISTER
, &data
);
1353 "%s: Failed to read int enable register\n", __func__
);
1356 rsi_dbg(INFO_ZONE
, "int enable reg content = %x\n", data
);
1359 sdio_release_host(pfunc
);
1363 static int rsi_suspend(struct device
*dev
)
1366 struct sdio_func
*pfunction
= dev_to_sdio_func(dev
);
1367 struct rsi_hw
*adapter
= sdio_get_drvdata(pfunction
);
1368 struct rsi_common
*common
;
1371 rsi_dbg(ERR_ZONE
, "Device is not ready\n");
1374 common
= adapter
->priv
;
1375 rsi_sdio_disable_interrupts(pfunction
);
1377 ret
= rsi_set_sdio_pm_caps(adapter
);
1380 "Setting power management caps failed\n");
1381 common
->fsm_state
= FSM_CARD_NOT_READY
;
1386 static int rsi_resume(struct device
*dev
)
1388 struct sdio_func
*pfunction
= dev_to_sdio_func(dev
);
1389 struct rsi_hw
*adapter
= sdio_get_drvdata(pfunction
);
1390 struct rsi_common
*common
= adapter
->priv
;
1392 common
->fsm_state
= FSM_MAC_INIT_DONE
;
1393 rsi_sdio_enable_interrupts(pfunction
);
1398 static int rsi_freeze(struct device
*dev
)
1401 struct sdio_func
*pfunction
= dev_to_sdio_func(dev
);
1402 struct rsi_hw
*adapter
= sdio_get_drvdata(pfunction
);
1403 struct rsi_common
*common
;
1404 struct rsi_91x_sdiodev
*sdev
;
1406 rsi_dbg(INFO_ZONE
, "SDIO Bus freeze ===>\n");
1409 rsi_dbg(ERR_ZONE
, "Device is not ready\n");
1412 common
= adapter
->priv
;
1413 sdev
= (struct rsi_91x_sdiodev
*)adapter
->rsi_dev
;
1415 if ((common
->wow_flags
& RSI_WOW_ENABLED
) &&
1416 (common
->wow_flags
& RSI_WOW_NO_CONNECTION
))
1418 "##### Device can not wake up through WLAN\n");
1420 if (IS_ENABLED(CONFIG_RSI_COEX
) && common
->coex_mode
> 1 &&
1421 common
->bt_adapter
) {
1422 rsi_bt_ops
.detach(common
->bt_adapter
);
1423 common
->bt_adapter
= NULL
;
1426 ret
= rsi_sdio_disable_interrupts(pfunction
);
1428 if (sdev
->write_fail
)
1429 rsi_dbg(INFO_ZONE
, "###### Device is not ready #######\n");
1431 ret
= rsi_set_sdio_pm_caps(adapter
);
1433 rsi_dbg(INFO_ZONE
, "Setting power management caps failed\n");
1435 rsi_dbg(INFO_ZONE
, "***** RSI module freezed *****\n");
1440 static int rsi_thaw(struct device
*dev
)
1442 struct sdio_func
*pfunction
= dev_to_sdio_func(dev
);
1443 struct rsi_hw
*adapter
= sdio_get_drvdata(pfunction
);
1444 struct rsi_common
*common
= adapter
->priv
;
1446 rsi_dbg(ERR_ZONE
, "SDIO Bus thaw =====>\n");
1448 common
->hibernate_resume
= true;
1449 common
->fsm_state
= FSM_CARD_NOT_READY
;
1450 common
->iface_down
= true;
1452 rsi_sdio_enable_interrupts(pfunction
);
1454 rsi_dbg(INFO_ZONE
, "***** RSI module thaw done *****\n");
1459 static void rsi_shutdown(struct device
*dev
)
1461 struct sdio_func
*pfunction
= dev_to_sdio_func(dev
);
1462 struct rsi_hw
*adapter
= sdio_get_drvdata(pfunction
);
1463 struct rsi_91x_sdiodev
*sdev
=
1464 (struct rsi_91x_sdiodev
*)adapter
->rsi_dev
;
1465 struct ieee80211_hw
*hw
= adapter
->hw
;
1467 rsi_dbg(ERR_ZONE
, "SDIO Bus shutdown =====>\n");
1470 struct cfg80211_wowlan
*wowlan
= hw
->wiphy
->wowlan_config
;
1472 if (rsi_config_wowlan(adapter
, wowlan
))
1473 rsi_dbg(ERR_ZONE
, "Failed to configure WoWLAN\n");
1476 if (IS_ENABLED(CONFIG_RSI_COEX
) && adapter
->priv
->coex_mode
> 1 &&
1477 adapter
->priv
->bt_adapter
) {
1478 rsi_bt_ops
.detach(adapter
->priv
->bt_adapter
);
1479 adapter
->priv
->bt_adapter
= NULL
;
1482 rsi_sdio_disable_interrupts(sdev
->pfunction
);
1484 if (sdev
->write_fail
)
1485 rsi_dbg(INFO_ZONE
, "###### Device is not ready #######\n");
1487 if (rsi_set_sdio_pm_caps(adapter
))
1488 rsi_dbg(INFO_ZONE
, "Setting power management caps failed\n");
1490 rsi_dbg(INFO_ZONE
, "***** RSI module shut down *****\n");
1493 static int rsi_restore(struct device
*dev
)
1495 struct sdio_func
*pfunction
= dev_to_sdio_func(dev
);
1496 struct rsi_hw
*adapter
= sdio_get_drvdata(pfunction
);
1497 struct rsi_common
*common
= adapter
->priv
;
1499 rsi_dbg(INFO_ZONE
, "SDIO Bus restore ======>\n");
1500 common
->hibernate_resume
= true;
1501 common
->fsm_state
= FSM_FW_NOT_LOADED
;
1502 common
->iface_down
= true;
1504 adapter
->sc_nvifs
= 0;
1505 adapter
->ps_state
= PS_NONE
;
1507 common
->wow_flags
= 0;
1508 common
->iface_down
= false;
1510 rsi_dbg(INFO_ZONE
, "RSI module restored\n");
1514 static const struct dev_pm_ops rsi_pm_ops
= {
1515 .suspend
= rsi_suspend
,
1516 .resume
= rsi_resume
,
1517 .freeze
= rsi_freeze
,
1519 .restore
= rsi_restore
,
1523 static const struct sdio_device_id rsi_dev_table
[] = {
1524 { SDIO_DEVICE(SDIO_VENDOR_ID_RSI
, SDIO_DEVICE_ID_RSI_9113
) },
1525 { SDIO_DEVICE(SDIO_VENDOR_ID_RSI
, SDIO_DEVICE_ID_RSI_9116
) },
1529 static struct sdio_driver rsi_driver
= {
1530 .name
= "RSI-SDIO WLAN",
1532 .remove
= rsi_disconnect
,
1533 .id_table
= rsi_dev_table
,
1537 .shutdown
= rsi_shutdown
,
1543 * rsi_module_init() - This function registers the sdio module.
1546 * Return: 0 on success.
1548 static int rsi_module_init(void)
1552 ret
= sdio_register_driver(&rsi_driver
);
1553 rsi_dbg(INIT_ZONE
, "%s: Registering driver\n", __func__
);
1558 * rsi_module_exit() - This function unregisters the sdio module.
1563 static void rsi_module_exit(void)
1565 sdio_unregister_driver(&rsi_driver
);
1566 rsi_dbg(INFO_ZONE
, "%s: Unregistering driver\n", __func__
);
1569 module_init(rsi_module_init
);
1570 module_exit(rsi_module_exit
);
1572 MODULE_AUTHOR("Redpine Signals Inc");
1573 MODULE_DESCRIPTION("Common SDIO layer for RSI drivers");
1574 MODULE_SUPPORTED_DEVICE("RSI-91x");
1575 MODULE_DEVICE_TABLE(sdio
, rsi_dev_table
);
1576 MODULE_FIRMWARE(FIRMWARE_RSI9113
);
1577 MODULE_VERSION("0.1");
1578 MODULE_LICENSE("Dual BSD/GPL");