Commit f57c1edc authored by Yogesh Ashok Powar's avatar Yogesh Ashok Powar Committed by John W. Linville

mwifiex: fix checkpatch --strict warnings/errors Part 4

For files main.c, main.h and pcie.c
Signed-off-by: default avatarYogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 931f1584
...@@ -64,11 +64,10 @@ static int mwifiex_register(void *card, struct mwifiex_if_ops *if_ops, ...@@ -64,11 +64,10 @@ static int mwifiex_register(void *card, struct mwifiex_if_ops *if_ops,
adapter->priv_num = 0; adapter->priv_num = 0;
/* Allocate memory for private structure */ /* Allocate memory for private structure */
adapter->priv[0] = kzalloc(sizeof(struct mwifiex_private), adapter->priv[0] = kzalloc(sizeof(struct mwifiex_private), GFP_KERNEL);
GFP_KERNEL);
if (!adapter->priv[0]) { if (!adapter->priv[0]) {
dev_err(adapter->dev, "%s: failed to alloc priv[0]\n", dev_err(adapter->dev,
__func__); "%s: failed to alloc priv[0]\n", __func__);
goto error; goto error;
} }
...@@ -169,8 +168,8 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter) ...@@ -169,8 +168,8 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter)
if ((adapter->ps_state == PS_STATE_SLEEP) && if ((adapter->ps_state == PS_STATE_SLEEP) &&
(adapter->pm_wakeup_card_req && (adapter->pm_wakeup_card_req &&
!adapter->pm_wakeup_fw_try) && !adapter->pm_wakeup_fw_try) &&
(is_command_pending(adapter) (is_command_pending(adapter) ||
|| !mwifiex_wmm_lists_empty(adapter))) { !mwifiex_wmm_lists_empty(adapter))) {
adapter->pm_wakeup_fw_try = true; adapter->pm_wakeup_fw_try = true;
adapter->if_ops.wakeup(adapter); adapter->if_ops.wakeup(adapter);
continue; continue;
...@@ -187,10 +186,10 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter) ...@@ -187,10 +186,10 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter)
adapter->tx_lock_flag) adapter->tx_lock_flag)
break; break;
if (adapter->scan_processing || adapter->data_sent if (adapter->scan_processing || adapter->data_sent ||
|| mwifiex_wmm_lists_empty(adapter)) { mwifiex_wmm_lists_empty(adapter)) {
if (adapter->cmd_sent || adapter->curr_cmd if (adapter->cmd_sent || adapter->curr_cmd ||
|| (!is_command_pending(adapter))) (!is_command_pending(adapter)))
break; break;
} }
} }
...@@ -223,10 +222,10 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter) ...@@ -223,10 +222,10 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter)
/* * The ps_state may have been changed during processing of /* * The ps_state may have been changed during processing of
* Sleep Request event. * Sleep Request event.
*/ */
if ((adapter->ps_state == PS_STATE_SLEEP) if ((adapter->ps_state == PS_STATE_SLEEP) ||
|| (adapter->ps_state == PS_STATE_PRE_SLEEP) (adapter->ps_state == PS_STATE_PRE_SLEEP) ||
|| (adapter->ps_state == PS_STATE_SLEEP_CFM) (adapter->ps_state == PS_STATE_SLEEP_CFM) ||
|| adapter->tx_lock_flag) adapter->tx_lock_flag)
continue; continue;
if (!adapter->cmd_sent && !adapter->curr_cmd) { if (!adapter->cmd_sent && !adapter->curr_cmd) {
...@@ -249,8 +248,8 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter) ...@@ -249,8 +248,8 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter)
} }
if (adapter->delay_null_pkt && !adapter->cmd_sent && if (adapter->delay_null_pkt && !adapter->cmd_sent &&
!adapter->curr_cmd && !is_command_pending(adapter) !adapter->curr_cmd && !is_command_pending(adapter) &&
&& mwifiex_wmm_lists_empty(adapter)) { mwifiex_wmm_lists_empty(adapter)) {
if (!mwifiex_send_null_packet if (!mwifiex_send_null_packet
(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA), (mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA),
MWIFIEX_TxPD_POWER_MGMT_NULL_PACKET | MWIFIEX_TxPD_POWER_MGMT_NULL_PACKET |
...@@ -494,8 +493,8 @@ mwifiex_set_mac_address(struct net_device *dev, void *addr) ...@@ -494,8 +493,8 @@ mwifiex_set_mac_address(struct net_device *dev, void *addr)
if (!ret) if (!ret)
memcpy(priv->netdev->dev_addr, priv->curr_addr, ETH_ALEN); memcpy(priv->netdev->dev_addr, priv->curr_addr, ETH_ALEN);
else else
dev_err(priv->adapter->dev, "set mac address failed: ret=%d" dev_err(priv->adapter->dev,
"\n", ret); "set mac address failed: ret=%d\n", ret);
memcpy(dev->dev_addr, priv->curr_addr, ETH_ALEN); memcpy(dev->dev_addr, priv->curr_addr, ETH_ALEN);
......
...@@ -841,8 +841,8 @@ mwifiex_get_priv_by_id(struct mwifiex_adapter *adapter, ...@@ -841,8 +841,8 @@ mwifiex_get_priv_by_id(struct mwifiex_adapter *adapter,
for (i = 0; i < adapter->priv_num; i++) { for (i = 0; i < adapter->priv_num; i++) {
if (adapter->priv[i]) { if (adapter->priv[i]) {
if ((adapter->priv[i]->bss_num == bss_num) if ((adapter->priv[i]->bss_num == bss_num) &&
&& (adapter->priv[i]->bss_type == bss_type)) (adapter->priv[i]->bss_type == bss_type))
break; break;
} }
} }
......
...@@ -110,6 +110,7 @@ static void mwifiex_pcie_remove(struct pci_dev *pdev) ...@@ -110,6 +110,7 @@ static void mwifiex_pcie_remove(struct pci_dev *pdev)
{ {
struct pcie_service_card *card; struct pcie_service_card *card;
struct mwifiex_adapter *adapter; struct mwifiex_adapter *adapter;
struct mwifiex_private *priv;
int i; int i;
card = pci_get_drvdata(pdev); card = pci_get_drvdata(pdev);
...@@ -132,12 +133,11 @@ static void mwifiex_pcie_remove(struct pci_dev *pdev) ...@@ -132,12 +133,11 @@ static void mwifiex_pcie_remove(struct pci_dev *pdev)
adapter->priv[i]->media_connected) adapter->priv[i]->media_connected)
mwifiex_deauthenticate(adapter->priv[i], NULL); mwifiex_deauthenticate(adapter->priv[i], NULL);
mwifiex_disable_auto_ds(mwifiex_get_priv(adapter, priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
MWIFIEX_BSS_ROLE_ANY));
mwifiex_init_shutdown_fw(mwifiex_get_priv(adapter, mwifiex_disable_auto_ds(priv);
MWIFIEX_BSS_ROLE_ANY),
MWIFIEX_FUNC_SHUTDOWN); mwifiex_init_shutdown_fw(priv, MWIFIEX_FUNC_SHUTDOWN);
} }
mwifiex_remove_card(card->adapter, &add_remove_card_sem); mwifiex_remove_card(card->adapter, &add_remove_card_sem);
...@@ -385,21 +385,21 @@ static int mwifiex_pcie_create_txbd_ring(struct mwifiex_adapter *adapter) ...@@ -385,21 +385,21 @@ static int mwifiex_pcie_create_txbd_ring(struct mwifiex_adapter *adapter)
card->txbd_ring_size); card->txbd_ring_size);
card->txbd_ring_vbase = kzalloc(card->txbd_ring_size, GFP_KERNEL); card->txbd_ring_vbase = kzalloc(card->txbd_ring_size, GFP_KERNEL);
if (!card->txbd_ring_vbase) { if (!card->txbd_ring_vbase) {
dev_err(adapter->dev, "Unable to allocate buffer for txbd ring.\n"); dev_err(adapter->dev, "Unable to alloc buffer for txbd ring\n");
return -ENOMEM; return -ENOMEM;
} }
card->txbd_ring_pbase = virt_to_phys(card->txbd_ring_vbase); card->txbd_ring_pbase = virt_to_phys(card->txbd_ring_vbase);
dev_dbg(adapter->dev, "info: txbd_ring - base: %p, pbase: %#x:%x," dev_dbg(adapter->dev,
"len: %x\n", card->txbd_ring_vbase, "info: txbd_ring - base: %p, pbase: %#x:%x, len: %x\n",
(u32)card->txbd_ring_pbase, card->txbd_ring_vbase, (u32)card->txbd_ring_pbase,
(u32)((u64)card->txbd_ring_pbase >> 32), (u32)((u64)card->txbd_ring_pbase >> 32), card->txbd_ring_size);
card->txbd_ring_size);
for (i = 0; i < MWIFIEX_MAX_TXRX_BD; i++) { for (i = 0; i < MWIFIEX_MAX_TXRX_BD; i++) {
card->txbd_ring[i] = (struct mwifiex_pcie_buf_desc *) card->txbd_ring[i] = (struct mwifiex_pcie_buf_desc *)
(card->txbd_ring_vbase + (card->txbd_ring_vbase +
(sizeof(struct mwifiex_pcie_buf_desc) * i)); (sizeof(struct mwifiex_pcie_buf_desc)
* i));
/* Allocate buffer here so that firmware can DMA data from it */ /* Allocate buffer here so that firmware can DMA data from it */
skb = dev_alloc_skb(MWIFIEX_RX_DATA_BUF_SIZE); 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,10 +412,9 @@ static int mwifiex_pcie_create_txbd_ring(struct mwifiex_adapter *adapter)
skb_put(skb, MWIFIEX_RX_DATA_BUF_SIZE); skb_put(skb, MWIFIEX_RX_DATA_BUF_SIZE);
dev_dbg(adapter->dev, "info: TX ring: add new skb base: %p, " dev_dbg(adapter->dev, "info: TX ring: add new skb base: %p, "
"buf_base: %p, buf_pbase: %#x:%x, " "buf_base: %p, buf_pbase: %#x:%x, buf_len: %#x\n",
"buf_len: %#x\n", skb, skb->data, skb, skb->data, (u32)*buf_pa,
(u32)*buf_pa, (u32)(((u64)*buf_pa >> 32)), (u32)(((u64)*buf_pa >> 32)), skb->len);
skb->len);
card->tx_buf_list[i] = skb; card->tx_buf_list[i] = skb;
card->txbd_ring[i]->paddr = *buf_pa; card->txbd_ring[i]->paddr = *buf_pa;
...@@ -480,21 +479,23 @@ static int mwifiex_pcie_create_rxbd_ring(struct mwifiex_adapter *adapter) ...@@ -480,21 +479,23 @@ static int mwifiex_pcie_create_rxbd_ring(struct mwifiex_adapter *adapter)
} }
card->rxbd_ring_pbase = virt_to_phys(card->rxbd_ring_vbase); card->rxbd_ring_pbase = virt_to_phys(card->rxbd_ring_vbase);
dev_dbg(adapter->dev, "info: rxbd_ring - base: %p, pbase: %#x:%x," dev_dbg(adapter->dev,
"len: %#x\n", card->rxbd_ring_vbase, "info: rxbd_ring - base: %p, pbase: %#x:%x, len: %#x\n",
(u32)card->rxbd_ring_pbase, card->rxbd_ring_vbase, (u32)card->rxbd_ring_pbase,
(u32)((u64)card->rxbd_ring_pbase >> 32), (u32)((u64)card->rxbd_ring_pbase >> 32),
card->rxbd_ring_size); card->rxbd_ring_size);
for (i = 0; i < MWIFIEX_MAX_TXRX_BD; i++) { for (i = 0; i < MWIFIEX_MAX_TXRX_BD; i++) {
card->rxbd_ring[i] = (struct mwifiex_pcie_buf_desc *) card->rxbd_ring[i] = (struct mwifiex_pcie_buf_desc *)
(card->rxbd_ring_vbase + (card->rxbd_ring_vbase +
(sizeof(struct mwifiex_pcie_buf_desc) * i)); (sizeof(struct mwifiex_pcie_buf_desc)
* i));
/* Allocate skb here so that firmware can DMA data from it */ /* Allocate skb here so that firmware can DMA data from it */
skb = dev_alloc_skb(MWIFIEX_RX_DATA_BUF_SIZE); skb = dev_alloc_skb(MWIFIEX_RX_DATA_BUF_SIZE);
if (!skb) { if (!skb) {
dev_err(adapter->dev, "Unable to allocate skb for RX ring.\n"); dev_err(adapter->dev,
"Unable to allocate skb for RX ring.\n");
kfree(card->rxbd_ring_vbase); kfree(card->rxbd_ring_vbase);
return -ENOMEM; return -ENOMEM;
} }
...@@ -502,9 +503,8 @@ static int mwifiex_pcie_create_rxbd_ring(struct mwifiex_adapter *adapter) ...@@ -502,9 +503,8 @@ static int mwifiex_pcie_create_rxbd_ring(struct mwifiex_adapter *adapter)
skb_put(skb, MWIFIEX_RX_DATA_BUF_SIZE); skb_put(skb, MWIFIEX_RX_DATA_BUF_SIZE);
dev_dbg(adapter->dev, "info: RX ring: add new skb base: %p, " dev_dbg(adapter->dev, "info: RX ring: add new skb base: %p, "
"buf_base: %p, buf_pbase: %#x:%x, " "buf_base: %p, buf_pbase: %#x:%x, buf_len: %#x\n",
"buf_len: %#x\n", skb, skb->data, skb, skb->data, (u32)*buf_pa, (u32)((u64)*buf_pa >> 32),
(u32)*buf_pa, (u32)((u64)*buf_pa >> 32),
skb->len); skb->len);
card->rx_buf_list[i] = skb; card->rx_buf_list[i] = skb;
...@@ -567,27 +567,29 @@ static int mwifiex_pcie_create_evtbd_ring(struct mwifiex_adapter *adapter) ...@@ -567,27 +567,29 @@ static int mwifiex_pcie_create_evtbd_ring(struct mwifiex_adapter *adapter)
card->evtbd_ring_size); card->evtbd_ring_size);
card->evtbd_ring_vbase = kzalloc(card->evtbd_ring_size, GFP_KERNEL); card->evtbd_ring_vbase = kzalloc(card->evtbd_ring_size, GFP_KERNEL);
if (!card->evtbd_ring_vbase) { if (!card->evtbd_ring_vbase) {
dev_err(adapter->dev, "Unable to allocate buffer. " dev_err(adapter->dev,
"Terminating download\n"); "Unable to allocate buffer. Terminating download\n");
return -ENOMEM; return -ENOMEM;
} }
card->evtbd_ring_pbase = virt_to_phys(card->evtbd_ring_vbase); card->evtbd_ring_pbase = virt_to_phys(card->evtbd_ring_vbase);
dev_dbg(adapter->dev, "info: CMDRSP/EVT bd_ring - base: %p, " dev_dbg(adapter->dev,
"pbase: %#x:%x, len: %#x\n", card->evtbd_ring_vbase, "info: CMDRSP/EVT bd_ring - base: %p pbase: %#x:%x len: %#x\n",
(u32)card->evtbd_ring_pbase, card->evtbd_ring_vbase, (u32)card->evtbd_ring_pbase,
(u32)((u64)card->evtbd_ring_pbase >> 32), (u32)((u64)card->evtbd_ring_pbase >> 32),
card->evtbd_ring_size); card->evtbd_ring_size);
for (i = 0; i < MWIFIEX_MAX_EVT_BD; i++) { for (i = 0; i < MWIFIEX_MAX_EVT_BD; i++) {
card->evtbd_ring[i] = (struct mwifiex_pcie_buf_desc *) card->evtbd_ring[i] = (struct mwifiex_pcie_buf_desc *)
(card->evtbd_ring_vbase + (card->evtbd_ring_vbase +
(sizeof(struct mwifiex_pcie_buf_desc) * i)); (sizeof(struct mwifiex_pcie_buf_desc)
* i));
/* Allocate skb here so that firmware can DMA data from it */ /* Allocate skb here so that firmware can DMA data from it */
skb = dev_alloc_skb(MAX_EVENT_SIZE); skb = dev_alloc_skb(MAX_EVENT_SIZE);
if (!skb) { if (!skb) {
dev_err(adapter->dev, "Unable to allocate skb for EVENT buf.\n"); dev_err(adapter->dev,
"Unable to allocate skb for EVENT buf.\n");
kfree(card->evtbd_ring_vbase); kfree(card->evtbd_ring_vbase);
return -ENOMEM; return -ENOMEM;
} }
...@@ -595,9 +597,8 @@ static int mwifiex_pcie_create_evtbd_ring(struct mwifiex_adapter *adapter) ...@@ -595,9 +597,8 @@ static int mwifiex_pcie_create_evtbd_ring(struct mwifiex_adapter *adapter)
skb_put(skb, MAX_EVENT_SIZE); skb_put(skb, MAX_EVENT_SIZE);
dev_dbg(adapter->dev, "info: Evt ring: add new skb. base: %p, " dev_dbg(adapter->dev, "info: Evt ring: add new skb. base: %p, "
"buf_base: %p, buf_pbase: %#x:%x, " "buf_base: %p, buf_pbase: %#x:%x, buf_len: %#x\n",
"buf_len: %#x\n", skb, skb->data, skb, skb->data, (u32)*buf_pa, (u32)((u64)*buf_pa >> 32),
(u32)*buf_pa, (u32)((u64)*buf_pa >> 32),
skb->len); skb->len);
card->evt_buf_list[i] = skb; card->evt_buf_list[i] = skb;
...@@ -647,8 +648,8 @@ static int mwifiex_pcie_alloc_cmdrsp_buf(struct mwifiex_adapter *adapter) ...@@ -647,8 +648,8 @@ static int mwifiex_pcie_alloc_cmdrsp_buf(struct mwifiex_adapter *adapter)
/* Allocate memory for receiving command response data */ /* Allocate memory for receiving command response data */
skb = dev_alloc_skb(MWIFIEX_UPLD_SIZE); skb = dev_alloc_skb(MWIFIEX_UPLD_SIZE);
if (!skb) { if (!skb) {
dev_err(adapter->dev, "Unable to allocate skb for command " dev_err(adapter->dev,
"response data.\n"); "Unable to allocate skb for command response data.\n");
return -ENOMEM; return -ENOMEM;
} }
mwifiex_update_sk_buff_pa(skb); mwifiex_update_sk_buff_pa(skb);
...@@ -659,8 +660,8 @@ static int mwifiex_pcie_alloc_cmdrsp_buf(struct mwifiex_adapter *adapter) ...@@ -659,8 +660,8 @@ static int mwifiex_pcie_alloc_cmdrsp_buf(struct mwifiex_adapter *adapter)
/* Allocate memory for sending command to firmware */ /* Allocate memory for sending command to firmware */
skb = dev_alloc_skb(MWIFIEX_SIZE_OF_CMD_BUFFER); skb = dev_alloc_skb(MWIFIEX_SIZE_OF_CMD_BUFFER);
if (!skb) { if (!skb) {
dev_err(adapter->dev, "Unable to allocate skb for command " dev_err(adapter->dev,
"data.\n"); "Unable to allocate skb for command data.\n");
return -ENOMEM; return -ENOMEM;
} }
mwifiex_update_sk_buff_pa(skb); mwifiex_update_sk_buff_pa(skb);
...@@ -702,8 +703,8 @@ static int mwifiex_pcie_alloc_sleep_cookie_buf(struct mwifiex_adapter *adapter) ...@@ -702,8 +703,8 @@ static int mwifiex_pcie_alloc_sleep_cookie_buf(struct mwifiex_adapter *adapter)
/* Allocate memory for sleep cookie */ /* Allocate memory for sleep cookie */
skb = dev_alloc_skb(sizeof(u32)); skb = dev_alloc_skb(sizeof(u32));
if (!skb) { if (!skb) {
dev_err(adapter->dev, "Unable to allocate skb for sleep " dev_err(adapter->dev,
"cookie!\n"); "Unable to allocate skb for sleep cookie!\n");
return -ENOMEM; return -ENOMEM;
} }
mwifiex_update_sk_buff_pa(skb); mwifiex_update_sk_buff_pa(skb);
...@@ -757,8 +758,8 @@ mwifiex_pcie_send_data(struct mwifiex_adapter *adapter, struct sk_buff *skb) ...@@ -757,8 +758,8 @@ mwifiex_pcie_send_data(struct mwifiex_adapter *adapter, struct sk_buff *skb)
/* Read the TX ring read pointer set by firmware */ /* Read the TX ring read pointer set by firmware */
if (mwifiex_read_reg(adapter, REG_TXBD_RDPTR, &rdptr)) { if (mwifiex_read_reg(adapter, REG_TXBD_RDPTR, &rdptr)) {
dev_err(adapter->dev, "SEND DATA: failed to read " dev_err(adapter->dev,
"REG_TXBD_RDPTR\n"); "SEND DATA: failed to read REG_TXBD_RDPTR\n");
return -1; return -1;
} }
...@@ -798,31 +799,30 @@ mwifiex_pcie_send_data(struct mwifiex_adapter *adapter, struct sk_buff *skb) ...@@ -798,31 +799,30 @@ mwifiex_pcie_send_data(struct mwifiex_adapter *adapter, struct sk_buff *skb)
/* Write the TX ring write pointer in to REG_TXBD_WRPTR */ /* Write the TX ring write pointer in to REG_TXBD_WRPTR */
if (mwifiex_write_reg(adapter, REG_TXBD_WRPTR, if (mwifiex_write_reg(adapter, REG_TXBD_WRPTR,
card->txbd_wrptr)) { card->txbd_wrptr)) {
dev_err(adapter->dev, "SEND DATA: failed to write " dev_err(adapter->dev,
"REG_TXBD_WRPTR\n"); "SEND DATA: failed to write REG_TXBD_WRPTR\n");
return 0; return 0;
} }
/* Send the TX ready interrupt */ /* Send the TX ready interrupt */
if (mwifiex_write_reg(adapter, PCIE_CPU_INT_EVENT, if (mwifiex_write_reg(adapter, PCIE_CPU_INT_EVENT,
CPU_INTR_DNLD_RDY)) { CPU_INTR_DNLD_RDY)) {
dev_err(adapter->dev, "SEND DATA: failed to assert " dev_err(adapter->dev,
"door-bell interrupt.\n"); "SEND DATA: failed to assert door-bell intr\n");
return -1; return -1;
} }
dev_dbg(adapter->dev, "info: SEND DATA: Updated <Rd: %#x, Wr: " dev_dbg(adapter->dev, "info: SEND DATA: Updated <Rd: %#x, Wr: "
"%#x> and sent packet to firmware " "%#x> and sent packet to firmware successfully\n",
"successfully\n", rdptr, rdptr, card->txbd_wrptr);
card->txbd_wrptr);
} else { } else {
dev_dbg(adapter->dev, "info: TX Ring full, can't send anymore " dev_dbg(adapter->dev,
"packets to firmware\n"); "info: TX Ring full, can't send packets to fw\n");
adapter->data_sent = true; adapter->data_sent = true;
/* Send the TX ready interrupt */ /* Send the TX ready interrupt */
if (mwifiex_write_reg(adapter, PCIE_CPU_INT_EVENT, if (mwifiex_write_reg(adapter, PCIE_CPU_INT_EVENT,
CPU_INTR_DNLD_RDY)) CPU_INTR_DNLD_RDY))
dev_err(adapter->dev, "SEND DATA: failed to assert " dev_err(adapter->dev,
"door-bell interrupt\n"); "SEND DATA: failed to assert door-bell intr\n");
return -EBUSY; return -EBUSY;
} }
...@@ -842,8 +842,8 @@ static int mwifiex_pcie_process_recv_data(struct mwifiex_adapter *adapter) ...@@ -842,8 +842,8 @@ static int mwifiex_pcie_process_recv_data(struct mwifiex_adapter *adapter)
/* Read the RX ring Write pointer set by firmware */ /* Read the RX ring Write pointer set by firmware */
if (mwifiex_read_reg(adapter, REG_RXBD_WRPTR, &wrptr)) { if (mwifiex_read_reg(adapter, REG_RXBD_WRPTR, &wrptr)) {
dev_err(adapter->dev, "RECV DATA: failed to read " dev_err(adapter->dev,
"REG_TXBD_RDPTR\n"); "RECV DATA: failed to read REG_TXBD_RDPTR\n");
ret = -1; ret = -1;
goto done; goto done;
} }
...@@ -861,12 +861,13 @@ static int mwifiex_pcie_process_recv_data(struct mwifiex_adapter *adapter) ...@@ -861,12 +861,13 @@ static int mwifiex_pcie_process_recv_data(struct mwifiex_adapter *adapter)
/* Get data length from interface header - /* Get data length from interface header -
first byte is len, second byte is type */ first byte is len, second byte is type */
rx_len = *((u16 *)skb_data->data); rx_len = *((u16 *)skb_data->data);
dev_dbg(adapter->dev, "info: RECV DATA: Rd=%#x, Wr=%#x, " dev_dbg(adapter->dev,
"Len=%d\n", card->rxbd_rdptr, wrptr, rx_len); "info: RECV DATA: Rd=%#x, Wr=%#x, Len=%d\n",
card->rxbd_rdptr, wrptr, rx_len);
skb_tmp = dev_alloc_skb(rx_len); skb_tmp = dev_alloc_skb(rx_len);
if (!skb_tmp) { if (!skb_tmp) {
dev_dbg(adapter->dev, "info: Failed to alloc skb " dev_dbg(adapter->dev,
"for RX\n"); "info: Failed to alloc skb for RX\n");
ret = -EBUSY; ret = -EBUSY;
goto done; goto done;
} }
...@@ -886,21 +887,21 @@ static int mwifiex_pcie_process_recv_data(struct mwifiex_adapter *adapter) ...@@ -886,21 +887,21 @@ static int mwifiex_pcie_process_recv_data(struct mwifiex_adapter *adapter)
/* Write the RX ring read pointer in to REG_RXBD_RDPTR */ /* Write the RX ring read pointer in to REG_RXBD_RDPTR */
if (mwifiex_write_reg(adapter, REG_RXBD_RDPTR, if (mwifiex_write_reg(adapter, REG_RXBD_RDPTR,
card->rxbd_rdptr)) { card->rxbd_rdptr)) {
dev_err(adapter->dev, "RECV DATA: failed to " dev_err(adapter->dev,
"write REG_RXBD_RDPTR\n"); "RECV DATA: failed to write REG_RXBD_RDPTR\n");
ret = -1; ret = -1;
goto done; goto done;
} }
/* Read the RX ring Write pointer set by firmware */ /* Read the RX ring Write pointer set by firmware */
if (mwifiex_read_reg(adapter, REG_RXBD_WRPTR, &wrptr)) { if (mwifiex_read_reg(adapter, REG_RXBD_WRPTR, &wrptr)) {
dev_err(adapter->dev, "RECV DATA: failed to read " dev_err(adapter->dev,
"REG_TXBD_RDPTR\n"); "RECV DATA: failed to read REG_TXBD_RDPTR\n");
ret = -1; ret = -1;
goto done; goto done;
} }
dev_dbg(adapter->dev, "info: RECV DATA: Received packet from " dev_dbg(adapter->dev,
"firmware successfully\n"); "info: RECV DATA: Rcvd packet from fw successfully\n");
mwifiex_handle_rx_packet(adapter, skb_tmp); mwifiex_handle_rx_packet(adapter, skb_tmp);
} }
...@@ -919,8 +920,9 @@ mwifiex_pcie_send_boot_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb) ...@@ -919,8 +920,9 @@ mwifiex_pcie_send_boot_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb)
phys_addr_t *buf_pa = MWIFIEX_SKB_PACB(skb); phys_addr_t *buf_pa = MWIFIEX_SKB_PACB(skb);
if (!(skb->data && skb->len && *buf_pa)) { if (!(skb->data && skb->len && *buf_pa)) {
dev_err(adapter->dev, "Invalid parameter in %s <%p, %#x:%x, " dev_err(adapter->dev,
"%x>\n", __func__, skb->data, skb->len, "Invalid parameter in %s <%p, %#x:%x, %x>\n",
__func__, skb->data, skb->len,
(u32)*buf_pa, (u32)((u64)*buf_pa >> 32)); (u32)*buf_pa, (u32)((u64)*buf_pa >> 32));
return -1; return -1;
} }
...@@ -928,8 +930,9 @@ mwifiex_pcie_send_boot_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb) ...@@ -928,8 +930,9 @@ mwifiex_pcie_send_boot_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb)
/* Write the lower 32bits of the physical address to scratch /* Write the lower 32bits of the physical address to scratch
* register 0 */ * register 0 */
if (mwifiex_write_reg(adapter, PCIE_SCRATCH_0_REG, (u32)*buf_pa)) { if (mwifiex_write_reg(adapter, PCIE_SCRATCH_0_REG, (u32)*buf_pa)) {
dev_err(adapter->dev, "%s: failed to write download command " dev_err(adapter->dev,
"to boot code.\n", __func__); "%s: failed to write download command to boot code.\n",
__func__);
return -1; return -1;
} }
...@@ -937,23 +940,25 @@ mwifiex_pcie_send_boot_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb) ...@@ -937,23 +940,25 @@ mwifiex_pcie_send_boot_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb)
* register 1 */ * register 1 */
if (mwifiex_write_reg(adapter, PCIE_SCRATCH_1_REG, if (mwifiex_write_reg(adapter, PCIE_SCRATCH_1_REG,
(u32)((u64)*buf_pa >> 32))) { (u32)((u64)*buf_pa >> 32))) {
dev_err(adapter->dev, "%s: failed to write download command " dev_err(adapter->dev,
"to boot code.\n", __func__); "%s: failed to write download command to boot code.\n",
__func__);
return -1; return -1;
} }
/* Write the command length to scratch register 2 */ /* Write the command length to scratch register 2 */
if (mwifiex_write_reg(adapter, PCIE_SCRATCH_2_REG, skb->len)) { if (mwifiex_write_reg(adapter, PCIE_SCRATCH_2_REG, skb->len)) {
dev_err(adapter->dev, "%s: failed to write command length to " dev_err(adapter->dev,
"scratch register 2\n", __func__); "%s: failed to write command len to scratch reg 2\n",
__func__);
return -1; return -1;
} }
/* Ring the door bell */ /* Ring the door bell */
if (mwifiex_write_reg(adapter, PCIE_CPU_INT_EVENT, if (mwifiex_write_reg(adapter, PCIE_CPU_INT_EVENT,
CPU_INTR_DOOR_BELL)) { CPU_INTR_DOOR_BELL)) {
dev_err(adapter->dev, "%s: failed to assert door-bell " dev_err(adapter->dev,
"interrupt.\n", __func__); "%s: failed to assert door-bell intr\n", __func__);
return -1; return -1;
} }
...@@ -979,8 +984,8 @@ mwifiex_pcie_send_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb) ...@@ -979,8 +984,8 @@ mwifiex_pcie_send_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb)
/* Make sure a command response buffer is available */ /* Make sure a command response buffer is available */
if (!card->cmdrsp_buf) { if (!card->cmdrsp_buf) {
dev_err(adapter->dev, "No response buffer available, send " dev_err(adapter->dev,
"command failed\n"); "No response buffer available, send command failed\n");
return -EBUSY; return -EBUSY;
} }
...@@ -1012,7 +1017,8 @@ mwifiex_pcie_send_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb) ...@@ -1012,7 +1017,8 @@ mwifiex_pcie_send_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb)
address */ address */
if (mwifiex_write_reg(adapter, REG_CMDRSP_ADDR_LO, if (mwifiex_write_reg(adapter, REG_CMDRSP_ADDR_LO,
(u32)*cmdrsp_buf_pa)) { (u32)*cmdrsp_buf_pa)) {
dev_err(adapter->dev, "Failed to write download command to boot code.\n"); dev_err(adapter->dev,
"Failed to write download cmd to boot code.\n");
ret = -1; ret = -1;
goto done; goto done;
} }
...@@ -1020,8 +1026,8 @@ mwifiex_pcie_send_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb) ...@@ -1020,8 +1026,8 @@ mwifiex_pcie_send_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb)
address */ address */
if (mwifiex_write_reg(adapter, REG_CMDRSP_ADDR_HI, if (mwifiex_write_reg(adapter, REG_CMDRSP_ADDR_HI,
(u32)((u64)*cmdrsp_buf_pa >> 32))) { (u32)((u64)*cmdrsp_buf_pa >> 32))) {
dev_err(adapter->dev, "Failed to write download command" dev_err(adapter->dev,
" to boot code.\n"); "Failed to write download cmd to boot code.\n");
ret = -1; ret = -1;
goto done; goto done;
} }
...@@ -1029,27 +1035,25 @@ mwifiex_pcie_send_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb) ...@@ -1029,27 +1035,25 @@ mwifiex_pcie_send_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb)
cmd_buf_pa = MWIFIEX_SKB_PACB(card->cmd_buf); cmd_buf_pa = MWIFIEX_SKB_PACB(card->cmd_buf);
/* Write the lower 32bits of the physical address to REG_CMD_ADDR_LO */ /* Write the lower 32bits of the physical address to REG_CMD_ADDR_LO */
if (mwifiex_write_reg(adapter, REG_CMD_ADDR_LO, if (mwifiex_write_reg(adapter, REG_CMD_ADDR_LO, (u32)*cmd_buf_pa)) {
(u32)*cmd_buf_pa)) { dev_err(adapter->dev,
dev_err(adapter->dev, "Failed to write download command " "Failed to write download cmd to boot code.\n");
"to boot code.\n");
ret = -1; ret = -1;
goto done; goto done;
} }
/* Write the upper 32bits of the physical address to REG_CMD_ADDR_HI */ /* Write the upper 32bits of the physical address to REG_CMD_ADDR_HI */
if (mwifiex_write_reg(adapter, REG_CMD_ADDR_HI, if (mwifiex_write_reg(adapter, REG_CMD_ADDR_HI,
(u32)((u64)*cmd_buf_pa >> 32))) { (u32)((u64)*cmd_buf_pa >> 32))) {
dev_err(adapter->dev, "Failed to write download command " dev_err(adapter->dev,
"to boot code.\n"); "Failed to write download cmd to boot code.\n");
ret = -1; ret = -1;
goto done; goto done;
} }
/* Write the command length to REG_CMD_SIZE */ /* Write the command length to REG_CMD_SIZE */
if (mwifiex_write_reg(adapter, REG_CMD_SIZE, if (mwifiex_write_reg(adapter, REG_CMD_SIZE, card->cmd_buf->len)) {
card->cmd_buf->len)) { dev_err(adapter->dev,
dev_err(adapter->dev, "Failed to write command length to " "Failed to write cmd len to REG_CMD_SIZE\n");
"REG_CMD_SIZE\n");
ret = -1; ret = -1;
goto done; goto done;
} }
...@@ -1057,8 +1061,8 @@ mwifiex_pcie_send_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb) ...@@ -1057,8 +1061,8 @@ mwifiex_pcie_send_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb)
/* Ring the door bell */ /* Ring the door bell */
if (mwifiex_write_reg(adapter, PCIE_CPU_INT_EVENT, if (mwifiex_write_reg(adapter, PCIE_CPU_INT_EVENT,
CPU_INTR_DOOR_BELL)) { CPU_INTR_DOOR_BELL)) {
dev_err(adapter->dev, "Failed to assert door-bell " dev_err(adapter->dev,
"interrupt.\n"); "Failed to assert door-bell intr\n");
ret = -1; ret = -1;
goto done; goto done;
} }
...@@ -1076,30 +1080,29 @@ mwifiex_pcie_send_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb) ...@@ -1076,30 +1080,29 @@ mwifiex_pcie_send_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb)
static int mwifiex_pcie_process_cmd_complete(struct mwifiex_adapter *adapter) static int mwifiex_pcie_process_cmd_complete(struct mwifiex_adapter *adapter)
{ {
struct pcie_service_card *card = adapter->card; struct pcie_service_card *card = adapter->card;
struct sk_buff *skb = card->cmdrsp_buf;
int count = 0; int count = 0;
dev_dbg(adapter->dev, "info: Rx CMD Response\n"); dev_dbg(adapter->dev, "info: Rx CMD Response\n");
if (!adapter->curr_cmd) { if (!adapter->curr_cmd) {
skb_pull(card->cmdrsp_buf, INTF_HEADER_LEN); skb_pull(skb, INTF_HEADER_LEN);
if (adapter->ps_state == PS_STATE_SLEEP_CFM) { if (adapter->ps_state == PS_STATE_SLEEP_CFM) {
mwifiex_process_sleep_confirm_resp(adapter, mwifiex_process_sleep_confirm_resp(adapter, skb->data,
card->cmdrsp_buf->data, skb->len);
card->cmdrsp_buf->len);
while (mwifiex_pcie_ok_to_access_hw(adapter) && while (mwifiex_pcie_ok_to_access_hw(adapter) &&
(count++ < 10)) (count++ < 10))
usleep_range(50, 60); usleep_range(50, 60);
} else { } else {
dev_err(adapter->dev, "There is no command but " dev_err(adapter->dev,
"got cmdrsp\n"); "There is no command but got cmdrsp\n");
} }
memcpy(adapter->upld_buf, card->cmdrsp_buf->data, memcpy(adapter->upld_buf, skb->data,
min_t(u32, MWIFIEX_SIZE_OF_CMD_BUFFER, min_t(u32, MWIFIEX_SIZE_OF_CMD_BUFFER, skb->len));
card->cmdrsp_buf->len)); skb_push(skb, INTF_HEADER_LEN);
skb_push(card->cmdrsp_buf, INTF_HEADER_LEN);
} else if (mwifiex_pcie_ok_to_access_hw(adapter)) { } else if (mwifiex_pcie_ok_to_access_hw(adapter)) {
skb_pull(card->cmdrsp_buf, INTF_HEADER_LEN); skb_pull(skb, INTF_HEADER_LEN);
adapter->curr_cmd->resp_skb = card->cmdrsp_buf; adapter->curr_cmd->resp_skb = skb;
adapter->cmd_resp_received = true; adapter->cmd_resp_received = true;
/* Take the pointer and set it to CMD node and will /* Take the pointer and set it to CMD node and will
return in the response complete callback */ return in the response complete callback */
...@@ -1109,15 +1112,15 @@ static int mwifiex_pcie_process_cmd_complete(struct mwifiex_adapter *adapter) ...@@ -1109,15 +1112,15 @@ static int mwifiex_pcie_process_cmd_complete(struct mwifiex_adapter *adapter)
will prevent firmware from writing to the same response will prevent firmware from writing to the same response
buffer again. */ buffer again. */
if (mwifiex_write_reg(adapter, REG_CMDRSP_ADDR_LO, 0)) { if (mwifiex_write_reg(adapter, REG_CMDRSP_ADDR_LO, 0)) {
dev_err(adapter->dev, "cmd_done: failed to clear " dev_err(adapter->dev,
"cmd_rsp address.\n"); "cmd_done: failed to clear cmd_rsp_addr_lo\n");
return -1; return -1;
} }
/* Write the upper 32bits of the cmdrsp buffer physical /* Write the upper 32bits of the cmdrsp buffer physical
address */ address */
if (mwifiex_write_reg(adapter, REG_CMDRSP_ADDR_HI, 0)) { if (mwifiex_write_reg(adapter, REG_CMDRSP_ADDR_HI, 0)) {
dev_err(adapter->dev, "cmd_done: failed to clear " dev_err(adapter->dev,
"cmd_rsp address.\n"); "cmd_done: failed to clear cmd_rsp_addr_hi\n");
return -1; return -1;
} }
} }
...@@ -1151,7 +1154,7 @@ static int mwifiex_pcie_process_event_ready(struct mwifiex_adapter *adapter) ...@@ -1151,7 +1154,7 @@ static int mwifiex_pcie_process_event_ready(struct mwifiex_adapter *adapter)
u32 wrptr, event; u32 wrptr, event;
if (adapter->event_received) { if (adapter->event_received) {
dev_dbg(adapter->dev, "info: Event being processed, "\ dev_dbg(adapter->dev, "info: Event being processed, "
"do not process this interrupt just yet\n"); "do not process this interrupt just yet\n");
return 0; return 0;
} }
...@@ -1163,14 +1166,15 @@ static int mwifiex_pcie_process_event_ready(struct mwifiex_adapter *adapter) ...@@ -1163,14 +1166,15 @@ static int mwifiex_pcie_process_event_ready(struct mwifiex_adapter *adapter)
/* Read the event ring write pointer set by firmware */ /* Read the event ring write pointer set by firmware */
if (mwifiex_read_reg(adapter, REG_EVTBD_WRPTR, &wrptr)) { if (mwifiex_read_reg(adapter, REG_EVTBD_WRPTR, &wrptr)) {
dev_err(adapter->dev, "EventReady: failed to read REG_EVTBD_WRPTR\n"); dev_err(adapter->dev,
"EventReady: failed to read REG_EVTBD_WRPTR\n");
return -1; return -1;
} }
dev_dbg(adapter->dev, "info: EventReady: Initial <Rd: 0x%x, Wr: 0x%x>", dev_dbg(adapter->dev, "info: EventReady: Initial <Rd: 0x%x, Wr: 0x%x>",
card->evtbd_rdptr, wrptr); card->evtbd_rdptr, wrptr);
if (((wrptr & MWIFIEX_EVTBD_MASK) != if (((wrptr & MWIFIEX_EVTBD_MASK) != (card->evtbd_rdptr
(card->evtbd_rdptr & MWIFIEX_EVTBD_MASK)) || & MWIFIEX_EVTBD_MASK)) ||
((wrptr & MWIFIEX_BD_FLAG_ROLLOVER_IND) == ((wrptr & MWIFIEX_BD_FLAG_ROLLOVER_IND) ==
(card->evtbd_rdptr & MWIFIEX_BD_FLAG_ROLLOVER_IND))) { (card->evtbd_rdptr & MWIFIEX_BD_FLAG_ROLLOVER_IND))) {
struct sk_buff *skb_cmd; struct sk_buff *skb_cmd;
...@@ -1236,7 +1240,8 @@ static int mwifiex_pcie_event_complete(struct mwifiex_adapter *adapter, ...@@ -1236,7 +1240,8 @@ static int mwifiex_pcie_event_complete(struct mwifiex_adapter *adapter,
/* Read the event ring write pointer set by firmware */ /* Read the event ring write pointer set by firmware */
if (mwifiex_read_reg(adapter, REG_EVTBD_WRPTR, &wrptr)) { if (mwifiex_read_reg(adapter, REG_EVTBD_WRPTR, &wrptr)) {
dev_err(adapter->dev, "event_complete: failed to read REG_EVTBD_WRPTR\n"); dev_err(adapter->dev,
"event_complete: failed to read REG_EVTBD_WRPTR\n");
return -1; return -1;
} }
...@@ -1249,9 +1254,9 @@ static int mwifiex_pcie_event_complete(struct mwifiex_adapter *adapter, ...@@ -1249,9 +1254,9 @@ static int mwifiex_pcie_event_complete(struct mwifiex_adapter *adapter,
card->evtbd_ring[rdptr]->flags = 0; card->evtbd_ring[rdptr]->flags = 0;
skb = NULL; skb = NULL;
} else { } else {
dev_dbg(adapter->dev, "info: ERROR: Buffer is still valid at " dev_dbg(adapter->dev,
"index %d, <%p, %p>\n", rdptr, "info: ERROR: buf still valid at index %d, <%p, %p>\n",
card->evt_buf_list[rdptr], skb); rdptr, card->evt_buf_list[rdptr], skb);
} }
if ((++card->evtbd_rdptr & MWIFIEX_EVTBD_MASK) == MWIFIEX_MAX_EVT_BD) { if ((++card->evtbd_rdptr & MWIFIEX_EVTBD_MASK) == MWIFIEX_MAX_EVT_BD) {
...@@ -1265,7 +1270,8 @@ static int mwifiex_pcie_event_complete(struct mwifiex_adapter *adapter, ...@@ -1265,7 +1270,8 @@ static int mwifiex_pcie_event_complete(struct mwifiex_adapter *adapter,
/* Write the event ring read pointer in to REG_EVTBD_RDPTR */ /* Write the event ring read pointer in to REG_EVTBD_RDPTR */
if (mwifiex_write_reg(adapter, REG_EVTBD_RDPTR, card->evtbd_rdptr)) { if (mwifiex_write_reg(adapter, REG_EVTBD_RDPTR, card->evtbd_rdptr)) {
dev_err(adapter->dev, "event_complete: failed to read REG_EVTBD_RDPTR\n"); dev_err(adapter->dev,
"event_complete: failed to read REG_EVTBD_RDPTR\n");
return -1; return -1;
} }
...@@ -1299,8 +1305,8 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, ...@@ -1299,8 +1305,8 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
} }
if (!firmware || !firmware_len) { if (!firmware || !firmware_len) {
dev_err(adapter->dev, "No firmware image found! " dev_err(adapter->dev,
"Terminating download\n"); "No firmware image found! Terminating download\n");
return -1; return -1;
} }
...@@ -1308,8 +1314,8 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, ...@@ -1308,8 +1314,8 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
firmware_len); firmware_len);
if (mwifiex_pcie_disable_host_int(adapter)) { if (mwifiex_pcie_disable_host_int(adapter)) {
dev_err(adapter->dev, "%s: Disabling interrupts" dev_err(adapter->dev,
" failed.\n", __func__); "%s: Disabling interrupts failed.\n", __func__);
return -1; return -1;
} }
...@@ -1332,7 +1338,8 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, ...@@ -1332,7 +1338,8 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
ret = mwifiex_read_reg(adapter, PCIE_SCRATCH_2_REG, ret = mwifiex_read_reg(adapter, PCIE_SCRATCH_2_REG,
&len); &len);
if (ret) { if (ret) {
dev_warn(adapter->dev, "Failed reading length from boot code\n"); dev_warn(adapter->dev,
"Failed reading len from boot code\n");
goto done; goto done;
} }
if (len) if (len)
...@@ -1360,8 +1367,8 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, ...@@ -1360,8 +1367,8 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
goto done; goto done;
} }
dev_err(adapter->dev, "FW CRC error indicated by the " dev_err(adapter->dev, "FW CRC error indicated by the "
"helper: len = 0x%04X, txlen = " "helper: len = 0x%04X, txlen = %d\n",
"%d\n", len, txlen); len, txlen);
len &= ~BIT(0); len &= ~BIT(0);
/* Setting this to 0 to resend from same offset */ /* Setting this to 0 to resend from same offset */
txlen = 0; txlen = 0;
...@@ -1374,8 +1381,8 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, ...@@ -1374,8 +1381,8 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
dev_dbg(adapter->dev, "."); dev_dbg(adapter->dev, ".");
tx_blocks = tx_blocks = (txlen +
(txlen + MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD - 1) / MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD - 1) /
MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD; MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD;
/* Copy payload to buffer */ /* Copy payload to buffer */
...@@ -1387,7 +1394,8 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, ...@@ -1387,7 +1394,8 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
/* Send the boot command to device */ /* Send the boot command to device */
if (mwifiex_pcie_send_boot_cmd(adapter, skb)) { if (mwifiex_pcie_send_boot_cmd(adapter, skb)) {
dev_err(adapter->dev, "Failed to send firmware download command\n"); dev_err(adapter->dev,
"Failed to send firmware download command\n");
ret = -1; ret = -1;
goto done; goto done;
} }
...@@ -1396,8 +1404,8 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, ...@@ -1396,8 +1404,8 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
if (mwifiex_read_reg(adapter, PCIE_CPU_INT_STATUS, if (mwifiex_read_reg(adapter, PCIE_CPU_INT_STATUS,
&ireg_intr)) { &ireg_intr)) {
dev_err(adapter->dev, "%s: Failed to read " dev_err(adapter->dev, "%s: Failed to read "
"interrupt status during " "interrupt status during fw dnld.\n",
"fw dnld.\n", __func__); __func__);
ret = -1; ret = -1;
goto done; goto done;
} }
...@@ -1437,7 +1445,8 @@ mwifiex_check_fw_status(struct mwifiex_adapter *adapter, u32 poll_num) ...@@ -1437,7 +1445,8 @@ mwifiex_check_fw_status(struct mwifiex_adapter *adapter, u32 poll_num)
dev_dbg(adapter->dev, "Setting driver ready signature\n"); dev_dbg(adapter->dev, "Setting driver ready signature\n");
if (mwifiex_write_reg(adapter, REG_DRV_READY, FIRMWARE_READY_PCIE)) { if (mwifiex_write_reg(adapter, REG_DRV_READY, FIRMWARE_READY_PCIE)) {
dev_err(adapter->dev, "Failed to write driver ready signature\n"); dev_err(adapter->dev,
"Failed to write driver ready signature\n");
return -1; return -1;
} }
...@@ -1468,7 +1477,8 @@ mwifiex_check_fw_status(struct mwifiex_adapter *adapter, u32 poll_num) ...@@ -1468,7 +1477,8 @@ mwifiex_check_fw_status(struct mwifiex_adapter *adapter, u32 poll_num)
adapter->winner = 1; adapter->winner = 1;
ret = -1; ret = -1;
} else { } else {
dev_err(adapter->dev, "PCI-E is not the winner <%#x, %d>, exit download\n", dev_err(adapter->dev,
"PCI-E is not the winner <%#x,%d>, exit dnld\n",
ret, adapter->winner); ret, adapter->winner);
ret = 0; ret = 0;
} }
...@@ -1513,9 +1523,10 @@ static void mwifiex_interrupt_status(struct mwifiex_adapter *adapter) ...@@ -1513,9 +1523,10 @@ static void mwifiex_interrupt_status(struct mwifiex_adapter *adapter)
mwifiex_pcie_enable_host_int(adapter); mwifiex_pcie_enable_host_int(adapter);
if (mwifiex_write_reg(adapter, if (mwifiex_write_reg(adapter,
PCIE_CPU_INT_EVENT, PCIE_CPU_INT_EVENT,
CPU_INTR_SLEEP_CFM_DONE)) { CPU_INTR_SLEEP_CFM_DONE)
dev_warn(adapter->dev, "Write register" ) {
" failed\n"); dev_warn(adapter->dev,
"Write register failed\n");
return; return;
} }
...@@ -1594,7 +1605,7 @@ static int mwifiex_process_int_status(struct mwifiex_adapter *adapter) ...@@ -1594,7 +1605,7 @@ static int mwifiex_process_int_status(struct mwifiex_adapter *adapter)
if (adapter->int_status & HOST_INTR_DNLD_DONE) { if (adapter->int_status & HOST_INTR_DNLD_DONE) {
adapter->int_status &= ~HOST_INTR_DNLD_DONE; adapter->int_status &= ~HOST_INTR_DNLD_DONE;
if (adapter->data_sent) { if (adapter->data_sent) {
dev_dbg(adapter->dev, "info: DATA sent Interrupt\n"); dev_dbg(adapter->dev, "info: DATA sent intr\n");
adapter->data_sent = false; adapter->data_sent = false;
} }
} }
...@@ -1616,7 +1627,8 @@ static int mwifiex_process_int_status(struct mwifiex_adapter *adapter) ...@@ -1616,7 +1627,8 @@ static int mwifiex_process_int_status(struct mwifiex_adapter *adapter)
if (adapter->int_status & HOST_INTR_CMD_DONE) { if (adapter->int_status & HOST_INTR_CMD_DONE) {
adapter->int_status &= ~HOST_INTR_CMD_DONE; adapter->int_status &= ~HOST_INTR_CMD_DONE;
if (adapter->cmd_sent) { if (adapter->cmd_sent) {
dev_dbg(adapter->dev, "info: CMD sent Interrupt\n"); dev_dbg(adapter->dev,
"info: CMD sent Interrupt\n");
adapter->cmd_sent = false; adapter->cmd_sent = false;
} }
/* Handle command response */ /* Handle command response */
...@@ -1628,15 +1640,17 @@ static int mwifiex_process_int_status(struct mwifiex_adapter *adapter) ...@@ -1628,15 +1640,17 @@ static int mwifiex_process_int_status(struct mwifiex_adapter *adapter)
if (mwifiex_pcie_ok_to_access_hw(adapter)) { if (mwifiex_pcie_ok_to_access_hw(adapter)) {
if (mwifiex_read_reg(adapter, PCIE_HOST_INT_STATUS, if (mwifiex_read_reg(adapter, PCIE_HOST_INT_STATUS,
&pcie_ireg)) { &pcie_ireg)) {
dev_warn(adapter->dev, "Read register failed\n"); dev_warn(adapter->dev,
"Read register failed\n");
return -1; return -1;
} }
if ((pcie_ireg != 0xFFFFFFFF) && (pcie_ireg)) { if ((pcie_ireg != 0xFFFFFFFF) && (pcie_ireg)) {
if (mwifiex_write_reg(adapter, if (mwifiex_write_reg(adapter,
PCIE_HOST_INT_STATUS, ~pcie_ireg)) { PCIE_HOST_INT_STATUS,
dev_warn(adapter->dev, "Write register" ~pcie_ireg)) {
" failed\n"); dev_warn(adapter->dev,
"Write register failed\n");
return -1; return -1;
} }
adapter->int_status |= pcie_ireg; adapter->int_status |= pcie_ireg;
...@@ -1737,8 +1751,9 @@ static int mwifiex_pcie_init(struct mwifiex_adapter *adapter) ...@@ -1737,8 +1751,9 @@ static int mwifiex_pcie_init(struct mwifiex_adapter *adapter)
goto err_iomap2; goto err_iomap2;
} }
dev_dbg(adapter->dev, "PCI memory map Virt0: %p PCI memory map Virt2: " dev_dbg(adapter->dev,
"%p\n", card->pci_mmap, card->pci_mmap1); "PCI memory map Virt0: %p PCI memory map Virt2: %p\n",
card->pci_mmap, card->pci_mmap1);
card->cmdrsp_buf = NULL; card->cmdrsp_buf = NULL;
ret = mwifiex_pcie_create_txbd_ring(adapter); ret = mwifiex_pcie_create_txbd_ring(adapter);
...@@ -1808,7 +1823,8 @@ static void mwifiex_pcie_cleanup(struct mwifiex_adapter *adapter) ...@@ -1808,7 +1823,8 @@ static void mwifiex_pcie_cleanup(struct mwifiex_adapter *adapter)
dev_dbg(adapter->dev, "Clearing driver ready signature\n"); dev_dbg(adapter->dev, "Clearing driver ready signature\n");
if (user_rmmod) { if (user_rmmod) {
if (mwifiex_write_reg(adapter, REG_DRV_READY, 0x00000000)) if (mwifiex_write_reg(adapter, REG_DRV_READY, 0x00000000))
dev_err(adapter->dev, "Failed to write driver not-ready signature\n"); dev_err(adapter->dev,
"Failed to write driver not-ready signature\n");
} }
if (pdev) { if (pdev) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment