All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@openwrt.org>
To: ath9k-devel@lists.ath9k.org
Subject: [ath9k-devel] [RFC] ath9k: Work around complete stuck of hw
Date: Fri, 14 Sep 2012 13:33:31 +0200	[thread overview]
Message-ID: <5053160B.8060908@openwrt.org> (raw)
In-Reply-To: <1347616045-29336-1-git-send-email-sven@narfation.org>

On 2012-09-14 11:47 AM, Sven Eckelmann wrote:
> AR9330 and most likely other chips like AR9285 seem to get stuck completely
> after they worked a long period of time in special environments. It is
> currently unknown which parameters causes this problem.
> 
> Symptom of these stuck is the exposure of 0xdeadbeef through different hardware
> registers. An interface down/up change seems to help the hardware to recover
> from the problem.
> 
> A workaround is to periodically test register AR_CFG for 0xdeadbeef and force
> an reset when 0xdeadbeef would be unexpected.
> 
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
> ---
> This check is currently tested. This takes quite a long time and maybe someone
> with more knowledge of atheros devices can check whether this one is completely
> and utterly wrong.
> 
> The type RESET_TYPE_FATAL_INT was chosen in this test to allow us to see
> whether this condition was already true by reading from
> /sys/kernel/debug/ieee80211/phy0/ath9k/reset
Your debug patch should not be silent when it resets the hw. We need 
to make sure that this bug gets fixed properly. If my patch below does
not fix it, then at least add a WARN_ON to ensure that we don't just
hide the bug and move on.

Somebody on the openwrt-devel list pointed out that there is some code 
missing in the ar933x wmac reset function. Please try this patch (apply 
it to your kernel tree):
---
--- a/arch/mips/ath79/dev-wmac.c
+++ b/arch/mips/ath79/dev-wmac.c
@@ -67,10 +67,27 @@ static void __init ar913x_wmac_setup(voi
 
 static int ar933x_wmac_reset(void)
 {
+	int retries = 20;
+
 	ath79_device_reset_set(AR933X_RESET_WMAC);
 	ath79_device_reset_clear(AR933X_RESET_WMAC);
 
-	return 0;
+	while (1) {
+		u32 bootstrap;
+
+		bootstrap = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP);
+		if ((bootstrap & AR933X_BOOTSTRAP_EEPBUSY) == 0)
+			return 0;
+
+		if (retries-- == 0)
+			break;
+
+		udelay(10000);
+		retries++;
+	}
+
+	pr_err("ar93xx: WMAC reset timed out");
+	return -ETIMEDOUT;
 }
 
 static int ar933x_r1_get_wmac_revision(void)

WARNING: multiple messages have this Message-ID (diff)
From: Felix Fietkau <nbd@openwrt.org>
To: Sven Eckelmann <sven@narfation.org>
Cc: ath9k-devel@lists.ath9k.org, adrian.chadd@gmail.com,
	linux-wireless@vger.kernel.org, shafi.wireless@gmail.com,
	lindner_marek@yahoo.de,
	Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Subject: Re: [RFC] ath9k: Work around complete stuck of hw
Date: Fri, 14 Sep 2012 13:33:31 +0200	[thread overview]
Message-ID: <5053160B.8060908@openwrt.org> (raw)
In-Reply-To: <1347616045-29336-1-git-send-email-sven@narfation.org>

On 2012-09-14 11:47 AM, Sven Eckelmann wrote:
> AR9330 and most likely other chips like AR9285 seem to get stuck completely
> after they worked a long period of time in special environments. It is
> currently unknown which parameters causes this problem.
> 
> Symptom of these stuck is the exposure of 0xdeadbeef through different hardware
> registers. An interface down/up change seems to help the hardware to recover
> from the problem.
> 
> A workaround is to periodically test register AR_CFG for 0xdeadbeef and force
> an reset when 0xdeadbeef would be unexpected.
> 
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
> ---
> This check is currently tested. This takes quite a long time and maybe someone
> with more knowledge of atheros devices can check whether this one is completely
> and utterly wrong.
> 
> The type RESET_TYPE_FATAL_INT was chosen in this test to allow us to see
> whether this condition was already true by reading from
> /sys/kernel/debug/ieee80211/phy0/ath9k/reset
Your debug patch should not be silent when it resets the hw. We need 
to make sure that this bug gets fixed properly. If my patch below does
not fix it, then at least add a WARN_ON to ensure that we don't just
hide the bug and move on.

