aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalle Valo <kvalo@qca.qualcomm.com>2013-03-09 05:01:50 -0500
committerKalle Valo <kvalo@qca.qualcomm.com>2013-03-18 07:38:37 -0400
commit44af34428dfdce0472cb229b013c72710285d2db (patch)
tree72be0a7711e2aa907b6b43c7b9b3576ff0f52b16
parent4e1609c9eec2bf9971004fce8b65c0877d5ae600 (diff)
ath6kl: cold reset target after host warm boot
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> Tested-by: Julien Massot <jmassot@aldebaran-robotics.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r--drivers/net/wireless/ath/ath6kl/htc_pipe.c2
-rw-r--r--drivers/net/wireless/ath/ath6kl/init.c13
2 files changed, 13 insertions, 2 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/htc_pipe.c b/drivers/net/wireless/ath/ath6kl/htc_pipe.c
index c02d9d34f74d..67aa924ed8b3 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)
1168 1168
1169 if (count <= 0) { 1169 if (count <= 0) {
1170 ath6kl_warn("htc pipe control receive timeout!\n"); 1170 ath6kl_warn("htc pipe control receive timeout!\n");
1171 return -ECOMM; 1171 return -ETIMEDOUT;
1172 } 1172 }
1173 1173
1174 return 0; 1174 return 0;
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index 8b01ec3d2b8c..4ad45bb3cf55 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)
1658 * size. 1658 * size.
1659 */ 1659 */
1660 ret = ath6kl_htc_wait_target(ar->htc_target); 1660 ret = ath6kl_htc_wait_target(ar->htc_target);
1661 if (ret) { 1661
1662 if (ret == -ETIMEDOUT) {
1663 /*
1664 * Most likely USB target is in odd state after reboot and
1665 * needs a reset. A cold reset makes the whole device
1666 * disappear from USB bus and initialisation starts from
1667 * beginning.
1668 */
1669 ath6kl_warn("htc wait target timed out, resetting device\n");
1670 ath6kl_init_hw_reset(ar);
1671 goto err_power_off;
1672 } else if (ret) {
1662 ath6kl_err("htc wait target failed: %d\n", ret); 1673 ath6kl_err("htc wait target failed: %d\n", ret);
1663 goto err_power_off; 1674 goto err_power_off;
1664 } 1675 }