ath9k patches
cover ath9k patches
From: Sujith Manoharan <[email protected]>
ath9k patches for -next.
Sujith Manoharan (17):
ath9k: Remove ATH9K_HW_WOW_DEVICE_CAPABLE
ath9k: Return early for error conditions
ath9k: Remove redundant device_can_wakeup() check
ath9k: Check early for multi-vif/STA conditions
ath9k: Check multi-channel context for WOW
ath9k: Fix wow init/deinit
ath9k: Check WOW triggers properly
ath9k: Remove unused BMISS processing
ath9k: Remove ath9k_hw_wow_event_to_string
ath9k: Add a debugfs file for WOW
ath9k: Simplify user pattern configuration
ath9k: Add a HW structure for WOW
ath9k: Register max WOW patterns
ath9k: Move WOW registers to reg_wow.h
ath9k: Remove incorrect register macros
ath9k: Cleanup reg_wow.h
ath9k: Fix max pattern check
drivers/net/wireless/ath/ath.h | 1 + drivers/net/wireless/ath/ath9k/ar9003_wow.c | 38 ++--- drivers/net/wireless/ath/ath9k/ath9k.h | 13 +- drivers/net/wireless/ath/ath9k/debug.c | 68 +++++++++ drivers/net/wireless/ath/ath9k/hw.c | 10 +- drivers/net/wireless/ath/ath9k/hw.h | 34 ++--- drivers/net/wireless/ath/ath9k/init.c | 1 + drivers/net/wireless/ath/ath9k/main.c | 9 -- drivers/net/wireless/ath/ath9k/pci.c | 5 +- drivers/net/wireless/ath/ath9k/reg.h | 120 ---------------- drivers/net/wireless/ath/ath9k/reg_wow.h | 93 ++++++++++++ drivers/net/wireless/ath/ath9k/wow.c | 212 ++++++++++++---------------- 12 files changed, 301 insertions(+), 303 deletions(-) create mode 100644 drivers/net/wireless/ath/ath9k/reg_wow.h
Signature · 1 line
2.2.2
PATCH 1/17 ath9k: Remove ATH9K_HW_WOW_DEVICE_CAPABLE
From: Sujith Manoharan <[email protected]>
Enabling WOW based on the chip is incorrect since it needs to be done for specific sub-devices which have proper platform support.
--- drivers/net/wireless/ath/ath9k/hw.c | 3 --- drivers/net/wireless/ath/ath9k/hw.h | 2 -- drivers/net/wireless/ath/ath9k/wow.c | 4 +--- 3 files changed, 1 insertion(+), 8 deletions(-)
drivers/net/wireless/ath/ath9k/hw.c +0 -3
@@ -2544,9 +2544,6 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) pCap->hw_caps |=ATH9K_HW_CAP_RTT ; } -if (AR_SREV_9462 (ah)) - pCap->hw_caps |=ATH9K_HW_WOW_DEVICE_CAPABLE ; -if (AR_SREV_9300_20_OR_LATER (ah) && ah->eep_ops->get_eeprom (ah,EEP_PAPRD )) pCap->hw_caps |=ATH9K_HW_CAP_PAPRD ;
drivers/net/wireless/ath/ath9k/hw.h +0 -2
@@ -248,12 +248,10 @@ enum ath9k_hw_caps {#ifdef CONFIG_ATH9K_PCOEM ATH9K_HW_CAP_RTT =BIT (14 ),ATH9K_HW_CAP_MCI =BIT (15 ), -ATH9K_HW_WOW_DEVICE_CAPABLE =BIT (16 ),ATH9K_HW_CAP_BT_ANT_DIV =BIT (17 ), #elseATH9K_HW_CAP_RTT =0 ,ATH9K_HW_CAP_MCI =0 , -ATH9K_HW_WOW_DEVICE_CAPABLE =0 ,ATH9K_HW_CAP_BT_ANT_DIV =0 , #endif ATH9K_HW_CAP_DFS = BIT(18),
drivers/net/wireless/ath/ath9k/wow.c +1 -3
@@ -352,9 +352,7 @@ void ath9k_init_wow(struct ieee80211_hw *hw) {struct ath_softc *sc = hw->priv; -if ((sc->sc_ah->caps.hw_caps &ATH9K_HW_WOW_DEVICE_CAPABLE ) && - (sc->driver_data &ATH9K_PCI_WOW ) && -device_can_wakeup (sc->dev)) +if ((sc->driver_data &ATH9K_PCI_WOW ) &&device_can_wakeup (sc->dev)) hw->wiphy->wowlan = &ath9k_wowlan_support;atomic_set (&sc->wow_sleep_proc_intr,-1 );
Signature · 1 line
2.2.2
PATCH 2/17 ath9k: Return early for error conditions
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
Do not try to cancel work instances and ANI when the device is not present or WOW triggers are not configured. Bail out early and use ath_err() for such error conditions.
--- drivers/net/wireless/ath/ath9k/wow.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath9k/wow.c +6 -6
@@ -197,21 +197,21 @@ int ath9k_suspend(struct ieee80211_hw *hw,mutex_lock (&sc->mutex); -ath_cancel_work (sc); -ath_stop_ani (sc); -if (test_bit (ATH_OP_INVALID , &common->op_flags)) { -ath_dbg (common,ANY ,"Device not present\n" ); - ret = -EINVAL ; +ath_err (common,"Device not present\n" ); + ret = -ENODEV ; goto fail_wow; }if (WARN_ON (!wowlan)) { -ath_dbg (common,WOW ,"None of the WoW triggers enabled\n" ); +ath_err (common,"None of the WoW triggers enabled\n" ); ret = -EINVAL ; goto fail_wow; } +ath_cancel_work (sc); +ath_stop_ani (sc); +if (!device_can_wakeup (sc->dev)) {ath_dbg (common,WOW ,"device_can_wakeup failed, WoW is not enabled\n" ); ret =1 ;
Signature · 1 line
2.2.2
PATCH 3/17 ath9k: Remove redundant device_can_wakeup() check
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
WOW capability is registered with mac80211 only when the device has the ability to wakeup, so there is no need to check in the suspend() routine.
--- drivers/net/wireless/ath/ath9k/wow.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/net/wireless/ath/ath9k/wow.c +0 -6
@@ -212,12 +212,6 @@ int ath9k_suspend(struct ieee80211_hw *hw,ath_cancel_work (sc);ath_stop_ani (sc); -if (!device_can_wakeup (sc->dev)) { -ath_dbg (common,WOW ,"device_can_wakeup failed, WoW is not enabled\n" ); - ret =1 ; - goto fail_wow; - } -/* * none of the sta vifs are associated * and we are not currently handling multivif
Signature · 1 line
2.2.2
PATCH 4/17 ath9k: Check early for multi-vif/STA conditions
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
If multiple interfaces are active or there is no associated station interface, bail out early and return 1 so that mac80211 can proceed with the normal suspend routine.
--- drivers/net/wireless/ath/ath9k/wow.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-)
drivers/net/wireless/ath/ath9k/wow.c +7 -15
@@ -209,29 +209,21 @@ int ath9k_suspend(struct ieee80211_hw *hw, goto fail_wow; } -ath_cancel_work (sc); -ath_stop_ani (sc); - -/* -* none of the sta vifs are associated -* and we are not currently handling multivif -* cases, for instance we have to seperately -* configure 'keep alive frame' for each -* STA. -*/ - -if (!test_bit (ATH_OP_PRIM_STA_VIF , &common->op_flags)) { -ath_dbg (common,WOW ,"None of the STA vifs are associated\n" ); +if (sc->cur_chan->nvifs >1 ) { +ath_dbg (common,WOW ,"WoW for multivif is not yet supported\n" ); ret =1 ; goto fail_wow; } -if (sc->cur_chan->nvifs >1 ) { -ath_dbg (common,WOW ,"WoW for multivif is not yet supported\n" ); +if (!test_bit (ATH_OP_PRIM_STA_VIF , &common->op_flags)) { +ath_dbg (common,WOW ,"None of the STA vifs are associated\n" ); ret =1 ; goto fail_wow; } +ath_cancel_work (sc); +ath_stop_ani (sc); +ath9k_wow_map_triggers (sc, wowlan, &wow_triggers_enabled); ath_dbg(common, WOW, "WoW triggers enabled 0x%x\n",
Signature · 1 line
2.2.2
PATCH 5/17 ath9k: Check multi-channel context for WOW
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
If CONFIG_ATH9K_CHANNEL_CONTEXT is enabled, check whether multiple contexts are active and if so, return 1 without enabling WOW since we don't support it in this case.
--- drivers/net/wireless/ath/ath9k/wow.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/wireless/ath/ath9k/wow.c +9 -0
@@ -215,6 +215,15 @@ int ath9k_suspend(struct ieee80211_hw *hw, goto fail_wow; } +if (ath9k_is_chanctx_enabled ()) { +if (test_bit (ATH_OP_MULTI_CHANNEL , &common->op_flags)) { +ath_dbg (common,WOW , +"Multi-channel WOW is not supported\n" ); + ret =1 ; + goto fail_wow; + } + } +if (!test_bit (ATH_OP_PRIM_STA_VIF , &common->op_flags)) {ath_dbg (common,WOW ,"None of the STA vifs are associated\n" ); ret =1 ;
Signature · 1 line
2.2.2
PATCH 6/17 ath9k: Fix wow init/deinit
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
Registering the card as a wakeup source needs to be done once, during initialization. When the WOW configuration changes, the card's status as wakeup source needs to be changed too and this is done via the set_wakeup() callback. Also, make sure the device is removed properly using ath9k_deinit_wow().
--- drivers/net/wireless/ath/ath9k/ath9k.h | 4 ++++ drivers/net/wireless/ath/ath9k/init.c | 1 + drivers/net/wireless/ath/ath9k/wow.c | 22 ++++++++++++++++++---- 3 files changed, 23 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +4 -0
@@ -838,6 +838,7 @@ struct ath9k_wow_pattern {#ifdef CONFIG_ATH9K_WOW void ath9k_init_wow (struct ieee80211_hw *hw); +void ath9k_deinit_wow (struct ieee80211_hw *hw);int ath9k_suspend (struct ieee80211_hw *hw,struct cfg80211_wowlan *wowlan);int ath9k_resume (struct ieee80211_hw *hw);
@@ -846,6 +847,9 @@ void ath9k_set_wakeup(struct ieee80211_hw *hw, bool enabled);static inline void ath9k_init_wow (struct ieee80211_hw *hw) { } +static inline void ath9k_deinit_wow (struct ieee80211_hw *hw) +{ +}static inline int ath9k_suspend (struct ieee80211_hw *hw,struct cfg80211_wowlan *wowlan) {
drivers/net/wireless/ath/ath9k/init.c +1 -0
@@ -996,6 +996,7 @@ void ath9k_deinit_device(struct ath_softc *sc)ath9k_ps_restore (sc);ath9k_deinit_debug (sc); +ath9k_deinit_wow (hw);ieee80211_unregister_hw (hw);ath_rx_cleanup (sc);ath9k_deinit_softc (sc);
drivers/net/wireless/ath/ath9k/wow.c +18 -4
@@ -336,20 +336,34 @@ int ath9k_resume(struct ieee80211_hw *hw)void ath9k_set_wakeup (struct ieee80211_hw *hw,bool enabled) {struct ath_softc *sc = hw->priv; +struct ath_common *common =ath9k_hw_common (sc->sc_ah);mutex_lock (&sc->mutex); -device_init_wakeup (sc->dev,1 );device_set_wakeup_enable (sc->dev, enabled);mutex_unlock (&sc->mutex); + +ath_dbg (common,WOW ,"WoW wakeup source is %s\n" , + (enabled) ?"enabled" :"disabled" ); }void ath9k_init_wow (struct ieee80211_hw *hw) {struct ath_softc *sc = hw->priv; -if ((sc->driver_data &ATH9K_PCI_WOW ) &&device_can_wakeup (sc->dev)) +if (sc->driver_data &ATH9K_PCI_WOW ) { hw->wiphy->wowlan = &ath9k_wowlan_support; -atomic_set (&sc->wow_sleep_proc_intr,-1 ); -atomic_set (&sc->wow_got_bmiss_intr,-1 ); +atomic_set (&sc->wow_sleep_proc_intr,-1 ); +atomic_set (&sc->wow_got_bmiss_intr,-1 ); + +device_init_wakeup (sc->dev,1 ); + } +} + +void ath9k_deinit_wow (struct ieee80211_hw *hw) +{ +struct ath_softc *sc = hw->priv; + +if (sc->driver_data &ATH9K_PCI_WOW ) +device_init_wakeup (sc->dev,0 ); }
Signature · 1 line
2.2.2
PATCH 7/17 ath9k: Check WOW triggers properly
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
This patch makes sure that valid WOW triggers are present before trying to suspend the device. Also, introduce and use ATH_OP_WOW_ENABLED to bypass PCI suspend and clear it in resume().
--- drivers/net/wireless/ath/ath.h | 1 + drivers/net/wireless/ath/ath9k/pci.c | 5 +++- drivers/net/wireless/ath/ath9k/wow.c | 53 ++++++++++++++++-------------------- 3 files changed, 29 insertions(+), 30 deletions(-)
drivers/net/wireless/ath/ath.h +1 -0
@@ -64,6 +64,7 @@ enum ath_op_flags {ATH_OP_HW_RESET ,ATH_OP_SCANNING ,ATH_OP_MULTI_CHANNEL , + ATH_OP_WOW_ENABLED, }; enum ath_bus_type {
drivers/net/wireless/ath/ath9k/pci.c +4 -1
@@ -998,9 +998,12 @@ static int ath_pci_suspend(struct device *device)struct pci_dev *pdev =to_pci_dev (device);struct ieee80211_hw *hw =pci_get_drvdata (pdev);struct ath_softc *sc = hw->priv; +struct ath_common *common =ath9k_hw_common (sc->sc_ah); -if (sc->wow_enabled) +if (test_bit (ATH_OP_WOW_ENABLED , &common->op_flags)) { +dev_info (&pdev->dev,"WOW is enabled, bypassing PCI suspend\n" );return 0 ; + }/* The device has to be moved to FULLSLEEP forcibly. * Otherwise the chip never moved to full sleep,
drivers/net/wireless/ath/ath9k/wow.c +24 -29
134 lines not on this page · raw message
Signature · 1 line
2.2.2
PATCH 8/17 ath9k: Remove unused BMISS processing
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
The various variables tracking bmiss interrupts are not really used anywhere except in a debug message. Remove them since they have no functional purpose.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 2 -- drivers/net/wireless/ath/ath9k/main.c | 9 --------- drivers/net/wireless/ath/ath9k/wow.c | 18 ------------------ 3 files changed, 29 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +0 -2
@@ -1043,8 +1043,6 @@ struct ath_softc {s16 tx99_power;#ifdef CONFIG_ATH9K_WOW -atomic_t wow_got_bmiss_intr; -atomic_t wow_sleep_proc_intr;/* in the middle of WoW sleep ? */ u32 wow_intr_before_sleep;#endif };
drivers/net/wireless/ath/ath9k/main.c +0 -9
@@ -555,15 +555,6 @@ irqreturn_t ath_isr(int irq, void *dev) (status & ATH9K_INT_BB_WATCHDOG)) goto chip_reset; -#ifdef CONFIG_ATH9K_WOW -if (status &ATH9K_INT_BMISS ) { -if (atomic_read (&sc->wow_sleep_proc_intr) ==0 ) { -atomic_inc (&sc->wow_got_bmiss_intr); -atomic_dec (&sc->wow_sleep_proc_intr); - } - } -#endif -if (status &ATH9K_INT_SWBA )tasklet_schedule (&sc->bcon_tasklet);
drivers/net/wireless/ath/ath9k/wow.c +0 -18
@@ -269,7 +269,6 @@ int ath9k_suspend(struct ieee80211_hw *hw,ath9k_ps_restore (sc);ath_dbg (common,WOW ,"Suspend with WoW triggers: 0x%x\n" , triggers); -atomic_inc (&sc->wow_sleep_proc_intr);set_bit (ATH_OP_WOW_ENABLED , &common->op_flags); fail_wow:
@@ -299,19 +298,6 @@ int ath9k_resume(struct ieee80211_hw *hw) wow_status =ath9k_hw_wow_wakeup (ah); -if (atomic_read (&sc->wow_got_bmiss_intr) ==0 ) { -/* -* some devices may not pick beacon miss -* as the reason they woke up so we add -* that here for that shortcoming. -*/ - wow_status |=AH_WOW_BEACON_MISS ; -atomic_dec (&sc->wow_got_bmiss_intr); -ath_dbg (common,ANY ,"Beacon miss interrupt picked up during WoW sleep\n" ); - } - -atomic_dec (&sc->wow_sleep_proc_intr); -if (wow_status) {ath_dbg (common,ANY ,"Waking up due to WoW triggers %s with WoW status = %x\n" ,ath9k_hw_wow_event_to_string (wow_status), wow_status);
@@ -347,10 +333,6 @@ void ath9k_init_wow(struct ieee80211_hw *hw)if (sc->driver_data &ATH9K_PCI_WOW ) { hw->wiphy->wowlan = &ath9k_wowlan_support; - -atomic_set (&sc->wow_sleep_proc_intr,-1 ); -atomic_set (&sc->wow_got_bmiss_intr,-1 ); -device_init_wakeup (sc->dev,1 ); } }
Signature · 1 line
2.2.2
PATCH 9/17 ath9k: Remove ath9k_hw_wow_event_to_string
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
Printing the value of the wakeup status is sufficient.
--- drivers/net/wireless/ath/ath9k/ar9003_wow.c | 15 --------------- drivers/net/wireless/ath/ath9k/hw.h | 5 ----- drivers/net/wireless/ath/ath9k/wow.c | 10 +++------- 3 files changed, 3 insertions(+), 27 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_wow.c +0 -15
@@ -19,21 +19,6 @@#include "reg.h" #include "hw-ops.h" -const char *ath9k_hw_wow_event_to_string (u32 wow_event) -{ -if (wow_event &AH_WOW_MAGIC_PATTERN_EN ) -return "Magic pattern" ; -if (wow_event &AH_WOW_USER_PATTERN_EN ) -return "User pattern" ; -if (wow_event &AH_WOW_LINK_CHANGE ) -return "Link change" ; -if (wow_event &AH_WOW_BEACON_MISS ) -return "Beacon miss" ; - -return "unknown reason" ; -} -EXPORT_SYMBOL (ath9k_hw_wow_event_to_string); -static void ath9k_hw_set_powermode_wow_sleep (struct ath_hw *ah) {struct ath_common *common =ath9k_hw_common (ah);
drivers/net/wireless/ath/ath9k/hw.h +0 -5
@@ -1146,17 +1146,12 @@ ath9k_hw_get_btcoex_scheme(struct ath_hw *ah)#ifdef CONFIG_ATH9K_WOW -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,
drivers/net/wireless/ath/ath9k/wow.c +3 -7
@@ -281,7 +281,7 @@ int ath9k_resume(struct ieee80211_hw *hw)struct ath_softc *sc = hw->priv;struct ath_hw *ah = sc->sc_ah;struct ath_common *common =ath9k_hw_common (ah); -u32 wow_status; +u8 status;mutex_lock (&sc->mutex);
@@ -296,12 +296,8 @@ int ath9k_resume(struct ieee80211_hw *hw)spin_unlock_bh (&sc->sc_pcu_lock); - wow_status =ath9k_hw_wow_wakeup (ah); - -if (wow_status) { -ath_dbg (common,ANY ,"Waking up due to WoW triggers %s with WoW status = %x\n" , -ath9k_hw_wow_event_to_string (wow_status), wow_status); - } + status =ath9k_hw_wow_wakeup (ah); +ath_dbg (common,WOW ,"Resume with WoW status: 0x%x\n" , status);ath_restart_work (sc);ath9k_start_btcoex (sc);
Signature · 1 line
2.2.2
PATCH 10/17 ath9k: Add a debugfs file for WOW
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
This can be used to force WOW for cards that
are not present in the supported PCI ID list.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 1 + drivers/net/wireless/ath/ath9k/debug.c | 68 ++++++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath9k/wow.c | 4 +- 3 files changed, 71 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +1 -0
@@ -1044,6 +1044,7 @@ struct ath_softc {#ifdef CONFIG_ATH9K_WOW u32 wow_intr_before_sleep; +bool force_wow;#endif };
drivers/net/wireless/ath/ath9k/debug.c +68 -0
80 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/wow.c +2 -2
@@ -327,7 +327,7 @@ void ath9k_init_wow(struct ieee80211_hw *hw) {struct ath_softc *sc = hw->priv; -if (sc->driver_data &ATH9K_PCI_WOW ) { +if ((sc->driver_data &ATH9K_PCI_WOW ) || sc->force_wow) { hw->wiphy->wowlan = &ath9k_wowlan_support;device_init_wakeup (sc->dev,1 ); }
@@ -337,6 +337,6 @@ void ath9k_deinit_wow(struct ieee80211_hw *hw) {struct ath_softc *sc = hw->priv; -if (sc->driver_data &ATH9K_PCI_WOW ) +if ((sc->driver_data &ATH9K_PCI_WOW ) || sc->force_wow)device_init_wakeup (sc->dev,0 ); }
Signature · 1 line
2.2.2
PATCH 11/17 ath9k: Simplify user pattern configuration
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
There is no need to allocate a new structure and
free it for every user pattern, instead use local
variables.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 6 ----- drivers/net/wireless/ath/ath9k/wow.c | 49 +++++++++------------------------- 2 files changed, 12 insertions(+), 43 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +0 -6
@@ -830,12 +830,6 @@ static inline void ath_fill_led_pin(struct ath_softc *sc)/* Wake on Wireless LAN */ /************************/ -struct ath9k_wow_pattern { -u8 pattern_bytes[MAX_PATTERN_SIZE ]; -u8 mask_bytes[MAX_PATTERN_SIZE ]; -u32 pattern_len; -}; -#ifdef CONFIG_ATH9K_WOW void ath9k_init_wow (struct ieee80211_hw *hw);void ath9k_deinit_wow (struct ieee80211_hw *hw);
drivers/net/wireless/ath/ath9k/wow.c +12 -37
62 lines not on this page · raw message
Signature · 1 line
2.2.2
PATCH 12/17 ath9k: Add a HW structure for WOW
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
This can be used to hold the WOW state inath9k_hw.
--- drivers/net/wireless/ath/ath9k/ar9003_wow.c | 10 +++++----- drivers/net/wireless/ath/ath9k/hw.h | 6 +++++- 2 files changed, 10 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_wow.c +5 -5
@@ -137,7 +137,7 @@ void ath9k_hw_wow_apply_pattern(struct ath_hw *ah, u8 *user_pattern,* other fields */ - ah->wow_event_mask |=BIT (pattern_count +AR_WOW_PAT_FOUND_SHIFT ); + ah->wow.wow_event_mask |=BIT (pattern_count +AR_WOW_PAT_FOUND_SHIFT );if (pattern_count <4 ) {/* Pattern 0-3 uses AR_WOW_LENGTH1 register */
@@ -174,7 +174,7 @@ u32 ath9k_hw_wow_wakeup(struct ath_hw *ah)* register. This mask will clean it up. */ - val &= ah->wow_event_mask; + val &= ah->wow.wow_event_mask;if (val) {if (val &AR_WOW_MAGIC_PAT_FOUND )
@@ -218,7 +218,7 @@ u32 ath9k_hw_wow_wakeup(struct ath_hw *ah)if (ah->is_pciexpress)ath9k_hw_configpcipowersave (ah, false); - ah->wow_event_mask =0 ; + ah->wow.wow_event_mask =0 ;return wow_status; }
@@ -235,7 +235,7 @@ void ath9k_hw_wow_enable(struct ath_hw *ah, u32 pattern_enable)* are from the 'pattern_enable' in this function and * 'pattern_count' of ath9k_hw_wow_apply_pattern() */ - wow_event_mask = ah->wow_event_mask; + wow_event_mask = ah->wow.wow_event_mask;/* * Untie Power-on-Reset from the PCI-E-Reset. When we are in
@@ -402,6 +402,6 @@ void ath9k_hw_wow_enable(struct ath_hw *ah, u32 pattern_enable)REG_CLR_BIT (ah,AR_PCU_MISC_MODE3 , clr);ath9k_hw_set_powermode_wow_sleep (ah); - ah->wow_event_mask = wow_event_mask; + ah->wow.wow_event_mask = wow_event_mask; }EXPORT_SYMBOL (ath9k_hw_wow_enable);
drivers/net/wireless/ath/ath9k/hw.h +5 -1
@@ -270,6 +270,10 @@ enum ath9k_hw_caps {* of those types. */ +struct ath9k_hw_wow { +u32 wow_event_mask; +}; +struct ath9k_hw_capabilities {u32 hw_caps;/* ATH9K_HW_CAP_* from ath9k_hw_caps */ u16 rts_aggr_limit;
@@ -928,7 +932,7 @@ struct ath_hw {u32 ent_mode;#ifdef CONFIG_ATH9K_WOW -u32 wow_event_mask; +struct ath9k_hw_wow wow;#endif bool is_clk_25mhz;int (*get_mac_revision)(void );
Signature · 1 line
2.2.2
PATCH 13/17 ath9k: Register max WOW patterns
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
Since the number of patterns that can be configured in the HW is higher for newer chips, store the chip-specific value in ath9k_hw_wow.
--- drivers/net/wireless/ath/ath9k/hw.c | 7 +++++++ drivers/net/wireless/ath/ath9k/hw.h | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/hw.c +7 -0
@@ -2548,6 +2548,13 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) ah->eep_ops->get_eeprom(ah, EEP_PAPRD)) pCap->hw_caps |=ATH9K_HW_CAP_PAPRD ; +#ifdef CONFIG_ATH9K_WOW +if (AR_SREV_9462_20_OR_LATER (ah) ||AR_SREV_9565_11_OR_LATER (ah)) + ah->wow.max_patterns =MAX_NUM_PATTERN ; +else + ah->wow.max_patterns =MAX_NUM_PATTERN_LEGACY ; +#endif +return 0 ; }
drivers/net/wireless/ath/ath9k/hw.h +3 -1
@@ -204,7 +204,8 @@#define MAX_PATTERN_SIZE 256#define MAX_PATTERN_MASK_SIZE 32 -#define MAX_NUM_PATTERN 8 +#define MAX_NUM_PATTERN 16 +#define MAX_NUM_PATTERN_LEGACY 8#define MAX_NUM_USER_PATTERN 6/* deducting the disassociate and deauthenticate packets */
@@ -272,6 +273,7 @@ enum ath9k_hw_caps {struct ath9k_hw_wow {u32 wow_event_mask; +u8 max_patterns; };struct ath9k_hw_capabilities {
Signature · 1 line
2.2.2
PATCH 14/17 ath9k: Move WOW registers to reg_wow.h
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
--- drivers/net/wireless/ath/ath9k/ar9003_wow.c | 1 + drivers/net/wireless/ath/ath9k/reg.h | 120 ------------------------ drivers/net/wireless/ath/ath9k/reg_wow.h | 136 ++++++++++++++++++++++++++++ 3 files changed, 137 insertions(+), 120 deletions(-) create mode 100644 drivers/net/wireless/ath/ath9k/reg_wow.h
drivers/net/wireless/ath/ath9k/ar9003_wow.c +1 -0
@@ -17,6 +17,7 @@#include <linux/export.h> #include "ath9k.h" #include "reg.h" +#include "reg_wow.h" #include "hw-ops.h" static void ath9k_hw_set_powermode_wow_sleep (struct ath_hw *ah)
drivers/net/wireless/ath/ath9k/reg.h +0 -120
126 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/reg_wow.h new file +136 -0
136 lines not on this page · raw message
Signature · 1 line
2.2.2
PATCH 15/17 ath9k: Remove incorrect register macros
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
These macros are applicable to pre-AR9003 chips and the addresses are different for the AR9003 family. Since they are unused anyway, remove them.
--- drivers/net/wireless/ath/ath9k/reg_wow.h | 5 ----- 1 file changed, 5 deletions(-)
drivers/net/wireless/ath/ath9k/reg_wow.h +0 -5
@@ -23,14 +23,9 @@#define AR_WOW_BCN_TIMO 0x8274#define AR_WOW_KEEP_ALIVE_TIMO 0x8278#define AR_WOW_KEEP_ALIVE 0x827c -#define AR_WOW_US_SCALAR 0x8284#define AR_WOW_KEEP_ALIVE_DELAY 0x8288#define AR_WOW_PATTERN_MATCH 0x828c -#define AR_WOW_PATTERN_OFF1 0x8290/* pattern bytes 0 -> 3 */ -#define AR_WOW_PATTERN_OFF2 0x8294/* pattern bytes 4 -> 7 */ -/* for AR9285 or later version of chips */ -#define AR_WOW_EXACT 0x829c#define AR_WOW_LENGTH1 0x8360#define AR_WOW_LENGTH2 0X8364/* register to enable match for less than 256 bytes packets */
Signature · 1 line
2.2.2
PATCH 16/17 ath9k: Cleanup reg_wow.h
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
* Remove unnecessary comments.
* Remove unused macros.
* Indent the macros.
--- drivers/net/wireless/ath/ath9k/reg_wow.h | 68 +++++++------------------------- 1 file changed, 15 insertions(+), 53 deletions(-)
drivers/net/wireless/ath/ath9k/reg_wow.h +15 -53
@@ -25,10 +25,8 @@#define AR_WOW_KEEP_ALIVE 0x827c#define AR_WOW_KEEP_ALIVE_DELAY 0x8288#define AR_WOW_PATTERN_MATCH 0x828c -#define AR_WOW_LENGTH1 0x8360#define AR_WOW_LENGTH2 0X8364 -/* register to enable match for less than 256 bytes packets */ #define AR_WOW_PATTERN_MATCH_LT_256B 0x8368#define AR_SW_WOW_CONTROL 0x20018
@@ -40,7 +38,6 @@#define AR_CLR_MAC_INTERRUPT 0x20#define AR_CLR_KA_INTERRUPT 0x40 -/* AR_WOW_PATTERN register values */ #define AR_WOW_BACK_OFF_SHIFT (x) ((x & 0xf) << 28)/* in usecs */ #define AR_WOW_MAC_INTR_EN 0x00040000#define AR_WOW_MAGIC_EN 0x00010000
@@ -63,69 +60,34 @@ AR_WOW_BEACON_FAIL | \ AR_WOW_KEEP_ALIVE_FAIL)) -/* AR_WOW_COUNT register values */ #define AR_WOW_AIFS_CNT (x) (x & 0xff)#define AR_WOW_SLOT_CNT (x) ((x & 0xff) << 8)#define AR_WOW_KEEP_ALIVE_CNT (x) ((x & 0xff) << 16) -/* AR_WOW_BCN_EN register */ #define AR_WOW_BEACON_FAIL_EN 0x00000001 - -/* AR_WOW_BCN_TIMO rgister */ -#define AR_WOW_BEACON_TIMO 0x40000000/* valid if BCN_EN is set */ - -/* AR_WOW_KEEP_ALIVE_TIMO register */ -#define AR_WOW_KEEP_ALIVE_TIMO_VALUE +#define AR_WOW_BEACON_TIMO 0x40000000#define AR_WOW_KEEP_ALIVE_NEVER 0xffffffff - -/* AR_WOW_KEEP_ALIVE register */ #define AR_WOW_KEEP_ALIVE_AUTO_DIS 0x00000001#define AR_WOW_KEEP_ALIVE_FAIL_DIS 0x00000002 - -/* AR_WOW_KEEP_ALIVE_DELAY register */ #define AR_WOW_KEEP_ALIVE_DELAY_VALUE 0x000003e8/* 1 msec */ - - -/* -* keep it long for beacon workaround - ensure no false alarm -*/ #define AR_WOW_BMISSTHRESHOLD 0x20 - -/* AR_WOW_PATTERN_MATCH register */ #define AR_WOW_PAT_END_OF_PKT (x) (x & 0xf)#define AR_WOW_PAT_OFF_MATCH (x) ((x & 0xf) << 8) - -/* -* default values for Wow Configuration for backoff, aifs, slot, keep-alive -* to be programmed into various registers. -*/ -#define AR_WOW_PAT_BACKOFF 0x00000004/* AR_WOW_PATTERN_REG */ -#define AR_WOW_CNT_AIFS_CNT 0x00000022/* AR_WOW_COUNT_REG */ -#define AR_WOW_CNT_SLOT_CNT 0x00000009/* AR_WOW_COUNT_REG */ -/* -* Keepalive count applicable for AR9280 2.0 and above. -*/ -#define AR_WOW_CNT_KA_CNT 0x00000008/* AR_WOW_COUNT register */ - -/* WoW - Transmit buffer for keep alive frames */ -#define AR_WOW_TRANSMIT_BUFFER 0xe000/* E000 - EFFC */ - -#define AR_WOW_TXBUF (i) (AR_WOW_TRANSMIT_BUFFER + ((i) << 2)) - -#define AR_WOW_KA_DESC_WORD2 0xe000 - -#define AR_WOW_KA_DATA_WORD0 0xe030 - -/* WoW Transmit Buffer for patterns */ -#define AR_WOW_TB_PATTERN (i) (0xe100 + (i << 8)) -#define AR_WOW_TB_MASK (i) (0xec00 + (i << 5)) - -/* Currently Pattern 0-7 are supported - so bit 0-7 are set */ +#define AR_WOW_PAT_BACKOFF 0x00000004 +#define AR_WOW_CNT_AIFS_CNT 0x00000022 +#define AR_WOW_CNT_SLOT_CNT 0x00000009 +#define AR_WOW_CNT_KA_CNT 0x00000008 + +#define AR_WOW_TRANSMIT_BUFFER 0xe000 +#define AR_WOW_TXBUF (i) (AR_WOW_TRANSMIT_BUFFER + ((i) << 2)) +#define AR_WOW_KA_DESC_WORD2 0xe000 +#define AR_WOW_TB_PATTERN (i) (0xe100 + (i << 8)) +#define AR_WOW_TB_MASK (i) (0xec00 + (i << 5))#define AR_WOW_PATTERN_SUPPORTED 0xff#define AR_WOW_LENGTH_MAX 0xff -#define AR_WOW_LEN1_SHIFT (_i) ((0x3 - ((_i) & 0x3)) << 0x3) -#define AR_WOW_LENGTH1_MASK (_i) (AR_WOW_LENGTH_MAX << AR_WOW_LEN1_SHIFT(_i)) -#define AR_WOW_LEN2_SHIFT (_i) ((0x7 - ((_i) & 0x7)) << 0x3) -#define AR_WOW_LENGTH2_MASK (_i) (AR_WOW_LENGTH_MAX << AR_WOW_LEN2_SHIFT(_i)) +#define AR_WOW_LEN1_SHIFT (_i) ((0x3 - ((_i) & 0x3)) << 0x3) +#define AR_WOW_LENGTH1_MASK (_i) (AR_WOW_LENGTH_MAX << AR_WOW_LEN1_SHIFT(_i)) +#define AR_WOW_LEN2_SHIFT (_i) ((0x7 - ((_i) & 0x7)) << 0x3) +#define AR_WOW_LENGTH2_MASK (_i) (AR_WOW_LENGTH_MAX << AR_WOW_LEN2_SHIFT(_i))#endif /* REG_WOW_H */
Signature · 1 line
2.2.2
PATCH 17/17 ath9k: Fix max pattern check
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
Since the maximum number of configurable patterns
is chip-specific, use the HW capability instead
of a fixed value for checking if a free pattern
slot is available.
--- drivers/net/wireless/ath/ath9k/ar9003_wow.c | 12 +++---- drivers/net/wireless/ath/ath9k/hw.h | 17 ++++----- drivers/net/wireless/ath/ath9k/wow.c | 53 ++++++++++++++++++++--------- 3 files changed, 51 insertions(+), 31 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_wow.c +6 -6
@@ -89,17 +89,16 @@ static void ath9k_wow_create_keep_alive_pattern(struct ath_hw *ah) } -void ath9k_hw_wow_apply_pattern (struct ath_hw *ah,u8 *user_pattern, -u8 *user_mask,int pattern_count, -int pattern_len) +int ath9k_hw_wow_apply_pattern (struct ath_hw *ah,u8 *user_pattern, +u8 *user_mask,int pattern_count, +int pattern_len) {int i;u32 pattern_val, mask_val;u32 set, clr; -/* FIXME: should check count by querying the hardware capability */ -if (pattern_count >=MAX_NUM_PATTERN ) -return ; +if (pattern_count >= ah->wow.max_patterns) +return -ENOSPC ;REG_SET_BIT (ah,AR_WOW_PATTERN ,BIT (pattern_count));
@@ -154,6 +153,7 @@ void ath9k_hw_wow_apply_pattern(struct ath_hw *ah, u8 *user_pattern,REG_RMW (ah,AR_WOW_LENGTH2 , set, clr); } +return 0 ; }EXPORT_SYMBOL (ath9k_hw_wow_apply_pattern);
drivers/net/wireless/ath/ath9k/hw.h +9 -8
@@ -1152,18 +1152,19 @@ ath9k_hw_get_btcoex_scheme(struct ath_hw *ah)#ifdef CONFIG_ATH9K_WOW -void ath9k_hw_wow_apply_pattern (struct ath_hw *ah,u8 *user_pattern, -u8 *user_mask,int pattern_count, -int pattern_len); +int 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 void ath9k_hw_wow_apply_pattern (struct ath_hw *ah, -u8 *user_pattern, -u8 *user_mask, -int pattern_count, -int pattern_len) +static inline int ath9k_hw_wow_apply_pattern (struct ath_hw *ah, +u8 *user_pattern, +u8 *user_mask, +int pattern_count, +int pattern_len) { +return 0 ; }static inline u32 ath9k_hw_wow_wakeup (struct ath_hw *ah) {
drivers/net/wireless/ath/ath9k/wow.c +36 -17
96 lines not on this page · raw message
Signature · 1 line
2.2.2
Quoted 14 lines · Sujith Manoharan
From: Sujith Manoharan <[email protected]>
ath9k patches for -next.
Sujith Manoharan (17):
ath9k: RemoveATH9K_HW_WOW_DEVICE_CAPABLE
ath9k: Return early for error conditions
ath9k: Remove redundantdevice_can_wakeup()check
ath9k: Check early for multi-vif/STA conditions
ath9k: Check multi-channel context for WOW
ath9k: Fix wow init/deinit
ath9k: Check WOW triggers properly
ath9k: Remove unused BMISS processing
ath9k: Removeath9k_hw_wow_event_to_string
Quoted 8 lines
ath9k: Add a debugfs file for WOW
ath9k: Simplify user pattern configuration
ath9k: Add a HW structure for WOW
ath9k: Register max WOW patterns
ath9k: Move WOW registers toreg_wow.h
ath9k: Remove incorrect register macros
ath9k: Cleanupreg_wow.h
ath9k: Fix max pattern check
Thanks, all 17 applied to wireless-drivers-next.git.
Signature · 1 line
Kalle Valo