Somebody on the openwrt-devel list pointed out that there is some code 
missing in the ar933x wmac reset function. Please try this patch (apply 
it to your kernel tree):
---
--- a/arch/mips/ath79/dev-wmac.c
+++ b/arch/mips/ath79/dev-wmac.c
@@ -67,10 +67,27 @@ static void __init ar913x_wmac_setup(voi
 
 static int ar933x_wmac_reset(void)
 {
+	int retries = 20;
+
 	ath79_device_reset_set(AR933X_RESET_WMAC);
 	ath79_device_reset_clear(AR933X_RESET_WMAC);
 
-	return 0;
+	while (1) {
+		u32 bootstrap;
+
+		bootstrap = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP);
+		if ((bootstrap & AR933X_BOOTSTRAP_EEPBUSY) == 0)
+			return 0;
+
+		if (retries-- == 0)
+			break;
+
+		udelay(10000);
+		retries++;
+	}
+
+	pr_err("ar93xx: WMAC reset timed out");
+	return -ETIMEDOUT;
 }
 
 static int ar933x_r1_get_wmac_revision(void)



  reply	other threads:[~2012-09-14 11:33 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-13 16:53 AR9330 hornet board stops beaconing after a few days (0xdeadbeef) Simon Wunderlich
2012-08-19 22:04 ` Simon Wunderlich
2012-08-22  5:20   ` Mohammed Shafi
2012-08-22 18:57     ` Adrian Chadd
2012-08-23  9:28       ` Simon Wunderlich
2012-08-23 17:10         ` Gabor Juhos
2012-08-23 19:26           ` Adrian Chadd
2012-08-23 14:59     ` Mohammed Shafi
2012-08-23 15:19       ` Sven Eckelmann
2012-08-23 15:27         ` Sven Eckelmann
2012-09-02 20:01       ` [ath9k-devel] " Simon Wunderlich
2012-09-02 20:01         ` Simon Wunderlich
2012-09-03 13:53         ` [ath9k-devel] " Mohammed Shafi
2012-09-03 13:53           ` Mohammed Shafi
2012-09-03 14:34           ` [ath9k-devel] " Sven Eckelmann
2012-09-03 14:34             ` Sven Eckelmann
2012-09-04 17:12           ` [ath9k-devel] " Simon Wunderlich
2012-09-04 17:12             ` Simon Wunderlich
2012-09-05  5:12             ` [ath9k-devel] " Mohammed Shafi
2012-09-05  5:12               ` Mohammed Shafi
2012-09-05 14:08               ` [ath9k-devel] " Adrian Chadd
2012-09-05 14:08                 ` Adrian Chadd
2012-09-05 14:20                 ` [ath9k-devel] " Sven Eckelmann
2012-09-05 14:20                   ` Sven Eckelmann
2012-09-13 16:51                   ` [ath9k-devel] " Simon Wunderlich
2012-09-13 16:51                     ` Simon Wunderlich
2012-09-13 16:59                     ` [ath9k-devel] " Adrian Chadd
2012-09-13 16:59                       ` Adrian Chadd
2012-09-13 17:55                     ` [ath9k-devel] [OpenWrt-Devel] " Felix Fietkau
2012-09-13 17:55                       ` Felix Fietkau
2012-09-14  9:47                       ` [ath9k-devel] [RFC] ath9k: Work around complete stuck of hw Sven Eckelmann
2012-09-14  9:47                         ` Sven Eckelmann
2012-09-14 11:33                         ` Felix Fietkau [this message]
2012-09-14 11:33                           ` Felix Fietkau
2012-09-23 10:04                           ` [ath9k-devel] " Sven Eckelmann
2012-09-23 10:04                             ` Sven Eckelmann
2013-11-20 20:57   ` [ath9k-devel] [OpenWrt-Devel] AR9330 hornet board stops beaconing after a few days (0xdeadbeef) Bastian Bittorf
2013-11-20 20:57     ` Bastian Bittorf
2013-11-20 21:00     ` [ath9k-devel] " Sven Eckelmann
2013-11-20 21:00       ` Sven Eckelmann

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=5053160B.8060908@openwrt.org \
    --to=nbd@openwrt.org \
    --cc=ath9k-devel@lists.ath9k.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.