carl9170 firmware: outsource obsolete TX DMA bump code
authorChristian Lamparter <chunkeey@googlemail.com>
Mon, 13 Sep 2010 21:13:09 +0000 (23:13 +0200)
committerChristian Lamparter <chunkeey@googlemail.com>
Mon, 13 Sep 2010 21:13:09 +0000 (23:13 +0200)
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
carlfw/Kconfig
carlfw/src/wlan.c

index 61824de890a4f3fc8980065ab4446654c24ff51b..f5d11168b0b9b766712a34d0006acb328b48ed90 100644 (file)
@@ -246,6 +246,11 @@ config CARL9170FW_USB_MODESWITCH
         Mostly implemented, but untested and some serious
         doubts remain.
 
+config CARL9170FW_DMA_QUEUE_BUMP
+       def_bool n
+       prompt "Bump a stuck TX queue before doing a MAC reset"
+       depends on CARL9170FW_BROKEN_FEATURES
+
 menu "Build Options"
 config CARL9170FW_AGGRESSIVE_CFLAGS
        def_bool y
index 09f48fdc43b4640fbcfaf595eab10730c07a95ce..b6c0e34958c51eed0ad2f84e4bd1f9cc3ae0f075 100644 (file)
@@ -38,12 +38,40 @@ static void wlan_txunstuck(unsigned int queue)
        wlan_trigger(BIT(queue));
 }
 
+#ifdef CONFIG_CARL9170FW_DMA_QUEUE_BUMP
 static void wlan_txupdate(unsigned int queue)
 {
        set_wlan_txq_dma_addr(queue, ((uint32_t) fw.wlan.tx_queue[queue].head));
        wlan_trigger(BIT(queue));
 }
 
+static void wlan_dma_bump(unsigned int qidx)
+{
+       unsigned int offset = qidx;
+       uint32_t status, trigger;
+
+       status = get(AR9170_MAC_REG_DMA_STATUS) >> 12;
+       trigger = get(AR9170_MAC_REG_DMA_TRIGGER) >> 12;
+
+       while (offset != 0) {
+               status >>= 4;
+               trigger >>= 4;
+               offset--;
+       }
+
+       status &= 0xf;
+       trigger &= 0xf;
+
+       if ((trigger == 0xa) && (status == 0x8)) {
+               DBG("UNSTUCK");
+               wlan_txunstuck(qidx);
+       } else {
+               DBG("UPDATE");
+               wlan_txupdate(qidx);
+       }
+}
+#endif /* CONFIG_CARL9170FW_DMA_QUEUE_BUMP */
+
 #ifdef CONFIG_CARL9170FW_DEBUG
 static void wlan_dump_queue(unsigned int qidx)
 {
@@ -812,32 +840,6 @@ void handle_wlan(void)
 #undef HANDLER
 }
 
-static void wlan_dma_bump(unsigned int qidx)
-{
-       unsigned int offset = qidx;
-       uint32_t status, trigger;
-
-       status = get(AR9170_MAC_REG_DMA_STATUS) >> 12;
-       trigger = get(AR9170_MAC_REG_DMA_TRIGGER) >> 12;
-
-       while (offset != 0) {
-               status >>= 4;
-               trigger >>= 4;
-               offset--;
-       }
-
-       status &= 0xf;
-       trigger &= 0xf;
-
-       if ((trigger == 0xa) && (status == 0x8)) {
-               DBG("UNSTUCK");
-               wlan_txunstuck(qidx);
-       } else {
-               DBG("UPDATE");
-               wlan_txupdate(qidx);
-       }
-}
-
 static void wlan_check_hang(void)
 {
        struct dma_desc *desc;
@@ -881,6 +883,7 @@ static void wlan_check_hang(void)
                        }
 #endif /* CONFIG_CARL9170FW_DEBUG */
 
+#ifdef CONFIG_CARL9170FW_DMA_QUEUE_BUMP
                        if (unlikely(fw.wlan.last_tx_desc_num[i] > 3)) {
                                /*
                                 * Hrrm, bump the queue a bit.
@@ -889,6 +892,7 @@ static void wlan_check_hang(void)
 
                                wlan_dma_bump(i);
                        }
+#endif /* CONFIG_CARL9170FW_DMA_QUEUE_BUMP */
                } else {
                        /* Nothing stuck */
                        fw.wlan.last_tx_desc[i] = desc;