diff options
Diffstat (limited to 'drivers/net/wireless/mwifiex/sdio.c')
-rw-r--r-- | drivers/net/wireless/mwifiex/sdio.c | 49 |
1 files changed, 16 insertions, 33 deletions
diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c index f21e5cd19839..5148d0e0fad6 100644 --- a/drivers/net/wireless/mwifiex/sdio.c +++ b/drivers/net/wireless/mwifiex/sdio.c | |||
@@ -208,7 +208,7 @@ static int mwifiex_sdio_resume(struct device *dev) | |||
208 | 208 | ||
209 | /* Disable Host Sleep */ | 209 | /* Disable Host Sleep */ |
210 | mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA), | 210 | mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA), |
211 | MWIFIEX_NO_WAIT); | 211 | MWIFIEX_ASYNC_CMD); |
212 | 212 | ||
213 | return 0; | 213 | return 0; |
214 | } | 214 | } |
@@ -282,7 +282,7 @@ mwifiex_read_reg(struct mwifiex_adapter *adapter, u32 reg, u32 *data) | |||
282 | */ | 282 | */ |
283 | static int | 283 | static int |
284 | mwifiex_write_data_sync(struct mwifiex_adapter *adapter, | 284 | mwifiex_write_data_sync(struct mwifiex_adapter *adapter, |
285 | u8 *buffer, u32 pkt_len, u32 port, u32 timeout) | 285 | u8 *buffer, u32 pkt_len, u32 port) |
286 | { | 286 | { |
287 | struct sdio_mmc_card *card = adapter->card; | 287 | struct sdio_mmc_card *card = adapter->card; |
288 | int ret = -1; | 288 | int ret = -1; |
@@ -314,9 +314,8 @@ mwifiex_write_data_sync(struct mwifiex_adapter *adapter, | |||
314 | /* | 314 | /* |
315 | * This function reads multiple data from SDIO card memory. | 315 | * This function reads multiple data from SDIO card memory. |
316 | */ | 316 | */ |
317 | static int mwifiex_read_data_sync(struct mwifiex_adapter *adapter, | 317 | static int mwifiex_read_data_sync(struct mwifiex_adapter *adapter, u8 *buffer, |
318 | u8 *buffer, u32 len, | 318 | u32 len, u32 port, u8 claim) |
319 | u32 port, u32 timeout, u8 claim) | ||
320 | { | 319 | { |
321 | struct sdio_mmc_card *card = adapter->card; | 320 | struct sdio_mmc_card *card = adapter->card; |
322 | int ret = -1; | 321 | int ret = -1; |
@@ -348,12 +347,9 @@ static int mwifiex_read_data_sync(struct mwifiex_adapter *adapter, | |||
348 | */ | 347 | */ |
349 | static int mwifiex_pm_wakeup_card(struct mwifiex_adapter *adapter) | 348 | static int mwifiex_pm_wakeup_card(struct mwifiex_adapter *adapter) |
350 | { | 349 | { |
351 | int ret; | ||
352 | |||
353 | dev_dbg(adapter->dev, "event: wakeup device...\n"); | 350 | dev_dbg(adapter->dev, "event: wakeup device...\n"); |
354 | ret = mwifiex_write_reg(adapter, CONFIGURATION_REG, HOST_POWER_UP); | ||
355 | 351 | ||
356 | return ret; | 352 | return mwifiex_write_reg(adapter, CONFIGURATION_REG, HOST_POWER_UP); |
357 | } | 353 | } |
358 | 354 | ||
359 | /* | 355 | /* |
@@ -363,12 +359,9 @@ static int mwifiex_pm_wakeup_card(struct mwifiex_adapter *adapter) | |||
363 | */ | 359 | */ |
364 | static int mwifiex_pm_wakeup_card_complete(struct mwifiex_adapter *adapter) | 360 | static int mwifiex_pm_wakeup_card_complete(struct mwifiex_adapter *adapter) |
365 | { | 361 | { |
366 | int ret; | ||
367 | |||
368 | dev_dbg(adapter->dev, "cmd: wakeup device completed\n"); | 362 | dev_dbg(adapter->dev, "cmd: wakeup device completed\n"); |
369 | ret = mwifiex_write_reg(adapter, CONFIGURATION_REG, 0); | ||
370 | 363 | ||
371 | return ret; | 364 | return mwifiex_write_reg(adapter, CONFIGURATION_REG, 0); |
372 | } | 365 | } |
373 | 366 | ||
374 | /* | 367 | /* |
@@ -430,8 +423,7 @@ static int mwifiex_write_data_to_card(struct mwifiex_adapter *adapter, | |||
430 | int ret = 0; | 423 | int ret = 0; |
431 | 424 | ||
432 | do { | 425 | do { |
433 | ret = mwifiex_write_data_sync(adapter, payload, pkt_len, | 426 | ret = mwifiex_write_data_sync(adapter, payload, pkt_len, port); |
434 | port, 0); | ||
435 | if (ret) { | 427 | if (ret) { |
436 | i++; | 428 | i++; |
437 | dev_err(adapter->dev, "host_to_card, write iomem" | 429 | dev_err(adapter->dev, "host_to_card, write iomem" |
@@ -630,7 +622,7 @@ static int mwifiex_sdio_card_to_host(struct mwifiex_adapter *adapter, | |||
630 | return -1; | 622 | return -1; |
631 | } | 623 | } |
632 | 624 | ||
633 | ret = mwifiex_read_data_sync(adapter, buffer, npayload, ioport, 0, 1); | 625 | ret = mwifiex_read_data_sync(adapter, buffer, npayload, ioport, 1); |
634 | 626 | ||
635 | if (ret) { | 627 | if (ret) { |
636 | dev_err(adapter->dev, "%s: read iomem failed: %d\n", __func__, | 628 | dev_err(adapter->dev, "%s: read iomem failed: %d\n", __func__, |
@@ -769,7 +761,7 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, | |||
769 | 761 | ||
770 | ret = mwifiex_write_data_sync(adapter, fwbuf, tx_blocks * | 762 | ret = mwifiex_write_data_sync(adapter, fwbuf, tx_blocks * |
771 | MWIFIEX_SDIO_BLOCK_SIZE, | 763 | MWIFIEX_SDIO_BLOCK_SIZE, |
772 | adapter->ioport, 0); | 764 | adapter->ioport); |
773 | if (ret) { | 765 | if (ret) { |
774 | dev_err(adapter->dev, "FW download, write iomem (%d)" | 766 | dev_err(adapter->dev, "FW download, write iomem (%d)" |
775 | " failed @ %d\n", i, offset); | 767 | " failed @ %d\n", i, offset); |
@@ -842,7 +834,7 @@ static void mwifiex_interrupt_status(struct mwifiex_adapter *adapter) | |||
842 | unsigned long flags; | 834 | unsigned long flags; |
843 | 835 | ||
844 | if (mwifiex_read_data_sync(adapter, card->mp_regs, MAX_MP_REGS, | 836 | if (mwifiex_read_data_sync(adapter, card->mp_regs, MAX_MP_REGS, |
845 | REG_PORT | MWIFIEX_SDIO_BYTE_MODE_MASK, 0, | 837 | REG_PORT | MWIFIEX_SDIO_BYTE_MODE_MASK, |
846 | 0)) { | 838 | 0)) { |
847 | dev_err(adapter->dev, "read mp_regs failed\n"); | 839 | dev_err(adapter->dev, "read mp_regs failed\n"); |
848 | return; | 840 | return; |
@@ -859,8 +851,6 @@ static void mwifiex_interrupt_status(struct mwifiex_adapter *adapter) | |||
859 | adapter->int_status |= sdio_ireg; | 851 | adapter->int_status |= sdio_ireg; |
860 | spin_unlock_irqrestore(&adapter->int_lock, flags); | 852 | spin_unlock_irqrestore(&adapter->int_lock, flags); |
861 | } | 853 | } |
862 | |||
863 | return; | ||
864 | } | 854 | } |
865 | 855 | ||
866 | /* | 856 | /* |
@@ -891,8 +881,6 @@ mwifiex_sdio_interrupt(struct sdio_func *func) | |||
891 | 881 | ||
892 | mwifiex_interrupt_status(adapter); | 882 | mwifiex_interrupt_status(adapter); |
893 | queue_work(adapter->workqueue, &adapter->main_work); | 883 | queue_work(adapter->workqueue, &adapter->main_work); |
894 | |||
895 | return; | ||
896 | } | 884 | } |
897 | 885 | ||
898 | /* | 886 | /* |
@@ -1054,7 +1042,7 @@ static int mwifiex_sdio_card_to_host_mp_aggr(struct mwifiex_adapter *adapter, | |||
1054 | card->mpa_rx.buf_len, | 1042 | card->mpa_rx.buf_len, |
1055 | (adapter->ioport | 0x1000 | | 1043 | (adapter->ioport | 0x1000 | |
1056 | (card->mpa_rx.ports << 4)) + | 1044 | (card->mpa_rx.ports << 4)) + |
1057 | card->mpa_rx.start_port, 0, 1)) | 1045 | card->mpa_rx.start_port, 1)) |
1058 | return -1; | 1046 | return -1; |
1059 | 1047 | ||
1060 | curr_ptr = card->mpa_rx.buf; | 1048 | curr_ptr = card->mpa_rx.buf; |
@@ -1709,13 +1697,9 @@ static struct mwifiex_if_ops sdio_ops = { | |||
1709 | static int | 1697 | static int |
1710 | mwifiex_sdio_init_module(void) | 1698 | mwifiex_sdio_init_module(void) |
1711 | { | 1699 | { |
1712 | int ret; | ||
1713 | |||
1714 | sema_init(&add_remove_card_sem, 1); | 1700 | sema_init(&add_remove_card_sem, 1); |
1715 | 1701 | ||
1716 | ret = sdio_register_driver(&mwifiex_sdio); | 1702 | return sdio_register_driver(&mwifiex_sdio); |
1717 | |||
1718 | return ret; | ||
1719 | } | 1703 | } |
1720 | 1704 | ||
1721 | /* | 1705 | /* |
@@ -1745,13 +1729,12 @@ mwifiex_sdio_cleanup_module(void) | |||
1745 | for (i = 0; i < adapter->priv_num; i++) | 1729 | for (i = 0; i < adapter->priv_num; i++) |
1746 | if ((GET_BSS_ROLE(adapter->priv[i]) == MWIFIEX_BSS_ROLE_STA) && | 1730 | if ((GET_BSS_ROLE(adapter->priv[i]) == MWIFIEX_BSS_ROLE_STA) && |
1747 | adapter->priv[i]->media_connected) | 1731 | adapter->priv[i]->media_connected) |
1748 | mwifiex_disconnect(adapter->priv[i], MWIFIEX_CMD_WAIT, | 1732 | mwifiex_deauthenticate(adapter->priv[i], NULL); |
1749 | NULL); | ||
1750 | 1733 | ||
1751 | if (!adapter->surprise_removed) | 1734 | if (!adapter->surprise_removed) |
1752 | mwifiex_shutdown_fw(mwifiex_get_priv | 1735 | mwifiex_init_shutdown_fw(mwifiex_get_priv(adapter, |
1753 | (adapter, MWIFIEX_BSS_ROLE_ANY), | 1736 | MWIFIEX_BSS_ROLE_ANY), |
1754 | MWIFIEX_CMD_WAIT); | 1737 | MWIFIEX_FUNC_SHUTDOWN); |
1755 | 1738 | ||
1756 | exit: | 1739 | exit: |
1757 | up(&add_remove_card_sem); | 1740 | up(&add_remove_card_sem); |