diff options
-rw-r--r-- | drivers/net/wireless/mwifiex/pcie.c | 30 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/pcie.h | 3 |
2 files changed, 25 insertions, 8 deletions
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c index 3b9be7c185cb..492655c048d1 100644 --- a/drivers/net/wireless/mwifiex/pcie.c +++ b/drivers/net/wireless/mwifiex/pcie.c | |||
@@ -62,6 +62,10 @@ static bool mwifiex_pcie_ok_to_access_hw(struct mwifiex_adapter *adapter) | |||
62 | { | 62 | { |
63 | u32 *cookie_addr; | 63 | u32 *cookie_addr; |
64 | struct pcie_service_card *card = adapter->card; | 64 | struct pcie_service_card *card = adapter->card; |
65 | const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; | ||
66 | |||
67 | if (!reg->sleep_cookie) | ||
68 | return true; | ||
65 | 69 | ||
66 | if (card->sleep_cookie_vbase) { | 70 | if (card->sleep_cookie_vbase) { |
67 | cookie_addr = (u32 *)card->sleep_cookie_vbase; | 71 | cookie_addr = (u32 *)card->sleep_cookie_vbase; |
@@ -299,8 +303,10 @@ static int mwifiex_read_reg(struct mwifiex_adapter *adapter, int reg, u32 *data) | |||
299 | static int mwifiex_pm_wakeup_card(struct mwifiex_adapter *adapter) | 303 | static int mwifiex_pm_wakeup_card(struct mwifiex_adapter *adapter) |
300 | { | 304 | { |
301 | int i = 0; | 305 | int i = 0; |
306 | struct pcie_service_card *card = adapter->card; | ||
307 | const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; | ||
302 | 308 | ||
303 | while (mwifiex_pcie_ok_to_access_hw(adapter)) { | 309 | while (reg->sleep_cookie && mwifiex_pcie_ok_to_access_hw(adapter)) { |
304 | i++; | 310 | i++; |
305 | usleep_range(10, 20); | 311 | usleep_range(10, 20); |
306 | /* 50ms max wait */ | 312 | /* 50ms max wait */ |
@@ -1513,8 +1519,8 @@ static int mwifiex_pcie_process_cmd_complete(struct mwifiex_adapter *adapter) | |||
1513 | if (adapter->ps_state == PS_STATE_SLEEP_CFM) { | 1519 | if (adapter->ps_state == PS_STATE_SLEEP_CFM) { |
1514 | mwifiex_process_sleep_confirm_resp(adapter, skb->data, | 1520 | mwifiex_process_sleep_confirm_resp(adapter, skb->data, |
1515 | skb->len); | 1521 | skb->len); |
1516 | while (mwifiex_pcie_ok_to_access_hw(adapter) && | 1522 | while (reg->sleep_cookie && (count++ < 10) && |
1517 | (count++ < 10)) | 1523 | mwifiex_pcie_ok_to_access_hw(adapter)) |
1518 | usleep_range(50, 60); | 1524 | usleep_range(50, 60); |
1519 | } else { | 1525 | } else { |
1520 | dev_err(adapter->dev, | 1526 | dev_err(adapter->dev, |
@@ -2172,6 +2178,7 @@ static int mwifiex_pcie_init(struct mwifiex_adapter *adapter) | |||
2172 | struct pcie_service_card *card = adapter->card; | 2178 | struct pcie_service_card *card = adapter->card; |
2173 | int ret; | 2179 | int ret; |
2174 | struct pci_dev *pdev = card->dev; | 2180 | struct pci_dev *pdev = card->dev; |
2181 | const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; | ||
2175 | 2182 | ||
2176 | pci_set_drvdata(pdev, card); | 2183 | pci_set_drvdata(pdev, card); |
2177 | 2184 | ||
@@ -2234,10 +2241,13 @@ static int mwifiex_pcie_init(struct mwifiex_adapter *adapter) | |||
2234 | ret = mwifiex_pcie_alloc_cmdrsp_buf(adapter); | 2241 | ret = mwifiex_pcie_alloc_cmdrsp_buf(adapter); |
2235 | if (ret) | 2242 | if (ret) |
2236 | goto err_alloc_cmdbuf; | 2243 | goto err_alloc_cmdbuf; |
2237 | ret = mwifiex_pcie_alloc_sleep_cookie_buf(adapter); | 2244 | if (reg->sleep_cookie) { |
2238 | if (ret) | 2245 | ret = mwifiex_pcie_alloc_sleep_cookie_buf(adapter); |
2239 | goto err_alloc_cookie; | 2246 | if (ret) |
2240 | 2247 | goto err_alloc_cookie; | |
2248 | } else { | ||
2249 | card->sleep_cookie_vbase = NULL; | ||
2250 | } | ||
2241 | return ret; | 2251 | return ret; |
2242 | 2252 | ||
2243 | err_alloc_cookie: | 2253 | err_alloc_cookie: |
@@ -2334,12 +2344,16 @@ static int mwifiex_register_dev(struct mwifiex_adapter *adapter) | |||
2334 | static void mwifiex_unregister_dev(struct mwifiex_adapter *adapter) | 2344 | static void mwifiex_unregister_dev(struct mwifiex_adapter *adapter) |
2335 | { | 2345 | { |
2336 | struct pcie_service_card *card = adapter->card; | 2346 | struct pcie_service_card *card = adapter->card; |
2347 | const struct mwifiex_pcie_card_reg *reg; | ||
2337 | 2348 | ||
2338 | if (card) { | 2349 | if (card) { |
2339 | dev_dbg(adapter->dev, "%s(): calling free_irq()\n", __func__); | 2350 | dev_dbg(adapter->dev, "%s(): calling free_irq()\n", __func__); |
2340 | free_irq(card->dev->irq, card->dev); | 2351 | free_irq(card->dev->irq, card->dev); |
2341 | 2352 | ||
2342 | mwifiex_pcie_delete_sleep_cookie_buf(adapter); | 2353 | reg = card->pcie.reg; |
2354 | if (reg->sleep_cookie) | ||
2355 | mwifiex_pcie_delete_sleep_cookie_buf(adapter); | ||
2356 | |||
2343 | mwifiex_pcie_delete_cmdrsp_buf(adapter); | 2357 | mwifiex_pcie_delete_cmdrsp_buf(adapter); |
2344 | mwifiex_pcie_delete_evtbd_ring(adapter); | 2358 | mwifiex_pcie_delete_evtbd_ring(adapter); |
2345 | mwifiex_pcie_delete_rxbd_ring(adapter); | 2359 | mwifiex_pcie_delete_rxbd_ring(adapter); |
diff --git a/drivers/net/wireless/mwifiex/pcie.h b/drivers/net/wireless/mwifiex/pcie.h index 608061578b37..d322ab8604ea 100644 --- a/drivers/net/wireless/mwifiex/pcie.h +++ b/drivers/net/wireless/mwifiex/pcie.h | |||
@@ -126,6 +126,7 @@ struct mwifiex_pcie_card_reg { | |||
126 | u8 ring_flag_xs_eop; | 126 | u8 ring_flag_xs_eop; |
127 | u32 ring_tx_start_ptr; | 127 | u32 ring_tx_start_ptr; |
128 | u8 pfu_enabled; | 128 | u8 pfu_enabled; |
129 | u8 sleep_cookie; | ||
129 | }; | 130 | }; |
130 | 131 | ||
131 | static const struct mwifiex_pcie_card_reg mwifiex_reg_8766 = { | 132 | static const struct mwifiex_pcie_card_reg mwifiex_reg_8766 = { |
@@ -156,6 +157,7 @@ static const struct mwifiex_pcie_card_reg mwifiex_reg_8766 = { | |||
156 | .ring_flag_xs_eop = 0, | 157 | .ring_flag_xs_eop = 0, |
157 | .ring_tx_start_ptr = 0, | 158 | .ring_tx_start_ptr = 0, |
158 | .pfu_enabled = 0, | 159 | .pfu_enabled = 0, |
160 | .sleep_cookie = 1, | ||
159 | }; | 161 | }; |
160 | 162 | ||
161 | static const struct mwifiex_pcie_card_reg mwifiex_reg_8897 = { | 163 | static const struct mwifiex_pcie_card_reg mwifiex_reg_8897 = { |
@@ -186,6 +188,7 @@ static const struct mwifiex_pcie_card_reg mwifiex_reg_8897 = { | |||
186 | .ring_flag_xs_eop = MWIFIEX_BD_FLAG_XS_EOP, | 188 | .ring_flag_xs_eop = MWIFIEX_BD_FLAG_XS_EOP, |
187 | .ring_tx_start_ptr = MWIFIEX_BD_FLAG_TX_START_PTR, | 189 | .ring_tx_start_ptr = MWIFIEX_BD_FLAG_TX_START_PTR, |
188 | .pfu_enabled = 1, | 190 | .pfu_enabled = 1, |
191 | .sleep_cookie = 0, | ||
189 | }; | 192 | }; |
190 | 193 | ||
191 | struct mwifiex_pcie_device { | 194 | struct mwifiex_pcie_device { |