diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/mwifiex/main.c | 49 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/main.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/pcie.c | 384 |
3 files changed, 226 insertions, 211 deletions
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c index 790a3796483c..9d1b3ca6334b 100644 --- a/drivers/net/wireless/mwifiex/main.c +++ b/drivers/net/wireless/mwifiex/main.c | |||
@@ -64,11 +64,10 @@ static int mwifiex_register(void *card, struct mwifiex_if_ops *if_ops, | |||
64 | adapter->priv_num = 0; | 64 | adapter->priv_num = 0; |
65 | 65 | ||
66 | /* Allocate memory for private structure */ | 66 | /* Allocate memory for private structure */ |
67 | adapter->priv[0] = kzalloc(sizeof(struct mwifiex_private), | 67 | adapter->priv[0] = kzalloc(sizeof(struct mwifiex_private), GFP_KERNEL); |
68 | GFP_KERNEL); | ||
69 | if (!adapter->priv[0]) { | 68 | if (!adapter->priv[0]) { |
70 | dev_err(adapter->dev, "%s: failed to alloc priv[0]\n", | 69 | dev_err(adapter->dev, |
71 | __func__); | 70 | "%s: failed to alloc priv[0]\n", __func__); |
72 | goto error; | 71 | goto error; |
73 | } | 72 | } |
74 | 73 | ||
@@ -169,8 +168,8 @@ process_start: | |||
169 | if ((adapter->ps_state == PS_STATE_SLEEP) && | 168 | if ((adapter->ps_state == PS_STATE_SLEEP) && |
170 | (adapter->pm_wakeup_card_req && | 169 | (adapter->pm_wakeup_card_req && |
171 | !adapter->pm_wakeup_fw_try) && | 170 | !adapter->pm_wakeup_fw_try) && |
172 | (is_command_pending(adapter) | 171 | (is_command_pending(adapter) || |
173 | || !mwifiex_wmm_lists_empty(adapter))) { | 172 | !mwifiex_wmm_lists_empty(adapter))) { |
174 | adapter->pm_wakeup_fw_try = true; | 173 | adapter->pm_wakeup_fw_try = true; |
175 | adapter->if_ops.wakeup(adapter); | 174 | adapter->if_ops.wakeup(adapter); |
176 | continue; | 175 | continue; |
@@ -187,10 +186,10 @@ process_start: | |||
187 | adapter->tx_lock_flag) | 186 | adapter->tx_lock_flag) |
188 | break; | 187 | break; |
189 | 188 | ||
190 | if (adapter->scan_processing || adapter->data_sent | 189 | if (adapter->scan_processing || adapter->data_sent || |
191 | || mwifiex_wmm_lists_empty(adapter)) { | 190 | mwifiex_wmm_lists_empty(adapter)) { |
192 | if (adapter->cmd_sent || adapter->curr_cmd | 191 | if (adapter->cmd_sent || adapter->curr_cmd || |
193 | || (!is_command_pending(adapter))) | 192 | (!is_command_pending(adapter))) |
194 | break; | 193 | break; |
195 | } | 194 | } |
196 | } | 195 | } |
@@ -223,10 +222,10 @@ process_start: | |||
223 | /* * The ps_state may have been changed during processing of | 222 | /* * The ps_state may have been changed during processing of |
224 | * Sleep Request event. | 223 | * Sleep Request event. |
225 | */ | 224 | */ |
226 | if ((adapter->ps_state == PS_STATE_SLEEP) | 225 | if ((adapter->ps_state == PS_STATE_SLEEP) || |
227 | || (adapter->ps_state == PS_STATE_PRE_SLEEP) | 226 | (adapter->ps_state == PS_STATE_PRE_SLEEP) || |
228 | || (adapter->ps_state == PS_STATE_SLEEP_CFM) | 227 | (adapter->ps_state == PS_STATE_SLEEP_CFM) || |
229 | || adapter->tx_lock_flag) | 228 | adapter->tx_lock_flag) |
230 | continue; | 229 | continue; |
231 | 230 | ||
232 | if (!adapter->cmd_sent && !adapter->curr_cmd) { | 231 | if (!adapter->cmd_sent && !adapter->curr_cmd) { |
@@ -249,8 +248,8 @@ process_start: | |||
249 | } | 248 | } |
250 | 249 | ||
251 | if (adapter->delay_null_pkt && !adapter->cmd_sent && | 250 | if (adapter->delay_null_pkt && !adapter->cmd_sent && |
252 | !adapter->curr_cmd && !is_command_pending(adapter) | 251 | !adapter->curr_cmd && !is_command_pending(adapter) && |
253 | && mwifiex_wmm_lists_empty(adapter)) { | 252 | mwifiex_wmm_lists_empty(adapter)) { |
254 | if (!mwifiex_send_null_packet | 253 | if (!mwifiex_send_null_packet |
255 | (mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA), | 254 | (mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA), |
256 | MWIFIEX_TxPD_POWER_MGMT_NULL_PACKET | | 255 | MWIFIEX_TxPD_POWER_MGMT_NULL_PACKET | |
@@ -371,7 +370,7 @@ mwifiex_fill_buffer(struct sk_buff *skb) | |||
371 | iph = ip_hdr(skb); | 370 | iph = ip_hdr(skb); |
372 | tid = IPTOS_PREC(iph->tos); | 371 | tid = IPTOS_PREC(iph->tos); |
373 | pr_debug("data: packet type ETH_P_IP: %04x, tid=%#x prio=%#x\n", | 372 | pr_debug("data: packet type ETH_P_IP: %04x, tid=%#x prio=%#x\n", |
374 | eth->h_proto, tid, skb->priority); | 373 | eth->h_proto, tid, skb->priority); |
375 | break; | 374 | break; |
376 | case __constant_htons(ETH_P_ARP): | 375 | case __constant_htons(ETH_P_ARP): |
377 | pr_debug("data: ARP packet: %04x\n", eth->h_proto); | 376 | pr_debug("data: ARP packet: %04x\n", eth->h_proto); |
@@ -425,7 +424,7 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
425 | struct mwifiex_txinfo *tx_info; | 424 | struct mwifiex_txinfo *tx_info; |
426 | 425 | ||
427 | dev_dbg(priv->adapter->dev, "data: %lu BSS(%d-%d): Data <= kernel\n", | 426 | dev_dbg(priv->adapter->dev, "data: %lu BSS(%d-%d): Data <= kernel\n", |
428 | jiffies, priv->bss_type, priv->bss_num); | 427 | jiffies, priv->bss_type, priv->bss_num); |
429 | 428 | ||
430 | if (priv->adapter->surprise_removed) { | 429 | if (priv->adapter->surprise_removed) { |
431 | kfree_skb(skb); | 430 | kfree_skb(skb); |
@@ -441,7 +440,7 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
441 | if (skb_headroom(skb) < MWIFIEX_MIN_DATA_HEADER_LEN) { | 440 | if (skb_headroom(skb) < MWIFIEX_MIN_DATA_HEADER_LEN) { |
442 | dev_dbg(priv->adapter->dev, | 441 | dev_dbg(priv->adapter->dev, |
443 | "data: Tx: insufficient skb headroom %d\n", | 442 | "data: Tx: insufficient skb headroom %d\n", |
444 | skb_headroom(skb)); | 443 | skb_headroom(skb)); |
445 | /* Insufficient skb headroom - allocate a new skb */ | 444 | /* Insufficient skb headroom - allocate a new skb */ |
446 | new_skb = | 445 | new_skb = |
447 | skb_realloc_headroom(skb, MWIFIEX_MIN_DATA_HEADER_LEN); | 446 | skb_realloc_headroom(skb, MWIFIEX_MIN_DATA_HEADER_LEN); |
@@ -454,7 +453,7 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
454 | kfree_skb(skb); | 453 | kfree_skb(skb); |
455 | skb = new_skb; | 454 | skb = new_skb; |
456 | dev_dbg(priv->adapter->dev, "info: new skb headroomd %d\n", | 455 | dev_dbg(priv->adapter->dev, "info: new skb headroomd %d\n", |
457 | skb_headroom(skb)); | 456 | skb_headroom(skb)); |
458 | } | 457 | } |
459 | 458 | ||
460 | tx_info = MWIFIEX_SKB_TXCB(skb); | 459 | tx_info = MWIFIEX_SKB_TXCB(skb); |
@@ -494,8 +493,8 @@ mwifiex_set_mac_address(struct net_device *dev, void *addr) | |||
494 | if (!ret) | 493 | if (!ret) |
495 | memcpy(priv->netdev->dev_addr, priv->curr_addr, ETH_ALEN); | 494 | memcpy(priv->netdev->dev_addr, priv->curr_addr, ETH_ALEN); |
496 | else | 495 | else |
497 | dev_err(priv->adapter->dev, "set mac address failed: ret=%d" | 496 | dev_err(priv->adapter->dev, |
498 | "\n", ret); | 497 | "set mac address failed: ret=%d\n", ret); |
499 | 498 | ||
500 | memcpy(dev->dev_addr, priv->curr_addr, ETH_ALEN); | 499 | memcpy(dev->dev_addr, priv->curr_addr, ETH_ALEN); |
501 | 500 | ||
@@ -533,7 +532,7 @@ mwifiex_tx_timeout(struct net_device *dev) | |||
533 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); | 532 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); |
534 | 533 | ||
535 | dev_err(priv->adapter->dev, "%lu : Tx timeout, bss_type-num = %d-%d\n", | 534 | dev_err(priv->adapter->dev, "%lu : Tx timeout, bss_type-num = %d-%d\n", |
536 | jiffies, priv->bss_type, priv->bss_num); | 535 | jiffies, priv->bss_type, priv->bss_num); |
537 | mwifiex_set_trans_start(dev); | 536 | mwifiex_set_trans_start(dev); |
538 | priv->num_tx_timeout++; | 537 | priv->num_tx_timeout++; |
539 | } | 538 | } |
@@ -704,7 +703,7 @@ mwifiex_add_card(void *card, struct semaphore *sem, | |||
704 | rtnl_lock(); | 703 | rtnl_lock(); |
705 | /* Create station interface by default */ | 704 | /* Create station interface by default */ |
706 | if (!mwifiex_add_virtual_intf(priv->wdev->wiphy, "mlan%d", | 705 | if (!mwifiex_add_virtual_intf(priv->wdev->wiphy, "mlan%d", |
707 | NL80211_IFTYPE_STATION, NULL, NULL)) { | 706 | NL80211_IFTYPE_STATION, NULL, NULL)) { |
708 | rtnl_unlock(); | 707 | rtnl_unlock(); |
709 | dev_err(adapter->dev, "cannot create default station" | 708 | dev_err(adapter->dev, "cannot create default station" |
710 | " interface\n"); | 709 | " interface\n"); |
@@ -781,7 +780,7 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem) | |||
781 | if (priv && priv->netdev) { | 780 | if (priv && priv->netdev) { |
782 | if (!netif_queue_stopped(priv->netdev)) | 781 | if (!netif_queue_stopped(priv->netdev)) |
783 | mwifiex_stop_net_dev_queue(priv->netdev, | 782 | mwifiex_stop_net_dev_queue(priv->netdev, |
784 | adapter); | 783 | adapter); |
785 | if (netif_carrier_ok(priv->netdev)) | 784 | if (netif_carrier_ok(priv->netdev)) |
786 | netif_carrier_off(priv->netdev); | 785 | netif_carrier_off(priv->netdev); |
787 | } | 786 | } |
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index c0df48f63e11..35225e9b1080 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -841,8 +841,8 @@ mwifiex_get_priv_by_id(struct mwifiex_adapter *adapter, | |||
841 | 841 | ||
842 | for (i = 0; i < adapter->priv_num; i++) { | 842 | for (i = 0; i < adapter->priv_num; i++) { |
843 | if (adapter->priv[i]) { | 843 | if (adapter->priv[i]) { |
844 | if ((adapter->priv[i]->bss_num == bss_num) | 844 | if ((adapter->priv[i]->bss_num == bss_num) && |
845 | && (adapter->priv[i]->bss_type == bss_type)) | 845 | (adapter->priv[i]->bss_type == bss_type)) |
846 | break; | 846 | break; |
847 | } | 847 | } |
848 | } | 848 | } |
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c index 1033f00a775f..e1f45ecf39a5 100644 --- a/drivers/net/wireless/mwifiex/pcie.c +++ b/drivers/net/wireless/mwifiex/pcie.c | |||
@@ -83,7 +83,7 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev, | |||
83 | struct pcie_service_card *card; | 83 | struct pcie_service_card *card; |
84 | 84 | ||
85 | pr_debug("info: vendor=0x%4.04X device=0x%4.04X rev=%d\n", | 85 | pr_debug("info: vendor=0x%4.04X device=0x%4.04X rev=%d\n", |
86 | pdev->vendor, pdev->device, pdev->revision); | 86 | pdev->vendor, pdev->device, pdev->revision); |
87 | 87 | ||
88 | card = kzalloc(sizeof(struct pcie_service_card), GFP_KERNEL); | 88 | card = kzalloc(sizeof(struct pcie_service_card), GFP_KERNEL); |
89 | if (!card) { | 89 | if (!card) { |
@@ -110,6 +110,7 @@ static void mwifiex_pcie_remove(struct pci_dev *pdev) | |||
110 | { | 110 | { |
111 | struct pcie_service_card *card; | 111 | struct pcie_service_card *card; |
112 | struct mwifiex_adapter *adapter; | 112 | struct mwifiex_adapter *adapter; |
113 | struct mwifiex_private *priv; | ||
113 | int i; | 114 | int i; |
114 | 115 | ||
115 | card = pci_get_drvdata(pdev); | 116 | card = pci_get_drvdata(pdev); |
@@ -128,16 +129,15 @@ static void mwifiex_pcie_remove(struct pci_dev *pdev) | |||
128 | 129 | ||
129 | for (i = 0; i < adapter->priv_num; i++) | 130 | for (i = 0; i < adapter->priv_num; i++) |
130 | if ((GET_BSS_ROLE(adapter->priv[i]) == | 131 | if ((GET_BSS_ROLE(adapter->priv[i]) == |
131 | MWIFIEX_BSS_ROLE_STA) && | 132 | MWIFIEX_BSS_ROLE_STA) && |
132 | adapter->priv[i]->media_connected) | 133 | adapter->priv[i]->media_connected) |
133 | mwifiex_deauthenticate(adapter->priv[i], NULL); | 134 | mwifiex_deauthenticate(adapter->priv[i], NULL); |
134 | 135 | ||
135 | mwifiex_disable_auto_ds(mwifiex_get_priv(adapter, | 136 | priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); |
136 | MWIFIEX_BSS_ROLE_ANY)); | ||
137 | 137 | ||
138 | mwifiex_init_shutdown_fw(mwifiex_get_priv(adapter, | 138 | mwifiex_disable_auto_ds(priv); |
139 | MWIFIEX_BSS_ROLE_ANY), | 139 | |
140 | MWIFIEX_FUNC_SHUTDOWN); | 140 | mwifiex_init_shutdown_fw(priv, MWIFIEX_FUNC_SHUTDOWN); |
141 | } | 141 | } |
142 | 142 | ||
143 | mwifiex_remove_card(card->adapter, &add_remove_card_sem); | 143 | mwifiex_remove_card(card->adapter, &add_remove_card_sem); |
@@ -221,7 +221,7 @@ static int mwifiex_pcie_resume(struct pci_dev *pdev) | |||
221 | netif_carrier_on(adapter->priv[i]->netdev); | 221 | netif_carrier_on(adapter->priv[i]->netdev); |
222 | 222 | ||
223 | mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA), | 223 | mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA), |
224 | MWIFIEX_ASYNC_CMD); | 224 | MWIFIEX_ASYNC_CMD); |
225 | 225 | ||
226 | return 0; | 226 | return 0; |
227 | } | 227 | } |
@@ -380,26 +380,26 @@ static int mwifiex_pcie_create_txbd_ring(struct mwifiex_adapter *adapter) | |||
380 | /* allocate shared memory for the BD ring and divide the same in to | 380 | /* allocate shared memory for the BD ring and divide the same in to |
381 | several descriptors */ | 381 | several descriptors */ |
382 | card->txbd_ring_size = sizeof(struct mwifiex_pcie_buf_desc) * | 382 | card->txbd_ring_size = sizeof(struct mwifiex_pcie_buf_desc) * |
383 | MWIFIEX_MAX_TXRX_BD; | 383 | MWIFIEX_MAX_TXRX_BD; |
384 | dev_dbg(adapter->dev, "info: txbd_ring: Allocating %d bytes\n", | 384 | dev_dbg(adapter->dev, "info: txbd_ring: Allocating %d bytes\n", |
385 | card->txbd_ring_size); | 385 | card->txbd_ring_size); |
386 | card->txbd_ring_vbase = kzalloc(card->txbd_ring_size, GFP_KERNEL); | 386 | card->txbd_ring_vbase = kzalloc(card->txbd_ring_size, GFP_KERNEL); |
387 | if (!card->txbd_ring_vbase) { | 387 | if (!card->txbd_ring_vbase) { |
388 | dev_err(adapter->dev, "Unable to allocate buffer for txbd ring.\n"); | 388 | dev_err(adapter->dev, "Unable to alloc buffer for txbd ring\n"); |
389 | return -ENOMEM; | 389 | return -ENOMEM; |
390 | } | 390 | } |
391 | card->txbd_ring_pbase = virt_to_phys(card->txbd_ring_vbase); | 391 | card->txbd_ring_pbase = virt_to_phys(card->txbd_ring_vbase); |
392 | 392 | ||
393 | dev_dbg(adapter->dev, "info: txbd_ring - base: %p, pbase: %#x:%x," | 393 | dev_dbg(adapter->dev, |
394 | "len: %x\n", card->txbd_ring_vbase, | 394 | "info: txbd_ring - base: %p, pbase: %#x:%x, len: %x\n", |
395 | (u32)card->txbd_ring_pbase, | 395 | card->txbd_ring_vbase, (u32)card->txbd_ring_pbase, |
396 | (u32)((u64)card->txbd_ring_pbase >> 32), | 396 | (u32)((u64)card->txbd_ring_pbase >> 32), card->txbd_ring_size); |
397 | card->txbd_ring_size); | ||
398 | 397 | ||
399 | for (i = 0; i < MWIFIEX_MAX_TXRX_BD; i++) { | 398 | for (i = 0; i < MWIFIEX_MAX_TXRX_BD; i++) { |
400 | card->txbd_ring[i] = (struct mwifiex_pcie_buf_desc *) | 399 | card->txbd_ring[i] = (struct mwifiex_pcie_buf_desc *) |
401 | (card->txbd_ring_vbase + | 400 | (card->txbd_ring_vbase + |
402 | (sizeof(struct mwifiex_pcie_buf_desc) * i)); | 401 | (sizeof(struct mwifiex_pcie_buf_desc) |
402 | * i)); | ||
403 | 403 | ||
404 | /* Allocate buffer here so that firmware can DMA data from it */ | 404 | /* Allocate buffer here so that firmware can DMA data from it */ |
405 | skb = dev_alloc_skb(MWIFIEX_RX_DATA_BUF_SIZE); | 405 | skb = dev_alloc_skb(MWIFIEX_RX_DATA_BUF_SIZE); |
@@ -412,10 +412,9 @@ static int mwifiex_pcie_create_txbd_ring(struct mwifiex_adapter *adapter) | |||
412 | 412 | ||
413 | skb_put(skb, MWIFIEX_RX_DATA_BUF_SIZE); | 413 | skb_put(skb, MWIFIEX_RX_DATA_BUF_SIZE); |
414 | dev_dbg(adapter->dev, "info: TX ring: add new skb base: %p, " | 414 | dev_dbg(adapter->dev, "info: TX ring: add new skb base: %p, " |
415 | "buf_base: %p, buf_pbase: %#x:%x, " | 415 | "buf_base: %p, buf_pbase: %#x:%x, buf_len: %#x\n", |
416 | "buf_len: %#x\n", skb, skb->data, | 416 | skb, skb->data, (u32)*buf_pa, |
417 | (u32)*buf_pa, (u32)(((u64)*buf_pa >> 32)), | 417 | (u32)(((u64)*buf_pa >> 32)), skb->len); |
418 | skb->len); | ||
419 | 418 | ||
420 | card->tx_buf_list[i] = skb; | 419 | card->tx_buf_list[i] = skb; |
421 | card->txbd_ring[i]->paddr = *buf_pa; | 420 | card->txbd_ring[i]->paddr = *buf_pa; |
@@ -469,9 +468,9 @@ static int mwifiex_pcie_create_rxbd_ring(struct mwifiex_adapter *adapter) | |||
469 | card->rxbd_rdptr |= MWIFIEX_BD_FLAG_ROLLOVER_IND; | 468 | card->rxbd_rdptr |= MWIFIEX_BD_FLAG_ROLLOVER_IND; |
470 | 469 | ||
471 | card->rxbd_ring_size = sizeof(struct mwifiex_pcie_buf_desc) * | 470 | card->rxbd_ring_size = sizeof(struct mwifiex_pcie_buf_desc) * |
472 | MWIFIEX_MAX_TXRX_BD; | 471 | MWIFIEX_MAX_TXRX_BD; |
473 | dev_dbg(adapter->dev, "info: rxbd_ring: Allocating %d bytes\n", | 472 | dev_dbg(adapter->dev, "info: rxbd_ring: Allocating %d bytes\n", |
474 | card->rxbd_ring_size); | 473 | card->rxbd_ring_size); |
475 | card->rxbd_ring_vbase = kzalloc(card->rxbd_ring_size, GFP_KERNEL); | 474 | card->rxbd_ring_vbase = kzalloc(card->rxbd_ring_size, GFP_KERNEL); |
476 | if (!card->rxbd_ring_vbase) { | 475 | if (!card->rxbd_ring_vbase) { |
477 | dev_err(adapter->dev, "Unable to allocate buffer for " | 476 | dev_err(adapter->dev, "Unable to allocate buffer for " |
@@ -480,21 +479,23 @@ static int mwifiex_pcie_create_rxbd_ring(struct mwifiex_adapter *adapter) | |||
480 | } | 479 | } |
481 | card->rxbd_ring_pbase = virt_to_phys(card->rxbd_ring_vbase); | 480 | card->rxbd_ring_pbase = virt_to_phys(card->rxbd_ring_vbase); |
482 | 481 | ||
483 | dev_dbg(adapter->dev, "info: rxbd_ring - base: %p, pbase: %#x:%x," | 482 | dev_dbg(adapter->dev, |
484 | "len: %#x\n", card->rxbd_ring_vbase, | 483 | "info: rxbd_ring - base: %p, pbase: %#x:%x, len: %#x\n", |
485 | (u32)card->rxbd_ring_pbase, | 484 | card->rxbd_ring_vbase, (u32)card->rxbd_ring_pbase, |
486 | (u32)((u64)card->rxbd_ring_pbase >> 32), | 485 | (u32)((u64)card->rxbd_ring_pbase >> 32), |
487 | card->rxbd_ring_size); | 486 | card->rxbd_ring_size); |
488 | 487 | ||
489 | for (i = 0; i < MWIFIEX_MAX_TXRX_BD; i++) { | 488 | for (i = 0; i < MWIFIEX_MAX_TXRX_BD; i++) { |
490 | card->rxbd_ring[i] = (struct mwifiex_pcie_buf_desc *) | 489 | card->rxbd_ring[i] = (struct mwifiex_pcie_buf_desc *) |
491 | (card->rxbd_ring_vbase + | 490 | (card->rxbd_ring_vbase + |
492 | (sizeof(struct mwifiex_pcie_buf_desc) * i)); | 491 | (sizeof(struct mwifiex_pcie_buf_desc) |
492 | * i)); | ||
493 | 493 | ||
494 | /* Allocate skb here so that firmware can DMA data from it */ | 494 | /* Allocate skb here so that firmware can DMA data from it */ |
495 | skb = dev_alloc_skb(MWIFIEX_RX_DATA_BUF_SIZE); | 495 | skb = dev_alloc_skb(MWIFIEX_RX_DATA_BUF_SIZE); |
496 | if (!skb) { | 496 | if (!skb) { |
497 | dev_err(adapter->dev, "Unable to allocate skb for RX ring.\n"); | 497 | dev_err(adapter->dev, |
498 | "Unable to allocate skb for RX ring.\n"); | ||
498 | kfree(card->rxbd_ring_vbase); | 499 | kfree(card->rxbd_ring_vbase); |
499 | return -ENOMEM; | 500 | return -ENOMEM; |
500 | } | 501 | } |
@@ -502,10 +503,9 @@ static int mwifiex_pcie_create_rxbd_ring(struct mwifiex_adapter *adapter) | |||
502 | skb_put(skb, MWIFIEX_RX_DATA_BUF_SIZE); | 503 | skb_put(skb, MWIFIEX_RX_DATA_BUF_SIZE); |
503 | 504 | ||
504 | dev_dbg(adapter->dev, "info: RX ring: add new skb base: %p, " | 505 | dev_dbg(adapter->dev, "info: RX ring: add new skb base: %p, " |
505 | "buf_base: %p, buf_pbase: %#x:%x, " | 506 | "buf_base: %p, buf_pbase: %#x:%x, buf_len: %#x\n", |
506 | "buf_len: %#x\n", skb, skb->data, | 507 | skb, skb->data, (u32)*buf_pa, (u32)((u64)*buf_pa >> 32), |
507 | (u32)*buf_pa, (u32)((u64)*buf_pa >> 32), | 508 | skb->len); |
508 | skb->len); | ||
509 | 509 | ||
510 | card->rx_buf_list[i] = skb; | 510 | card->rx_buf_list[i] = skb; |
511 | card->rxbd_ring[i]->paddr = *buf_pa; | 511 | card->rxbd_ring[i]->paddr = *buf_pa; |
@@ -562,32 +562,34 @@ static int mwifiex_pcie_create_evtbd_ring(struct mwifiex_adapter *adapter) | |||
562 | card->evtbd_rdptr |= MWIFIEX_BD_FLAG_ROLLOVER_IND; | 562 | card->evtbd_rdptr |= MWIFIEX_BD_FLAG_ROLLOVER_IND; |
563 | 563 | ||
564 | card->evtbd_ring_size = sizeof(struct mwifiex_pcie_buf_desc) * | 564 | card->evtbd_ring_size = sizeof(struct mwifiex_pcie_buf_desc) * |
565 | MWIFIEX_MAX_EVT_BD; | 565 | MWIFIEX_MAX_EVT_BD; |
566 | dev_dbg(adapter->dev, "info: evtbd_ring: Allocating %d bytes\n", | 566 | dev_dbg(adapter->dev, "info: evtbd_ring: Allocating %d bytes\n", |
567 | card->evtbd_ring_size); | 567 | card->evtbd_ring_size); |
568 | card->evtbd_ring_vbase = kzalloc(card->evtbd_ring_size, GFP_KERNEL); | 568 | card->evtbd_ring_vbase = kzalloc(card->evtbd_ring_size, GFP_KERNEL); |
569 | if (!card->evtbd_ring_vbase) { | 569 | if (!card->evtbd_ring_vbase) { |
570 | dev_err(adapter->dev, "Unable to allocate buffer. " | 570 | dev_err(adapter->dev, |
571 | "Terminating download\n"); | 571 | "Unable to allocate buffer. Terminating download\n"); |
572 | return -ENOMEM; | 572 | return -ENOMEM; |
573 | } | 573 | } |
574 | card->evtbd_ring_pbase = virt_to_phys(card->evtbd_ring_vbase); | 574 | card->evtbd_ring_pbase = virt_to_phys(card->evtbd_ring_vbase); |
575 | 575 | ||
576 | dev_dbg(adapter->dev, "info: CMDRSP/EVT bd_ring - base: %p, " | 576 | dev_dbg(adapter->dev, |
577 | "pbase: %#x:%x, len: %#x\n", card->evtbd_ring_vbase, | 577 | "info: CMDRSP/EVT bd_ring - base: %p pbase: %#x:%x len: %#x\n", |
578 | (u32)card->evtbd_ring_pbase, | 578 | card->evtbd_ring_vbase, (u32)card->evtbd_ring_pbase, |
579 | (u32)((u64)card->evtbd_ring_pbase >> 32), | 579 | (u32)((u64)card->evtbd_ring_pbase >> 32), |
580 | card->evtbd_ring_size); | 580 | card->evtbd_ring_size); |
581 | 581 | ||
582 | for (i = 0; i < MWIFIEX_MAX_EVT_BD; i++) { | 582 | for (i = 0; i < MWIFIEX_MAX_EVT_BD; i++) { |
583 | card->evtbd_ring[i] = (struct mwifiex_pcie_buf_desc *) | 583 | card->evtbd_ring[i] = (struct mwifiex_pcie_buf_desc *) |
584 | (card->evtbd_ring_vbase + | 584 | (card->evtbd_ring_vbase + |
585 | (sizeof(struct mwifiex_pcie_buf_desc) * i)); | 585 | (sizeof(struct mwifiex_pcie_buf_desc) |
586 | * i)); | ||
586 | 587 | ||
587 | /* Allocate skb here so that firmware can DMA data from it */ | 588 | /* Allocate skb here so that firmware can DMA data from it */ |
588 | skb = dev_alloc_skb(MAX_EVENT_SIZE); | 589 | skb = dev_alloc_skb(MAX_EVENT_SIZE); |
589 | if (!skb) { | 590 | if (!skb) { |
590 | dev_err(adapter->dev, "Unable to allocate skb for EVENT buf.\n"); | 591 | dev_err(adapter->dev, |
592 | "Unable to allocate skb for EVENT buf.\n"); | ||
591 | kfree(card->evtbd_ring_vbase); | 593 | kfree(card->evtbd_ring_vbase); |
592 | return -ENOMEM; | 594 | return -ENOMEM; |
593 | } | 595 | } |
@@ -595,10 +597,9 @@ static int mwifiex_pcie_create_evtbd_ring(struct mwifiex_adapter *adapter) | |||
595 | skb_put(skb, MAX_EVENT_SIZE); | 597 | skb_put(skb, MAX_EVENT_SIZE); |
596 | 598 | ||
597 | dev_dbg(adapter->dev, "info: Evt ring: add new skb. base: %p, " | 599 | dev_dbg(adapter->dev, "info: Evt ring: add new skb. base: %p, " |
598 | "buf_base: %p, buf_pbase: %#x:%x, " | 600 | "buf_base: %p, buf_pbase: %#x:%x, buf_len: %#x\n", |
599 | "buf_len: %#x\n", skb, skb->data, | 601 | skb, skb->data, (u32)*buf_pa, (u32)((u64)*buf_pa >> 32), |
600 | (u32)*buf_pa, (u32)((u64)*buf_pa >> 32), | 602 | skb->len); |
601 | skb->len); | ||
602 | 603 | ||
603 | card->evt_buf_list[i] = skb; | 604 | card->evt_buf_list[i] = skb; |
604 | card->evtbd_ring[i]->paddr = *buf_pa; | 605 | card->evtbd_ring[i]->paddr = *buf_pa; |
@@ -647,8 +648,8 @@ static int mwifiex_pcie_alloc_cmdrsp_buf(struct mwifiex_adapter *adapter) | |||
647 | /* Allocate memory for receiving command response data */ | 648 | /* Allocate memory for receiving command response data */ |
648 | skb = dev_alloc_skb(MWIFIEX_UPLD_SIZE); | 649 | skb = dev_alloc_skb(MWIFIEX_UPLD_SIZE); |
649 | if (!skb) { | 650 | if (!skb) { |
650 | dev_err(adapter->dev, "Unable to allocate skb for command " | 651 | dev_err(adapter->dev, |
651 | "response data.\n"); | 652 | "Unable to allocate skb for command response data.\n"); |
652 | return -ENOMEM; | 653 | return -ENOMEM; |
653 | } | 654 | } |
654 | mwifiex_update_sk_buff_pa(skb); | 655 | mwifiex_update_sk_buff_pa(skb); |
@@ -659,8 +660,8 @@ static int mwifiex_pcie_alloc_cmdrsp_buf(struct mwifiex_adapter *adapter) | |||
659 | /* Allocate memory for sending command to firmware */ | 660 | /* Allocate memory for sending command to firmware */ |
660 | skb = dev_alloc_skb(MWIFIEX_SIZE_OF_CMD_BUFFER); | 661 | skb = dev_alloc_skb(MWIFIEX_SIZE_OF_CMD_BUFFER); |
661 | if (!skb) { | 662 | if (!skb) { |
662 | dev_err(adapter->dev, "Unable to allocate skb for command " | 663 | dev_err(adapter->dev, |
663 | "data.\n"); | 664 | "Unable to allocate skb for command data.\n"); |
664 | return -ENOMEM; | 665 | return -ENOMEM; |
665 | } | 666 | } |
666 | mwifiex_update_sk_buff_pa(skb); | 667 | mwifiex_update_sk_buff_pa(skb); |
@@ -702,8 +703,8 @@ static int mwifiex_pcie_alloc_sleep_cookie_buf(struct mwifiex_adapter *adapter) | |||
702 | /* Allocate memory for sleep cookie */ | 703 | /* Allocate memory for sleep cookie */ |
703 | skb = dev_alloc_skb(sizeof(u32)); | 704 | skb = dev_alloc_skb(sizeof(u32)); |
704 | if (!skb) { | 705 | if (!skb) { |
705 | dev_err(adapter->dev, "Unable to allocate skb for sleep " | 706 | dev_err(adapter->dev, |
706 | "cookie!\n"); | 707 | "Unable to allocate skb for sleep cookie!\n"); |
707 | return -ENOMEM; | 708 | return -ENOMEM; |
708 | } | 709 | } |
709 | mwifiex_update_sk_buff_pa(skb); | 710 | mwifiex_update_sk_buff_pa(skb); |
@@ -713,7 +714,7 @@ static int mwifiex_pcie_alloc_sleep_cookie_buf(struct mwifiex_adapter *adapter) | |||
713 | *(u32 *)skb->data = FW_AWAKE_COOKIE; | 714 | *(u32 *)skb->data = FW_AWAKE_COOKIE; |
714 | 715 | ||
715 | dev_dbg(adapter->dev, "alloc_scook: sleep cookie=0x%x\n", | 716 | dev_dbg(adapter->dev, "alloc_scook: sleep cookie=0x%x\n", |
716 | *((u32 *)skb->data)); | 717 | *((u32 *)skb->data)); |
717 | 718 | ||
718 | /* Save the sleep cookie */ | 719 | /* Save the sleep cookie */ |
719 | card->sleep_cookie = skb; | 720 | card->sleep_cookie = skb; |
@@ -757,15 +758,15 @@ mwifiex_pcie_send_data(struct mwifiex_adapter *adapter, struct sk_buff *skb) | |||
757 | 758 | ||
758 | /* Read the TX ring read pointer set by firmware */ | 759 | /* Read the TX ring read pointer set by firmware */ |
759 | if (mwifiex_read_reg(adapter, REG_TXBD_RDPTR, &rdptr)) { | 760 | if (mwifiex_read_reg(adapter, REG_TXBD_RDPTR, &rdptr)) { |
760 | dev_err(adapter->dev, "SEND DATA: failed to read " | 761 | dev_err(adapter->dev, |
761 | "REG_TXBD_RDPTR\n"); | 762 | "SEND DATA: failed to read REG_TXBD_RDPTR\n"); |
762 | return -1; | 763 | return -1; |
763 | } | 764 | } |
764 | 765 | ||
765 | wrindx = card->txbd_wrptr & MWIFIEX_TXBD_MASK; | 766 | wrindx = card->txbd_wrptr & MWIFIEX_TXBD_MASK; |
766 | 767 | ||
767 | dev_dbg(adapter->dev, "info: SEND DATA: <Rd: %#x, Wr: %#x>\n", rdptr, | 768 | dev_dbg(adapter->dev, "info: SEND DATA: <Rd: %#x, Wr: %#x>\n", rdptr, |
768 | card->txbd_wrptr); | 769 | card->txbd_wrptr); |
769 | if (((card->txbd_wrptr & MWIFIEX_TXBD_MASK) != | 770 | if (((card->txbd_wrptr & MWIFIEX_TXBD_MASK) != |
770 | (rdptr & MWIFIEX_TXBD_MASK)) || | 771 | (rdptr & MWIFIEX_TXBD_MASK)) || |
771 | ((card->txbd_wrptr & MWIFIEX_BD_FLAG_ROLLOVER_IND) != | 772 | ((card->txbd_wrptr & MWIFIEX_BD_FLAG_ROLLOVER_IND) != |
@@ -797,32 +798,31 @@ mwifiex_pcie_send_data(struct mwifiex_adapter *adapter, struct sk_buff *skb) | |||
797 | 798 | ||
798 | /* Write the TX ring write pointer in to REG_TXBD_WRPTR */ | 799 | /* Write the TX ring write pointer in to REG_TXBD_WRPTR */ |
799 | if (mwifiex_write_reg(adapter, REG_TXBD_WRPTR, | 800 | if (mwifiex_write_reg(adapter, REG_TXBD_WRPTR, |
800 | card->txbd_wrptr)) { | 801 | card->txbd_wrptr)) { |
801 | dev_err(adapter->dev, "SEND DATA: failed to write " | 802 | dev_err(adapter->dev, |
802 | "REG_TXBD_WRPTR\n"); | 803 | "SEND DATA: failed to write REG_TXBD_WRPTR\n"); |
803 | return 0; | 804 | return 0; |
804 | } | 805 | } |
805 | 806 | ||
806 | /* Send the TX ready interrupt */ | 807 | /* Send the TX ready interrupt */ |
807 | if (mwifiex_write_reg(adapter, PCIE_CPU_INT_EVENT, | 808 | if (mwifiex_write_reg(adapter, PCIE_CPU_INT_EVENT, |
808 | CPU_INTR_DNLD_RDY)) { | 809 | CPU_INTR_DNLD_RDY)) { |
809 | dev_err(adapter->dev, "SEND DATA: failed to assert " | 810 | dev_err(adapter->dev, |
810 | "door-bell interrupt.\n"); | 811 | "SEND DATA: failed to assert door-bell intr\n"); |
811 | return -1; | 812 | return -1; |
812 | } | 813 | } |
813 | dev_dbg(adapter->dev, "info: SEND DATA: Updated <Rd: %#x, Wr: " | 814 | dev_dbg(adapter->dev, "info: SEND DATA: Updated <Rd: %#x, Wr: " |
814 | "%#x> and sent packet to firmware " | 815 | "%#x> and sent packet to firmware successfully\n", |
815 | "successfully\n", rdptr, | 816 | rdptr, card->txbd_wrptr); |
816 | card->txbd_wrptr); | ||
817 | } else { | 817 | } else { |
818 | dev_dbg(adapter->dev, "info: TX Ring full, can't send anymore " | 818 | dev_dbg(adapter->dev, |
819 | "packets to firmware\n"); | 819 | "info: TX Ring full, can't send packets to fw\n"); |
820 | adapter->data_sent = true; | 820 | adapter->data_sent = true; |
821 | /* Send the TX ready interrupt */ | 821 | /* Send the TX ready interrupt */ |
822 | if (mwifiex_write_reg(adapter, PCIE_CPU_INT_EVENT, | 822 | if (mwifiex_write_reg(adapter, PCIE_CPU_INT_EVENT, |
823 | CPU_INTR_DNLD_RDY)) | 823 | CPU_INTR_DNLD_RDY)) |
824 | dev_err(adapter->dev, "SEND DATA: failed to assert " | 824 | dev_err(adapter->dev, |
825 | "door-bell interrupt\n"); | 825 | "SEND DATA: failed to assert door-bell intr\n"); |
826 | return -EBUSY; | 826 | return -EBUSY; |
827 | } | 827 | } |
828 | 828 | ||
@@ -842,8 +842,8 @@ static int mwifiex_pcie_process_recv_data(struct mwifiex_adapter *adapter) | |||
842 | 842 | ||
843 | /* Read the RX ring Write pointer set by firmware */ | 843 | /* Read the RX ring Write pointer set by firmware */ |
844 | if (mwifiex_read_reg(adapter, REG_RXBD_WRPTR, &wrptr)) { | 844 | if (mwifiex_read_reg(adapter, REG_RXBD_WRPTR, &wrptr)) { |
845 | dev_err(adapter->dev, "RECV DATA: failed to read " | 845 | dev_err(adapter->dev, |
846 | "REG_TXBD_RDPTR\n"); | 846 | "RECV DATA: failed to read REG_TXBD_RDPTR\n"); |
847 | ret = -1; | 847 | ret = -1; |
848 | goto done; | 848 | goto done; |
849 | } | 849 | } |
@@ -861,12 +861,13 @@ static int mwifiex_pcie_process_recv_data(struct mwifiex_adapter *adapter) | |||
861 | /* Get data length from interface header - | 861 | /* Get data length from interface header - |
862 | first byte is len, second byte is type */ | 862 | first byte is len, second byte is type */ |
863 | rx_len = *((u16 *)skb_data->data); | 863 | rx_len = *((u16 *)skb_data->data); |
864 | dev_dbg(adapter->dev, "info: RECV DATA: Rd=%#x, Wr=%#x, " | 864 | dev_dbg(adapter->dev, |
865 | "Len=%d\n", card->rxbd_rdptr, wrptr, rx_len); | 865 | "info: RECV DATA: Rd=%#x, Wr=%#x, Len=%d\n", |
866 | card->rxbd_rdptr, wrptr, rx_len); | ||
866 | skb_tmp = dev_alloc_skb(rx_len); | 867 | skb_tmp = dev_alloc_skb(rx_len); |
867 | if (!skb_tmp) { | 868 | if (!skb_tmp) { |
868 | dev_dbg(adapter->dev, "info: Failed to alloc skb " | 869 | dev_dbg(adapter->dev, |
869 | "for RX\n"); | 870 | "info: Failed to alloc skb for RX\n"); |
870 | ret = -EBUSY; | 871 | ret = -EBUSY; |
871 | goto done; | 872 | goto done; |
872 | } | 873 | } |
@@ -881,26 +882,26 @@ static int mwifiex_pcie_process_recv_data(struct mwifiex_adapter *adapter) | |||
881 | MWIFIEX_BD_FLAG_ROLLOVER_IND); | 882 | MWIFIEX_BD_FLAG_ROLLOVER_IND); |
882 | } | 883 | } |
883 | dev_dbg(adapter->dev, "info: RECV DATA: <Rd: %#x, Wr: %#x>\n", | 884 | dev_dbg(adapter->dev, "info: RECV DATA: <Rd: %#x, Wr: %#x>\n", |
884 | card->rxbd_rdptr, wrptr); | 885 | card->rxbd_rdptr, wrptr); |
885 | 886 | ||
886 | /* Write the RX ring read pointer in to REG_RXBD_RDPTR */ | 887 | /* Write the RX ring read pointer in to REG_RXBD_RDPTR */ |
887 | if (mwifiex_write_reg(adapter, REG_RXBD_RDPTR, | 888 | if (mwifiex_write_reg(adapter, REG_RXBD_RDPTR, |
888 | card->rxbd_rdptr)) { | 889 | card->rxbd_rdptr)) { |
889 | dev_err(adapter->dev, "RECV DATA: failed to " | 890 | dev_err(adapter->dev, |
890 | "write REG_RXBD_RDPTR\n"); | 891 | "RECV DATA: failed to write REG_RXBD_RDPTR\n"); |
891 | ret = -1; | 892 | ret = -1; |
892 | goto done; | 893 | goto done; |
893 | } | 894 | } |
894 | 895 | ||
895 | /* Read the RX ring Write pointer set by firmware */ | 896 | /* Read the RX ring Write pointer set by firmware */ |
896 | if (mwifiex_read_reg(adapter, REG_RXBD_WRPTR, &wrptr)) { | 897 | if (mwifiex_read_reg(adapter, REG_RXBD_WRPTR, &wrptr)) { |
897 | dev_err(adapter->dev, "RECV DATA: failed to read " | 898 | dev_err(adapter->dev, |
898 | "REG_TXBD_RDPTR\n"); | 899 | "RECV DATA: failed to read REG_TXBD_RDPTR\n"); |
899 | ret = -1; | 900 | ret = -1; |
900 | goto done; | 901 | goto done; |
901 | } | 902 | } |
902 | dev_dbg(adapter->dev, "info: RECV DATA: Received packet from " | 903 | dev_dbg(adapter->dev, |
903 | "firmware successfully\n"); | 904 | "info: RECV DATA: Rcvd packet from fw successfully\n"); |
904 | mwifiex_handle_rx_packet(adapter, skb_tmp); | 905 | mwifiex_handle_rx_packet(adapter, skb_tmp); |
905 | } | 906 | } |
906 | 907 | ||
@@ -919,17 +920,19 @@ mwifiex_pcie_send_boot_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb) | |||
919 | phys_addr_t *buf_pa = MWIFIEX_SKB_PACB(skb); | 920 | phys_addr_t *buf_pa = MWIFIEX_SKB_PACB(skb); |
920 | 921 | ||
921 | if (!(skb->data && skb->len && *buf_pa)) { | 922 | if (!(skb->data && skb->len && *buf_pa)) { |
922 | dev_err(adapter->dev, "Invalid parameter in %s <%p, %#x:%x, " | 923 | dev_err(adapter->dev, |
923 | "%x>\n", __func__, skb->data, skb->len, | 924 | "Invalid parameter in %s <%p, %#x:%x, %x>\n", |
924 | (u32)*buf_pa, (u32)((u64)*buf_pa >> 32)); | 925 | __func__, skb->data, skb->len, |
926 | (u32)*buf_pa, (u32)((u64)*buf_pa >> 32)); | ||
925 | return -1; | 927 | return -1; |
926 | } | 928 | } |
927 | 929 | ||
928 | /* Write the lower 32bits of the physical address to scratch | 930 | /* Write the lower 32bits of the physical address to scratch |
929 | * register 0 */ | 931 | * register 0 */ |
930 | if (mwifiex_write_reg(adapter, PCIE_SCRATCH_0_REG, (u32)*buf_pa)) { | 932 | if (mwifiex_write_reg(adapter, PCIE_SCRATCH_0_REG, (u32)*buf_pa)) { |
931 | dev_err(adapter->dev, "%s: failed to write download command " | 933 | dev_err(adapter->dev, |
932 | "to boot code.\n", __func__); | 934 | "%s: failed to write download command to boot code.\n", |
935 | __func__); | ||
933 | return -1; | 936 | return -1; |
934 | } | 937 | } |
935 | 938 | ||
@@ -937,23 +940,25 @@ mwifiex_pcie_send_boot_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb) | |||
937 | * register 1 */ | 940 | * register 1 */ |
938 | if (mwifiex_write_reg(adapter, PCIE_SCRATCH_1_REG, | 941 | if (mwifiex_write_reg(adapter, PCIE_SCRATCH_1_REG, |
939 | (u32)((u64)*buf_pa >> 32))) { | 942 | (u32)((u64)*buf_pa >> 32))) { |
940 | dev_err(adapter->dev, "%s: failed to write download command " | 943 | dev_err(adapter->dev, |
941 | "to boot code.\n", __func__); | 944 | "%s: failed to write download command to boot code.\n", |
945 | __func__); | ||
942 | return -1; | 946 | return -1; |
943 | } | 947 | } |
944 | 948 | ||
945 | /* Write the command length to scratch register 2 */ | 949 | /* Write the command length to scratch register 2 */ |
946 | if (mwifiex_write_reg(adapter, PCIE_SCRATCH_2_REG, skb->len)) { | 950 | if (mwifiex_write_reg(adapter, PCIE_SCRATCH_2_REG, skb->len)) { |
947 | dev_err(adapter->dev, "%s: failed to write command length to " | 951 | dev_err(adapter->dev, |
948 | "scratch register 2\n", __func__); | 952 | "%s: failed to write command len to scratch reg 2\n", |
953 | __func__); | ||
949 | return -1; | 954 | return -1; |
950 | } | 955 | } |
951 | 956 | ||
952 | /* Ring the door bell */ | 957 | /* Ring the door bell */ |
953 | if (mwifiex_write_reg(adapter, PCIE_CPU_INT_EVENT, | 958 | if (mwifiex_write_reg(adapter, PCIE_CPU_INT_EVENT, |
954 | CPU_INTR_DOOR_BELL)) { | 959 | CPU_INTR_DOOR_BELL)) { |
955 | dev_err(adapter->dev, "%s: failed to assert door-bell " | 960 | dev_err(adapter->dev, |
956 | "interrupt.\n", __func__); | 961 | "%s: failed to assert door-bell intr\n", __func__); |
957 | return -1; | 962 | return -1; |
958 | } | 963 | } |
959 | 964 | ||
@@ -973,14 +978,14 @@ mwifiex_pcie_send_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb) | |||
973 | 978 | ||
974 | if (!(skb->data && skb->len)) { | 979 | if (!(skb->data && skb->len)) { |
975 | dev_err(adapter->dev, "Invalid parameter in %s <%p, %#x>\n", | 980 | dev_err(adapter->dev, "Invalid parameter in %s <%p, %#x>\n", |
976 | __func__, skb->data, skb->len); | 981 | __func__, skb->data, skb->len); |
977 | return -1; | 982 | return -1; |
978 | } | 983 | } |
979 | 984 | ||
980 | /* Make sure a command response buffer is available */ | 985 | /* Make sure a command response buffer is available */ |
981 | if (!card->cmdrsp_buf) { | 986 | if (!card->cmdrsp_buf) { |
982 | dev_err(adapter->dev, "No response buffer available, send " | 987 | dev_err(adapter->dev, |
983 | "command failed\n"); | 988 | "No response buffer available, send command failed\n"); |
984 | return -EBUSY; | 989 | return -EBUSY; |
985 | } | 990 | } |
986 | 991 | ||
@@ -1011,17 +1016,18 @@ mwifiex_pcie_send_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb) | |||
1011 | /* Write the lower 32bits of the cmdrsp buffer physical | 1016 | /* Write the lower 32bits of the cmdrsp buffer physical |
1012 | address */ | 1017 | address */ |
1013 | if (mwifiex_write_reg(adapter, REG_CMDRSP_ADDR_LO, | 1018 | if (mwifiex_write_reg(adapter, REG_CMDRSP_ADDR_LO, |
1014 | (u32)*cmdrsp_buf_pa)) { | 1019 | (u32)*cmdrsp_buf_pa)) { |
1015 | dev_err(adapter->dev, "Failed to write download command to boot code.\n"); | 1020 | dev_err(adapter->dev, |
1021 | "Failed to write download cmd to boot code.\n"); | ||
1016 | ret = -1; | 1022 | ret = -1; |
1017 | goto done; | 1023 | goto done; |
1018 | } | 1024 | } |
1019 | /* Write the upper 32bits of the cmdrsp buffer physical | 1025 | /* Write the upper 32bits of the cmdrsp buffer physical |
1020 | address */ | 1026 | address */ |
1021 | if (mwifiex_write_reg(adapter, REG_CMDRSP_ADDR_HI, | 1027 | if (mwifiex_write_reg(adapter, REG_CMDRSP_ADDR_HI, |
1022 | (u32)((u64)*cmdrsp_buf_pa >> 32))) { | 1028 | (u32)((u64)*cmdrsp_buf_pa >> 32))) { |
1023 | dev_err(adapter->dev, "Failed to write download command" | 1029 | dev_err(adapter->dev, |
1024 | " to boot code.\n"); | 1030 | "Failed to write download cmd to boot code.\n"); |
1025 | ret = -1; | 1031 | ret = -1; |
1026 | goto done; | 1032 | goto done; |
1027 | } | 1033 | } |
@@ -1029,27 +1035,25 @@ mwifiex_pcie_send_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb) | |||
1029 | 1035 | ||
1030 | cmd_buf_pa = MWIFIEX_SKB_PACB(card->cmd_buf); | 1036 | cmd_buf_pa = MWIFIEX_SKB_PACB(card->cmd_buf); |
1031 | /* Write the lower 32bits of the physical address to REG_CMD_ADDR_LO */ | 1037 | /* Write the lower 32bits of the physical address to REG_CMD_ADDR_LO */ |
1032 | if (mwifiex_write_reg(adapter, REG_CMD_ADDR_LO, | 1038 | if (mwifiex_write_reg(adapter, REG_CMD_ADDR_LO, (u32)*cmd_buf_pa)) { |
1033 | (u32)*cmd_buf_pa)) { | 1039 | dev_err(adapter->dev, |
1034 | dev_err(adapter->dev, "Failed to write download command " | 1040 | "Failed to write download cmd to boot code.\n"); |
1035 | "to boot code.\n"); | ||
1036 | ret = -1; | 1041 | ret = -1; |
1037 | goto done; | 1042 | goto done; |
1038 | } | 1043 | } |
1039 | /* Write the upper 32bits of the physical address to REG_CMD_ADDR_HI */ | 1044 | /* Write the upper 32bits of the physical address to REG_CMD_ADDR_HI */ |
1040 | if (mwifiex_write_reg(adapter, REG_CMD_ADDR_HI, | 1045 | if (mwifiex_write_reg(adapter, REG_CMD_ADDR_HI, |
1041 | (u32)((u64)*cmd_buf_pa >> 32))) { | 1046 | (u32)((u64)*cmd_buf_pa >> 32))) { |
1042 | dev_err(adapter->dev, "Failed to write download command " | 1047 | dev_err(adapter->dev, |
1043 | "to boot code.\n"); | 1048 | "Failed to write download cmd to boot code.\n"); |
1044 | ret = -1; | 1049 | ret = -1; |
1045 | goto done; | 1050 | goto done; |
1046 | } | 1051 | } |
1047 | 1052 | ||
1048 | /* Write the command length to REG_CMD_SIZE */ | 1053 | /* Write the command length to REG_CMD_SIZE */ |
1049 | if (mwifiex_write_reg(adapter, REG_CMD_SIZE, | 1054 | if (mwifiex_write_reg(adapter, REG_CMD_SIZE, card->cmd_buf->len)) { |
1050 | card->cmd_buf->len)) { | 1055 | dev_err(adapter->dev, |
1051 | dev_err(adapter->dev, "Failed to write command length to " | 1056 | "Failed to write cmd len to REG_CMD_SIZE\n"); |
1052 | "REG_CMD_SIZE\n"); | ||
1053 | ret = -1; | 1057 | ret = -1; |
1054 | goto done; | 1058 | goto done; |
1055 | } | 1059 | } |
@@ -1057,8 +1061,8 @@ mwifiex_pcie_send_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb) | |||
1057 | /* Ring the door bell */ | 1061 | /* Ring the door bell */ |
1058 | if (mwifiex_write_reg(adapter, PCIE_CPU_INT_EVENT, | 1062 | if (mwifiex_write_reg(adapter, PCIE_CPU_INT_EVENT, |
1059 | CPU_INTR_DOOR_BELL)) { | 1063 | CPU_INTR_DOOR_BELL)) { |
1060 | dev_err(adapter->dev, "Failed to assert door-bell " | 1064 | dev_err(adapter->dev, |
1061 | "interrupt.\n"); | 1065 | "Failed to assert door-bell intr\n"); |
1062 | ret = -1; | 1066 | ret = -1; |
1063 | goto done; | 1067 | goto done; |
1064 | } | 1068 | } |
@@ -1076,30 +1080,29 @@ done: | |||
1076 | static int mwifiex_pcie_process_cmd_complete(struct mwifiex_adapter *adapter) | 1080 | static int mwifiex_pcie_process_cmd_complete(struct mwifiex_adapter *adapter) |
1077 | { | 1081 | { |
1078 | struct pcie_service_card *card = adapter->card; | 1082 | struct pcie_service_card *card = adapter->card; |
1083 | struct sk_buff *skb = card->cmdrsp_buf; | ||
1079 | int count = 0; | 1084 | int count = 0; |
1080 | 1085 | ||
1081 | dev_dbg(adapter->dev, "info: Rx CMD Response\n"); | 1086 | dev_dbg(adapter->dev, "info: Rx CMD Response\n"); |
1082 | 1087 | ||
1083 | if (!adapter->curr_cmd) { | 1088 | if (!adapter->curr_cmd) { |
1084 | skb_pull(card->cmdrsp_buf, INTF_HEADER_LEN); | 1089 | skb_pull(skb, INTF_HEADER_LEN); |
1085 | if (adapter->ps_state == PS_STATE_SLEEP_CFM) { | 1090 | if (adapter->ps_state == PS_STATE_SLEEP_CFM) { |
1086 | mwifiex_process_sleep_confirm_resp(adapter, | 1091 | mwifiex_process_sleep_confirm_resp(adapter, skb->data, |
1087 | card->cmdrsp_buf->data, | 1092 | skb->len); |
1088 | card->cmdrsp_buf->len); | ||
1089 | while (mwifiex_pcie_ok_to_access_hw(adapter) && | 1093 | while (mwifiex_pcie_ok_to_access_hw(adapter) && |
1090 | (count++ < 10)) | 1094 | (count++ < 10)) |
1091 | usleep_range(50, 60); | 1095 | usleep_range(50, 60); |
1092 | } else { | 1096 | } else { |
1093 | dev_err(adapter->dev, "There is no command but " | 1097 | dev_err(adapter->dev, |
1094 | "got cmdrsp\n"); | 1098 | "There is no command but got cmdrsp\n"); |
1095 | } | 1099 | } |
1096 | memcpy(adapter->upld_buf, card->cmdrsp_buf->data, | 1100 | memcpy(adapter->upld_buf, skb->data, |
1097 | min_t(u32, MWIFIEX_SIZE_OF_CMD_BUFFER, | 1101 | min_t(u32, MWIFIEX_SIZE_OF_CMD_BUFFER, skb->len)); |
1098 | card->cmdrsp_buf->len)); | 1102 | skb_push(skb, INTF_HEADER_LEN); |
1099 | skb_push(card->cmdrsp_buf, INTF_HEADER_LEN); | ||
1100 | } else if (mwifiex_pcie_ok_to_access_hw(adapter)) { | 1103 | } else if (mwifiex_pcie_ok_to_access_hw(adapter)) { |
1101 | skb_pull(card->cmdrsp_buf, INTF_HEADER_LEN); | 1104 | skb_pull(skb, INTF_HEADER_LEN); |
1102 | adapter->curr_cmd->resp_skb = card->cmdrsp_buf; | 1105 | adapter->curr_cmd->resp_skb = skb; |
1103 | adapter->cmd_resp_received = true; | 1106 | adapter->cmd_resp_received = true; |
1104 | /* Take the pointer and set it to CMD node and will | 1107 | /* Take the pointer and set it to CMD node and will |
1105 | return in the response complete callback */ | 1108 | return in the response complete callback */ |
@@ -1109,15 +1112,15 @@ static int mwifiex_pcie_process_cmd_complete(struct mwifiex_adapter *adapter) | |||
1109 | will prevent firmware from writing to the same response | 1112 | will prevent firmware from writing to the same response |
1110 | buffer again. */ | 1113 | buffer again. */ |
1111 | if (mwifiex_write_reg(adapter, REG_CMDRSP_ADDR_LO, 0)) { | 1114 | if (mwifiex_write_reg(adapter, REG_CMDRSP_ADDR_LO, 0)) { |
1112 | dev_err(adapter->dev, "cmd_done: failed to clear " | 1115 | dev_err(adapter->dev, |
1113 | "cmd_rsp address.\n"); | 1116 | "cmd_done: failed to clear cmd_rsp_addr_lo\n"); |
1114 | return -1; | 1117 | return -1; |
1115 | } | 1118 | } |
1116 | /* Write the upper 32bits of the cmdrsp buffer physical | 1119 | /* Write the upper 32bits of the cmdrsp buffer physical |
1117 | address */ | 1120 | address */ |
1118 | if (mwifiex_write_reg(adapter, REG_CMDRSP_ADDR_HI, 0)) { | 1121 | if (mwifiex_write_reg(adapter, REG_CMDRSP_ADDR_HI, 0)) { |
1119 | dev_err(adapter->dev, "cmd_done: failed to clear " | 1122 | dev_err(adapter->dev, |
1120 | "cmd_rsp address.\n"); | 1123 | "cmd_done: failed to clear cmd_rsp_addr_hi\n"); |
1121 | return -1; | 1124 | return -1; |
1122 | } | 1125 | } |
1123 | } | 1126 | } |
@@ -1151,8 +1154,8 @@ static int mwifiex_pcie_process_event_ready(struct mwifiex_adapter *adapter) | |||
1151 | u32 wrptr, event; | 1154 | u32 wrptr, event; |
1152 | 1155 | ||
1153 | if (adapter->event_received) { | 1156 | if (adapter->event_received) { |
1154 | dev_dbg(adapter->dev, "info: Event being processed, "\ | 1157 | dev_dbg(adapter->dev, "info: Event being processed, " |
1155 | "do not process this interrupt just yet\n"); | 1158 | "do not process this interrupt just yet\n"); |
1156 | return 0; | 1159 | return 0; |
1157 | } | 1160 | } |
1158 | 1161 | ||
@@ -1163,14 +1166,15 @@ static int mwifiex_pcie_process_event_ready(struct mwifiex_adapter *adapter) | |||
1163 | 1166 | ||
1164 | /* Read the event ring write pointer set by firmware */ | 1167 | /* Read the event ring write pointer set by firmware */ |
1165 | if (mwifiex_read_reg(adapter, REG_EVTBD_WRPTR, &wrptr)) { | 1168 | if (mwifiex_read_reg(adapter, REG_EVTBD_WRPTR, &wrptr)) { |
1166 | dev_err(adapter->dev, "EventReady: failed to read REG_EVTBD_WRPTR\n"); | 1169 | dev_err(adapter->dev, |
1170 | "EventReady: failed to read REG_EVTBD_WRPTR\n"); | ||
1167 | return -1; | 1171 | return -1; |
1168 | } | 1172 | } |
1169 | 1173 | ||
1170 | dev_dbg(adapter->dev, "info: EventReady: Initial <Rd: 0x%x, Wr: 0x%x>", | 1174 | dev_dbg(adapter->dev, "info: EventReady: Initial <Rd: 0x%x, Wr: 0x%x>", |
1171 | card->evtbd_rdptr, wrptr); | 1175 | card->evtbd_rdptr, wrptr); |
1172 | if (((wrptr & MWIFIEX_EVTBD_MASK) != | 1176 | if (((wrptr & MWIFIEX_EVTBD_MASK) != (card->evtbd_rdptr |
1173 | (card->evtbd_rdptr & MWIFIEX_EVTBD_MASK)) || | 1177 | & MWIFIEX_EVTBD_MASK)) || |
1174 | ((wrptr & MWIFIEX_BD_FLAG_ROLLOVER_IND) == | 1178 | ((wrptr & MWIFIEX_BD_FLAG_ROLLOVER_IND) == |
1175 | (card->evtbd_rdptr & MWIFIEX_BD_FLAG_ROLLOVER_IND))) { | 1179 | (card->evtbd_rdptr & MWIFIEX_BD_FLAG_ROLLOVER_IND))) { |
1176 | struct sk_buff *skb_cmd; | 1180 | struct sk_buff *skb_cmd; |
@@ -1230,13 +1234,14 @@ static int mwifiex_pcie_event_complete(struct mwifiex_adapter *adapter, | |||
1230 | 1234 | ||
1231 | if (rdptr >= MWIFIEX_MAX_EVT_BD) { | 1235 | if (rdptr >= MWIFIEX_MAX_EVT_BD) { |
1232 | dev_err(adapter->dev, "event_complete: Invalid rdptr 0x%x\n", | 1236 | dev_err(adapter->dev, "event_complete: Invalid rdptr 0x%x\n", |
1233 | rdptr); | 1237 | rdptr); |
1234 | return -EINVAL; | 1238 | return -EINVAL; |
1235 | } | 1239 | } |
1236 | 1240 | ||
1237 | /* Read the event ring write pointer set by firmware */ | 1241 | /* Read the event ring write pointer set by firmware */ |
1238 | if (mwifiex_read_reg(adapter, REG_EVTBD_WRPTR, &wrptr)) { | 1242 | if (mwifiex_read_reg(adapter, REG_EVTBD_WRPTR, &wrptr)) { |
1239 | dev_err(adapter->dev, "event_complete: failed to read REG_EVTBD_WRPTR\n"); | 1243 | dev_err(adapter->dev, |
1244 | "event_complete: failed to read REG_EVTBD_WRPTR\n"); | ||
1240 | return -1; | 1245 | return -1; |
1241 | } | 1246 | } |
1242 | 1247 | ||
@@ -1249,9 +1254,9 @@ static int mwifiex_pcie_event_complete(struct mwifiex_adapter *adapter, | |||
1249 | card->evtbd_ring[rdptr]->flags = 0; | 1254 | card->evtbd_ring[rdptr]->flags = 0; |
1250 | skb = NULL; | 1255 | skb = NULL; |
1251 | } else { | 1256 | } else { |
1252 | dev_dbg(adapter->dev, "info: ERROR: Buffer is still valid at " | 1257 | dev_dbg(adapter->dev, |
1253 | "index %d, <%p, %p>\n", rdptr, | 1258 | "info: ERROR: buf still valid at index %d, <%p, %p>\n", |
1254 | card->evt_buf_list[rdptr], skb); | 1259 | rdptr, card->evt_buf_list[rdptr], skb); |
1255 | } | 1260 | } |
1256 | 1261 | ||
1257 | if ((++card->evtbd_rdptr & MWIFIEX_EVTBD_MASK) == MWIFIEX_MAX_EVT_BD) { | 1262 | if ((++card->evtbd_rdptr & MWIFIEX_EVTBD_MASK) == MWIFIEX_MAX_EVT_BD) { |
@@ -1261,11 +1266,12 @@ static int mwifiex_pcie_event_complete(struct mwifiex_adapter *adapter, | |||
1261 | } | 1266 | } |
1262 | 1267 | ||
1263 | dev_dbg(adapter->dev, "info: Updated <Rd: 0x%x, Wr: 0x%x>", | 1268 | dev_dbg(adapter->dev, "info: Updated <Rd: 0x%x, Wr: 0x%x>", |
1264 | card->evtbd_rdptr, wrptr); | 1269 | card->evtbd_rdptr, wrptr); |
1265 | 1270 | ||
1266 | /* Write the event ring read pointer in to REG_EVTBD_RDPTR */ | 1271 | /* Write the event ring read pointer in to REG_EVTBD_RDPTR */ |
1267 | if (mwifiex_write_reg(adapter, REG_EVTBD_RDPTR, card->evtbd_rdptr)) { | 1272 | if (mwifiex_write_reg(adapter, REG_EVTBD_RDPTR, card->evtbd_rdptr)) { |
1268 | dev_err(adapter->dev, "event_complete: failed to read REG_EVTBD_RDPTR\n"); | 1273 | dev_err(adapter->dev, |
1274 | "event_complete: failed to read REG_EVTBD_RDPTR\n"); | ||
1269 | return -1; | 1275 | return -1; |
1270 | } | 1276 | } |
1271 | 1277 | ||
@@ -1299,17 +1305,17 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, | |||
1299 | } | 1305 | } |
1300 | 1306 | ||
1301 | if (!firmware || !firmware_len) { | 1307 | if (!firmware || !firmware_len) { |
1302 | dev_err(adapter->dev, "No firmware image found! " | 1308 | dev_err(adapter->dev, |
1303 | "Terminating download\n"); | 1309 | "No firmware image found! Terminating download\n"); |
1304 | return -1; | 1310 | return -1; |
1305 | } | 1311 | } |
1306 | 1312 | ||
1307 | dev_dbg(adapter->dev, "info: Downloading FW image (%d bytes)\n", | 1313 | dev_dbg(adapter->dev, "info: Downloading FW image (%d bytes)\n", |
1308 | firmware_len); | 1314 | firmware_len); |
1309 | 1315 | ||
1310 | if (mwifiex_pcie_disable_host_int(adapter)) { | 1316 | if (mwifiex_pcie_disable_host_int(adapter)) { |
1311 | dev_err(adapter->dev, "%s: Disabling interrupts" | 1317 | dev_err(adapter->dev, |
1312 | " failed.\n", __func__); | 1318 | "%s: Disabling interrupts failed.\n", __func__); |
1313 | return -1; | 1319 | return -1; |
1314 | } | 1320 | } |
1315 | 1321 | ||
@@ -1332,7 +1338,8 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, | |||
1332 | ret = mwifiex_read_reg(adapter, PCIE_SCRATCH_2_REG, | 1338 | ret = mwifiex_read_reg(adapter, PCIE_SCRATCH_2_REG, |
1333 | &len); | 1339 | &len); |
1334 | if (ret) { | 1340 | if (ret) { |
1335 | dev_warn(adapter->dev, "Failed reading length from boot code\n"); | 1341 | dev_warn(adapter->dev, |
1342 | "Failed reading len from boot code\n"); | ||
1336 | goto done; | 1343 | goto done; |
1337 | } | 1344 | } |
1338 | if (len) | 1345 | if (len) |
@@ -1344,7 +1351,7 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, | |||
1344 | break; | 1351 | break; |
1345 | } else if (len > MWIFIEX_UPLD_SIZE) { | 1352 | } else if (len > MWIFIEX_UPLD_SIZE) { |
1346 | pr_err("FW download failure @ %d, invalid length %d\n", | 1353 | pr_err("FW download failure @ %d, invalid length %d\n", |
1347 | offset, len); | 1354 | offset, len); |
1348 | ret = -1; | 1355 | ret = -1; |
1349 | goto done; | 1356 | goto done; |
1350 | } | 1357 | } |
@@ -1360,8 +1367,8 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, | |||
1360 | goto done; | 1367 | goto done; |
1361 | } | 1368 | } |
1362 | dev_err(adapter->dev, "FW CRC error indicated by the " | 1369 | dev_err(adapter->dev, "FW CRC error indicated by the " |
1363 | "helper: len = 0x%04X, txlen = " | 1370 | "helper: len = 0x%04X, txlen = %d\n", |
1364 | "%d\n", len, txlen); | 1371 | len, txlen); |
1365 | len &= ~BIT(0); | 1372 | len &= ~BIT(0); |
1366 | /* Setting this to 0 to resend from same offset */ | 1373 | /* Setting this to 0 to resend from same offset */ |
1367 | txlen = 0; | 1374 | txlen = 0; |
@@ -1374,9 +1381,9 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, | |||
1374 | 1381 | ||
1375 | dev_dbg(adapter->dev, "."); | 1382 | dev_dbg(adapter->dev, "."); |
1376 | 1383 | ||
1377 | tx_blocks = | 1384 | tx_blocks = (txlen + |
1378 | (txlen + MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD - 1) / | 1385 | MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD - 1) / |
1379 | MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD; | 1386 | MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD; |
1380 | 1387 | ||
1381 | /* Copy payload to buffer */ | 1388 | /* Copy payload to buffer */ |
1382 | memmove(skb->data, &firmware[offset], txlen); | 1389 | memmove(skb->data, &firmware[offset], txlen); |
@@ -1387,7 +1394,8 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, | |||
1387 | 1394 | ||
1388 | /* Send the boot command to device */ | 1395 | /* Send the boot command to device */ |
1389 | if (mwifiex_pcie_send_boot_cmd(adapter, skb)) { | 1396 | if (mwifiex_pcie_send_boot_cmd(adapter, skb)) { |
1390 | dev_err(adapter->dev, "Failed to send firmware download command\n"); | 1397 | dev_err(adapter->dev, |
1398 | "Failed to send firmware download command\n"); | ||
1391 | ret = -1; | 1399 | ret = -1; |
1392 | goto done; | 1400 | goto done; |
1393 | } | 1401 | } |
@@ -1396,8 +1404,8 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, | |||
1396 | if (mwifiex_read_reg(adapter, PCIE_CPU_INT_STATUS, | 1404 | if (mwifiex_read_reg(adapter, PCIE_CPU_INT_STATUS, |
1397 | &ireg_intr)) { | 1405 | &ireg_intr)) { |
1398 | dev_err(adapter->dev, "%s: Failed to read " | 1406 | dev_err(adapter->dev, "%s: Failed to read " |
1399 | "interrupt status during " | 1407 | "interrupt status during fw dnld.\n", |
1400 | "fw dnld.\n", __func__); | 1408 | __func__); |
1401 | ret = -1; | 1409 | ret = -1; |
1402 | goto done; | 1410 | goto done; |
1403 | } | 1411 | } |
@@ -1407,7 +1415,7 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, | |||
1407 | } while (true); | 1415 | } while (true); |
1408 | 1416 | ||
1409 | dev_dbg(adapter->dev, "info:\nFW download over, size %d bytes\n", | 1417 | dev_dbg(adapter->dev, "info:\nFW download over, size %d bytes\n", |
1410 | offset); | 1418 | offset); |
1411 | 1419 | ||
1412 | ret = 0; | 1420 | ret = 0; |
1413 | 1421 | ||
@@ -1430,14 +1438,15 @@ mwifiex_check_fw_status(struct mwifiex_adapter *adapter, u32 poll_num) | |||
1430 | 1438 | ||
1431 | /* Mask spurios interrupts */ | 1439 | /* Mask spurios interrupts */ |
1432 | if (mwifiex_write_reg(adapter, PCIE_HOST_INT_STATUS_MASK, | 1440 | if (mwifiex_write_reg(adapter, PCIE_HOST_INT_STATUS_MASK, |
1433 | HOST_INTR_MASK)) { | 1441 | HOST_INTR_MASK)) { |
1434 | dev_warn(adapter->dev, "Write register failed\n"); | 1442 | dev_warn(adapter->dev, "Write register failed\n"); |
1435 | return -1; | 1443 | return -1; |
1436 | } | 1444 | } |
1437 | 1445 | ||
1438 | dev_dbg(adapter->dev, "Setting driver ready signature\n"); | 1446 | dev_dbg(adapter->dev, "Setting driver ready signature\n"); |
1439 | if (mwifiex_write_reg(adapter, REG_DRV_READY, FIRMWARE_READY_PCIE)) { | 1447 | if (mwifiex_write_reg(adapter, REG_DRV_READY, FIRMWARE_READY_PCIE)) { |
1440 | dev_err(adapter->dev, "Failed to write driver ready signature\n"); | 1448 | dev_err(adapter->dev, |
1449 | "Failed to write driver ready signature\n"); | ||
1441 | return -1; | 1450 | return -1; |
1442 | } | 1451 | } |
1443 | 1452 | ||
@@ -1468,8 +1477,9 @@ mwifiex_check_fw_status(struct mwifiex_adapter *adapter, u32 poll_num) | |||
1468 | adapter->winner = 1; | 1477 | adapter->winner = 1; |
1469 | ret = -1; | 1478 | ret = -1; |
1470 | } else { | 1479 | } else { |
1471 | dev_err(adapter->dev, "PCI-E is not the winner <%#x, %d>, exit download\n", | 1480 | dev_err(adapter->dev, |
1472 | ret, adapter->winner); | 1481 | "PCI-E is not the winner <%#x,%d>, exit dnld\n", |
1482 | ret, adapter->winner); | ||
1473 | ret = 0; | 1483 | ret = 0; |
1474 | } | 1484 | } |
1475 | } | 1485 | } |
@@ -1512,10 +1522,11 @@ static void mwifiex_interrupt_status(struct mwifiex_adapter *adapter) | |||
1512 | (adapter->ps_state == PS_STATE_SLEEP)) { | 1522 | (adapter->ps_state == PS_STATE_SLEEP)) { |
1513 | mwifiex_pcie_enable_host_int(adapter); | 1523 | mwifiex_pcie_enable_host_int(adapter); |
1514 | if (mwifiex_write_reg(adapter, | 1524 | if (mwifiex_write_reg(adapter, |
1515 | PCIE_CPU_INT_EVENT, | 1525 | PCIE_CPU_INT_EVENT, |
1516 | CPU_INTR_SLEEP_CFM_DONE)) { | 1526 | CPU_INTR_SLEEP_CFM_DONE) |
1517 | dev_warn(adapter->dev, "Write register" | 1527 | ) { |
1518 | " failed\n"); | 1528 | dev_warn(adapter->dev, |
1529 | "Write register failed\n"); | ||
1519 | return; | 1530 | return; |
1520 | 1531 | ||
1521 | } | 1532 | } |
@@ -1551,7 +1562,7 @@ static irqreturn_t mwifiex_pcie_interrupt(int irq, void *context) | |||
1551 | card = (struct pcie_service_card *) pci_get_drvdata(pdev); | 1562 | card = (struct pcie_service_card *) pci_get_drvdata(pdev); |
1552 | if (!card || !card->adapter) { | 1563 | if (!card || !card->adapter) { |
1553 | pr_debug("info: %s: card=%p adapter=%p\n", __func__, card, | 1564 | pr_debug("info: %s: card=%p adapter=%p\n", __func__, card, |
1554 | card ? card->adapter : NULL); | 1565 | card ? card->adapter : NULL); |
1555 | goto exit; | 1566 | goto exit; |
1556 | } | 1567 | } |
1557 | adapter = card->adapter; | 1568 | adapter = card->adapter; |
@@ -1594,7 +1605,7 @@ static int mwifiex_process_int_status(struct mwifiex_adapter *adapter) | |||
1594 | if (adapter->int_status & HOST_INTR_DNLD_DONE) { | 1605 | if (adapter->int_status & HOST_INTR_DNLD_DONE) { |
1595 | adapter->int_status &= ~HOST_INTR_DNLD_DONE; | 1606 | adapter->int_status &= ~HOST_INTR_DNLD_DONE; |
1596 | if (adapter->data_sent) { | 1607 | if (adapter->data_sent) { |
1597 | dev_dbg(adapter->dev, "info: DATA sent Interrupt\n"); | 1608 | dev_dbg(adapter->dev, "info: DATA sent intr\n"); |
1598 | adapter->data_sent = false; | 1609 | adapter->data_sent = false; |
1599 | } | 1610 | } |
1600 | } | 1611 | } |
@@ -1616,7 +1627,8 @@ static int mwifiex_process_int_status(struct mwifiex_adapter *adapter) | |||
1616 | if (adapter->int_status & HOST_INTR_CMD_DONE) { | 1627 | if (adapter->int_status & HOST_INTR_CMD_DONE) { |
1617 | adapter->int_status &= ~HOST_INTR_CMD_DONE; | 1628 | adapter->int_status &= ~HOST_INTR_CMD_DONE; |
1618 | if (adapter->cmd_sent) { | 1629 | if (adapter->cmd_sent) { |
1619 | dev_dbg(adapter->dev, "info: CMD sent Interrupt\n"); | 1630 | dev_dbg(adapter->dev, |
1631 | "info: CMD sent Interrupt\n"); | ||
1620 | adapter->cmd_sent = false; | 1632 | adapter->cmd_sent = false; |
1621 | } | 1633 | } |
1622 | /* Handle command response */ | 1634 | /* Handle command response */ |
@@ -1628,15 +1640,17 @@ static int mwifiex_process_int_status(struct mwifiex_adapter *adapter) | |||
1628 | if (mwifiex_pcie_ok_to_access_hw(adapter)) { | 1640 | if (mwifiex_pcie_ok_to_access_hw(adapter)) { |
1629 | if (mwifiex_read_reg(adapter, PCIE_HOST_INT_STATUS, | 1641 | if (mwifiex_read_reg(adapter, PCIE_HOST_INT_STATUS, |
1630 | &pcie_ireg)) { | 1642 | &pcie_ireg)) { |
1631 | dev_warn(adapter->dev, "Read register failed\n"); | 1643 | dev_warn(adapter->dev, |
1644 | "Read register failed\n"); | ||
1632 | return -1; | 1645 | return -1; |
1633 | } | 1646 | } |
1634 | 1647 | ||
1635 | if ((pcie_ireg != 0xFFFFFFFF) && (pcie_ireg)) { | 1648 | if ((pcie_ireg != 0xFFFFFFFF) && (pcie_ireg)) { |
1636 | if (mwifiex_write_reg(adapter, | 1649 | if (mwifiex_write_reg(adapter, |
1637 | PCIE_HOST_INT_STATUS, ~pcie_ireg)) { | 1650 | PCIE_HOST_INT_STATUS, |
1638 | dev_warn(adapter->dev, "Write register" | 1651 | ~pcie_ireg)) { |
1639 | " failed\n"); | 1652 | dev_warn(adapter->dev, |
1653 | "Write register failed\n"); | ||
1640 | return -1; | 1654 | return -1; |
1641 | } | 1655 | } |
1642 | adapter->int_status |= pcie_ireg; | 1656 | adapter->int_status |= pcie_ireg; |
@@ -1646,7 +1660,7 @@ static int mwifiex_process_int_status(struct mwifiex_adapter *adapter) | |||
1646 | } | 1660 | } |
1647 | } | 1661 | } |
1648 | dev_dbg(adapter->dev, "info: cmd_sent=%d data_sent=%d\n", | 1662 | dev_dbg(adapter->dev, "info: cmd_sent=%d data_sent=%d\n", |
1649 | adapter->cmd_sent, adapter->data_sent); | 1663 | adapter->cmd_sent, adapter->data_sent); |
1650 | mwifiex_pcie_enable_host_int(adapter); | 1664 | mwifiex_pcie_enable_host_int(adapter); |
1651 | 1665 | ||
1652 | return 0; | 1666 | return 0; |
@@ -1737,8 +1751,9 @@ static int mwifiex_pcie_init(struct mwifiex_adapter *adapter) | |||
1737 | goto err_iomap2; | 1751 | goto err_iomap2; |
1738 | } | 1752 | } |
1739 | 1753 | ||
1740 | dev_dbg(adapter->dev, "PCI memory map Virt0: %p PCI memory map Virt2: " | 1754 | dev_dbg(adapter->dev, |
1741 | "%p\n", card->pci_mmap, card->pci_mmap1); | 1755 | "PCI memory map Virt0: %p PCI memory map Virt2: %p\n", |
1756 | card->pci_mmap, card->pci_mmap1); | ||
1742 | 1757 | ||
1743 | card->cmdrsp_buf = NULL; | 1758 | card->cmdrsp_buf = NULL; |
1744 | ret = mwifiex_pcie_create_txbd_ring(adapter); | 1759 | ret = mwifiex_pcie_create_txbd_ring(adapter); |
@@ -1808,7 +1823,8 @@ static void mwifiex_pcie_cleanup(struct mwifiex_adapter *adapter) | |||
1808 | dev_dbg(adapter->dev, "Clearing driver ready signature\n"); | 1823 | dev_dbg(adapter->dev, "Clearing driver ready signature\n"); |
1809 | if (user_rmmod) { | 1824 | if (user_rmmod) { |
1810 | if (mwifiex_write_reg(adapter, REG_DRV_READY, 0x00000000)) | 1825 | if (mwifiex_write_reg(adapter, REG_DRV_READY, 0x00000000)) |
1811 | dev_err(adapter->dev, "Failed to write driver not-ready signature\n"); | 1826 | dev_err(adapter->dev, |
1827 | "Failed to write driver not-ready signature\n"); | ||
1812 | } | 1828 | } |
1813 | 1829 | ||
1814 | if (pdev) { | 1830 | if (pdev) { |