diff options
author | Vasanthakumar Thiagarajan <vasanth@atheros.com> | 2009-08-26 11:38:49 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-08-28 14:40:51 -0400 |
commit | ff155a45cea56ad7a90c3f5192db59a4c7812fde (patch) | |
tree | 3733ebad8263ba4c92e9ad429b901e56958d8c76 /drivers/net/wireless/ath/ath9k/hw.h | |
parent | 81fa16fbe06cb3a4d29cc5a6f925132554521c72 (diff) |
ath9k: Add infrastructure for generic hw timers
Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/hw.h')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index de10de8370d2..052a9c4ebb92 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -237,6 +237,7 @@ enum ath9k_int { | |||
237 | ATH9K_INT_GPIO = 0x01000000, | 237 | ATH9K_INT_GPIO = 0x01000000, |
238 | ATH9K_INT_CABEND = 0x02000000, | 238 | ATH9K_INT_CABEND = 0x02000000, |
239 | ATH9K_INT_TSFOOR = 0x04000000, | 239 | ATH9K_INT_TSFOOR = 0x04000000, |
240 | ATH9K_INT_GENTIMER = 0x08000000, | ||
240 | ATH9K_INT_CST = 0x10000000, | 241 | ATH9K_INT_CST = 0x10000000, |
241 | ATH9K_INT_GTT = 0x20000000, | 242 | ATH9K_INT_GTT = 0x20000000, |
242 | ATH9K_INT_FATAL = 0x40000000, | 243 | ATH9K_INT_FATAL = 0x40000000, |
@@ -390,6 +391,41 @@ struct ath9k_hw_version { | |||
390 | u16 analog2GhzRev; | 391 | u16 analog2GhzRev; |
391 | }; | 392 | }; |
392 | 393 | ||
394 | /* Generic TSF timer definitions */ | ||
395 | |||
396 | #define ATH_MAX_GEN_TIMER 16 | ||
397 | |||
398 | #define AR_GENTMR_BIT(_index) (1 << (_index)) | ||
399 | |||
400 | /* | ||
401 | * Using de Bruijin sequence to to look up 1's index in a 32 bit number | ||
402 | * debruijn32 = 0000 0111 0111 1100 1011 0101 0011 0001 | ||
403 | */ | ||
404 | #define debruijn32 0x077CB531UL | ||
405 | |||
406 | struct ath_gen_timer_configuration { | ||
407 | u32 next_addr; | ||
408 | u32 period_addr; | ||
409 | u32 mode_addr; | ||
410 | u32 mode_mask; | ||
411 | }; | ||
412 | |||
413 | struct ath_gen_timer { | ||
414 | void (*trigger)(void *arg); | ||
415 | void (*overflow)(void *arg); | ||
416 | void *arg; | ||
417 | u8 index; | ||
418 | }; | ||
419 | |||
420 | struct ath_gen_timer_table { | ||
421 | u32 gen_timer_index[32]; | ||
422 | struct ath_gen_timer *timers[ATH_MAX_GEN_TIMER]; | ||
423 | union { | ||
424 | unsigned long timer_bits; | ||
425 | u16 val; | ||
426 | } timer_mask; | ||
427 | }; | ||
428 | |||
393 | struct ath_hw { | 429 | struct ath_hw { |
394 | struct ath_softc *ah_sc; | 430 | struct ath_softc *ah_sc; |
395 | struct ath9k_hw_version hw_version; | 431 | struct ath9k_hw_version hw_version; |
@@ -536,6 +572,10 @@ struct ath_hw { | |||
536 | struct ar5416IniArray iniModesAdditional; | 572 | struct ar5416IniArray iniModesAdditional; |
537 | struct ar5416IniArray iniModesRxGain; | 573 | struct ar5416IniArray iniModesRxGain; |
538 | struct ar5416IniArray iniModesTxGain; | 574 | struct ar5416IniArray iniModesTxGain; |
575 | |||
576 | u32 intr_gen_timer_trigger; | ||
577 | u32 intr_gen_timer_thresh; | ||
578 | struct ath_gen_timer_table hw_gen_timers; | ||
539 | }; | 579 | }; |
540 | 580 | ||
541 | /* Initialization, Detach, Reset */ | 581 | /* Initialization, Detach, Reset */ |
@@ -611,4 +651,16 @@ bool ath9k_hw_intrpend(struct ath_hw *ah); | |||
611 | bool ath9k_hw_getisr(struct ath_hw *ah, enum ath9k_int *masked); | 651 | bool ath9k_hw_getisr(struct ath_hw *ah, enum ath9k_int *masked); |
612 | enum ath9k_int ath9k_hw_set_interrupts(struct ath_hw *ah, enum ath9k_int ints); | 652 | enum ath9k_int ath9k_hw_set_interrupts(struct ath_hw *ah, enum ath9k_int ints); |
613 | 653 | ||
654 | /* Generic hw timer primitives */ | ||
655 | struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah, | ||
656 | void (*trigger)(void *), | ||
657 | void (*overflow)(void *), | ||
658 | void *arg, | ||
659 | u8 timer_index); | ||
660 | void ath_gen_timer_start(struct ath_hw *ah, struct ath_gen_timer *timer, | ||
661 | u32 timer_next, u32 timer_period); | ||
662 | void ath_gen_timer_stop(struct ath_hw *ah, struct ath_gen_timer *timer); | ||
663 | void ath_gen_timer_free(struct ath_hw *ah, struct ath_gen_timer *timer); | ||
664 | void ath_gen_timer_isr(struct ath_hw *hw); | ||
665 | |||
614 | #endif | 666 | #endif |