rsi: SDIO Rx packet processing enhancement
authorKarun Eagalapati <karun256@gmail.com>
Thu, 6 Jul 2017 14:37:22 +0000 (20:07 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 28 Jul 2017 14:22:42 +0000 (17:22 +0300)
Newer firmware sends information about number of blocks through
interrupt only. We don't need to read extra register for this.
This patch adds needed driver changes for this enhancment. The
change here is backward compatible

Signed-off-by: Karun Eagalapati <karun256@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/rsi/rsi_91x_sdio_ops.c
drivers/net/wireless/rsi/rsi_main.h
drivers/net/wireless/rsi/rsi_sdio.h

index df2a63b1f15cf2e289fe21994c6b827bf3d62d4e..b6d0e2ae141229e8d23e5037216bed566551ba6b 100644 (file)
@@ -69,20 +69,37 @@ int rsi_sdio_master_access_msword(struct rsi_hw *adapter, u16 ms_word)
 static int rsi_process_pkt(struct rsi_common *common)
 {
        struct rsi_hw *adapter = common->priv;
+       struct rsi_91x_sdiodev *dev =
+               (struct rsi_91x_sdiodev *)adapter->rsi_dev;
        u8 num_blks = 0;
        u32 rcv_pkt_len = 0;
        int status = 0;
+       u8 value = 0;
 
-       status = rsi_sdio_read_register(adapter,
-                                       SDIO_RX_NUM_BLOCKS_REG,
-                                       &num_blks);
+       num_blks = ((adapter->interrupt_status & 1) |
+                       ((adapter->interrupt_status >> RECV_NUM_BLOCKS) << 1));
 
-       if (status) {
-               rsi_dbg(ERR_ZONE,
-                       "%s: Failed to read pkt length from the card:\n",
-                       __func__);
-               return status;
+       if (!num_blks) {
+               status = rsi_sdio_read_register(adapter,
+                                               SDIO_RX_NUM_BLOCKS_REG,
+                                               &value);
+               if (status) {
+                       rsi_dbg(ERR_ZONE,
+                               "%s: Failed to read pkt length from the card:\n",
+                               __func__);
+                       return status;
+               }
+               num_blks = value & 0x1f;
        }
+
+       if (dev->write_fail == 2)
+               rsi_sdio_ack_intr(common->priv, (1 << MSDU_PKT_PENDING));
+
+       if (unlikely(!num_blks)) {
+               dev->write_fail = 2;
+               return -1;
+       }
+
        rcv_pkt_len = (num_blks * 256);
 
        common->rx_data_pkt = kmalloc(rcv_pkt_len, GFP_KERNEL);
@@ -224,6 +241,7 @@ void rsi_interrupt_handler(struct rsi_hw *adapter)
                        mutex_unlock(&common->tx_rxlock);
                        return;
                }
+               adapter->interrupt_status = isr_status;
 
                if (isr_status == 0) {
                        rsi_set_event(&common->tx_thread.event);
index 699e9da1a87bc408a06a22882ebe61607e905c98..c2e1c1ce285ce57211c7f3f2511c8060b096e130 100644 (file)
@@ -275,6 +275,7 @@ struct rsi_hw {
        bool blcmd_timer_expired;
        u32 flash_capacity;
        struct eepromrw_info eeprom;
+       u32 interrupt_status;
        u8 dfs_region;
        void *rsi_dev;
        struct rsi_host_intf_ops *host_intf_ops;
index cbbc0448dc40dc99915fd0470bb664c9ac0aa662..3cf67565feb133c69d69efb017fcdb8be2cd8734 100644 (file)
@@ -41,6 +41,7 @@ enum sdio_interrupt_type {
 #define PKT_BUFF_FULL                           1
 #define PKT_MGMT_BUFF_FULL                      2
 #define MSDU_PKT_PENDING                        3
+#define RECV_NUM_BLOCKS                         4
 /* Interrupt Bit Related Macros */
 #define PKT_BUFF_AVAILABLE                      1
 #define FW_ASSERT_IND                           2