aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/libertas/decl.h2
-rw-r--r--drivers/net/wireless/libertas/if_usb.c30
-rw-r--r--drivers/net/wireless/libertas/main.c14
3 files changed, 25 insertions, 21 deletions
diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h
index 40f56bb1eac8..846e79a77f67 100644
--- a/drivers/net/wireless/libertas/decl.h
+++ b/drivers/net/wireless/libertas/decl.h
@@ -86,6 +86,6 @@ int libertas_activate_card(wlan_private *priv, char *fw_name);
86int libertas_remove_card(wlan_private *priv); 86int libertas_remove_card(wlan_private *priv);
87int libertas_add_mesh(wlan_private *priv, struct device *dev); 87int libertas_add_mesh(wlan_private *priv, struct device *dev);
88void libertas_remove_mesh(wlan_private *priv); 88void libertas_remove_mesh(wlan_private *priv);
89 89int libertas_reset_device(wlan_private *priv);
90 90
91#endif /* _WLAN_DECL_H_ */ 91#endif /* _WLAN_DECL_H_ */
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index a3334f63a80d..e38fce73cf74 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -15,6 +15,7 @@
15#include "defs.h" 15#include "defs.h"
16#include "dev.h" 16#include "dev.h"
17#include "if_usb.h" 17#include "if_usb.h"
18#include "decl.h"
18 19
19#define MESSAGE_HEADER_LEN 4 20#define MESSAGE_HEADER_LEN 4
20 21
@@ -44,7 +45,6 @@ MODULE_DEVICE_TABLE(usb, if_usb_table);
44 45
45static void if_usb_receive(struct urb *urb); 46static void if_usb_receive(struct urb *urb);
46static void if_usb_receive_fwload(struct urb *urb); 47static void if_usb_receive_fwload(struct urb *urb);
47static int if_usb_reset_device(wlan_private *priv);
48static int if_usb_register_dev(wlan_private * priv); 48static int if_usb_register_dev(wlan_private * priv);
49static int if_usb_unregister_dev(wlan_private *); 49static int if_usb_unregister_dev(wlan_private *);
50static int if_usb_prog_firmware(wlan_private *); 50static int if_usb_prog_firmware(wlan_private *);
@@ -355,17 +355,20 @@ static int if_prog_firmware(wlan_private * priv)
355 return 0; 355 return 0;
356} 356}
357 357
358static int libertas_do_reset(wlan_private *priv) 358static int if_usb_reset_device(wlan_private *priv)
359{ 359{
360 int ret; 360 int ret;
361 struct usb_card_rec *cardp = priv->card; 361 struct usb_card_rec *cardp = priv->card;
362 362
363 lbs_deb_enter(LBS_DEB_USB); 363 lbs_deb_enter(LBS_DEB_USB);
364 364
365 /* Try a USB port reset first, if that fails send the reset
366 * command to the firmware.
367 */
365 ret = usb_reset_device(cardp->udev); 368 ret = usb_reset_device(cardp->udev);
366 if (!ret) { 369 if (!ret) {
367 msleep(10); 370 msleep(10);
368 if_usb_reset_device(priv); 371 ret = libertas_reset_device(priv);
369 msleep(10); 372 msleep(10);
370 } 373 }
371 374
@@ -753,19 +756,6 @@ static int if_usb_read_event_cause(wlan_private * priv)
753 return 0; 756 return 0;
754} 757}
755 758
756static int if_usb_reset_device(wlan_private *priv)
757{
758 int ret;
759
760 lbs_deb_enter(LBS_DEB_USB);
761 ret = libertas_prepare_and_send_command(priv, CMD_802_11_RESET,
762 CMD_ACT_HALT, 0, 0, NULL);
763 msleep_interruptible(10);
764
765 lbs_deb_leave_args(LBS_DEB_USB, "ret %d", ret);
766 return ret;
767}
768
769static int if_usb_unregister_dev(wlan_private * priv) 759static int if_usb_unregister_dev(wlan_private * priv)
770{ 760{
771 int ret = 0; 761 int ret = 0;
@@ -775,7 +765,7 @@ static int if_usb_unregister_dev(wlan_private * priv)
775 * again. 765 * again.
776 */ 766 */
777 if (priv) 767 if (priv)
778 if_usb_reset_device(priv); 768 libertas_reset_device(priv);
779 769
780 return ret; 770 return ret;
781} 771}
@@ -862,7 +852,7 @@ restart:
862 852
863 if (cardp->bootcmdresp == 0) { 853 if (cardp->bootcmdresp == 0) {
864 if (--reset_count >= 0) { 854 if (--reset_count >= 0) {
865 libertas_do_reset(priv); 855 if_usb_reset_device(priv);
866 goto restart; 856 goto restart;
867 } 857 }
868 return -1; 858 return -1;
@@ -892,7 +882,7 @@ restart:
892 if (!cardp->fwdnldover) { 882 if (!cardp->fwdnldover) {
893 lbs_pr_info("failed to load fw, resetting device!\n"); 883 lbs_pr_info("failed to load fw, resetting device!\n");
894 if (--reset_count >= 0) { 884 if (--reset_count >= 0) {
895 libertas_do_reset(priv); 885 if_usb_reset_device(priv);
896 goto restart; 886 goto restart;
897 } 887 }
898 888
@@ -995,7 +985,7 @@ static void if_usb_exit_module(void)
995 lbs_deb_enter(LBS_DEB_MAIN); 985 lbs_deb_enter(LBS_DEB_MAIN);
996 986
997 list_for_each_entry_safe(cardp, cardp_temp, &usb_devices, list) 987 list_for_each_entry_safe(cardp, cardp_temp, &usb_devices, list)
998 if_usb_reset_device((wlan_private *) cardp->priv); 988 libertas_reset_device((wlan_private *) cardp->priv);
999 989
1000 /* API unregisters the driver from USB subsystem */ 990 /* API unregisters the driver from USB subsystem */
1001 usb_deregister(&if_usb_driver); 991 usb_deregister(&if_usb_driver);
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index b9e4bf293224..589c583ddbeb 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -1157,6 +1157,20 @@ void libertas_interrupt(struct net_device *dev)
1157} 1157}
1158EXPORT_SYMBOL_GPL(libertas_interrupt); 1158EXPORT_SYMBOL_GPL(libertas_interrupt);
1159 1159
1160int libertas_reset_device(wlan_private *priv)
1161{
1162 int ret;
1163
1164 lbs_deb_enter(LBS_DEB_MAIN);
1165 ret = libertas_prepare_and_send_command(priv, CMD_802_11_RESET,
1166 CMD_ACT_HALT, 0, 0, NULL);
1167 msleep_interruptible(10);
1168
1169 lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret);
1170 return ret;
1171}
1172EXPORT_SYMBOL_GPL(libertas_reset_device);
1173
1160static int libertas_init_module(void) 1174static int libertas_init_module(void)
1161{ 1175{
1162 lbs_deb_enter(LBS_DEB_MAIN); 1176 lbs_deb_enter(LBS_DEB_MAIN);