aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/mwifiex/main.h1
-rw-r--r--drivers/net/wireless/mwifiex/pcie.c32
-rw-r--r--drivers/net/wireless/mwifiex/pcie.h13
-rw-r--r--drivers/net/wireless/mwifiex/wmm.c2
4 files changed, 48 insertions, 0 deletions
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index ef02a5bf57b1..51044e3ea89b 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -602,6 +602,7 @@ struct mwifiex_if_ops {
602 int (*init_fw_port) (struct mwifiex_adapter *); 602 int (*init_fw_port) (struct mwifiex_adapter *);
603 int (*dnld_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *); 603 int (*dnld_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *);
604 void (*card_reset) (struct mwifiex_adapter *); 604 void (*card_reset) (struct mwifiex_adapter *);
605 int (*clean_pcie_ring) (struct mwifiex_adapter *adapter);
605}; 606};
606 607
607struct mwifiex_adapter { 608struct mwifiex_adapter {
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c
index ac20bc4bc1a0..19b5a83f4e7f 100644
--- a/drivers/net/wireless/mwifiex/pcie.c
+++ b/drivers/net/wireless/mwifiex/pcie.c
@@ -764,6 +764,37 @@ static int mwifiex_pcie_delete_sleep_cookie_buf(struct mwifiex_adapter *adapter)
764 return 0; 764 return 0;
765} 765}
766 766
767/* This function flushes the TX buffer descriptor ring
768 * This function defined as handler is also called while cleaning TXRX
769 * during disconnect/ bss stop.
770 */
771static int mwifiex_clean_pcie_ring_buf(struct mwifiex_adapter *adapter)
772{
773 struct pcie_service_card *card = adapter->card;
774 u32 rdptr;
775
776 /* Read the TX ring read pointer set by firmware */
777 if (mwifiex_read_reg(adapter, REG_TXBD_RDPTR, &rdptr)) {
778 dev_err(adapter->dev,
779 "Flush TXBD: failed to read REG_TXBD_RDPTR\n");
780 return -1;
781 }
782
783 if (!mwifiex_pcie_txbd_empty(card, rdptr)) {
784 card->txbd_flush = 1;
785 /* write pointer already set at last send
786 * send dnld-rdy intr again, wait for completion.
787 */
788 if (mwifiex_write_reg(adapter, PCIE_CPU_INT_EVENT,
789 CPU_INTR_DNLD_RDY)) {
790 dev_err(adapter->dev,
791 "failed to assert dnld-rdy interrupt.\n");
792 return -1;
793 }
794 }
795 return 0;
796}
797
767/* 798/*
768 * This function sends data buffer to device 799 * This function sends data buffer to device
769 */ 800 */
@@ -1995,6 +2026,7 @@ static struct mwifiex_if_ops pcie_ops = {
1995 .update_mp_end_port = NULL, 2026 .update_mp_end_port = NULL,
1996 .cleanup_mpa_buf = NULL, 2027 .cleanup_mpa_buf = NULL,
1997 .init_fw_port = mwifiex_pcie_init_fw_port, 2028 .init_fw_port = mwifiex_pcie_init_fw_port,
2029 .clean_pcie_ring = mwifiex_clean_pcie_ring_buf,
1998}; 2030};
1999 2031
2000/* 2032/*
diff --git a/drivers/net/wireless/mwifiex/pcie.h b/drivers/net/wireless/mwifiex/pcie.h
index 87201f554d2e..24a39b32a222 100644
--- a/drivers/net/wireless/mwifiex/pcie.h
+++ b/drivers/net/wireless/mwifiex/pcie.h
@@ -114,6 +114,7 @@ struct pcie_service_card {
114 struct pci_dev *dev; 114 struct pci_dev *dev;
115 struct mwifiex_adapter *adapter; 115 struct mwifiex_adapter *adapter;
116 116
117 u8 txbd_flush;
117 u32 txbd_wrptr; 118 u32 txbd_wrptr;
118 u32 txbd_rdptr; 119 u32 txbd_rdptr;
119 u32 txbd_ring_size; 120 u32 txbd_ring_size;
@@ -146,4 +147,16 @@ struct pcie_service_card {
146 void __iomem *pci_mmap1; 147 void __iomem *pci_mmap1;
147}; 148};
148 149
150static inline int
151mwifiex_pcie_txbd_empty(struct pcie_service_card *card, u32 rdptr)
152{
153 if (((card->txbd_wrptr & MWIFIEX_TXBD_MASK) ==
154 (rdptr & MWIFIEX_TXBD_MASK)) &&
155 ((card->txbd_wrptr & MWIFIEX_BD_FLAG_ROLLOVER_IND) !=
156 (rdptr & MWIFIEX_BD_FLAG_ROLLOVER_IND)))
157 return 1;
158
159 return 0;
160}
161
149#endif /* _MWIFIEX_PCIE_H */ 162#endif /* _MWIFIEX_PCIE_H */
diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c
index 818f871ae987..6d641cbce726 100644
--- a/drivers/net/wireless/mwifiex/wmm.c
+++ b/drivers/net/wireless/mwifiex/wmm.c
@@ -568,6 +568,8 @@ mwifiex_clean_txrx(struct mwifiex_private *priv)
568 mwifiex_wmm_delete_all_ralist(priv); 568 mwifiex_wmm_delete_all_ralist(priv);
569 memcpy(tos_to_tid, ac_to_tid, sizeof(tos_to_tid)); 569 memcpy(tos_to_tid, ac_to_tid, sizeof(tos_to_tid));
570 570
571 if (priv->adapter->if_ops.clean_pcie_ring)
572 priv->adapter->if_ops.clean_pcie_ring(priv->adapter);
571 spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, flags); 573 spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, flags);
572} 574}
573 575