aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2012-10-03 15:07:51 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-10-05 16:26:17 -0400
commitceb26a6013b962b82f644189ea29d802490fc8fc (patch)
tree72b22bf99cd0848df867d821231e52be36a40cbe /drivers/net
parent93170516a4d64319ffcc43bc9dd61f12775bd297 (diff)
ath9k: improve suspend/resume reliability
Ensure that drv_start() always returns true, as a failing hw start usually eventually leads to crashes when there's still a station entry present. Call a power-on reset after a resume and after a hw reset failure to bring the hardware back to life again. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c13
-rw-r--r--drivers/net/wireless/ath/ath9k/pci.c4
4 files changed, 13 insertions, 10 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index f9a6ec5cf470..8e1559aba495 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1450,9 +1450,14 @@ static bool ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type)
1450 REG_WRITE(ah, AR_RTC_FORCE_WAKE, 1450 REG_WRITE(ah, AR_RTC_FORCE_WAKE,
1451 AR_RTC_FORCE_WAKE_EN | AR_RTC_FORCE_WAKE_ON_INT); 1451 AR_RTC_FORCE_WAKE_EN | AR_RTC_FORCE_WAKE_ON_INT);
1452 1452
1453 if (!ah->reset_power_on)
1454 type = ATH9K_RESET_POWER_ON;
1455
1453 switch (type) { 1456 switch (type) {
1454 case ATH9K_RESET_POWER_ON: 1457 case ATH9K_RESET_POWER_ON:
1455 ret = ath9k_hw_set_reset_power_on(ah); 1458 ret = ath9k_hw_set_reset_power_on(ah);
1459 if (!ret)
1460 ah->reset_power_on = true;
1456 break; 1461 break;
1457 case ATH9K_RESET_WARM: 1462 case ATH9K_RESET_WARM:
1458 case ATH9K_RESET_COLD: 1463 case ATH9K_RESET_COLD:
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 566a4ce4f156..dbc1b7a4cbfd 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -741,6 +741,7 @@ struct ath_hw {
741 u32 rfkill_polarity; 741 u32 rfkill_polarity;
742 u32 ah_flags; 742 u32 ah_flags;
743 743
744 bool reset_power_on;
744 bool htc_reset_init; 745 bool htc_reset_init;
745 746
746 enum nl80211_iftype opmode; 747 enum nl80211_iftype opmode;
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 31ab82e3ba85..e2fe713235dc 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -639,8 +639,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
639 ath_err(common, 639 ath_err(common,
640 "Unable to reset hardware; reset status %d (freq %u MHz)\n", 640 "Unable to reset hardware; reset status %d (freq %u MHz)\n",
641 r, curchan->center_freq); 641 r, curchan->center_freq);
642 spin_unlock_bh(&sc->sc_pcu_lock); 642 ah->reset_power_on = false;
643 goto mutex_unlock;
644 } 643 }
645 644
646 /* Setup our intr mask. */ 645 /* Setup our intr mask. */
@@ -665,11 +664,8 @@ static int ath9k_start(struct ieee80211_hw *hw)
665 clear_bit(SC_OP_INVALID, &sc->sc_flags); 664 clear_bit(SC_OP_INVALID, &sc->sc_flags);
666 sc->sc_ah->is_monitoring = false; 665 sc->sc_ah->is_monitoring = false;
667 666
668 if (!ath_complete_reset(sc, false)) { 667 if (!ath_complete_reset(sc, false))
669 r = -EIO; 668 ah->reset_power_on = false;
670 spin_unlock_bh(&sc->sc_pcu_lock);
671 goto mutex_unlock;
672 }
673 669
674 if (ah->led_pin >= 0) { 670 if (ah->led_pin >= 0) {
675 ath9k_hw_cfg_output(ah, ah->led_pin, 671 ath9k_hw_cfg_output(ah, ah->led_pin,
@@ -688,12 +684,11 @@ static int ath9k_start(struct ieee80211_hw *hw)
688 if (ah->caps.pcie_lcr_extsync_en && common->bus_ops->extn_synch_en) 684 if (ah->caps.pcie_lcr_extsync_en && common->bus_ops->extn_synch_en)
689 common->bus_ops->extn_synch_en(common); 685 common->bus_ops->extn_synch_en(common);
690 686
691mutex_unlock:
692 mutex_unlock(&sc->mutex); 687 mutex_unlock(&sc->mutex);
693 688
694 ath9k_ps_restore(sc); 689 ath9k_ps_restore(sc);
695 690
696 return r; 691 return 0;
697} 692}
698 693
699static void ath9k_tx(struct ieee80211_hw *hw, 694static void ath9k_tx(struct ieee80211_hw *hw,
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index 270abf720f3e..f088f4bf9a26 100644
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -326,7 +326,8 @@ static int ath_pci_resume(struct device *device)
326 struct pci_dev *pdev = to_pci_dev(device); 326 struct pci_dev *pdev = to_pci_dev(device);
327 struct ieee80211_hw *hw = pci_get_drvdata(pdev); 327 struct ieee80211_hw *hw = pci_get_drvdata(pdev);
328 struct ath_softc *sc = hw->priv; 328 struct ath_softc *sc = hw->priv;
329 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 329 struct ath_hw *ah = sc->sc_ah;
330 struct ath_common *common = ath9k_hw_common(ah);
330 u32 val; 331 u32 val;
331 332
332 /* 333 /*
@@ -339,6 +340,7 @@ static int ath_pci_resume(struct device *device)
339 pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); 340 pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
340 341
341 ath_pci_aspm_init(common); 342 ath_pci_aspm_init(common);
343 ah->reset_power_on = false;
342 344
343 return 0; 345 return 0;
344} 346}