aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/libertas/main.c')
-rw-r--r--drivers/net/wireless/libertas/main.c72
1 files changed, 30 insertions, 42 deletions
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index ed57cf863b69..8c40949cb076 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -4,6 +4,8 @@
4 * thread etc.. 4 * thread etc..
5 */ 5 */
6 6
7#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
8
7#include <linux/moduleparam.h> 9#include <linux/moduleparam.h>
8#include <linux/delay.h> 10#include <linux/delay.h>
9#include <linux/etherdevice.h> 11#include <linux/etherdevice.h>
@@ -34,6 +36,10 @@ unsigned int lbs_debug;
34EXPORT_SYMBOL_GPL(lbs_debug); 36EXPORT_SYMBOL_GPL(lbs_debug);
35module_param_named(libertas_debug, lbs_debug, int, 0644); 37module_param_named(libertas_debug, lbs_debug, int, 0644);
36 38
39unsigned int lbs_disablemesh;
40EXPORT_SYMBOL_GPL(lbs_disablemesh);
41module_param_named(libertas_disablemesh, lbs_disablemesh, int, 0644);
42
37 43
38/* 44/*
39 * This global structure is used to send the confirm_sleep command as 45 * This global structure is used to send the confirm_sleep command as
@@ -149,28 +155,6 @@ static int lbs_eth_stop(struct net_device *dev)
149 return 0; 155 return 0;
150} 156}
151 157
152static void lbs_tx_timeout(struct net_device *dev)
153{
154 struct lbs_private *priv = dev->ml_priv;
155
156 lbs_deb_enter(LBS_DEB_TX);
157
158 lbs_pr_err("tx watch dog timeout\n");
159
160 dev->trans_start = jiffies; /* prevent tx timeout */
161
162 if (priv->currenttxskb)
163 lbs_send_tx_feedback(priv, 0);
164
165 /* XX: Shouldn't we also call into the hw-specific driver
166 to kick it somehow? */
167 lbs_host_to_card_done(priv);
168
169 /* FIXME: reset the card */
170
171 lbs_deb_leave(LBS_DEB_TX);
172}
173
174void lbs_host_to_card_done(struct lbs_private *priv) 158void lbs_host_to_card_done(struct lbs_private *priv)
175{ 159{
176 unsigned long flags; 160 unsigned long flags;
@@ -464,8 +448,8 @@ static int lbs_thread(void *data)
464 if (priv->cmd_timed_out && priv->cur_cmd) { 448 if (priv->cmd_timed_out && priv->cur_cmd) {
465 struct cmd_ctrl_node *cmdnode = priv->cur_cmd; 449 struct cmd_ctrl_node *cmdnode = priv->cur_cmd;
466 450
467 lbs_pr_info("Timeout submitting command 0x%04x\n", 451 netdev_info(dev, "Timeout submitting command 0x%04x\n",
468 le16_to_cpu(cmdnode->cmdbuf->command)); 452 le16_to_cpu(cmdnode->cmdbuf->command));
469 lbs_complete_command(priv, cmdnode, -ETIMEDOUT); 453 lbs_complete_command(priv, cmdnode, -ETIMEDOUT);
470 if (priv->reset_card) 454 if (priv->reset_card)
471 priv->reset_card(priv); 455 priv->reset_card(priv);
@@ -492,8 +476,8 @@ static int lbs_thread(void *data)
492 * after firmware fixes it 476 * after firmware fixes it
493 */ 477 */
494 priv->psstate = PS_STATE_AWAKE; 478 priv->psstate = PS_STATE_AWAKE;
495 lbs_pr_alert("ignore PS_SleepConfirm in " 479 netdev_alert(dev,
496 "non-connected state\n"); 480 "ignore PS_SleepConfirm in non-connected state\n");
497 } 481 }
498 } 482 }
499 483
@@ -587,7 +571,8 @@ int lbs_suspend(struct lbs_private *priv)
587 if (priv->is_deep_sleep) { 571 if (priv->is_deep_sleep) {
588 ret = lbs_set_deep_sleep(priv, 0); 572 ret = lbs_set_deep_sleep(priv, 0);
589 if (ret) { 573 if (ret) {
590 lbs_pr_err("deep sleep cancellation failed: %d\n", ret); 574 netdev_err(priv->dev,
575 "deep sleep cancellation failed: %d\n", ret);
591 return ret; 576 return ret;
592 } 577 }
593 priv->deep_sleep_required = 1; 578 priv->deep_sleep_required = 1;
@@ -620,7 +605,8 @@ int lbs_resume(struct lbs_private *priv)
620 priv->deep_sleep_required = 0; 605 priv->deep_sleep_required = 0;
621 ret = lbs_set_deep_sleep(priv, 1); 606 ret = lbs_set_deep_sleep(priv, 1);
622 if (ret) 607 if (ret)
623 lbs_pr_err("deep sleep activation failed: %d\n", ret); 608 netdev_err(priv->dev,
609 "deep sleep activation failed: %d\n", ret);
624 } 610 }
625 611
626 if (priv->setup_fw_on_resume) 612 if (priv->setup_fw_on_resume)
@@ -648,8 +634,8 @@ static void lbs_cmd_timeout_handler(unsigned long data)
648 if (!priv->cur_cmd) 634 if (!priv->cur_cmd)
649 goto out; 635 goto out;
650 636
651 lbs_pr_info("command 0x%04x timed out\n", 637 netdev_info(priv->dev, "command 0x%04x timed out\n",
652 le16_to_cpu(priv->cur_cmd->cmdbuf->command)); 638 le16_to_cpu(priv->cur_cmd->cmdbuf->command));
653 639
654 priv->cmd_timed_out = 1; 640 priv->cmd_timed_out = 1;
655 wake_up_interruptible(&priv->waitq); 641 wake_up_interruptible(&priv->waitq);
@@ -754,7 +740,7 @@ static int lbs_init_adapter(struct lbs_private *priv)
754 740
755 /* Allocate the command buffers */ 741 /* Allocate the command buffers */
756 if (lbs_allocate_cmd_buffer(priv)) { 742 if (lbs_allocate_cmd_buffer(priv)) {
757 lbs_pr_err("Out of memory allocating command buffers\n"); 743 pr_err("Out of memory allocating command buffers\n");
758 ret = -ENOMEM; 744 ret = -ENOMEM;
759 goto out; 745 goto out;
760 } 746 }
@@ -764,7 +750,7 @@ static int lbs_init_adapter(struct lbs_private *priv)
764 /* Create the event FIFO */ 750 /* Create the event FIFO */
765 ret = kfifo_alloc(&priv->event_fifo, sizeof(u32) * 16, GFP_KERNEL); 751 ret = kfifo_alloc(&priv->event_fifo, sizeof(u32) * 16, GFP_KERNEL);
766 if (ret) { 752 if (ret) {
767 lbs_pr_err("Out of memory allocating event FIFO buffer\n"); 753 pr_err("Out of memory allocating event FIFO buffer\n");
768 goto out; 754 goto out;
769 } 755 }
770 756
@@ -791,7 +777,6 @@ static const struct net_device_ops lbs_netdev_ops = {
791 .ndo_stop = lbs_eth_stop, 777 .ndo_stop = lbs_eth_stop,
792 .ndo_start_xmit = lbs_hard_start_xmit, 778 .ndo_start_xmit = lbs_hard_start_xmit,
793 .ndo_set_mac_address = lbs_set_mac_address, 779 .ndo_set_mac_address = lbs_set_mac_address,
794 .ndo_tx_timeout = lbs_tx_timeout,
795 .ndo_set_multicast_list = lbs_set_multicast_list, 780 .ndo_set_multicast_list = lbs_set_multicast_list,
796 .ndo_change_mtu = eth_change_mtu, 781 .ndo_change_mtu = eth_change_mtu,
797 .ndo_validate_addr = eth_validate_addr, 782 .ndo_validate_addr = eth_validate_addr,
@@ -816,7 +801,7 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev)
816 /* Allocate an Ethernet device and register it */ 801 /* Allocate an Ethernet device and register it */
817 wdev = lbs_cfg_alloc(dmdev); 802 wdev = lbs_cfg_alloc(dmdev);
818 if (IS_ERR(wdev)) { 803 if (IS_ERR(wdev)) {
819 lbs_pr_err("cfg80211 init failed\n"); 804 pr_err("cfg80211 init failed\n");
820 goto done; 805 goto done;
821 } 806 }
822 807
@@ -825,7 +810,7 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev)
825 priv->wdev = wdev; 810 priv->wdev = wdev;
826 811
827 if (lbs_init_adapter(priv)) { 812 if (lbs_init_adapter(priv)) {
828 lbs_pr_err("failed to initialize adapter structure.\n"); 813 pr_err("failed to initialize adapter structure\n");
829 goto err_wdev; 814 goto err_wdev;
830 } 815 }
831 816
@@ -957,17 +942,20 @@ int lbs_start_card(struct lbs_private *priv)
957 goto done; 942 goto done;
958 943
959 if (lbs_cfg_register(priv)) { 944 if (lbs_cfg_register(priv)) {
960 lbs_pr_err("cannot register device\n"); 945 pr_err("cannot register device\n");
961 goto done; 946 goto done;
962 } 947 }
963 948
964 lbs_update_channel(priv); 949 lbs_update_channel(priv);
965 950
966 lbs_init_mesh(priv); 951 if (!lbs_disablemesh)
952 lbs_init_mesh(priv);
953 else
954 pr_info("%s: mesh disabled\n", dev->name);
967 955
968 lbs_debugfs_init_one(priv, dev); 956 lbs_debugfs_init_one(priv, dev);
969 957
970 lbs_pr_info("%s: Marvell WLAN 802.11 adapter\n", dev->name); 958 netdev_info(dev, "Marvell WLAN 802.11 adapter\n");
971 959
972 ret = 0; 960 ret = 0;
973 961
@@ -1094,16 +1082,16 @@ int lbs_get_firmware(struct device *dev, const char *user_helper,
1094 if (user_helper) { 1082 if (user_helper) {
1095 ret = request_firmware(helper, user_helper, dev); 1083 ret = request_firmware(helper, user_helper, dev);
1096 if (ret) { 1084 if (ret) {
1097 lbs_pr_err("couldn't find helper firmware %s", 1085 dev_err(dev, "couldn't find helper firmware %s\n",
1098 user_helper); 1086 user_helper);
1099 goto fail; 1087 goto fail;
1100 } 1088 }
1101 } 1089 }
1102 if (user_mainfw) { 1090 if (user_mainfw) {
1103 ret = request_firmware(mainfw, user_mainfw, dev); 1091 ret = request_firmware(mainfw, user_mainfw, dev);
1104 if (ret) { 1092 if (ret) {
1105 lbs_pr_err("couldn't find main firmware %s", 1093 dev_err(dev, "couldn't find main firmware %s\n",
1106 user_mainfw); 1094 user_mainfw);
1107 goto fail; 1095 goto fail;
1108 } 1096 }
1109 } 1097 }