1 #include "hfa384x_usb.c"
2 #include "prism2mgmt.c"
7 #define PRISM_USB_DEVICE(vid, pid, name) \
8 USB_DEVICE(vid, pid), \
9 .driver_info = (unsigned long) name
11 static struct usb_device_id usb_prism_tbl
[] = {
12 {PRISM_USB_DEVICE(0x04bb, 0x0922, "IOData AirPort WN-B11/USBS")},
13 {PRISM_USB_DEVICE(0x07aa, 0x0012, "Corega Wireless LAN USB Stick-11")},
14 {PRISM_USB_DEVICE(0x09aa, 0x3642, "Prism2.x 11Mbps WLAN USB Adapter")},
16 (0x1668, 0x0408, "Actiontec Prism2.5 11Mbps WLAN USB Adapter")},
18 (0x1668, 0x0421, "Actiontec Prism2.5 11Mbps WLAN USB Adapter")},
20 (0x1915, 0x2236, "Linksys WUSB11v3.0 11Mbps WLAN USB Adapter")},
22 (0x066b, 0x2212, "Linksys WUSB11v2.5 11Mbps WLAN USB Adapter")},
24 (0x066b, 0x2213, "Linksys WUSB12v1.1 11Mbps WLAN USB Adapter")},
26 (0x067c, 0x1022, "Siemens SpeedStream 1022 11Mbps WLAN USB Adapter")},
29 "Compaq/Intel W100 PRO/Wireless 11Mbps multiport WLAN Adapter")},
31 (0x0411, 0x0016, "Melco WLI-USB-S11 11Mbps WLAN Adapter")},
33 (0x08de, 0x7a01, "PRISM25 IEEE 802.11 Mini USB Adapter")},
35 (0x8086, 0x1111, "Intel PRO/Wireless 2011B LAN USB Adapter")},
37 (0x0d8e, 0x7a01, "PRISM25 IEEE 802.11 Mini USB Adapter")},
39 (0x045e, 0x006e, "Microsoft MN510 Wireless USB Adapter")},
40 {PRISM_USB_DEVICE(0x0967, 0x0204, "Acer Warplink USB Adapter")},
42 (0x0cde, 0x0002, "Z-Com 725/726 Prism2.5 USB/USB Integrated")},
44 (0x0cde, 0x0005, "Z-Com Xl735 Wireless 802.11b USB Adapter")},
46 (0x413c, 0x8100, "Dell TrueMobile 1180 Wireless USB Adapter")},
48 (0x0b3b, 0x1601, "ALLNET 0193 11Mbps WLAN USB Adapter")},
50 (0x0b3b, 0x1602, "ZyXEL ZyAIR B200 Wireless USB Adapter")},
52 (0x0baf, 0x00eb, "USRobotics USR1120 Wireless USB Adapter")},
54 (0x0411, 0x0027, "Melco WLI-USB-KS11G 11Mbps WLAN Adapter")},
56 (0x04f1, 0x3009, "JVC MP-XP7250 Builtin USB WLAN Adapter")},
57 {PRISM_USB_DEVICE(0x0846, 0x4110, "NetGear MA111")},
58 {PRISM_USB_DEVICE(0x03f3, 0x0020, "Adaptec AWN-8020 USB WLAN Adapter")},
59 {PRISM_USB_DEVICE(0x2821, 0x3300, "ASUS-WL140 Wireless USB Adapter")},
60 {PRISM_USB_DEVICE(0x2001, 0x3700, "DWL-122 Wireless USB Adapter")},
62 (0x2001, 0x3702, "DWL-120 Rev F Wireless USB Adapter")},
63 {PRISM_USB_DEVICE(0x50c2, 0x4013, "Averatec USB WLAN Adapter")},
64 {PRISM_USB_DEVICE(0x2c02, 0x14ea, "Planex GW-US11H WLAN USB Adapter")},
65 {PRISM_USB_DEVICE(0x124a, 0x168b, "Airvast PRISM3 WLAN USB Adapter")},
66 {PRISM_USB_DEVICE(0x083a, 0x3503, "T-Sinus 111 USB WLAN Adapter")},
67 {PRISM_USB_DEVICE(0x2821, 0x3300, "Hawking HighDB USB Adapter")},
69 (0x0411, 0x0044, "Melco WLI-USB-KB11 11Mbps WLAN Adapter")},
70 {PRISM_USB_DEVICE(0x1668, 0x6106, "ROPEX FreeLan 802.11b USB Adapter")},
72 (0x124a, 0x4017, "Pheenet WL-503IA 802.11b USB Adapter")},
73 {PRISM_USB_DEVICE(0x0bb2, 0x0302, "Ambit Microsystems Corp.")},
75 (0x9016, 0x182d, "Sitecom WL-022 802.11b USB Adapter")},
77 (0x0543, 0x0f01, "ViewSonic Airsync USB Adapter 11Mbps (Prism2.5)")},
81 MODULE_DEVICE_TABLE(usb
, usb_prism_tbl
);
83 /*----------------------------------------------------------------
86 * Probe routine called by the USB subsystem.
89 * dev ptr to the usb_device struct
90 * ifnum interface number being offered
93 * NULL - we're not claiming the device+interface
94 * non-NULL - we are claiming the device+interface and
95 * this is a ptr to the data we want back
96 * when disconnect is called.
101 * I'm not sure, assume it's interrupt.
103 ----------------------------------------------------------------*/
104 static int prism2sta_probe_usb(struct usb_interface
*interface
,
105 const struct usb_device_id
*id
)
107 struct usb_device
*dev
;
109 wlandevice_t
*wlandev
= NULL
;
110 hfa384x_t
*hw
= NULL
;
113 dev
= interface_to_usbdev(interface
);
114 wlandev
= create_wlan();
115 if (wlandev
== NULL
) {
116 dev_err(&interface
->dev
, "Memory allocation failure.\n");
122 if (wlan_setup(wlandev
, &(interface
->dev
)) != 0) {
123 dev_err(&interface
->dev
, "wlan_setup() failed.\n");
128 /* Initialize the hw data */
129 hfa384x_create(hw
, dev
);
130 hw
->wlandev
= wlandev
;
132 /* Register the wlandev, this gets us a name and registers the
135 SET_NETDEV_DEV(wlandev
->netdev
, &(interface
->dev
));
137 /* Do a chip-level reset on the MAC */
138 if (prism2_doreset
) {
139 result
= hfa384x_corereset(hw
,
140 prism2_reset_holdtime
,
141 prism2_reset_settletime
, 0);
144 dev_err(&interface
->dev
, "hfa384x_corereset() failed.\n");
151 wlandev
->msdstate
= WLAN_MSD_HWPRESENT
;
153 /* Try and load firmware, then enable card before we register */
154 prism2_fwtry(dev
, wlandev
);
155 prism2sta_ifstate(wlandev
, P80211ENUM_ifstate_enable
);
157 if (register_wlandev(wlandev
) != 0) {
158 dev_err(&interface
->dev
, "register_wlandev() failed.\n");
160 goto failed_register
;
168 wlan_unsetup(wlandev
);
175 usb_set_intfdata(interface
, wlandev
);
179 /*----------------------------------------------------------------
180 * prism2sta_disconnect_usb
182 * Called when a device previously claimed by probe is removed
186 * dev ptr to the usb_device struct
187 * ptr ptr returned by probe() when the device
197 ----------------------------------------------------------------*/
198 static void prism2sta_disconnect_usb(struct usb_interface
*interface
)
200 wlandevice_t
*wlandev
;
202 wlandev
= (wlandevice_t
*) usb_get_intfdata(interface
);
204 if (wlandev
!= NULL
) {
205 LIST_HEAD(cleanlist
);
206 struct list_head
*entry
;
207 struct list_head
*temp
;
210 hfa384x_t
*hw
= wlandev
->priv
;
215 spin_lock_irqsave(&hw
->ctlxq
.lock
, flags
);
217 p80211netdev_hwremoved(wlandev
);
218 list_splice_init(&hw
->ctlxq
.reapable
, &cleanlist
);
219 list_splice_init(&hw
->ctlxq
.completing
, &cleanlist
);
220 list_splice_init(&hw
->ctlxq
.pending
, &cleanlist
);
221 list_splice_init(&hw
->ctlxq
.active
, &cleanlist
);
223 spin_unlock_irqrestore(&hw
->ctlxq
.lock
, flags
);
225 /* There's no hardware to shutdown, but the driver
226 * might have some tasks or tasklets that must be
227 * stopped before we can tear everything down.
229 prism2sta_ifstate(wlandev
, P80211ENUM_ifstate_disable
);
231 del_singleshot_timer_sync(&hw
->throttle
);
232 del_singleshot_timer_sync(&hw
->reqtimer
);
233 del_singleshot_timer_sync(&hw
->resptimer
);
235 /* Unlink all the URBs. This "removes the wheels"
236 * from the entire CTLX handling mechanism.
238 usb_kill_urb(&hw
->rx_urb
);
239 usb_kill_urb(&hw
->tx_urb
);
240 usb_kill_urb(&hw
->ctlx_urb
);
242 tasklet_kill(&hw
->completion_bh
);
243 tasklet_kill(&hw
->reaper_bh
);
245 flush_scheduled_work();
247 /* Now we complete any outstanding commands
248 * and tell everyone who is waiting for their
249 * responses that we have shut down.
251 list_for_each(entry
, &cleanlist
) {
252 hfa384x_usbctlx_t
*ctlx
;
254 ctlx
= list_entry(entry
, hfa384x_usbctlx_t
, list
);
255 complete(&ctlx
->done
);
258 /* Give any outstanding synchronous commands
259 * a chance to complete. All they need to do
260 * is "wake up", so that's easy.
261 * (I'd like a better way to do this, really.)
265 /* Now delete the CTLXs, because no-one else can now. */
266 list_for_each_safe(entry
, temp
, &cleanlist
) {
267 hfa384x_usbctlx_t
*ctlx
;
269 ctlx
= list_entry(entry
, hfa384x_usbctlx_t
, list
);
273 /* Unhook the wlandev */
274 unregister_wlandev(wlandev
);
275 wlan_unsetup(wlandev
);
277 usb_put_dev(hw
->usb
);
286 usb_set_intfdata(interface
, NULL
);
290 static int prism2sta_suspend(struct usb_interface
*interface
,
291 pm_message_t message
)
293 hfa384x_t
*hw
= NULL
;
294 wlandevice_t
*wlandev
;
295 wlandev
= (wlandevice_t
*) usb_get_intfdata(interface
);
303 prism2sta_ifstate(wlandev
, P80211ENUM_ifstate_disable
);
305 usb_kill_urb(&hw
->rx_urb
);
306 usb_kill_urb(&hw
->tx_urb
);
307 usb_kill_urb(&hw
->ctlx_urb
);
312 static int prism2sta_resume(struct usb_interface
*interface
)
315 hfa384x_t
*hw
= NULL
;
316 wlandevice_t
*wlandev
;
317 wlandev
= (wlandevice_t
*) usb_get_intfdata(interface
);
325 /* Do a chip-level reset on the MAC */
326 if (prism2_doreset
) {
327 result
= hfa384x_corereset(hw
,
328 prism2_reset_holdtime
,
329 prism2_reset_settletime
, 0);
331 unregister_wlandev(wlandev
);
333 dev_err(&interface
->dev
, "hfa384x_corereset() failed.\n");
341 prism2sta_ifstate(wlandev
, P80211ENUM_ifstate_enable
);
346 #define prism2sta_suspend NULL
347 #define prism2sta_resume NULL
348 #endif /* CONFIG_PM */
350 static struct usb_driver prism2_usb_driver
= {
351 .name
= "prism2_usb",
352 .probe
= prism2sta_probe_usb
,
353 .disconnect
= prism2sta_disconnect_usb
,
354 .id_table
= usb_prism_tbl
,
355 .suspend
= prism2sta_suspend
,
356 .resume
= prism2sta_resume
,
357 .reset_resume
= prism2sta_resume
,
361 module_usb_driver(prism2_usb_driver
);