diff options
Diffstat (limited to 'drivers/net/wireless/libertas/if_usb.c')
-rw-r--r-- | drivers/net/wireless/libertas/if_usb.c | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index e1e2128f4113..b5acc393a65a 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c | |||
@@ -1,6 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | * This file contains functions used in USB interface module. | 2 | * This file contains functions used in USB interface module. |
3 | */ | 3 | */ |
4 | |||
5 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
6 | |||
4 | #include <linux/delay.h> | 7 | #include <linux/delay.h> |
5 | #include <linux/moduleparam.h> | 8 | #include <linux/moduleparam.h> |
6 | #include <linux/firmware.h> | 9 | #include <linux/firmware.h> |
@@ -153,7 +156,7 @@ static void if_usb_write_bulk_callback(struct urb *urb) | |||
153 | lbs_host_to_card_done(priv); | 156 | lbs_host_to_card_done(priv); |
154 | } else { | 157 | } else { |
155 | /* print the failure status number for debug */ | 158 | /* print the failure status number for debug */ |
156 | lbs_pr_info("URB in failure status: %d\n", urb->status); | 159 | pr_info("URB in failure status: %d\n", urb->status); |
157 | } | 160 | } |
158 | } | 161 | } |
159 | 162 | ||
@@ -203,7 +206,7 @@ static void if_usb_setup_firmware(struct lbs_private *priv) | |||
203 | wake_method.hdr.size = cpu_to_le16(sizeof(wake_method)); | 206 | wake_method.hdr.size = cpu_to_le16(sizeof(wake_method)); |
204 | wake_method.action = cpu_to_le16(CMD_ACT_GET); | 207 | wake_method.action = cpu_to_le16(CMD_ACT_GET); |
205 | if (lbs_cmd_with_response(priv, CMD_802_11_FW_WAKE_METHOD, &wake_method)) { | 208 | if (lbs_cmd_with_response(priv, CMD_802_11_FW_WAKE_METHOD, &wake_method)) { |
206 | lbs_pr_info("Firmware does not seem to support PS mode\n"); | 209 | netdev_info(priv->dev, "Firmware does not seem to support PS mode\n"); |
207 | priv->fwcapinfo &= ~FW_CAPINFO_PS; | 210 | priv->fwcapinfo &= ~FW_CAPINFO_PS; |
208 | } else { | 211 | } else { |
209 | if (le16_to_cpu(wake_method.method) == CMD_WAKE_METHOD_COMMAND_INT) { | 212 | if (le16_to_cpu(wake_method.method) == CMD_WAKE_METHOD_COMMAND_INT) { |
@@ -212,7 +215,8 @@ static void if_usb_setup_firmware(struct lbs_private *priv) | |||
212 | /* The versions which boot up this way don't seem to | 215 | /* The versions which boot up this way don't seem to |
213 | work even if we set it to the command interrupt */ | 216 | work even if we set it to the command interrupt */ |
214 | priv->fwcapinfo &= ~FW_CAPINFO_PS; | 217 | priv->fwcapinfo &= ~FW_CAPINFO_PS; |
215 | lbs_pr_info("Firmware doesn't wake via command interrupt; disabling PS mode\n"); | 218 | netdev_info(priv->dev, |
219 | "Firmware doesn't wake via command interrupt; disabling PS mode\n"); | ||
216 | } | 220 | } |
217 | } | 221 | } |
218 | } | 222 | } |
@@ -224,7 +228,7 @@ static void if_usb_fw_timeo(unsigned long priv) | |||
224 | if (cardp->fwdnldover) { | 228 | if (cardp->fwdnldover) { |
225 | lbs_deb_usb("Download complete, no event. Assuming success\n"); | 229 | lbs_deb_usb("Download complete, no event. Assuming success\n"); |
226 | } else { | 230 | } else { |
227 | lbs_pr_err("Download timed out\n"); | 231 | pr_err("Download timed out\n"); |
228 | cardp->surprise_removed = 1; | 232 | cardp->surprise_removed = 1; |
229 | } | 233 | } |
230 | wake_up(&cardp->fw_wq); | 234 | wake_up(&cardp->fw_wq); |
@@ -258,7 +262,7 @@ static int if_usb_probe(struct usb_interface *intf, | |||
258 | 262 | ||
259 | cardp = kzalloc(sizeof(struct if_usb_card), GFP_KERNEL); | 263 | cardp = kzalloc(sizeof(struct if_usb_card), GFP_KERNEL); |
260 | if (!cardp) { | 264 | if (!cardp) { |
261 | lbs_pr_err("Out of memory allocating private data.\n"); | 265 | pr_err("Out of memory allocating private data\n"); |
262 | goto error; | 266 | goto error; |
263 | } | 267 | } |
264 | 268 | ||
@@ -348,10 +352,12 @@ static int if_usb_probe(struct usb_interface *intf, | |||
348 | usb_set_intfdata(intf, cardp); | 352 | usb_set_intfdata(intf, cardp); |
349 | 353 | ||
350 | if (device_create_file(&priv->dev->dev, &dev_attr_lbs_flash_fw)) | 354 | if (device_create_file(&priv->dev->dev, &dev_attr_lbs_flash_fw)) |
351 | lbs_pr_err("cannot register lbs_flash_fw attribute\n"); | 355 | netdev_err(priv->dev, |
356 | "cannot register lbs_flash_fw attribute\n"); | ||
352 | 357 | ||
353 | if (device_create_file(&priv->dev->dev, &dev_attr_lbs_flash_boot2)) | 358 | if (device_create_file(&priv->dev->dev, &dev_attr_lbs_flash_boot2)) |
354 | lbs_pr_err("cannot register lbs_flash_boot2 attribute\n"); | 359 | netdev_err(priv->dev, |
360 | "cannot register lbs_flash_boot2 attribute\n"); | ||
355 | 361 | ||
356 | /* | 362 | /* |
357 | * EHS_REMOVE_WAKEUP is not supported on all versions of the firmware. | 363 | * EHS_REMOVE_WAKEUP is not supported on all versions of the firmware. |
@@ -536,7 +542,7 @@ static int __if_usb_submit_rx_urb(struct if_usb_card *cardp, | |||
536 | int ret = -1; | 542 | int ret = -1; |
537 | 543 | ||
538 | if (!(skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE))) { | 544 | if (!(skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE))) { |
539 | lbs_pr_err("No free skb\n"); | 545 | pr_err("No free skb\n"); |
540 | goto rx_ret; | 546 | goto rx_ret; |
541 | } | 547 | } |
542 | 548 | ||
@@ -595,7 +601,7 @@ static void if_usb_receive_fwload(struct urb *urb) | |||
595 | 601 | ||
596 | if (tmp[0] == cpu_to_le32(CMD_TYPE_INDICATION) && | 602 | if (tmp[0] == cpu_to_le32(CMD_TYPE_INDICATION) && |
597 | tmp[1] == cpu_to_le32(MACREG_INT_CODE_FIRMWARE_READY)) { | 603 | tmp[1] == cpu_to_le32(MACREG_INT_CODE_FIRMWARE_READY)) { |
598 | lbs_pr_info("Firmware ready event received\n"); | 604 | pr_info("Firmware ready event received\n"); |
599 | wake_up(&cardp->fw_wq); | 605 | wake_up(&cardp->fw_wq); |
600 | } else { | 606 | } else { |
601 | lbs_deb_usb("Waiting for confirmation; got %x %x\n", | 607 | lbs_deb_usb("Waiting for confirmation; got %x %x\n", |
@@ -622,20 +628,20 @@ static void if_usb_receive_fwload(struct urb *urb) | |||
622 | bootcmdresp.magic == cpu_to_le32(CMD_TYPE_DATA) || | 628 | bootcmdresp.magic == cpu_to_le32(CMD_TYPE_DATA) || |
623 | bootcmdresp.magic == cpu_to_le32(CMD_TYPE_INDICATION)) { | 629 | bootcmdresp.magic == cpu_to_le32(CMD_TYPE_INDICATION)) { |
624 | if (!cardp->bootcmdresp) | 630 | if (!cardp->bootcmdresp) |
625 | lbs_pr_info("Firmware already seems alive; resetting\n"); | 631 | pr_info("Firmware already seems alive; resetting\n"); |
626 | cardp->bootcmdresp = -1; | 632 | cardp->bootcmdresp = -1; |
627 | } else { | 633 | } else { |
628 | lbs_pr_info("boot cmd response wrong magic number (0x%x)\n", | 634 | pr_info("boot cmd response wrong magic number (0x%x)\n", |
629 | le32_to_cpu(bootcmdresp.magic)); | 635 | le32_to_cpu(bootcmdresp.magic)); |
630 | } | 636 | } |
631 | } else if ((bootcmdresp.cmd != BOOT_CMD_FW_BY_USB) && | 637 | } else if ((bootcmdresp.cmd != BOOT_CMD_FW_BY_USB) && |
632 | (bootcmdresp.cmd != BOOT_CMD_UPDATE_FW) && | 638 | (bootcmdresp.cmd != BOOT_CMD_UPDATE_FW) && |
633 | (bootcmdresp.cmd != BOOT_CMD_UPDATE_BOOT2)) { | 639 | (bootcmdresp.cmd != BOOT_CMD_UPDATE_BOOT2)) { |
634 | lbs_pr_info("boot cmd response cmd_tag error (%d)\n", | 640 | pr_info("boot cmd response cmd_tag error (%d)\n", |
635 | bootcmdresp.cmd); | 641 | bootcmdresp.cmd); |
636 | } else if (bootcmdresp.result != BOOT_CMD_RESP_OK) { | 642 | } else if (bootcmdresp.result != BOOT_CMD_RESP_OK) { |
637 | lbs_pr_info("boot cmd response result error (%d)\n", | 643 | pr_info("boot cmd response result error (%d)\n", |
638 | bootcmdresp.result); | 644 | bootcmdresp.result); |
639 | } else { | 645 | } else { |
640 | cardp->bootcmdresp = 1; | 646 | cardp->bootcmdresp = 1; |
641 | lbs_deb_usbd(&cardp->udev->dev, | 647 | lbs_deb_usbd(&cardp->udev->dev, |
@@ -901,7 +907,7 @@ static int check_fwfile_format(const uint8_t *data, uint32_t totlen) | |||
901 | } while (!exit); | 907 | } while (!exit); |
902 | 908 | ||
903 | if (ret) | 909 | if (ret) |
904 | lbs_pr_err("firmware file format check FAIL\n"); | 910 | pr_err("firmware file format check FAIL\n"); |
905 | else | 911 | else |
906 | lbs_deb_fw("firmware file format check PASS\n"); | 912 | lbs_deb_fw("firmware file format check PASS\n"); |
907 | 913 | ||
@@ -998,7 +1004,7 @@ static int __if_usb_prog_firmware(struct if_usb_card *cardp, | |||
998 | 1004 | ||
999 | ret = get_fw(cardp, fwname); | 1005 | ret = get_fw(cardp, fwname); |
1000 | if (ret) { | 1006 | if (ret) { |
1001 | lbs_pr_err("failed to find firmware (%d)\n", ret); | 1007 | pr_err("failed to find firmware (%d)\n", ret); |
1002 | goto done; | 1008 | goto done; |
1003 | } | 1009 | } |
1004 | 1010 | ||
@@ -1073,13 +1079,13 @@ restart: | |||
1073 | usb_kill_urb(cardp->rx_urb); | 1079 | usb_kill_urb(cardp->rx_urb); |
1074 | 1080 | ||
1075 | if (!cardp->fwdnldover) { | 1081 | if (!cardp->fwdnldover) { |
1076 | lbs_pr_info("failed to load fw, resetting device!\n"); | 1082 | pr_info("failed to load fw, resetting device!\n"); |
1077 | if (--reset_count >= 0) { | 1083 | if (--reset_count >= 0) { |
1078 | if_usb_reset_device(cardp); | 1084 | if_usb_reset_device(cardp); |
1079 | goto restart; | 1085 | goto restart; |
1080 | } | 1086 | } |
1081 | 1087 | ||
1082 | lbs_pr_info("FW download failure, time = %d ms\n", i * 100); | 1088 | pr_info("FW download failure, time = %d ms\n", i * 100); |
1083 | ret = -EIO; | 1089 | ret = -EIO; |
1084 | goto release_fw; | 1090 | goto release_fw; |
1085 | } | 1091 | } |