From: Kalle Valo <kvalo@qca.qualcomm.com>
To: kvalo@qca.qualcomm.com
Cc: ath6kl-devel@qca.qualcomm.com, linux-wireless@vger.kernel.org
Subject: [PATCH 3/3] ath6kl: cold reset target after host warm boot
Date: Fri, 08 Mar 2013 12:27:11 +0200 [thread overview]
Message-ID: <20130308102711.23245.98569.stgit@localhost6.localdomain6> (raw)
In-Reply-To: <20130308102539.23245.55176.stgit@localhost6.localdomain6>
Julien reported that ar6004 usb device fails to initialise after host has been rebooted and
power is still on for the ar6004 device. He found out that doing a cold reset fixes the issue.
I wasn't sure what would be the best way to detect if target needs a reset so I settled on
checking a timeout from htc_wait_recv_ctrl_message().
Reported-by: Julien Massot <jmassot@aldebaran-robotics.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath6kl/htc_pipe.c | 2 +-
drivers/net/wireless/ath/ath6kl/init.c | 19 ++++++++++++-------
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/ath/ath6kl/htc_pipe.c b/drivers/net/wireless/ath/ath6kl/htc_pipe.c
index c02d9d3..67aa924 100644
--- a/drivers/net/wireless/ath/ath6kl/htc_pipe.c
+++ b/drivers/net/wireless/ath/ath6kl/htc_pipe.c
@@ -1168,7 +1168,7 @@ static int htc_wait_recv_ctrl_message(struct htc_target *target)
if (count <= 0) {
ath6kl_warn("htc pipe control receive timeout!\n");
- return -ECOMM;
+ return -ETIMEDOUT;
}
return 0;
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index 8b01ec3..ecf196f 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -1658,7 +1658,18 @@ static int __ath6kl_init_hw_start(struct ath6kl *ar)
* size.
*/
ret = ath6kl_htc_wait_target(ar->htc_target);
- if (ret) {
+
+ if (ret == -ETIMEDOUT) {
+ /*
+ * Most likely USB target is in odd state after reboot and
+ * needs a reset. A cold reset makes the whole device
+ * disappear from USB bus and initialisation starts from
+ * beginning.
+ */
+ ath6kl_warn("htc wait target timed out, resetting device\n");
+ ath6kl_init_hw_reset(ar);
+ goto err_power_off;
+ } else if (ret) {
ath6kl_err("htc wait target failed: %d\n", ret);
goto err_power_off;
}
@@ -1842,12 +1853,6 @@ void ath6kl_stop_txrx(struct ath6kl *ar)
ath6kl_htc_stop(ar->htc_target);
}
- /*
- * Try to reset the device if we can. The driver may have been
- * configure NOT to reset the target during a debug session.
- */
- ath6kl_init_hw_reset(ar);
-
up(&ar->sem);
}
EXPORT_SYMBOL(ath6kl_stop_txrx);
next prev parent reply other threads:[~2013-03-08 10:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-08 10:26 [PATCH 0/3] ath6kl: fix usb warm reboot and cleanups Kalle Valo
2013-03-08 10:26 ` [PATCH 1/3] ath6kl: cleanup ath6kl_reset_device() Kalle Valo
2013-03-08 10:27 ` [PATCH 2/3] ath6kl: fix usb related error handling and warnings Kalle Valo
2013-03-08 10:27 ` Kalle Valo [this message]
2013-03-09 5:58 ` [PATCH 3/3] ath6kl: cold reset target after host warm boot Kalle Valo
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=20130308102711.23245.98569.stgit@localhost6.localdomain6 \
--to=kvalo@qca.qualcomm.com \
--cc=ath6kl-devel@qca.qualcomm.com \
--cc=linux-wireless@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox