ath9k: Fix bug in configuring hw timer
authorVasanthakumar Thiagarajan <vasanth@atheros.com>
Thu, 21 Apr 2011 13:03:27 +0000 (18:33 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 25 Apr 2011 18:50:16 +0000 (14:50 -0400)
Hw next tigger time is configured as current_tsf + (timer_period * 10) which
is wrong, it should be current_tsf + timer_period. The wrong hw timer configuration
would cause btcoex related issues.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/gpio.c
drivers/net/wireless/ath/ath9k/hw.c

index 44a0a88..cc5fad6 100644 (file)
@@ -138,10 +138,10 @@ static void ath_detect_bt_priority(struct ath_softc *sc)
 
 static void ath9k_gen_timer_start(struct ath_hw *ah,
                                  struct ath_gen_timer *timer,
-                                 u32 timer_next,
+                                 u32 trig_timeout,
                                  u32 timer_period)
 {
-       ath9k_hw_gen_timer_start(ah, timer, timer_next, timer_period);
+       ath9k_hw_gen_timer_start(ah, timer, trig_timeout, timer_period);
 
        if ((ah->imask & ATH9K_INT_GENTIMER) == 0) {
                ath9k_hw_disable_interrupts(ah);
@@ -195,7 +195,7 @@ static void ath_btcoex_period_timer(unsigned long data)
 
                timer_period = is_btscan ? btcoex->btscan_no_stomp :
                                           btcoex->btcoex_no_stomp;
-               ath9k_gen_timer_start(ah, btcoex->no_stomp_timer, 0,
+               ath9k_gen_timer_start(ah, btcoex->no_stomp_timer, timer_period,
                                      timer_period * 10);
                btcoex->hw_timer_enabled = true;
        }
index 0fcfa59..577ca59 100644 (file)
@@ -2430,11 +2430,11 @@ EXPORT_SYMBOL(ath_gen_timer_alloc);
 
 void ath9k_hw_gen_timer_start(struct ath_hw *ah,
                              struct ath_gen_timer *timer,
-                             u32 timer_next,
+                             u32 trig_timeout,
                              u32 timer_period)
 {
        struct ath_gen_timer_table *timer_table = &ah->hw_gen_timers;
-       u32 tsf;
+       u32 tsf, timer_next;
 
        BUG_ON(!timer_period);
 
@@ -2442,18 +2442,13 @@ void ath9k_hw_gen_timer_start(struct ath_hw *ah,
 
        tsf = ath9k_hw_gettsf32(ah);
 
+       timer_next = tsf + trig_timeout;
+
        ath_dbg(ath9k_hw_common(ah), ATH_DBG_HWTIMER,
                "current tsf %x period %x timer_next %x\n",
                tsf, timer_period, timer_next);
 
        /*
-        * Pull timer_next forward if the current TSF already passed it
-        * because of software latency
-        */
-       if (timer_next < tsf)
-               timer_next = tsf + timer_period;
-
-       /*
         * Program generic timer registers
         */
        REG_WRITE(ah, gen_tmr_configuration[timer->index].next_addr,