diff options
author | David Woodhouse <dwmw2@infradead.org> | 2007-12-08 18:49:06 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:06:21 -0500 |
commit | 6d35fdfced3922aa27f130eec2b28857c39298fd (patch) | |
tree | 154078d8defe6240808e12f07f0d3738e88867dd | |
parent | a63b22bb5bb58d7a1d1b38aeac9a55c51565131c (diff) |
libertas: cope with device which already has firmware loaded
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/libertas/if_usb.c | 35 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/if_usb.h | 2 |
2 files changed, 23 insertions, 14 deletions
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 87bed4a1718d..141d185ac01b 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c | |||
@@ -374,20 +374,23 @@ static int if_prog_firmware(struct usb_card_rec *cardp) | |||
374 | 374 | ||
375 | static int if_usb_reset_device(struct usb_card_rec *cardp) | 375 | static int if_usb_reset_device(struct usb_card_rec *cardp) |
376 | { | 376 | { |
377 | struct cmd_ds_command *cmd = (void *)&cardp->bulk_out_buffer[4]; | ||
377 | int ret; | 378 | int ret; |
378 | struct lbs_private *priv = cardp->priv; | ||
379 | 379 | ||
380 | lbs_deb_enter(LBS_DEB_USB); | 380 | lbs_deb_enter(LBS_DEB_USB); |
381 | 381 | ||
382 | /* Try a USB port reset first, if that fails send the reset | 382 | *(__le32 *)cardp->bulk_out_buffer = cpu_to_le32(CMD_TYPE_REQUEST); |
383 | * command to the firmware. | 383 | |
384 | */ | 384 | cmd->command = cpu_to_le16(CMD_802_11_RESET); |
385 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_reset) + S_DS_GEN); | ||
386 | cmd->result = cpu_to_le16(0); | ||
387 | cmd->seqnum = cpu_to_le16(0x5a5a); | ||
388 | cmd->params.reset.action = cpu_to_le16(CMD_ACT_HALT); | ||
389 | usb_tx_block(cardp, cardp->bulk_out_buffer, 4 + S_DS_GEN + sizeof(struct cmd_ds_802_11_reset)); | ||
390 | |||
391 | msleep(10); | ||
385 | ret = usb_reset_device(cardp->udev); | 392 | ret = usb_reset_device(cardp->udev); |
386 | if (!ret && priv) { | 393 | msleep(10); |
387 | msleep(10); | ||
388 | ret = lbs_reset_device(priv); | ||
389 | msleep(10); | ||
390 | } | ||
391 | 394 | ||
392 | lbs_deb_leave_args(LBS_DEB_USB, "ret %d", ret); | 395 | lbs_deb_leave_args(LBS_DEB_USB, "ret %d", ret); |
393 | 396 | ||
@@ -508,9 +511,15 @@ static void if_usb_receive_fwload(struct urb *urb) | |||
508 | return; | 511 | return; |
509 | } | 512 | } |
510 | if (bootcmdresp.u32magicnumber != cpu_to_le32(BOOT_CMD_MAGIC_NUMBER)) { | 513 | if (bootcmdresp.u32magicnumber != cpu_to_le32(BOOT_CMD_MAGIC_NUMBER)) { |
511 | lbs_pr_info( | 514 | if (bootcmdresp.u32magicnumber == cpu_to_le32(CMD_TYPE_REQUEST) || |
512 | "boot cmd response wrong magic number (0x%x)\n", | 515 | bootcmdresp.u32magicnumber == cpu_to_le32(CMD_TYPE_DATA) || |
513 | le32_to_cpu(bootcmdresp.u32magicnumber)); | 516 | bootcmdresp.u32magicnumber == cpu_to_le32(CMD_TYPE_INDICATION)) { |
517 | lbs_pr_info("Firmware already seems alive; resetting\n"); | ||
518 | cardp->bootcmdresp = -1; | ||
519 | } else { | ||
520 | lbs_pr_info("boot cmd response wrong magic number (0x%x)\n", | ||
521 | le32_to_cpu(bootcmdresp.u32magicnumber)); | ||
522 | } | ||
514 | } else if (bootcmdresp.u8cmd_tag != BOOT_CMD_FW_BY_USB) { | 523 | } else if (bootcmdresp.u8cmd_tag != BOOT_CMD_FW_BY_USB) { |
515 | lbs_pr_info( | 524 | lbs_pr_info( |
516 | "boot cmd response cmd_tag error (%d)\n", | 525 | "boot cmd response cmd_tag error (%d)\n", |
@@ -883,7 +892,7 @@ restart: | |||
883 | } while (cardp->bootcmdresp == 0 && j < 10); | 892 | } while (cardp->bootcmdresp == 0 && j < 10); |
884 | } while (cardp->bootcmdresp == 0 && i < 5); | 893 | } while (cardp->bootcmdresp == 0 && i < 5); |
885 | 894 | ||
886 | if (cardp->bootcmdresp == 0) { | 895 | if (cardp->bootcmdresp <= 0) { |
887 | if (--reset_count >= 0) { | 896 | if (--reset_count >= 0) { |
888 | if_usb_reset_device(cardp); | 897 | if_usb_reset_device(cardp); |
889 | goto restart; | 898 | goto restart; |
diff --git a/drivers/net/wireless/libertas/if_usb.h b/drivers/net/wireless/libertas/if_usb.h index f53ddb251586..940a369f1fe7 100644 --- a/drivers/net/wireless/libertas/if_usb.h +++ b/drivers/net/wireless/libertas/if_usb.h | |||
@@ -70,7 +70,7 @@ struct usb_card_rec { | |||
70 | 70 | ||
71 | u8 rx_urb_recall; | 71 | u8 rx_urb_recall; |
72 | 72 | ||
73 | u8 bootcmdresp; | 73 | s8 bootcmdresp; |
74 | }; | 74 | }; |
75 | 75 | ||
76 | /** fwheader */ | 76 | /** fwheader */ |