ath5k: Fix nic_wakeup for 5210
PATCH 2/9 ath5k: Fix nic_wakeup for 5210
* Reset PCI after chip reset for 5210 at nic_wakeup. This fixes the system hang during 5210 attach.
Changes-licensed-under: ISC
Signed-off-by Nick Kossifidis <[email protected]>
---
drivers/net/wireless/ath5k/hw.c +10 -29
@@ -294,6 +294,13 @@ static int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial)ATH5K_TRACE (ah->ah_sc); +/* Wakeup the device */ + ret =ath5k_hw_set_power (ah,AR5K_PM_AWAKE , true,0 ); +if (ret) { +ATH5K_ERR (ah->ah_sc,"failed to wakeup the MAC Chip\n" ); +return ret; + } +if (ah->ah_version !=AR5K_AR5210 ) {/* * Get channel mode flags
@@ -319,7 +326,7 @@ static int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial)* CCK headers) operation. We need to test * this, 5211 might support ofdm-only g after * all, there are also initial register values -* in the code for g mode (see ath5k_hw.h). */ +* in the code for g mode (see initvals.c). */ if (ah->ah_version ==AR5K_AR5211 ) mode |=AR5K_PHY_MODE_MOD_OFDM ;else
@@ -347,38 +354,12 @@ static int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial)if (flags &CHANNEL_TURBO ) turbo =AR5K_PHY_TURBO_MODE |AR5K_PHY_TURBO_SHORT ; - }else {/* Reset and wakeup the device */ -if (initial == true) { -/* ...reset hardware */ -if (ath5k_hw_nic_reset (ah,AR5K_RESET_CTL_PCI )) { -ATH5K_ERR (ah->ah_sc, -"failed to reset the PCI chipset\n" ); -return -EIO ; - } - -mdelay (1 ); - } - -/* ...wakeup */ - ret =ath5k_hw_set_power (ah,AR5K_PM_AWAKE , true,0 ); -if (ret) { -ATH5K_ERR (ah->ah_sc,"failed to resume the MAC Chip\n" ); -return ret; - } + }else {/* Reset the device */ /* ...enable Atheros turbo mode if requested */ if (flags &CHANNEL_TURBO )ath5k_hw_reg_write (ah,AR5K_PHY_TURBO_MODE ,AR5K_PHY_TURBO ); - -/* ...reset chipset */ -if (ath5k_hw_nic_reset (ah,AR5K_RESET_CTL_CHIP )) { -ATH5K_ERR (ah->ah_sc, -"failed to reset the AR5210 chipset\n" ); -return -EIO ; - } - -mdelay (1 ); }/* ...reset chipset and PCI device */
@@ -391,7 +372,7 @@ static int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial)if (ah->ah_version ==AR5K_AR5210 )udelay (2300 ); -/* ...wakeup */ +/* ...wakeup again!*/ ret =ath5k_hw_set_power (ah,AR5K_PM_AWAKE , true,0 );if (ret) {ATH5K_ERR (ah->ah_sc,"failed to resume the MAC Chip\n" );