diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-09-10 19:11:21 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-10-07 16:39:27 -0400 |
commit | 9e4bffd233f27fe83fc48efb01935aee7d0685bf (patch) | |
tree | 9c7444e68bda2774284dcff2eddacbdef8890932 /drivers/net/wireless/ath/ath9k/hw.h | |
parent | 867633f026456ff71d4c4890f502c7a61b2adac0 (diff) |
atheros/ath9k: add common read/write ops and port ath9k to use it
In an effort to make hw code driver core agnostic read
and write operations are defined on the ath_common structure.
This patch adds that and makes ath9k use it. This allows
drivers like ath9k_htc to define its own read/write ops and
still rely on the same hw code. This also paves the way for
sharing code between ath9k/ath5k/ath9k_htc.
Signed-off-by: Luis R. Rodriguez <lrodriguez@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 | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index f460a06b86ac..ae351a183416 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -51,8 +51,11 @@ | |||
51 | #define AT9285_COEX3WIRE_DA_SUBSYSID 0x30ab | 51 | #define AT9285_COEX3WIRE_DA_SUBSYSID 0x30ab |
52 | 52 | ||
53 | /* Register read/write primitives */ | 53 | /* Register read/write primitives */ |
54 | #define REG_WRITE(_ah, _reg, _val) ath9k_iowrite32((_ah), (_reg), (_val)) | 54 | #define REG_WRITE(_ah, _reg, _val) \ |
55 | #define REG_READ(_ah, _reg) ath9k_ioread32((_ah), (_reg)) | 55 | ath9k_hw_common(_ah)->ops->write((_ah), (_val), (_reg)) |
56 | |||
57 | #define REG_READ(_ah, _reg) \ | ||
58 | ath9k_hw_common(_ah)->ops->read((_ah), (_reg)) | ||
56 | 59 | ||
57 | #define SM(_v, _f) (((_v) << _f##_S) & _f) | 60 | #define SM(_v, _f) (((_v) << _f##_S) & _f) |
58 | #define MS(_v, _f) (((_v) & _f) >> _f##_S) | 61 | #define MS(_v, _f) (((_v) & _f) >> _f##_S) |
@@ -588,6 +591,16 @@ struct ath_hw { | |||
588 | struct ath_gen_timer_table hw_gen_timers; | 591 | struct ath_gen_timer_table hw_gen_timers; |
589 | }; | 592 | }; |
590 | 593 | ||
594 | static inline struct ath_common *ath9k_hw_common(struct ath_hw *ah) | ||
595 | { | ||
596 | return &ah->common; | ||
597 | } | ||
598 | |||
599 | static inline struct ath_regulatory *ath9k_hw_regulatory(struct ath_hw *ah) | ||
600 | { | ||
601 | return &(ath9k_hw_common(ah)->regulatory); | ||
602 | } | ||
603 | |||
591 | /* Initialization, Detach, Reset */ | 604 | /* Initialization, Detach, Reset */ |
592 | const char *ath9k_hw_probe(u16 vendorid, u16 devid); | 605 | const char *ath9k_hw_probe(u16 vendorid, u16 devid); |
593 | void ath9k_hw_detach(struct ath_hw *ah); | 606 | void ath9k_hw_detach(struct ath_hw *ah); |