aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas
diff options
context:
space:
mode:
authorHolger Schurig <hs4233@mail.mn-solutions.de>2007-05-25 12:37:58 -0400
committerJohn W. Linville <linville@tuxdriver.com>2007-06-11 14:28:39 -0400
commit084708b61014776198c56d1606343d4f504c691e (patch)
tree201a683b3a1eff6f8103eef7fe93690d970b09f3 /drivers/net/wireless/libertas
parented457037c5e8287a3fd24408250fb396b57b9a1b (diff)
[PATCH] libertas: split module into two (libertas.ko and usb8xxx.ko)
* add CONFIG_LIBERTAS to Kconfig * remove global variable libertas_fw_name, the USB module might want to use a different default FW name than the CF module, so libertas_fw_name is now local to if_usb.c * exported some symbols as GPL Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas')
-rw-r--r--drivers/net/wireless/libertas/Makefile4
-rw-r--r--drivers/net/wireless/libertas/cmd.c1
-rw-r--r--drivers/net/wireless/libertas/decl.h16
-rw-r--r--drivers/net/wireless/libertas/fw.c14
-rw-r--r--drivers/net/wireless/libertas/if_usb.c62
-rw-r--r--drivers/net/wireless/libertas/main.c52
-rw-r--r--drivers/net/wireless/libertas/rx.c1
-rw-r--r--drivers/net/wireless/libertas/tx.c1
8 files changed, 74 insertions, 77 deletions
diff --git a/drivers/net/wireless/libertas/Makefile b/drivers/net/wireless/libertas/Makefile
index 56a8ea1fbf04..a1097f59fd46 100644
--- a/drivers/net/wireless/libertas/Makefile
+++ b/drivers/net/wireless/libertas/Makefile
@@ -1,4 +1,4 @@
1usb8xxx-objs := main.o fw.o wext.o \ 1libertas-objs := main.o fw.o wext.o \
2 rx.o tx.o cmd.o \ 2 rx.o tx.o cmd.o \
3 cmdresp.o scan.o \ 3 cmdresp.o scan.o \
4 join.o 11d.o \ 4 join.o 11d.o \
@@ -8,5 +8,5 @@ usb8xxx-objs := main.o fw.o wext.o \
8usb8xxx-objs += if_bootcmd.o 8usb8xxx-objs += if_bootcmd.o
9usb8xxx-objs += if_usb.o 9usb8xxx-objs += if_usb.o
10 10
11obj-$(CONFIG_LIBERTAS) += libertas.o
11obj-$(CONFIG_LIBERTAS_USB) += usb8xxx.o 12obj-$(CONFIG_LIBERTAS_USB) += usb8xxx.o
12
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 899b115f4c14..c6e50195d65c 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -1459,6 +1459,7 @@ done:
1459 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); 1459 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
1460 return ret; 1460 return ret;
1461} 1461}
1462EXPORT_SYMBOL_GPL(libertas_prepare_and_send_command);
1462 1463
1463/** 1464/**
1464 * @brief This function allocates the command buffer and link 1465 * @brief This function allocates the command buffer and link
diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h
index 8b34336ff3db..d6fcb339f5c2 100644
--- a/drivers/net/wireless/libertas/decl.h
+++ b/drivers/net/wireless/libertas/decl.h
@@ -74,20 +74,16 @@ void libertas_mac_event_disconnected(wlan_private * priv);
74void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str); 74void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str);
75 75
76/* fw.c */ 76/* fw.c */
77int libertas_init_fw(wlan_private * priv); 77int libertas_init_fw(wlan_private * priv, char *fw_name);
78 78
79/* main.c */ 79/* main.c */
80struct chan_freq_power *libertas_get_region_cfp_table(u8 region, u8 band, 80struct chan_freq_power *libertas_get_region_cfp_table(u8 region, u8 band,
81 int *cfp_no); 81 int *cfp_no);
82wlan_private *wlan_add_card(void *card); 82wlan_private *libertas_add_card(void *card);
83int libertas_activate_card(wlan_private *priv); 83int libertas_activate_card(wlan_private *priv, char *fw_name);
84int wlan_remove_card(wlan_private *priv); 84int libertas_remove_card(wlan_private *priv);
85int wlan_add_mesh(wlan_private *priv); 85int libertas_add_mesh(wlan_private *priv);
86void wlan_remove_mesh(wlan_private *priv); 86void libertas_remove_mesh(wlan_private *priv);
87
88/* preliminary here */
89int if_usb_register(void);
90void if_usb_unregister(void);
91 87
92 88
93#endif /* _WLAN_DECL_H_ */ 89#endif /* _WLAN_DECL_H_ */
diff --git a/drivers/net/wireless/libertas/fw.c b/drivers/net/wireless/libertas/fw.c
index aa63a967635e..08c914b62bae 100644
--- a/drivers/net/wireless/libertas/fw.c
+++ b/drivers/net/wireless/libertas/fw.c
@@ -1,7 +1,6 @@
1/** 1/**
2 * This file contains the initialization for FW and HW 2 * This file contains the initialization for FW and HW
3 */ 3 */
4#include <linux/moduleparam.h>
5#include <linux/firmware.h> 4#include <linux/firmware.h>
6 5
7#include "host.h" 6#include "host.h"
@@ -11,9 +10,6 @@
11#include "wext.h" 10#include "wext.h"
12#include "if_usb.h" 11#include "if_usb.h"
13 12
14char *libertas_fw_name = NULL;
15module_param_named(fw_name, libertas_fw_name, charp, 0644);
16
17/** 13/**
18 * @brief This function checks the validity of Boot2/FW image. 14 * @brief This function checks the validity of Boot2/FW image.
19 * 15 *
@@ -67,18 +63,18 @@ static int check_fwfile_format(u8 *data, u32 totlen)
67 * @param priv A pointer to wlan_private structure 63 * @param priv A pointer to wlan_private structure
68 * @return 0 or -1 64 * @return 0 or -1
69 */ 65 */
70static int wlan_setup_station_hw(wlan_private * priv) 66static int wlan_setup_station_hw(wlan_private * priv, char *fw_name)
71{ 67{
72 int ret = -1; 68 int ret = -1;
73 wlan_adapter *adapter = priv->adapter; 69 wlan_adapter *adapter = priv->adapter;
74 70
75 lbs_deb_enter(LBS_DEB_FW); 71 lbs_deb_enter(LBS_DEB_FW);
76 72
77 if ((ret = request_firmware(&priv->firmware, libertas_fw_name, 73 if ((ret = request_firmware(&priv->firmware, fw_name,
78 priv->hotplug_device)) < 0) { 74 priv->hotplug_device)) < 0) {
79 lbs_pr_err("request_firmware() failed with %#x\n", 75 lbs_pr_err("request_firmware() failed with %#x\n",
80 ret); 76 ret);
81 lbs_pr_err("firmware %s not found\n", libertas_fw_name); 77 lbs_pr_err("firmware %s not found\n", fw_name);
82 goto done; 78 goto done;
83 } 79 }
84 80
@@ -247,7 +243,7 @@ static void wlan_init_adapter(wlan_private * priv)
247 243
248static void command_timer_fn(unsigned long data); 244static void command_timer_fn(unsigned long data);
249 245
250int libertas_init_fw(wlan_private * priv) 246int libertas_init_fw(wlan_private * priv, char *fw_name)
251{ 247{
252 int ret = -1; 248 int ret = -1;
253 wlan_adapter *adapter = priv->adapter; 249 wlan_adapter *adapter = priv->adapter;
@@ -266,7 +262,7 @@ int libertas_init_fw(wlan_private * priv)
266 (unsigned long)priv); 262 (unsigned long)priv);
267 263
268 /* download fimrware etc. */ 264 /* download fimrware etc. */
269 if ((ret = wlan_setup_station_hw(priv)) != 0) { 265 if ((ret = wlan_setup_station_hw(priv, fw_name)) != 0) {
270 del_timer_sync(&adapter->command_timer); 266 del_timer_sync(&adapter->command_timer);
271 goto done; 267 goto done;
272 } 268 }
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 5b0e0f76f404..ca5d01296a08 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -2,6 +2,7 @@
2 * This file contains functions used in USB interface module. 2 * This file contains functions used in USB interface module.
3 */ 3 */
4#include <linux/delay.h> 4#include <linux/delay.h>
5#include <linux/moduleparam.h>
5#include <linux/firmware.h> 6#include <linux/firmware.h>
6#include <linux/netdevice.h> 7#include <linux/netdevice.h>
7#include <linux/usb.h> 8#include <linux/usb.h>
@@ -15,6 +16,11 @@
15#define MESSAGE_HEADER_LEN 4 16#define MESSAGE_HEADER_LEN 4
16 17
17static const char usbdriver_name[] = "usb8xxx"; 18static const char usbdriver_name[] = "usb8xxx";
19static u8 *default_fw_name = "usb8388.bin";
20
21char *libertas_fw_name = NULL;
22module_param_named(fw_name, libertas_fw_name, charp, 0644);
23
18 24
19#define MAX_DEVS 5 25#define MAX_DEVS 5
20static struct net_device *libertas_devs[MAX_DEVS]; 26static struct net_device *libertas_devs[MAX_DEVS];
@@ -195,14 +201,14 @@ static int if_usb_probe(struct usb_interface *intf,
195 } 201 }
196 202
197 203
198 /* At this point wlan_add_card() will be called. Don't worry 204 /* At this point libertas_add_card() will be called. Don't worry
199 * about keeping pwlanpriv around since it will be set on our 205 * about keeping pwlanpriv around since it will be set on our
200 * usb device data in -> add() -> hw_register_dev() -> if_usb_register_dev. 206 * usb device data in -> add() -> hw_register_dev() -> if_usb_register_dev.
201 */ 207 */
202 if (!(priv = wlan_add_card(usb_cardp))) 208 if (!(priv = libertas_add_card(usb_cardp)))
203 goto dealloc; 209 goto dealloc;
204 210
205 if (wlan_add_mesh(priv)) 211 if (libertas_add_mesh(priv))
206 goto err_add_mesh; 212 goto err_add_mesh;
207 213
208 priv->hw_register_dev = if_usb_register_dev; 214 priv->hw_register_dev = if_usb_register_dev;
@@ -212,7 +218,7 @@ static int if_usb_probe(struct usb_interface *intf,
212 priv->hw_get_int_status = if_usb_get_int_status; 218 priv->hw_get_int_status = if_usb_get_int_status;
213 priv->hw_read_event_cause = if_usb_read_event_cause; 219 priv->hw_read_event_cause = if_usb_read_event_cause;
214 220
215 if (libertas_activate_card(priv)) 221 if (libertas_activate_card(priv, libertas_fw_name))
216 goto err_activate_card; 222 goto err_activate_card;
217 223
218 if (libertas_found < MAX_DEVS) { 224 if (libertas_found < MAX_DEVS) {
@@ -273,8 +279,8 @@ static void if_usb_disconnect(struct usb_interface *intf)
273 279
274 /* card is removed and we can call wlan_remove_card */ 280 /* card is removed and we can call wlan_remove_card */
275 lbs_deb_usbd(&cardp->udev->dev, "call remove card\n"); 281 lbs_deb_usbd(&cardp->udev->dev, "call remove card\n");
276 wlan_remove_mesh(priv); 282 libertas_remove_mesh(priv);
277 wlan_remove_card(priv); 283 libertas_remove_card(priv);
278 284
279 /* Unlink and free urb */ 285 /* Unlink and free urb */
280 if_usb_free(cardp); 286 if_usb_free(cardp);
@@ -964,33 +970,28 @@ static struct usb_driver if_usb_driver = {
964 .resume = if_usb_resume, 970 .resume = if_usb_resume,
965}; 971};
966 972
967/** 973static int if_usb_init_module(void)
968 * @brief This function registers driver.
969 * @param add pointer to add_card callback function
970 * @param remove pointer to remove card callback function
971 * @param arg pointer to call back function parameter
972 * @return dummy success variable
973 */
974int if_usb_register(void)
975{ 974{
976 /* 975 int ret = 0;
977 * API registers the Marvell USB driver
978 * to the USB system
979 */
980 usb_register(&if_usb_driver);
981 976
982 /* Return success to wlan layer */ 977 lbs_deb_enter(LBS_DEB_MAIN);
983 return 0; 978
979 if (libertas_fw_name == NULL) {
980 libertas_fw_name = default_fw_name;
981 }
982
983 ret = usb_register(&if_usb_driver);
984
985 lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret);
986 return ret;
984} 987}
985 988
986/** 989static void if_usb_exit_module(void)
987 * @brief This function removes usb driver.
988 * @return N/A
989 */
990void if_usb_unregister(void)
991{ 990{
992 int i; 991 int i;
993 992
993 lbs_deb_enter(LBS_DEB_MAIN);
994
994 for (i = 0; i<libertas_found; i++) { 995 for (i = 0; i<libertas_found; i++) {
995 wlan_private *priv = libertas_devs[i]->priv; 996 wlan_private *priv = libertas_devs[i]->priv;
996 reset_device(priv); 997 reset_device(priv);
@@ -998,4 +999,13 @@ void if_usb_unregister(void)
998 999
999 /* API unregisters the driver from USB subsystem */ 1000 /* API unregisters the driver from USB subsystem */
1000 usb_deregister(&if_usb_driver); 1001 usb_deregister(&if_usb_driver);
1002
1003 lbs_deb_leave(LBS_DEB_MAIN);
1001} 1004}
1005
1006module_init(if_usb_init_module);
1007module_exit(if_usb_exit_module);
1008
1009MODULE_DESCRIPTION("8388 USB WLAN Driver");
1010MODULE_AUTHOR("Marvell International Ltd.");
1011MODULE_LICENSE("GPL");
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index c9d155ce98a0..8c1f0e1e890c 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -32,7 +32,7 @@ const char libertas_driver_version[] = "COMM-USB8388-" DRIVER_RELEASE_VERSION
32/* Module parameters */ 32/* Module parameters */
33unsigned int libertas_debug = 0; 33unsigned int libertas_debug = 0;
34module_param(libertas_debug, int, 0644); 34module_param(libertas_debug, int, 0644);
35 35EXPORT_SYMBOL_GPL(libertas_debug);
36 36
37 37
38#define WLAN_TX_PWR_DEFAULT 20 /*100mW */ 38#define WLAN_TX_PWR_DEFAULT 20 /*100mW */
@@ -173,8 +173,6 @@ u8 libertas_adhoc_rates_b[4] = { 0x82, 0x84, 0x8b, 0x96 };
173u16 libertas_region_code_to_index[MRVDRV_MAX_REGION_CODE] = 173u16 libertas_region_code_to_index[MRVDRV_MAX_REGION_CODE] =
174 { 0x10, 0x20, 0x30, 0x31, 0x32, 0x40 }; 174 { 0x10, 0x20, 0x30, 0x31, 0x32, 0x40 };
175 175
176static u8 *default_fw_name = "usb8388.bin";
177
178/** 176/**
179 * Attributes exported through sysfs 177 * Attributes exported through sysfs
180 */ 178 */
@@ -766,7 +764,7 @@ static int wlan_service_main_thread(void *data)
766 * @param card A pointer to card 764 * @param card A pointer to card
767 * @return A pointer to wlan_private structure 765 * @return A pointer to wlan_private structure
768 */ 766 */
769wlan_private *wlan_add_card(void *card) 767wlan_private *libertas_add_card(void *card)
770{ 768{
771 struct net_device *dev = NULL; 769 struct net_device *dev = NULL;
772 wlan_private *priv = NULL; 770 wlan_private *priv = NULL;
@@ -826,8 +824,9 @@ done:
826 lbs_deb_leave_args(LBS_DEB_NET, "priv %p", priv); 824 lbs_deb_leave_args(LBS_DEB_NET, "priv %p", priv);
827 return priv; 825 return priv;
828} 826}
827EXPORT_SYMBOL_GPL(libertas_add_card);
829 828
830int libertas_activate_card(wlan_private *priv) 829int libertas_activate_card(wlan_private *priv, char *fw_name)
831{ 830{
832 struct net_device *dev = priv->wlan_dev.netdev; 831 struct net_device *dev = priv->wlan_dev.netdev;
833 int ret = -1; 832 int ret = -1;
@@ -854,7 +853,7 @@ int libertas_activate_card(wlan_private *priv)
854 } 853 }
855 854
856 /* init FW and HW */ 855 /* init FW and HW */
857 if (libertas_init_fw(priv)) { 856 if (fw_name && libertas_init_fw(priv, fw_name)) {
858 lbs_pr_err("firmware init failed\n"); 857 lbs_pr_err("firmware init failed\n");
859 goto err_registerdev; 858 goto err_registerdev;
860 } 859 }
@@ -884,6 +883,8 @@ done:
884 lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); 883 lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
885 return ret; 884 return ret;
886} 885}
886EXPORT_SYMBOL_GPL(libertas_activate_card);
887
887 888
888/** 889/**
889 * @brief This function adds mshX interface 890 * @brief This function adds mshX interface
@@ -891,7 +892,7 @@ done:
891 * @param priv A pointer to the wlan_private structure 892 * @param priv A pointer to the wlan_private structure
892 * @return 0 if successful, -X otherwise 893 * @return 0 if successful, -X otherwise
893 */ 894 */
894int wlan_add_mesh(wlan_private *priv) 895int libertas_add_mesh(wlan_private *priv)
895{ 896{
896 struct net_device *mesh_dev = NULL; 897 struct net_device *mesh_dev = NULL;
897 int ret = 0; 898 int ret = 0;
@@ -949,6 +950,7 @@ done:
949 lbs_deb_leave_args(LBS_DEB_MESH, "ret %d", ret); 950 lbs_deb_leave_args(LBS_DEB_MESH, "ret %d", ret);
950 return ret; 951 return ret;
951} 952}
953EXPORT_SYMBOL_GPL(libertas_add_mesh);
952 954
953static void wake_pending_cmdnodes(wlan_private *priv) 955static void wake_pending_cmdnodes(wlan_private *priv)
954{ 956{
@@ -966,7 +968,7 @@ static void wake_pending_cmdnodes(wlan_private *priv)
966} 968}
967 969
968 970
969int wlan_remove_card(wlan_private *priv) 971int libertas_remove_card(wlan_private *priv)
970{ 972{
971 wlan_adapter *adapter; 973 wlan_adapter *adapter;
972 struct net_device *dev; 974 struct net_device *dev;
@@ -1022,8 +1024,10 @@ out:
1022 lbs_deb_leave(LBS_DEB_NET); 1024 lbs_deb_leave(LBS_DEB_NET);
1023 return 0; 1025 return 0;
1024} 1026}
1027EXPORT_SYMBOL_GPL(libertas_remove_card);
1025 1028
1026void wlan_remove_mesh(wlan_private *priv) 1029
1030void libertas_remove_mesh(wlan_private *priv)
1027{ 1031{
1028 struct net_device *mesh_dev; 1032 struct net_device *mesh_dev;
1029 1033
@@ -1046,6 +1050,7 @@ void wlan_remove_mesh(wlan_private *priv)
1046out: 1050out:
1047 lbs_deb_leave(LBS_DEB_NET); 1051 lbs_deb_leave(LBS_DEB_NET);
1048} 1052}
1053EXPORT_SYMBOL_GPL(libertas_remove_mesh);
1049 1054
1050/** 1055/**
1051 * @brief This function finds the CFP in 1056 * @brief This function finds the CFP in
@@ -1141,41 +1146,28 @@ void libertas_interrupt(struct net_device *dev)
1141 1146
1142 lbs_deb_leave(LBS_DEB_THREAD); 1147 lbs_deb_leave(LBS_DEB_THREAD);
1143} 1148}
1149EXPORT_SYMBOL_GPL(libertas_interrupt);
1144 1150
1145static int wlan_init_module(void) 1151static int libertas_init_module(void)
1146{ 1152{
1147 int ret = 0;
1148
1149 lbs_deb_enter(LBS_DEB_MAIN); 1153 lbs_deb_enter(LBS_DEB_MAIN);
1150
1151 if (libertas_fw_name == NULL) {
1152 libertas_fw_name = default_fw_name;
1153 }
1154
1155 libertas_debugfs_init(); 1154 libertas_debugfs_init();
1156 1155 lbs_deb_leave(LBS_DEB_MAIN);
1157 if (if_usb_register()) { 1156 return 0;
1158 ret = -1;
1159 libertas_debugfs_remove();
1160 }
1161
1162 lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret);
1163 return ret;
1164} 1157}
1165 1158
1166static void wlan_cleanup_module(void) 1159static void libertas_exit_module(void)
1167{ 1160{
1168 lbs_deb_enter(LBS_DEB_MAIN); 1161 lbs_deb_enter(LBS_DEB_MAIN);
1169 1162
1170 if_usb_unregister();
1171 libertas_debugfs_remove(); 1163 libertas_debugfs_remove();
1172 1164
1173 lbs_deb_leave(LBS_DEB_MAIN); 1165 lbs_deb_leave(LBS_DEB_MAIN);
1174} 1166}
1175 1167
1176module_init(wlan_init_module); 1168module_init(libertas_init_module);
1177module_exit(wlan_cleanup_module); 1169module_exit(libertas_exit_module);
1178 1170
1179MODULE_DESCRIPTION("M-WLAN Driver"); 1171MODULE_DESCRIPTION("Libertas WLAN Driver Library");
1180MODULE_AUTHOR("Marvell International Ltd."); 1172MODULE_AUTHOR("Marvell International Ltd.");
1181MODULE_LICENSE("GPL"); 1173MODULE_LICENSE("GPL");
diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c
index a0779dc78285..0b7854d797c4 100644
--- a/drivers/net/wireless/libertas/rx.c
+++ b/drivers/net/wireless/libertas/rx.c
@@ -277,6 +277,7 @@ done:
277 lbs_deb_leave_args(LBS_DEB_RX, "ret %d", ret); 277 lbs_deb_leave_args(LBS_DEB_RX, "ret %d", ret);
278 return ret; 278 return ret;
279} 279}
280EXPORT_SYMBOL_GPL(libertas_process_rxed_packet);
280 281
281/** 282/**
282 * @brief This function converts Tx/Rx rates from the Marvell WLAN format 283 * @brief This function converts Tx/Rx rates from the Marvell WLAN format
diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c
index 1993e8e79c45..138668ea9cf6 100644
--- a/drivers/net/wireless/libertas/tx.c
+++ b/drivers/net/wireless/libertas/tx.c
@@ -287,3 +287,4 @@ void libertas_send_tx_feedback(wlan_private * priv)
287 netif_wake_queue(priv->mesh_dev); 287 netif_wake_queue(priv->mesh_dev);
288 } 288 }
289} 289}
290EXPORT_SYMBOL_GPL(libertas_send_tx_feedback);