linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/9] ath5k: Fix nic_wakeup for 5210
@ 2007-12-16  0:53 Nick Kossifidis
  0 siblings, 0 replies; only message in thread
From: Nick Kossifidis @ 2007-12-16  0:53 UTC (permalink / raw)
  To: ath5k-devel, linux-wireless; +Cc: linville, bruno, jirislaby, mcgrof

* 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 <mickflemm@gmail.com>

---
diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c
index 83fd241..aea9589 100644
--- a/drivers/net/wireless/ath5k/hw.c
+++ b/drivers/net/wireless/ath5k/hw.c
@@ -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");




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-12-16  0:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-16  0:53 [PATCH 2/9] ath5k: Fix nic_wakeup for 5210 Nick Kossifidis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).