ath9k_hw: Add hardware code for WoW
PATCH v4 7/10 ath9k_hw: Add hardware code for WoW
From: Mohammed Shafi Shajakhan <[email protected]>
add a new file wow.c which takes care of the hardware code for WoW.
*program the descriptors and data words to periodically send Keep Alive Frames.
*program the user defined patterns/masks and pattern length in the hardware registers.
*'ath9k_hw_wow_enable' is called during the drivers suspend callback which takes care of the following
- tracking wow event mask (to suppress spurious wow events)
- properly configure suspend/resume WAR registers
- configure PCIE PM control register
- configure MAC WoW registers and their timeouts
- enabling wow configuration like magic packet, user patterns based on users configuration
- configuring timeouts for KAL, beacon miss, aifs, slot time, backoff
- create Keep Alive Pattern ('KAL')
*'ath9k_hw_wow_wakeup' is called during the drivers resume callback which takes care of the following
- primary task is to find the reason for wakeup from the wow status register
- configure/restore AR_PCIE_PM_CTRL register
- clear all WoW events
- configure/restore suspend/resume WAR registers
--- drivers/net/wireless/ath/ath9k/Makefile | 1 + drivers/net/wireless/ath/ath9k/hw.h | 31 ++ drivers/net/wireless/ath/ath9k/wow.c | 532 +++++++++++++++++++++++++++++++ 3 files changed, 564 insertions(+), 0 deletions(-) create mode 100644 drivers/net/wireless/ath/ath9k/wow.c
drivers/net/wireless/ath/ath9k/Makefile +1 -0
@@ -17,6 +17,7 @@ ath9k-$(CONFIG_ATH9K_DFS_CERTIFIED) += \ dfs.o \ dfs_pattern_detector.o \ dfs_pri_detector.o +ath9k-$(CONFIG_PM_SLEEP) += wow.o obj-$(CONFIG_ATH9K) += ath9k.o
drivers/net/wireless/ath/ath9k/hw.h +31 -0
@@ -1112,6 +1112,37 @@ ath9k_hw_get_btcoex_scheme(struct ath_hw *ah) }#endif /* CONFIG_ATH9K_BTCOEX_SUPPORT */ + +#ifdef CONFIG_PM_SLEEP +const char *ath9k_hw_wow_event_to_string (u32 wow_event); +void ath9k_hw_wow_apply_pattern (struct ath_hw *ah,u8 *user_pattern, +u8 *user_mask,int pattern_count, +int pattern_len); +u32 ath9k_hw_wow_wakeup (struct ath_hw *ah); +void ath9k_hw_wow_enable (struct ath_hw *ah,u32 pattern_enable); +#else +static inline const char *ath9k_hw_wow_event_to_string (u32 wow_event) +{ +return NULL ; +} +static inline void ath9k_hw_wow_apply_pattern (struct ath_hw *ah, +u8 *user_pattern, +u8 *user_mask, +int pattern_count, +int pattern_len) +{ +} +static inline u32 ath9k_hw_wow_wakeup (struct ath_hw *ah) +{ +return 0 ; +} +static inline void ath9k_hw_wow_enable (struct ath_hw *ah,u32 pattern_enable) +{ +} +#endif + + +#define ATH9K_CLOCK_RATE_CCK 22#define ATH9K_CLOCK_RATE_5GHZ_OFDM 40#define ATH9K_CLOCK_RATE_2GHZ_OFDM 44
drivers/net/wireless/ath/ath9k/wow.c new file +532 -0
532 lines not on this page · raw message
Signature · 1 line
1.7.0.4