2 * Intel Wireless WiMAX Connection 2400m
3 * Linux driver model glue for USB device, reset & fw upload
6 * Copyright (C) 2007-2008 Intel Corporation <linux-wimax@intel.com>
7 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
8 * Yanir Lubetkin <yanirx.lubetkin@intel.com>
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License version
12 * 2 as published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 * See i2400m-usb.h for a general description of this driver.
27 * This file implements driver model glue, and hook ups for the
28 * generic driver to implement the bus-specific functions (device
29 * communication setup/tear down, firmware upload and resetting).
35 * i2400mu_netdev_setup()
37 * i2400m_netdev_setup()
45 * i2400m_cmd_enter_powersave()
46 * i2400mu_notification_release()
49 * i2400mu_notification_setup()
51 * i2400mu_bus_dev_start() Called by i2400m_dev_start() [who is
52 * i2400mu_tx_setup() called by i2400m_setup()]
54 * i2400mu_notification_setup()
56 * i2400mu_bus_dev_stop() Called by i2400m_dev_stop() [who is
57 * i2400mu_notification_release() called by i2400m_release()]
58 * i2400mu_rx_release()
59 * i2400mu_tx_release()
61 * i2400mu_bus_reset() Called by i2400m_reset
63 * __i2400mu_send_barker()
66 #include "i2400m-usb.h"
67 #include <linux/wimax/i2400m.h>
68 #include <linux/debugfs.h>
69 #include <linux/slab.h>
70 #include <linux/module.h>
73 #define D_SUBMODULE usb
74 #include "usb-debug-levels.h"
76 static char i2400mu_debug_params
[128];
77 module_param_string(debug
, i2400mu_debug_params
, sizeof(i2400mu_debug_params
),
79 MODULE_PARM_DESC(debug
,
80 "String of space-separated NAME:VALUE pairs, where NAMEs "
81 "are the different debug submodules and VALUE are the "
82 "initial debug value to set.");
84 /* Our firmware file name */
85 static const char *i2400mu_bus_fw_names_5x50
[] = {
86 #define I2400MU_FW_FILE_NAME_v1_5 "i2400m-fw-usb-1.5.sbcf"
87 I2400MU_FW_FILE_NAME_v1_5
,
88 #define I2400MU_FW_FILE_NAME_v1_4 "i2400m-fw-usb-1.4.sbcf"
89 I2400MU_FW_FILE_NAME_v1_4
,
94 static const char *i2400mu_bus_fw_names_6050
[] = {
95 #define I6050U_FW_FILE_NAME_v1_5 "i6050-fw-usb-1.5.sbcf"
96 I6050U_FW_FILE_NAME_v1_5
,
102 int i2400mu_bus_dev_start(struct i2400m
*i2400m
)
105 struct i2400mu
*i2400mu
= container_of(i2400m
, struct i2400mu
, i2400m
);
106 struct device
*dev
= &i2400mu
->usb_iface
->dev
;
108 d_fnstart(3, dev
, "(i2400m %p)\n", i2400m
);
109 result
= i2400mu_tx_setup(i2400mu
);
111 goto error_usb_tx_setup
;
112 result
= i2400mu_rx_setup(i2400mu
);
114 goto error_usb_rx_setup
;
115 result
= i2400mu_notification_setup(i2400mu
);
117 goto error_notif_setup
;
118 d_fnend(3, dev
, "(i2400m %p) = %d\n", i2400m
, result
);
122 i2400mu_rx_release(i2400mu
);
124 i2400mu_tx_release(i2400mu
);
126 d_fnend(3, dev
, "(i2400m %p) = void\n", i2400m
);
132 void i2400mu_bus_dev_stop(struct i2400m
*i2400m
)
134 struct i2400mu
*i2400mu
= container_of(i2400m
, struct i2400mu
, i2400m
);
135 struct device
*dev
= &i2400mu
->usb_iface
->dev
;
137 d_fnstart(3, dev
, "(i2400m %p)\n", i2400m
);
138 i2400mu_notification_release(i2400mu
);
139 i2400mu_rx_release(i2400mu
);
140 i2400mu_tx_release(i2400mu
);
141 d_fnend(3, dev
, "(i2400m %p) = void\n", i2400m
);
146 * Sends a barker buffer to the device
148 * This helper will allocate a kmalloced buffer and use it to transmit
149 * (then free it). Reason for this is that other arches cannot use
150 * stack/vmalloc/text areas for DMA transfers.
152 * Error recovery here is simpler: anything is considered a hard error
153 * and will move the reset code to use a last-resort bus-based reset.
156 int __i2400mu_send_barker(struct i2400mu
*i2400mu
,
157 const __le32
*barker
,
161 struct usb_endpoint_descriptor
*epd
= NULL
;
162 int pipe
, actual_len
, ret
;
163 struct device
*dev
= &i2400mu
->usb_iface
->dev
;
167 ret
= usb_autopm_get_interface(i2400mu
->usb_iface
);
169 dev_err(dev
, "RESET: can't get autopm: %d\n", ret
);
173 buffer
= kmalloc(barker_size
, GFP_KERNEL
);
176 epd
= usb_get_epd(i2400mu
->usb_iface
, endpoint
);
177 pipe
= usb_sndbulkpipe(i2400mu
->usb_dev
, epd
->bEndpointAddress
);
178 memcpy(buffer
, barker
, barker_size
);
180 ret
= usb_bulk_msg(i2400mu
->usb_dev
, pipe
, buffer
, barker_size
,
184 if (actual_len
!= barker_size
) { /* Too short? drop it */
185 dev_err(dev
, "E: %s: short write (%d B vs %zu "
187 __func__
, actual_len
, barker_size
);
193 * Stall -- maybe the device is choking with our
194 * requests. Clear it and give it some time. If they
195 * happen to often, it might be another symptom, so we
198 * No error handling for usb_clear_halt(0; if it
199 * works, the retry works; if it fails, this switch
200 * does the error handling for us.
202 if (edc_inc(&i2400mu
->urb_edc
,
203 10 * EDC_MAX_ERRORS
, EDC_ERROR_TIMEFRAME
)) {
204 dev_err(dev
, "E: %s: too many stalls in "
205 "URB; resetting device\n", __func__
);
206 usb_queue_reset_device(i2400mu
->usb_iface
);
209 usb_clear_halt(i2400mu
->usb_dev
, pipe
);
210 msleep(10); /* give the device some time */
213 case -EINVAL
: /* while removing driver */
214 case -ENODEV
: /* dev disconnect ... */
215 case -ENOENT
: /* just ignore it */
216 case -ESHUTDOWN
: /* and exit */
220 default: /* Some error? */
221 if (edc_inc(&i2400mu
->urb_edc
,
222 EDC_MAX_ERRORS
, EDC_ERROR_TIMEFRAME
)) {
223 dev_err(dev
, "E: %s: maximum errors in URB "
224 "exceeded; resetting device\n",
226 usb_queue_reset_device(i2400mu
->usb_iface
);
228 dev_warn(dev
, "W: %s: cannot send URB: %d\n",
236 usb_autopm_put_interface(i2400mu
->usb_iface
);
242 * Reset a device at different levels (warm, cold or bus)
244 * @i2400m: device descriptor
245 * @reset_type: soft, warm or bus reset (I2400M_RT_WARM/SOFT/BUS)
247 * Warm and cold resets get a USB reset if they fail.
251 * The device will be fully reset internally, but won't be
252 * disconnected from the USB bus (so no reenumeration will
253 * happen). Firmware upload will be necessary.
255 * The device will send a reboot barker in the notification endpoint
256 * that will trigger the driver to reinitialize the state
257 * automatically from notif.c:i2400m_notification_grok() into
258 * i2400m_dev_bootstrap_delayed().
260 * Cold and bus (USB) reset:
262 * The device will be fully reset internally, disconnected from the
263 * USB bus an a reenumeration will happen. Firmware upload will be
264 * necessary. Thus, we don't do any locking or struct
265 * reinitialization, as we are going to be fully disconnected and
268 * Note we need to return -ENODEV if a warm reset was requested and we
269 * had to resort to a bus reset. See i2400m_op_reset(), wimax_reset()
270 * and wimax_dev->op_reset.
272 * WARNING: no driver state saved/fixed
275 int i2400mu_bus_reset(struct i2400m
*i2400m
, enum i2400m_reset_type rt
)
278 struct i2400mu
*i2400mu
=
279 container_of(i2400m
, struct i2400mu
, i2400m
);
280 struct device
*dev
= i2400m_dev(i2400m
);
281 static const __le32 i2400m_WARM_BOOT_BARKER
[4] = {
282 cpu_to_le32(I2400M_WARM_RESET_BARKER
),
283 cpu_to_le32(I2400M_WARM_RESET_BARKER
),
284 cpu_to_le32(I2400M_WARM_RESET_BARKER
),
285 cpu_to_le32(I2400M_WARM_RESET_BARKER
),
287 static const __le32 i2400m_COLD_BOOT_BARKER
[4] = {
288 cpu_to_le32(I2400M_COLD_RESET_BARKER
),
289 cpu_to_le32(I2400M_COLD_RESET_BARKER
),
290 cpu_to_le32(I2400M_COLD_RESET_BARKER
),
291 cpu_to_le32(I2400M_COLD_RESET_BARKER
),
294 d_fnstart(3, dev
, "(i2400m %p rt %u)\n", i2400m
, rt
);
295 if (rt
== I2400M_RT_WARM
)
296 result
= __i2400mu_send_barker(
297 i2400mu
, i2400m_WARM_BOOT_BARKER
,
298 sizeof(i2400m_WARM_BOOT_BARKER
),
299 i2400mu
->endpoint_cfg
.bulk_out
);
300 else if (rt
== I2400M_RT_COLD
)
301 result
= __i2400mu_send_barker(
302 i2400mu
, i2400m_COLD_BOOT_BARKER
,
303 sizeof(i2400m_COLD_BOOT_BARKER
),
304 i2400mu
->endpoint_cfg
.reset_cold
);
305 else if (rt
== I2400M_RT_BUS
) {
306 result
= usb_reset_device(i2400mu
->usb_dev
);
309 case -EINVAL
: /* device is gone */
314 break; /* We assume the device is disconnected */
316 dev_err(dev
, "USB reset failed (%d), giving up!\n",
320 result
= -EINVAL
; /* shut gcc up in certain arches */
324 && result
!= -EINVAL
/* device is gone */
325 && rt
!= I2400M_RT_BUS
) {
327 * Things failed -- resort to lower level reset, that
328 * we queue in another context; the reason for this is
329 * that the pre and post reset functionality requires
330 * the i2400m->init_mutex; RT_WARM and RT_COLD can
331 * come from areas where i2400m->init_mutex is taken.
333 dev_err(dev
, "%s reset failed (%d); trying USB reset\n",
334 rt
== I2400M_RT_WARM
? "warm" : "cold", result
);
335 usb_queue_reset_device(i2400mu
->usb_iface
);
338 d_fnend(3, dev
, "(i2400m %p rt %u) = %d\n", i2400m
, rt
, result
);
344 void i2400mu_netdev_setup(struct net_device
*net_dev
)
346 struct i2400m
*i2400m
= net_dev_to_i2400m(net_dev
);
347 struct i2400mu
*i2400mu
= container_of(i2400m
, struct i2400mu
, i2400m
);
348 i2400mu_init(i2400mu
);
349 i2400m_netdev_setup(net_dev
);
354 * Debug levels control; see debug.h
356 struct d_level D_LEVEL
[] = {
357 D_SUBMODULE_DEFINE(usb
),
358 D_SUBMODULE_DEFINE(fw
),
359 D_SUBMODULE_DEFINE(notif
),
360 D_SUBMODULE_DEFINE(rx
),
361 D_SUBMODULE_DEFINE(tx
),
363 size_t D_LEVEL_SIZE
= ARRAY_SIZE(D_LEVEL
);
366 #define __debugfs_register(prefix, name, parent) \
368 result = d_level_register_debugfs(prefix, name, parent); \
375 int i2400mu_debugfs_add(struct i2400mu
*i2400mu
)
378 struct device
*dev
= &i2400mu
->usb_iface
->dev
;
379 struct dentry
*dentry
= i2400mu
->i2400m
.wimax_dev
.debugfs_dentry
;
382 dentry
= debugfs_create_dir("i2400m-usb", dentry
);
383 result
= PTR_ERR(dentry
);
384 if (IS_ERR(dentry
)) {
385 if (result
== -ENODEV
)
386 result
= 0; /* No debugfs support */
389 i2400mu
->debugfs_dentry
= dentry
;
390 __debugfs_register("dl_", usb
, dentry
);
391 __debugfs_register("dl_", fw
, dentry
);
392 __debugfs_register("dl_", notif
, dentry
);
393 __debugfs_register("dl_", rx
, dentry
);
394 __debugfs_register("dl_", tx
, dentry
);
396 /* Don't touch these if you don't know what you are doing */
397 fd
= debugfs_create_u8("rx_size_auto_shrink", 0600, dentry
,
398 &i2400mu
->rx_size_auto_shrink
);
399 result
= PTR_ERR(fd
);
400 if (IS_ERR(fd
) && result
!= -ENODEV
) {
401 dev_err(dev
, "Can't create debugfs entry "
402 "rx_size_auto_shrink: %d\n", result
);
406 fd
= debugfs_create_size_t("rx_size", 0600, dentry
,
408 result
= PTR_ERR(fd
);
409 if (IS_ERR(fd
) && result
!= -ENODEV
) {
410 dev_err(dev
, "Can't create debugfs entry "
411 "rx_size: %d\n", result
);
418 debugfs_remove_recursive(i2400mu
->debugfs_dentry
);
423 static struct device_type i2400mu_type
= {
428 * Probe a i2400m interface and register it
430 * @iface: USB interface to link to
431 * @id: USB class/subclass/protocol id
432 * @returns: 0 if ok, < 0 errno code on error.
434 * Alloc a net device, initialize the bus-specific details and then
435 * calls the bus-generic initialization routine. That will register
436 * the wimax and netdev devices, upload the firmware [using
437 * _bus_bm_*()], call _bus_dev_start() to finalize the setup of the
438 * communication with the device and then will start to talk to it to
439 * finnish setting it up.
442 int i2400mu_probe(struct usb_interface
*iface
,
443 const struct usb_device_id
*id
)
446 struct net_device
*net_dev
;
447 struct device
*dev
= &iface
->dev
;
448 struct i2400m
*i2400m
;
449 struct i2400mu
*i2400mu
;
450 struct usb_device
*usb_dev
= interface_to_usbdev(iface
);
452 if (usb_dev
->speed
!= USB_SPEED_HIGH
)
453 dev_err(dev
, "device not connected as high speed\n");
455 /* Allocate instance [calls i2400m_netdev_setup() on it]. */
457 net_dev
= alloc_netdev(sizeof(*i2400mu
), "wmx%d",
458 i2400mu_netdev_setup
);
459 if (net_dev
== NULL
) {
460 dev_err(dev
, "no memory for network device instance\n");
461 goto error_alloc_netdev
;
463 SET_NETDEV_DEV(net_dev
, dev
);
464 SET_NETDEV_DEVTYPE(net_dev
, &i2400mu_type
);
465 i2400m
= net_dev_to_i2400m(net_dev
);
466 i2400mu
= container_of(i2400m
, struct i2400mu
, i2400m
);
467 i2400m
->wimax_dev
.net_dev
= net_dev
;
468 i2400mu
->usb_dev
= usb_get_dev(usb_dev
);
469 i2400mu
->usb_iface
= iface
;
470 usb_set_intfdata(iface
, i2400mu
);
472 i2400m
->bus_tx_block_size
= I2400MU_BLK_SIZE
;
474 * Room required in the Tx queue for USB message to accommodate
475 * a smallest payload while allocating header space is 16 bytes.
476 * Adding this room for the new tx message increases the
477 * possibilities of including any payload with size <= 16 bytes.
479 i2400m
->bus_tx_room_min
= I2400MU_BLK_SIZE
;
480 i2400m
->bus_pl_size_max
= I2400MU_PL_SIZE_MAX
;
481 i2400m
->bus_setup
= NULL
;
482 i2400m
->bus_dev_start
= i2400mu_bus_dev_start
;
483 i2400m
->bus_dev_stop
= i2400mu_bus_dev_stop
;
484 i2400m
->bus_release
= NULL
;
485 i2400m
->bus_tx_kick
= i2400mu_bus_tx_kick
;
486 i2400m
->bus_reset
= i2400mu_bus_reset
;
487 i2400m
->bus_bm_retries
= I2400M_USB_BOOT_RETRIES
;
488 i2400m
->bus_bm_cmd_send
= i2400mu_bus_bm_cmd_send
;
489 i2400m
->bus_bm_wait_for_ack
= i2400mu_bus_bm_wait_for_ack
;
490 i2400m
->bus_bm_mac_addr_impaired
= 0;
492 switch (id
->idProduct
) {
493 case USB_DEVICE_ID_I6050
:
494 case USB_DEVICE_ID_I6050_2
:
495 case USB_DEVICE_ID_I6250
:
502 if (i2400mu
->i6050
) {
503 i2400m
->bus_fw_names
= i2400mu_bus_fw_names_6050
;
504 i2400mu
->endpoint_cfg
.bulk_out
= 0;
505 i2400mu
->endpoint_cfg
.notification
= 3;
506 i2400mu
->endpoint_cfg
.reset_cold
= 2;
507 i2400mu
->endpoint_cfg
.bulk_in
= 1;
509 i2400m
->bus_fw_names
= i2400mu_bus_fw_names_5x50
;
510 i2400mu
->endpoint_cfg
.bulk_out
= 0;
511 i2400mu
->endpoint_cfg
.notification
= 1;
512 i2400mu
->endpoint_cfg
.reset_cold
= 2;
513 i2400mu
->endpoint_cfg
.bulk_in
= 3;
516 iface
->needs_remote_wakeup
= 1; /* autosuspend (15s delay) */
517 device_init_wakeup(dev
, 1);
518 pm_runtime_set_autosuspend_delay(&usb_dev
->dev
, 15000);
519 usb_enable_autosuspend(usb_dev
);
522 result
= i2400m_setup(i2400m
, I2400M_BRI_MAC_REINIT
);
524 dev_err(dev
, "cannot setup device: %d\n", result
);
527 result
= i2400mu_debugfs_add(i2400mu
);
529 dev_err(dev
, "Can't register i2400mu's debugfs: %d\n", result
);
530 goto error_debugfs_add
;
535 i2400m_release(i2400m
);
537 usb_set_intfdata(iface
, NULL
);
538 usb_put_dev(i2400mu
->usb_dev
);
539 free_netdev(net_dev
);
546 * Disconect a i2400m from the system.
548 * i2400m_stop() has been called before, so al the rx and tx contexts
549 * have been taken down already. Make sure the queue is stopped,
550 * unregister netdev and i2400m, free and kill.
553 void i2400mu_disconnect(struct usb_interface
*iface
)
555 struct i2400mu
*i2400mu
= usb_get_intfdata(iface
);
556 struct i2400m
*i2400m
= &i2400mu
->i2400m
;
557 struct net_device
*net_dev
= i2400m
->wimax_dev
.net_dev
;
558 struct device
*dev
= &iface
->dev
;
560 d_fnstart(3, dev
, "(iface %p i2400m %p)\n", iface
, i2400m
);
562 debugfs_remove_recursive(i2400mu
->debugfs_dentry
);
563 i2400m_release(i2400m
);
564 usb_set_intfdata(iface
, NULL
);
565 usb_put_dev(i2400mu
->usb_dev
);
566 free_netdev(net_dev
);
567 d_fnend(3, dev
, "(iface %p i2400m %p) = void\n", iface
, i2400m
);
572 * Get the device ready for USB port or system standby and hibernation
574 * USB port and system standby are handled the same.
576 * When the system hibernates, the USB device is powered down and then
577 * up, so we don't really have to do much here, as it will be seen as
578 * a reconnect. Still for simplicity we consider this case the same as
579 * suspend, so that the device has a chance to do notify the base
580 * station (if connected).
582 * So at the end, the three cases require common handling.
584 * If at the time of this call the device's firmware is not loaded,
585 * nothing has to be done. Note we can be "loose" about not reading
586 * i2400m->updown under i2400m->init_mutex. If it happens to change
587 * inmediately, other parts of the call flow will fail and effectively
590 * If the firmware is loaded, we need to:
592 * - tell the device to go into host interface power save mode, wait
595 * This is quite more interesting than it is; we need to execute a
596 * command, but this time, we don't want the code in usb-{tx,rx}.c
597 * to call the usb_autopm_get/put_interface() barriers as it'd
598 * deadlock, so we need to decrement i2400mu->do_autopm, that acts
599 * as a poor man's semaphore. Ugly, but it works.
601 * As well, the device might refuse going to sleep for whichever
602 * reason. In this case we just fail. For system suspend/hibernate,
603 * we *can't* fail. We check PMSG_IS_AUTO to see if the
604 * suspend call comes from the USB stack or from the system and act
607 * - stop the notification endpoint polling
610 int i2400mu_suspend(struct usb_interface
*iface
, pm_message_t pm_msg
)
613 struct device
*dev
= &iface
->dev
;
614 struct i2400mu
*i2400mu
= usb_get_intfdata(iface
);
615 unsigned is_autosuspend
= 0;
616 struct i2400m
*i2400m
= &i2400mu
->i2400m
;
619 if (PMSG_IS_AUTO(pm_msg
))
623 d_fnstart(3, dev
, "(iface %p pm_msg %u)\n", iface
, pm_msg
.event
);
624 rmb(); /* see i2400m->updown's documentation */
625 if (i2400m
->updown
== 0)
627 if (i2400m
->state
== I2400M_SS_DATA_PATH_CONNECTED
&& is_autosuspend
) {
628 /* ugh -- the device is connected and this suspend
629 * request is an autosuspend one (not a system standby
632 * The only way the device can go to standby is if the
633 * link with the base station is in IDLE mode; that
634 * were the case, we'd be in status
635 * I2400M_SS_CONNECTED_IDLE. But we are not.
637 * If we *tell* him to go power save now, it'll reset
638 * as a precautionary measure, so if this is an
639 * autosuspend thing, say no and it'll come back
640 * later, when the link is IDLE
643 d_printf(1, dev
, "fw up, link up, not-idle, autosuspend: "
644 "not entering powersave\n");
647 d_printf(1, dev
, "fw up: entering powersave\n");
648 atomic_dec(&i2400mu
->do_autopm
);
649 result
= i2400m_cmd_enter_powersave(i2400m
);
650 atomic_inc(&i2400mu
->do_autopm
);
651 if (result
< 0 && !is_autosuspend
) {
652 /* System suspend, can't fail */
653 dev_err(dev
, "failed to suspend, will reset on resume\n");
657 goto error_enter_powersave
;
658 i2400mu_notification_release(i2400mu
);
659 d_printf(1, dev
, "powersave requested\n");
660 error_enter_powersave
:
663 d_fnend(3, dev
, "(iface %p pm_msg %u) = %d\n",
664 iface
, pm_msg
.event
, result
);
670 int i2400mu_resume(struct usb_interface
*iface
)
673 struct device
*dev
= &iface
->dev
;
674 struct i2400mu
*i2400mu
= usb_get_intfdata(iface
);
675 struct i2400m
*i2400m
= &i2400mu
->i2400m
;
677 d_fnstart(3, dev
, "(iface %p)\n", iface
);
678 rmb(); /* see i2400m->updown's documentation */
679 if (i2400m
->updown
== 0) {
680 d_printf(1, dev
, "fw was down, no resume neeed\n");
683 d_printf(1, dev
, "fw was up, resuming\n");
684 i2400mu_notification_setup(i2400mu
);
685 /* USB has flow control, so we don't need to give it time to
686 * come back; otherwise, we'd use something like a get-state
689 d_fnend(3, dev
, "(iface %p) = %d\n", iface
, ret
);
695 int i2400mu_reset_resume(struct usb_interface
*iface
)
698 struct device
*dev
= &iface
->dev
;
699 struct i2400mu
*i2400mu
= usb_get_intfdata(iface
);
700 struct i2400m
*i2400m
= &i2400mu
->i2400m
;
702 d_fnstart(3, dev
, "(iface %p)\n", iface
);
703 result
= i2400m_dev_reset_handle(i2400m
, "device reset on resume");
704 d_fnend(3, dev
, "(iface %p) = %d\n", iface
, result
);
705 return result
< 0 ? result
: 0;
710 * Another driver or user space is triggering a reset on the device
711 * which contains the interface passed as an argument. Cease IO and
712 * save any device state you need to restore.
714 * If you need to allocate memory here, use GFP_NOIO or GFP_ATOMIC, if
715 * you are in atomic context.
718 int i2400mu_pre_reset(struct usb_interface
*iface
)
720 struct i2400mu
*i2400mu
= usb_get_intfdata(iface
);
721 return i2400m_pre_reset(&i2400mu
->i2400m
);
726 * The reset has completed. Restore any saved device state and begin
727 * using the device again.
729 * If you need to allocate memory here, use GFP_NOIO or GFP_ATOMIC, if
730 * you are in atomic context.
733 int i2400mu_post_reset(struct usb_interface
*iface
)
735 struct i2400mu
*i2400mu
= usb_get_intfdata(iface
);
736 return i2400m_post_reset(&i2400mu
->i2400m
);
741 struct usb_device_id i2400mu_id_table
[] = {
742 { USB_DEVICE(0x8086, USB_DEVICE_ID_I6050
) },
743 { USB_DEVICE(0x8086, USB_DEVICE_ID_I6050_2
) },
744 { USB_DEVICE(0x8086, USB_DEVICE_ID_I6250
) },
745 { USB_DEVICE(0x8086, 0x0181) },
746 { USB_DEVICE(0x8086, 0x1403) },
747 { USB_DEVICE(0x8086, 0x1405) },
748 { USB_DEVICE(0x8086, 0x0180) },
749 { USB_DEVICE(0x8086, 0x0182) },
750 { USB_DEVICE(0x8086, 0x1406) },
751 { USB_DEVICE(0x8086, 0x1403) },
754 MODULE_DEVICE_TABLE(usb
, i2400mu_id_table
);
758 struct usb_driver i2400mu_driver
= {
759 .name
= KBUILD_MODNAME
,
760 .suspend
= i2400mu_suspend
,
761 .resume
= i2400mu_resume
,
762 .reset_resume
= i2400mu_reset_resume
,
763 .probe
= i2400mu_probe
,
764 .disconnect
= i2400mu_disconnect
,
765 .pre_reset
= i2400mu_pre_reset
,
766 .post_reset
= i2400mu_post_reset
,
767 .id_table
= i2400mu_id_table
,
768 .supports_autosuspend
= 1,
772 int __init
i2400mu_driver_init(void)
774 d_parse_params(D_LEVEL
, D_LEVEL_SIZE
, i2400mu_debug_params
,
776 return usb_register(&i2400mu_driver
);
778 module_init(i2400mu_driver_init
);
782 void __exit
i2400mu_driver_exit(void)
784 usb_deregister(&i2400mu_driver
);
786 module_exit(i2400mu_driver_exit
);
788 MODULE_AUTHOR("Intel Corporation <linux-wimax@intel.com>");
789 MODULE_DESCRIPTION("Driver for USB based Intel Wireless WiMAX Connection 2400M "
791 MODULE_LICENSE("GPL");
792 MODULE_FIRMWARE(I2400MU_FW_FILE_NAME_v1_5
);
793 MODULE_FIRMWARE(I6050U_FW_FILE_NAME_v1_5
);