libertas: reset usb device if boot2 init command fails
Marcelo Tosatti
mtosatti at redhat.unroutablecom
Sun Dec 24 04:30:49 EST 2006
Commit: ba1090a33c573c003eb1127c7db16dc71e720306
Parent: cad10c43037fc9688a7d69aaf83e9e5746ecf8bc
commit ba1090a33c573c003eb1127c7db16dc71e720306
Author: Marcelo Tosatti <mtosatti at redhat.com>
AuthorDate: Sat Dec 23 22:32:02 2006 -0200
Commit: Marcelo Tosatti <mtosatti at redhat.com>
CommitDate: Sat Dec 23 22:32:02 2006 -0200
libertas: reset usb device if boot2 init command fails
Still getting errors from boot2 init command: reset and retry
in such case.
Signed-off-by: Marcelo Tosatti <mtosatti at redhat.com>
---
drivers/net/wireless/libertas/if_usb.c | 33 ++++++++++++++++++++++++--------
1 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index d88c675..403b6e8 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -884,6 +884,20 @@ static int if_prog_firmware(wlan_private
return WLAN_STATUS_SUCCESS;
}
+static int libertas_do_reset(wlan_private *priv)
+{
+ int ret;
+ struct usb_card_rec *cardp = priv->wlan_dev.card;
+
+ ret = usb_reset_device(cardp->udev);
+ if (!ret) {
+ msleep(10);
+ reset_device(priv);
+ msleep(10);
+ }
+ return ret;
+}
+
/**
* @brief This function download fw
* @param priv pointer to wlan_private
@@ -893,10 +907,11 @@ int libertas_sbi_prog_firmware(wlan_priv
{
struct usb_card_rec *cardp = priv->wlan_dev.card;
int i = 0;
- int reset_count = 10;
+ static int reset_count = 10;
ENTER();
+restart:
if (if_usb_submit_rx_urb_fwload(priv) < 0) {
dprintk(1, "URB submission is failed\n");
LEAVE();
@@ -917,11 +932,15 @@ #ifdef SUPPORT_BOOT_COMMAND
} while (cardp->BootCMDResp == 0 && j < 10);
} while (cardp->BootCMDResp == 0 && i < 5);
- if (cardp->BootCMDResp == 0)
+ if (cardp->BootCMDResp == 0) {
+ if (--reset_count >= 0) {
+ libertas_do_reset(priv);
+ goto restart;
+ }
return WLAN_STATUS_FAILURE;
+ }
#endif
-restart:
i = 0;
priv->adapter->fw_ready = 0;
@@ -945,13 +964,11 @@ restart:
if (!cardp->FwDnldOver) {
printk(KERN_INFO "Failed to load fw, resetting device!\n");
- reset_count--;
- if (!usb_reset_device(cardp->udev) && reset_count >= 0) {
- msleep(10);
- reset_device(priv);
- msleep(10);
+ if (--reset_count >= 0) {
+ libertas_do_reset(priv);
goto restart;
}
+
printk(KERN_INFO "FW download failure, time = %d ms\n", i * 100);
LEAVE();
return WLAN_STATUS_FAILURE;
More information about the Commits-kernel
mailing list