diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-09-13 05:08:34 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-10-07 16:39:28 -0400 |
commit | cd9bf689600e62d84449d65b3d25fb6d2757589e (patch) | |
tree | f9d0569c8b37ccd0a380c75bfbd528e511cd5ceb | |
parent | b002a4a950e41326310795cf4a0c74d0e90fa70a (diff) |
ath9k: separate core driver and hw timer code
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.c | 22 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.h | 9 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/main.c | 44 |
3 files changed, 47 insertions, 28 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 177244b2b6b9..e6ca3158759b 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -4136,9 +4136,10 @@ struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah, | |||
4136 | return timer; | 4136 | return timer; |
4137 | } | 4137 | } |
4138 | 4138 | ||
4139 | void ath_gen_timer_start(struct ath_hw *ah, | 4139 | void ath9k_hw_gen_timer_start(struct ath_hw *ah, |
4140 | struct ath_gen_timer *timer, | 4140 | struct ath_gen_timer *timer, |
4141 | u32 timer_next, u32 timer_period) | 4141 | u32 timer_next, |
4142 | u32 timer_period) | ||
4142 | { | 4143 | { |
4143 | struct ath_gen_timer_table *timer_table = &ah->hw_gen_timers; | 4144 | struct ath_gen_timer_table *timer_table = &ah->hw_gen_timers; |
4144 | u32 tsf; | 4145 | u32 tsf; |
@@ -4173,15 +4174,9 @@ void ath_gen_timer_start(struct ath_hw *ah, | |||
4173 | REG_SET_BIT(ah, AR_IMR_S5, | 4174 | REG_SET_BIT(ah, AR_IMR_S5, |
4174 | (SM(AR_GENTMR_BIT(timer->index), AR_IMR_S5_GENTIMER_THRESH) | | 4175 | (SM(AR_GENTMR_BIT(timer->index), AR_IMR_S5_GENTIMER_THRESH) | |
4175 | SM(AR_GENTMR_BIT(timer->index), AR_IMR_S5_GENTIMER_TRIG))); | 4176 | SM(AR_GENTMR_BIT(timer->index), AR_IMR_S5_GENTIMER_TRIG))); |
4176 | |||
4177 | if ((ah->ah_sc->imask & ATH9K_INT_GENTIMER) == 0) { | ||
4178 | ath9k_hw_set_interrupts(ah, 0); | ||
4179 | ah->ah_sc->imask |= ATH9K_INT_GENTIMER; | ||
4180 | ath9k_hw_set_interrupts(ah, ah->ah_sc->imask); | ||
4181 | } | ||
4182 | } | 4177 | } |
4183 | 4178 | ||
4184 | void ath_gen_timer_stop(struct ath_hw *ah, struct ath_gen_timer *timer) | 4179 | void ath9k_hw_gen_timer_stop(struct ath_hw *ah, struct ath_gen_timer *timer) |
4185 | { | 4180 | { |
4186 | struct ath_gen_timer_table *timer_table = &ah->hw_gen_timers; | 4181 | struct ath_gen_timer_table *timer_table = &ah->hw_gen_timers; |
4187 | 4182 | ||
@@ -4200,13 +4195,6 @@ void ath_gen_timer_stop(struct ath_hw *ah, struct ath_gen_timer *timer) | |||
4200 | SM(AR_GENTMR_BIT(timer->index), AR_IMR_S5_GENTIMER_TRIG))); | 4195 | SM(AR_GENTMR_BIT(timer->index), AR_IMR_S5_GENTIMER_TRIG))); |
4201 | 4196 | ||
4202 | clear_bit(timer->index, &timer_table->timer_mask.timer_bits); | 4197 | clear_bit(timer->index, &timer_table->timer_mask.timer_bits); |
4203 | |||
4204 | /* if no timer is enabled, turn off interrupt mask */ | ||
4205 | if (timer_table->timer_mask.val == 0) { | ||
4206 | ath9k_hw_set_interrupts(ah, 0); | ||
4207 | ah->ah_sc->imask &= ~ATH9K_INT_GENTIMER; | ||
4208 | ath9k_hw_set_interrupts(ah, ah->ah_sc->imask); | ||
4209 | } | ||
4210 | } | 4198 | } |
4211 | 4199 | ||
4212 | void ath_gen_timer_free(struct ath_hw *ah, struct ath_gen_timer *timer) | 4200 | void ath_gen_timer_free(struct ath_hw *ah, struct ath_gen_timer *timer) |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index 1f6dece9b007..32401742751e 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -682,9 +682,12 @@ struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah, | |||
682 | void (*overflow)(void *), | 682 | void (*overflow)(void *), |
683 | void *arg, | 683 | void *arg, |
684 | u8 timer_index); | 684 | u8 timer_index); |
685 | void ath_gen_timer_start(struct ath_hw *ah, struct ath_gen_timer *timer, | 685 | void ath9k_hw_gen_timer_start(struct ath_hw *ah, |
686 | u32 timer_next, u32 timer_period); | 686 | struct ath_gen_timer *timer, |
687 | void ath_gen_timer_stop(struct ath_hw *ah, struct ath_gen_timer *timer); | 687 | u32 timer_next, |
688 | u32 timer_period); | ||
689 | void ath9k_hw_gen_timer_stop(struct ath_hw *ah, struct ath_gen_timer *timer); | ||
690 | |||
688 | void ath_gen_timer_free(struct ath_hw *ah, struct ath_gen_timer *timer); | 691 | void ath_gen_timer_free(struct ath_hw *ah, struct ath_gen_timer *timer); |
689 | void ath_gen_timer_isr(struct ath_hw *hw); | 692 | void ath_gen_timer_isr(struct ath_hw *hw); |
690 | u32 ath9k_hw_gettsf32(struct ath_hw *ah); | 693 | u32 ath9k_hw_gettsf32(struct ath_hw *ah); |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 693555728eab..571a0d9c8605 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -1408,6 +1408,34 @@ static void ath9k_btcoex_bt_stomp(struct ath_softc *sc, | |||
1408 | ath9k_hw_btcoex_enable(ah); | 1408 | ath9k_hw_btcoex_enable(ah); |
1409 | } | 1409 | } |
1410 | 1410 | ||
1411 | static void ath9k_gen_timer_start(struct ath_hw *ah, | ||
1412 | struct ath_gen_timer *timer, | ||
1413 | u32 timer_next, | ||
1414 | u32 timer_period) | ||
1415 | { | ||
1416 | ath9k_hw_gen_timer_start(ah, timer, timer_next, timer_period); | ||
1417 | |||
1418 | if ((ah->ah_sc->imask & ATH9K_INT_GENTIMER) == 0) { | ||
1419 | ath9k_hw_set_interrupts(ah, 0); | ||
1420 | ah->ah_sc->imask |= ATH9K_INT_GENTIMER; | ||
1421 | ath9k_hw_set_interrupts(ah, ah->ah_sc->imask); | ||
1422 | } | ||
1423 | } | ||
1424 | |||
1425 | static void ath9k_gen_timer_stop(struct ath_hw *ah, struct ath_gen_timer *timer) | ||
1426 | { | ||
1427 | struct ath_gen_timer_table *timer_table = &ah->hw_gen_timers; | ||
1428 | |||
1429 | ath9k_hw_gen_timer_stop(ah, timer); | ||
1430 | |||
1431 | /* if no timer is enabled, turn off interrupt mask */ | ||
1432 | if (timer_table->timer_mask.val == 0) { | ||
1433 | ath9k_hw_set_interrupts(ah, 0); | ||
1434 | ah->ah_sc->imask &= ~ATH9K_INT_GENTIMER; | ||
1435 | ath9k_hw_set_interrupts(ah, ah->ah_sc->imask); | ||
1436 | } | ||
1437 | } | ||
1438 | |||
1411 | /* | 1439 | /* |
1412 | * This is the master bt coex timer which runs for every | 1440 | * This is the master bt coex timer which runs for every |
1413 | * 45ms, bt traffic will be given priority during 55% of this | 1441 | * 45ms, bt traffic will be given priority during 55% of this |
@@ -1429,13 +1457,13 @@ static void ath_btcoex_period_timer(unsigned long data) | |||
1429 | 1457 | ||
1430 | if (btcoex->btcoex_period != btcoex->btcoex_no_stomp) { | 1458 | if (btcoex->btcoex_period != btcoex->btcoex_no_stomp) { |
1431 | if (btcoex->hw_timer_enabled) | 1459 | if (btcoex->hw_timer_enabled) |
1432 | ath_gen_timer_stop(ah, btcoex->no_stomp_timer); | 1460 | ath9k_gen_timer_stop(ah, btcoex->no_stomp_timer); |
1433 | 1461 | ||
1434 | ath_gen_timer_start(ah, | 1462 | ath9k_gen_timer_start(ah, |
1435 | btcoex->no_stomp_timer, | 1463 | btcoex->no_stomp_timer, |
1436 | (ath9k_hw_gettsf32(ah) + | 1464 | (ath9k_hw_gettsf32(ah) + |
1437 | btcoex->btcoex_no_stomp), | 1465 | btcoex->btcoex_no_stomp), |
1438 | btcoex->btcoex_no_stomp * 10); | 1466 | btcoex->btcoex_no_stomp * 10); |
1439 | btcoex->hw_timer_enabled = true; | 1467 | btcoex->hw_timer_enabled = true; |
1440 | } | 1468 | } |
1441 | 1469 | ||
@@ -2165,7 +2193,7 @@ static void ath9k_btcoex_timer_resume(struct ath_softc *sc) | |||
2165 | 2193 | ||
2166 | /* make sure duty cycle timer is also stopped when resuming */ | 2194 | /* make sure duty cycle timer is also stopped when resuming */ |
2167 | if (btcoex->hw_timer_enabled) | 2195 | if (btcoex->hw_timer_enabled) |
2168 | ath_gen_timer_stop(sc->sc_ah, btcoex->no_stomp_timer); | 2196 | ath9k_gen_timer_stop(sc->sc_ah, btcoex->no_stomp_timer); |
2169 | 2197 | ||
2170 | btcoex->bt_priority_cnt = 0; | 2198 | btcoex->bt_priority_cnt = 0; |
2171 | btcoex->bt_priority_time = jiffies; | 2199 | btcoex->bt_priority_time = jiffies; |
@@ -2407,7 +2435,7 @@ static void ath9k_btcoex_timer_pause(struct ath_softc *sc) | |||
2407 | del_timer_sync(&btcoex->period_timer); | 2435 | del_timer_sync(&btcoex->period_timer); |
2408 | 2436 | ||
2409 | if (btcoex->hw_timer_enabled) | 2437 | if (btcoex->hw_timer_enabled) |
2410 | ath_gen_timer_stop(ah, btcoex->no_stomp_timer); | 2438 | ath9k_gen_timer_stop(ah, btcoex->no_stomp_timer); |
2411 | 2439 | ||
2412 | btcoex->hw_timer_enabled = false; | 2440 | btcoex->hw_timer_enabled = false; |
2413 | } | 2441 | } |