Skip to content

Commit

Permalink
ath6kl: cold reset target after host warm boot
Browse files Browse the repository at this point in the history
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 <[email protected]>
Tested-by: Julien Massot <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
  • Loading branch information
kvalo committed Mar 18, 2013
1 parent 4e1609c commit 44af344
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/net/wireless/ath/ath6kl/htc_pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
13 changes: 12 additions & 1 deletion drivers/net/wireless/ath/ath6kl/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 44af344

Please sign in to comment.