Linux wireless drivers development
 help / color / mirror / Atom feed
From: Nick Kossifidis <mick@madwifi.org>
To: ath5k-devel@lists.ath5k.org, linux-wireless@vger.kernel.org
Cc: linville@tuxdriver.com, bruno@thinktube.com, jirislaby@gmail.com,
	mcgrof@gmail.com
Subject: [PATCH 2/9] ath5k: Fix nic_wakeup for 5210
Date: Sun, 16 Dec 2007 02:53:18 +0200	[thread overview]
Message-ID: <20071216005318.GB5482@makis.domain.invalid> (raw)

* 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");




                 reply	other threads:[~2007-12-16  0:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071216005318.GB5482@makis.domain.invalid \
    --to=mick@madwifi.org \
    --cc=ath5k-devel@lists.ath5k.org \
    --cc=bruno@thinktube.com \
    --cc=jirislaby@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=mcgrof@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox