2008-12-21 07:57:51 +07:00
|
|
|
/*
|
|
|
|
* Intel Wireless WiMAX Connection 2400m
|
|
|
|
* Linux driver model glue for USB device, reset & fw upload
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007-2008 Intel Corporation <linux-wimax@intel.com>
|
|
|
|
* Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
|
|
|
|
* Yanir Lubetkin <yanirx.lubetkin@intel.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License version
|
|
|
|
* 2 as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
|
|
* 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* See i2400m-usb.h for a general description of this driver.
|
|
|
|
*
|
|
|
|
* This file implements driver model glue, and hook ups for the
|
|
|
|
* generic driver to implement the bus-specific functions (device
|
|
|
|
* communication setup/tear down, firmware upload and resetting).
|
|
|
|
*
|
|
|
|
* ROADMAP
|
|
|
|
*
|
|
|
|
* i2400mu_probe()
|
|
|
|
* alloc_netdev()...
|
|
|
|
* i2400mu_netdev_setup()
|
|
|
|
* i2400mu_init()
|
|
|
|
* i2400m_netdev_setup()
|
|
|
|
* i2400m_setup()...
|
|
|
|
*
|
|
|
|
* i2400mu_disconnect
|
|
|
|
* i2400m_release()
|
|
|
|
* free_netdev()
|
|
|
|
*
|
|
|
|
* i2400mu_suspend()
|
|
|
|
* i2400m_cmd_enter_powersave()
|
|
|
|
* i2400mu_notification_release()
|
|
|
|
*
|
|
|
|
* i2400mu_resume()
|
|
|
|
* i2400mu_notification_setup()
|
|
|
|
*
|
|
|
|
* i2400mu_bus_dev_start() Called by i2400m_dev_start() [who is
|
|
|
|
* i2400mu_tx_setup() called by i2400m_setup()]
|
|
|
|
* i2400mu_rx_setup()
|
|
|
|
* i2400mu_notification_setup()
|
|
|
|
*
|
|
|
|
* i2400mu_bus_dev_stop() Called by i2400m_dev_stop() [who is
|
|
|
|
* i2400mu_notification_release() called by i2400m_release()]
|
|
|
|
* i2400mu_rx_release()
|
|
|
|
* i2400mu_tx_release()
|
|
|
|
*
|
2009-10-19 14:24:56 +07:00
|
|
|
* i2400mu_bus_reset() Called by i2400m_reset
|
2008-12-21 07:57:51 +07:00
|
|
|
* __i2400mu_reset()
|
|
|
|
* __i2400mu_send_barker()
|
|
|
|
* usb_reset_device()
|
|
|
|
*/
|
|
|
|
#include "i2400m-usb.h"
|
|
|
|
#include <linux/wimax/i2400m.h>
|
|
|
|
#include <linux/debugfs.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 15:04:11 +07:00
|
|
|
#include <linux/slab.h>
|
2008-12-21 07:57:51 +07:00
|
|
|
|
|
|
|
|
|
|
|
#define D_SUBMODULE usb
|
|
|
|
#include "usb-debug-levels.h"
|
|
|
|
|
2009-09-03 05:36:05 +07:00
|
|
|
static char i2400mu_debug_params[128];
|
|
|
|
module_param_string(debug, i2400mu_debug_params, sizeof(i2400mu_debug_params),
|
|
|
|
0644);
|
|
|
|
MODULE_PARM_DESC(debug,
|
|
|
|
"String of space-separated NAME:VALUE pairs, where NAMEs "
|
|
|
|
"are the different debug submodules and VALUE are the "
|
|
|
|
"initial debug value to set.");
|
2008-12-21 07:57:51 +07:00
|
|
|
|
|
|
|
/* Our firmware file name */
|
2009-08-13 01:29:46 +07:00
|
|
|
static const char *i2400mu_bus_fw_names_5x50[] = {
|
2009-03-01 06:42:47 +07:00
|
|
|
#define I2400MU_FW_FILE_NAME_v1_4 "i2400m-fw-usb-1.4.sbcf"
|
|
|
|
I2400MU_FW_FILE_NAME_v1_4,
|
2009-08-13 01:29:46 +07:00
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static const char *i2400mu_bus_fw_names_6050[] = {
|
|
|
|
#define I6050U_FW_FILE_NAME_v1_5 "i6050-fw-usb-1.5.sbcf"
|
|
|
|
I6050U_FW_FILE_NAME_v1_5,
|
2009-03-01 06:42:47 +07:00
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
2008-12-21 07:57:51 +07:00
|
|
|
|
|
|
|
static
|
|
|
|
int i2400mu_bus_dev_start(struct i2400m *i2400m)
|
|
|
|
{
|
|
|
|
int result;
|
|
|
|
struct i2400mu *i2400mu = container_of(i2400m, struct i2400mu, i2400m);
|
|
|
|
struct device *dev = &i2400mu->usb_iface->dev;
|
|
|
|
|
|
|
|
d_fnstart(3, dev, "(i2400m %p)\n", i2400m);
|
|
|
|
result = i2400mu_tx_setup(i2400mu);
|
|
|
|
if (result < 0)
|
|
|
|
goto error_usb_tx_setup;
|
|
|
|
result = i2400mu_rx_setup(i2400mu);
|
|
|
|
if (result < 0)
|
|
|
|
goto error_usb_rx_setup;
|
|
|
|
result = i2400mu_notification_setup(i2400mu);
|
|
|
|
if (result < 0)
|
|
|
|
goto error_notif_setup;
|
|
|
|
d_fnend(3, dev, "(i2400m %p) = %d\n", i2400m, result);
|
|
|
|
return result;
|
|
|
|
|
|
|
|
error_notif_setup:
|
|
|
|
i2400mu_rx_release(i2400mu);
|
|
|
|
error_usb_rx_setup:
|
|
|
|
i2400mu_tx_release(i2400mu);
|
|
|
|
error_usb_tx_setup:
|
|
|
|
d_fnend(3, dev, "(i2400m %p) = void\n", i2400m);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static
|
|
|
|
void i2400mu_bus_dev_stop(struct i2400m *i2400m)
|
|
|
|
{
|
|
|
|
struct i2400mu *i2400mu = container_of(i2400m, struct i2400mu, i2400m);
|
|
|
|
struct device *dev = &i2400mu->usb_iface->dev;
|
|
|
|
|
|
|
|
d_fnstart(3, dev, "(i2400m %p)\n", i2400m);
|
|
|
|
i2400mu_notification_release(i2400mu);
|
|
|
|
i2400mu_rx_release(i2400mu);
|
|
|
|
i2400mu_tx_release(i2400mu);
|
|
|
|
d_fnend(3, dev, "(i2400m %p) = void\n", i2400m);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Sends a barker buffer to the device
|
|
|
|
*
|
|
|
|
* This helper will allocate a kmalloced buffer and use it to transmit
|
|
|
|
* (then free it). Reason for this is that other arches cannot use
|
|
|
|
* stack/vmalloc/text areas for DMA transfers.
|
|
|
|
*
|
|
|
|
* Error recovery here is simpler: anything is considered a hard error
|
|
|
|
* and will move the reset code to use a last-resort bus-based reset.
|
|
|
|
*/
|
|
|
|
static
|
|
|
|
int __i2400mu_send_barker(struct i2400mu *i2400mu,
|
|
|
|
const __le32 *barker,
|
|
|
|
size_t barker_size,
|
|
|
|
unsigned endpoint)
|
|
|
|
{
|
|
|
|
struct usb_endpoint_descriptor *epd = NULL;
|
|
|
|
int pipe, actual_len, ret;
|
|
|
|
struct device *dev = &i2400mu->usb_iface->dev;
|
|
|
|
void *buffer;
|
|
|
|
int do_autopm = 1;
|
|
|
|
|
|
|
|
ret = usb_autopm_get_interface(i2400mu->usb_iface);
|
|
|
|
if (ret < 0) {
|
|
|
|
dev_err(dev, "RESET: can't get autopm: %d\n", ret);
|
|
|
|
do_autopm = 0;
|
|
|
|
}
|
|
|
|
ret = -ENOMEM;
|
|
|
|
buffer = kmalloc(barker_size, GFP_KERNEL);
|
|
|
|
if (buffer == NULL)
|
|
|
|
goto error_kzalloc;
|
|
|
|
epd = usb_get_epd(i2400mu->usb_iface, endpoint);
|
|
|
|
pipe = usb_sndbulkpipe(i2400mu->usb_dev, epd->bEndpointAddress);
|
|
|
|
memcpy(buffer, barker, barker_size);
|
2009-10-20 09:10:59 +07:00
|
|
|
retry:
|
2008-12-21 07:57:51 +07:00
|
|
|
ret = usb_bulk_msg(i2400mu->usb_dev, pipe, buffer, barker_size,
|
2009-10-20 09:09:25 +07:00
|
|
|
&actual_len, 200);
|
2009-10-20 09:10:59 +07:00
|
|
|
switch (ret) {
|
|
|
|
case 0:
|
|
|
|
if (actual_len != barker_size) { /* Too short? drop it */
|
|
|
|
dev_err(dev, "E: %s: short write (%d B vs %zu "
|
|
|
|
"expected)\n",
|
|
|
|
__func__, actual_len, barker_size);
|
|
|
|
ret = -EIO;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case -EPIPE:
|
|
|
|
/*
|
|
|
|
* Stall -- maybe the device is choking with our
|
|
|
|
* requests. Clear it and give it some time. If they
|
|
|
|
* happen to often, it might be another symptom, so we
|
|
|
|
* reset.
|
|
|
|
*
|
|
|
|
* No error handling for usb_clear_halt(0; if it
|
|
|
|
* works, the retry works; if it fails, this switch
|
|
|
|
* does the error handling for us.
|
|
|
|
*/
|
|
|
|
if (edc_inc(&i2400mu->urb_edc,
|
|
|
|
10 * EDC_MAX_ERRORS, EDC_ERROR_TIMEFRAME)) {
|
|
|
|
dev_err(dev, "E: %s: too many stalls in "
|
|
|
|
"URB; resetting device\n", __func__);
|
|
|
|
usb_queue_reset_device(i2400mu->usb_iface);
|
|
|
|
/* fallthrough */
|
|
|
|
} else {
|
|
|
|
usb_clear_halt(i2400mu->usb_dev, pipe);
|
|
|
|
msleep(10); /* give the device some time */
|
|
|
|
goto retry;
|
|
|
|
}
|
|
|
|
case -EINVAL: /* while removing driver */
|
|
|
|
case -ENODEV: /* dev disconnect ... */
|
|
|
|
case -ENOENT: /* just ignore it */
|
|
|
|
case -ESHUTDOWN: /* and exit */
|
|
|
|
case -ECONNRESET:
|
|
|
|
ret = -ESHUTDOWN;
|
|
|
|
break;
|
|
|
|
default: /* Some error? */
|
|
|
|
if (edc_inc(&i2400mu->urb_edc,
|
|
|
|
EDC_MAX_ERRORS, EDC_ERROR_TIMEFRAME)) {
|
|
|
|
dev_err(dev, "E: %s: maximum errors in URB "
|
|
|
|
"exceeded; resetting device\n",
|
|
|
|
__func__);
|
|
|
|
usb_queue_reset_device(i2400mu->usb_iface);
|
|
|
|
} else {
|
|
|
|
dev_warn(dev, "W: %s: cannot send URB: %d\n",
|
|
|
|
__func__, ret);
|
|
|
|
goto retry;
|
|
|
|
}
|
2008-12-21 07:57:51 +07:00
|
|
|
}
|
|
|
|
kfree(buffer);
|
|
|
|
error_kzalloc:
|
|
|
|
if (do_autopm)
|
|
|
|
usb_autopm_put_interface(i2400mu->usb_iface);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Reset a device at different levels (warm, cold or bus)
|
|
|
|
*
|
|
|
|
* @i2400m: device descriptor
|
|
|
|
* @reset_type: soft, warm or bus reset (I2400M_RT_WARM/SOFT/BUS)
|
|
|
|
*
|
|
|
|
* Warm and cold resets get a USB reset if they fail.
|
|
|
|
*
|
|
|
|
* Warm reset:
|
|
|
|
*
|
|
|
|
* The device will be fully reset internally, but won't be
|
|
|
|
* disconnected from the USB bus (so no reenumeration will
|
tree-wide: Assorted spelling fixes
In particular, several occurances of funny versions of 'success',
'unknown', 'therefore', 'acknowledge', 'argument', 'achieve', 'address',
'beginning', 'desirable', 'separate' and 'necessary' are fixed.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Joe Perches <joe@perches.com>
Cc: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-03 07:01:28 +07:00
|
|
|
* happen). Firmware upload will be necessary.
|
2008-12-21 07:57:51 +07:00
|
|
|
*
|
|
|
|
* The device will send a reboot barker in the notification endpoint
|
|
|
|
* that will trigger the driver to reinitialize the state
|
|
|
|
* automatically from notif.c:i2400m_notification_grok() into
|
|
|
|
* i2400m_dev_bootstrap_delayed().
|
|
|
|
*
|
|
|
|
* Cold and bus (USB) reset:
|
|
|
|
*
|
|
|
|
* The device will be fully reset internally, disconnected from the
|
|
|
|
* USB bus an a reenumeration will happen. Firmware upload will be
|
tree-wide: Assorted spelling fixes
In particular, several occurances of funny versions of 'success',
'unknown', 'therefore', 'acknowledge', 'argument', 'achieve', 'address',
'beginning', 'desirable', 'separate' and 'necessary' are fixed.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Joe Perches <joe@perches.com>
Cc: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-03 07:01:28 +07:00
|
|
|
* necessary. Thus, we don't do any locking or struct
|
2008-12-21 07:57:51 +07:00
|
|
|
* reinitialization, as we are going to be fully disconnected and
|
|
|
|
* reenumerated.
|
|
|
|
*
|
|
|
|
* Note we need to return -ENODEV if a warm reset was requested and we
|
|
|
|
* had to resort to a bus reset. See i2400m_op_reset(), wimax_reset()
|
|
|
|
* and wimax_dev->op_reset.
|
|
|
|
*
|
|
|
|
* WARNING: no driver state saved/fixed
|
|
|
|
*/
|
|
|
|
static
|
|
|
|
int i2400mu_bus_reset(struct i2400m *i2400m, enum i2400m_reset_type rt)
|
|
|
|
{
|
|
|
|
int result;
|
|
|
|
struct i2400mu *i2400mu =
|
|
|
|
container_of(i2400m, struct i2400mu, i2400m);
|
|
|
|
struct device *dev = i2400m_dev(i2400m);
|
|
|
|
static const __le32 i2400m_WARM_BOOT_BARKER[4] = {
|
2009-02-01 15:43:54 +07:00
|
|
|
cpu_to_le32(I2400M_WARM_RESET_BARKER),
|
|
|
|
cpu_to_le32(I2400M_WARM_RESET_BARKER),
|
|
|
|
cpu_to_le32(I2400M_WARM_RESET_BARKER),
|
|
|
|
cpu_to_le32(I2400M_WARM_RESET_BARKER),
|
2008-12-21 07:57:51 +07:00
|
|
|
};
|
|
|
|
static const __le32 i2400m_COLD_BOOT_BARKER[4] = {
|
2009-02-01 15:43:54 +07:00
|
|
|
cpu_to_le32(I2400M_COLD_RESET_BARKER),
|
|
|
|
cpu_to_le32(I2400M_COLD_RESET_BARKER),
|
|
|
|
cpu_to_le32(I2400M_COLD_RESET_BARKER),
|
|
|
|
cpu_to_le32(I2400M_COLD_RESET_BARKER),
|
2008-12-21 07:57:51 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
d_fnstart(3, dev, "(i2400m %p rt %u)\n", i2400m, rt);
|
|
|
|
if (rt == I2400M_RT_WARM)
|
2009-08-13 01:29:46 +07:00
|
|
|
result = __i2400mu_send_barker(
|
|
|
|
i2400mu, i2400m_WARM_BOOT_BARKER,
|
|
|
|
sizeof(i2400m_WARM_BOOT_BARKER),
|
|
|
|
i2400mu->endpoint_cfg.bulk_out);
|
2008-12-21 07:57:51 +07:00
|
|
|
else if (rt == I2400M_RT_COLD)
|
2009-08-13 01:29:46 +07:00
|
|
|
result = __i2400mu_send_barker(
|
|
|
|
i2400mu, i2400m_COLD_BOOT_BARKER,
|
|
|
|
sizeof(i2400m_COLD_BOOT_BARKER),
|
|
|
|
i2400mu->endpoint_cfg.reset_cold);
|
2008-12-21 07:57:51 +07:00
|
|
|
else if (rt == I2400M_RT_BUS) {
|
|
|
|
result = usb_reset_device(i2400mu->usb_dev);
|
|
|
|
switch (result) {
|
|
|
|
case 0:
|
|
|
|
case -EINVAL: /* device is gone */
|
|
|
|
case -ENODEV:
|
|
|
|
case -ENOENT:
|
|
|
|
case -ESHUTDOWN:
|
2009-10-07 10:34:13 +07:00
|
|
|
result = 0;
|
2008-12-21 07:57:51 +07:00
|
|
|
break; /* We assume the device is disconnected */
|
|
|
|
default:
|
|
|
|
dev_err(dev, "USB reset failed (%d), giving up!\n",
|
|
|
|
result);
|
|
|
|
}
|
2009-06-12 01:13:41 +07:00
|
|
|
} else {
|
|
|
|
result = -EINVAL; /* shut gcc up in certain arches */
|
2008-12-21 07:57:51 +07:00
|
|
|
BUG();
|
2009-06-12 01:13:41 +07:00
|
|
|
}
|
2008-12-21 07:57:51 +07:00
|
|
|
if (result < 0
|
|
|
|
&& result != -EINVAL /* device is gone */
|
|
|
|
&& rt != I2400M_RT_BUS) {
|
2009-10-07 10:34:13 +07:00
|
|
|
/*
|
|
|
|
* Things failed -- resort to lower level reset, that
|
|
|
|
* we queue in another context; the reason for this is
|
|
|
|
* that the pre and post reset functionality requires
|
|
|
|
* the i2400m->init_mutex; RT_WARM and RT_COLD can
|
|
|
|
* come from areas where i2400m->init_mutex is taken.
|
|
|
|
*/
|
2008-12-21 07:57:51 +07:00
|
|
|
dev_err(dev, "%s reset failed (%d); trying USB reset\n",
|
|
|
|
rt == I2400M_RT_WARM ? "warm" : "cold", result);
|
2009-10-07 10:34:13 +07:00
|
|
|
usb_queue_reset_device(i2400mu->usb_iface);
|
|
|
|
result = -ENODEV;
|
2008-12-21 07:57:51 +07:00
|
|
|
}
|
|
|
|
d_fnend(3, dev, "(i2400m %p rt %u) = %d\n", i2400m, rt, result);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static
|
|
|
|
void i2400mu_netdev_setup(struct net_device *net_dev)
|
|
|
|
{
|
|
|
|
struct i2400m *i2400m = net_dev_to_i2400m(net_dev);
|
|
|
|
struct i2400mu *i2400mu = container_of(i2400m, struct i2400mu, i2400m);
|
|
|
|
i2400mu_init(i2400mu);
|
|
|
|
i2400m_netdev_setup(net_dev);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Debug levels control; see debug.h
|
|
|
|
*/
|
|
|
|
struct d_level D_LEVEL[] = {
|
|
|
|
D_SUBMODULE_DEFINE(usb),
|
|
|
|
D_SUBMODULE_DEFINE(fw),
|
|
|
|
D_SUBMODULE_DEFINE(notif),
|
|
|
|
D_SUBMODULE_DEFINE(rx),
|
|
|
|
D_SUBMODULE_DEFINE(tx),
|
|
|
|
};
|
|
|
|
size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL);
|
|
|
|
|
|
|
|
|
|
|
|
#define __debugfs_register(prefix, name, parent) \
|
|
|
|
do { \
|
|
|
|
result = d_level_register_debugfs(prefix, name, parent); \
|
|
|
|
if (result < 0) \
|
|
|
|
goto error; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
|
|
|
|
static
|
|
|
|
int i2400mu_debugfs_add(struct i2400mu *i2400mu)
|
|
|
|
{
|
|
|
|
int result;
|
|
|
|
struct device *dev = &i2400mu->usb_iface->dev;
|
|
|
|
struct dentry *dentry = i2400mu->i2400m.wimax_dev.debugfs_dentry;
|
|
|
|
struct dentry *fd;
|
|
|
|
|
|
|
|
dentry = debugfs_create_dir("i2400m-usb", dentry);
|
|
|
|
result = PTR_ERR(dentry);
|
|
|
|
if (IS_ERR(dentry)) {
|
|
|
|
if (result == -ENODEV)
|
|
|
|
result = 0; /* No debugfs support */
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
i2400mu->debugfs_dentry = dentry;
|
|
|
|
__debugfs_register("dl_", usb, dentry);
|
|
|
|
__debugfs_register("dl_", fw, dentry);
|
|
|
|
__debugfs_register("dl_", notif, dentry);
|
|
|
|
__debugfs_register("dl_", rx, dentry);
|
|
|
|
__debugfs_register("dl_", tx, dentry);
|
|
|
|
|
|
|
|
/* Don't touch these if you don't know what you are doing */
|
|
|
|
fd = debugfs_create_u8("rx_size_auto_shrink", 0600, dentry,
|
|
|
|
&i2400mu->rx_size_auto_shrink);
|
|
|
|
result = PTR_ERR(fd);
|
|
|
|
if (IS_ERR(fd) && result != -ENODEV) {
|
|
|
|
dev_err(dev, "Can't create debugfs entry "
|
|
|
|
"rx_size_auto_shrink: %d\n", result);
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
fd = debugfs_create_size_t("rx_size", 0600, dentry,
|
|
|
|
&i2400mu->rx_size);
|
|
|
|
result = PTR_ERR(fd);
|
|
|
|
if (IS_ERR(fd) && result != -ENODEV) {
|
|
|
|
dev_err(dev, "Can't create debugfs entry "
|
|
|
|
"rx_size: %d\n", result);
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error:
|
|
|
|
debugfs_remove_recursive(i2400mu->debugfs_dentry);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-01 04:08:19 +07:00
|
|
|
static struct device_type i2400mu_type = {
|
|
|
|
.name = "wimax",
|
|
|
|
};
|
|
|
|
|
2008-12-21 07:57:51 +07:00
|
|
|
/*
|
|
|
|
* Probe a i2400m interface and register it
|
|
|
|
*
|
|
|
|
* @iface: USB interface to link to
|
|
|
|
* @id: USB class/subclass/protocol id
|
|
|
|
* @returns: 0 if ok, < 0 errno code on error.
|
|
|
|
*
|
|
|
|
* Alloc a net device, initialize the bus-specific details and then
|
|
|
|
* calls the bus-generic initialization routine. That will register
|
|
|
|
* the wimax and netdev devices, upload the firmware [using
|
|
|
|
* _bus_bm_*()], call _bus_dev_start() to finalize the setup of the
|
|
|
|
* communication with the device and then will start to talk to it to
|
|
|
|
* finnish setting it up.
|
|
|
|
*/
|
|
|
|
static
|
|
|
|
int i2400mu_probe(struct usb_interface *iface,
|
|
|
|
const struct usb_device_id *id)
|
|
|
|
{
|
|
|
|
int result;
|
|
|
|
struct net_device *net_dev;
|
|
|
|
struct device *dev = &iface->dev;
|
|
|
|
struct i2400m *i2400m;
|
|
|
|
struct i2400mu *i2400mu;
|
|
|
|
struct usb_device *usb_dev = interface_to_usbdev(iface);
|
|
|
|
|
|
|
|
if (usb_dev->speed != USB_SPEED_HIGH)
|
|
|
|
dev_err(dev, "device not connected as high speed\n");
|
|
|
|
|
|
|
|
/* Allocate instance [calls i2400m_netdev_setup() on it]. */
|
|
|
|
result = -ENOMEM;
|
|
|
|
net_dev = alloc_netdev(sizeof(*i2400mu), "wmx%d",
|
|
|
|
i2400mu_netdev_setup);
|
|
|
|
if (net_dev == NULL) {
|
|
|
|
dev_err(dev, "no memory for network device instance\n");
|
|
|
|
goto error_alloc_netdev;
|
|
|
|
}
|
|
|
|
SET_NETDEV_DEV(net_dev, dev);
|
2009-09-01 04:08:19 +07:00
|
|
|
SET_NETDEV_DEVTYPE(net_dev, &i2400mu_type);
|
2008-12-21 07:57:51 +07:00
|
|
|
i2400m = net_dev_to_i2400m(net_dev);
|
|
|
|
i2400mu = container_of(i2400m, struct i2400mu, i2400m);
|
|
|
|
i2400m->wimax_dev.net_dev = net_dev;
|
|
|
|
i2400mu->usb_dev = usb_get_dev(usb_dev);
|
|
|
|
i2400mu->usb_iface = iface;
|
|
|
|
usb_set_intfdata(iface, i2400mu);
|
|
|
|
|
|
|
|
i2400m->bus_tx_block_size = I2400MU_BLK_SIZE;
|
|
|
|
i2400m->bus_pl_size_max = I2400MU_PL_SIZE_MAX;
|
2009-09-17 08:23:27 +07:00
|
|
|
i2400m->bus_setup = NULL;
|
2008-12-21 07:57:51 +07:00
|
|
|
i2400m->bus_dev_start = i2400mu_bus_dev_start;
|
|
|
|
i2400m->bus_dev_stop = i2400mu_bus_dev_stop;
|
2009-09-17 08:23:27 +07:00
|
|
|
i2400m->bus_release = NULL;
|
2008-12-21 07:57:51 +07:00
|
|
|
i2400m->bus_tx_kick = i2400mu_bus_tx_kick;
|
|
|
|
i2400m->bus_reset = i2400mu_bus_reset;
|
2009-08-14 03:48:29 +07:00
|
|
|
i2400m->bus_bm_retries = I2400M_USB_BOOT_RETRIES;
|
2008-12-21 07:57:51 +07:00
|
|
|
i2400m->bus_bm_cmd_send = i2400mu_bus_bm_cmd_send;
|
|
|
|
i2400m->bus_bm_wait_for_ack = i2400mu_bus_bm_wait_for_ack;
|
|
|
|
i2400m->bus_bm_mac_addr_impaired = 0;
|
|
|
|
|
2010-01-21 03:41:13 +07:00
|
|
|
switch (id->idProduct) {
|
|
|
|
case USB_DEVICE_ID_I6050:
|
|
|
|
case USB_DEVICE_ID_I6050_2:
|
|
|
|
i2400mu->i6050 = 1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i2400mu->i6050) {
|
2009-08-13 01:29:46 +07:00
|
|
|
i2400m->bus_fw_names = i2400mu_bus_fw_names_6050;
|
|
|
|
i2400mu->endpoint_cfg.bulk_out = 0;
|
|
|
|
i2400mu->endpoint_cfg.notification = 3;
|
|
|
|
i2400mu->endpoint_cfg.reset_cold = 2;
|
|
|
|
i2400mu->endpoint_cfg.bulk_in = 1;
|
|
|
|
} else {
|
|
|
|
i2400m->bus_fw_names = i2400mu_bus_fw_names_5x50;
|
2009-08-13 01:29:46 +07:00
|
|
|
i2400mu->endpoint_cfg.bulk_out = 0;
|
|
|
|
i2400mu->endpoint_cfg.notification = 1;
|
|
|
|
i2400mu->endpoint_cfg.reset_cold = 2;
|
|
|
|
i2400mu->endpoint_cfg.bulk_in = 3;
|
|
|
|
}
|
2009-01-09 02:08:25 +07:00
|
|
|
#ifdef CONFIG_PM
|
2008-12-21 07:57:51 +07:00
|
|
|
iface->needs_remote_wakeup = 1; /* autosuspend (15s delay) */
|
|
|
|
device_init_wakeup(dev, 1);
|
|
|
|
usb_dev->autosuspend_delay = 15 * HZ;
|
|
|
|
usb_dev->autosuspend_disabled = 0;
|
2009-01-09 02:08:25 +07:00
|
|
|
#endif
|
2008-12-21 07:57:51 +07:00
|
|
|
|
|
|
|
result = i2400m_setup(i2400m, I2400M_BRI_MAC_REINIT);
|
|
|
|
if (result < 0) {
|
|
|
|
dev_err(dev, "cannot setup device: %d\n", result);
|
|
|
|
goto error_setup;
|
|
|
|
}
|
|
|
|
result = i2400mu_debugfs_add(i2400mu);
|
|
|
|
if (result < 0) {
|
|
|
|
dev_err(dev, "Can't register i2400mu's debugfs: %d\n", result);
|
|
|
|
goto error_debugfs_add;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error_debugfs_add:
|
|
|
|
i2400m_release(i2400m);
|
|
|
|
error_setup:
|
|
|
|
usb_set_intfdata(iface, NULL);
|
|
|
|
usb_put_dev(i2400mu->usb_dev);
|
|
|
|
free_netdev(net_dev);
|
|
|
|
error_alloc_netdev:
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Disconect a i2400m from the system.
|
|
|
|
*
|
|
|
|
* i2400m_stop() has been called before, so al the rx and tx contexts
|
|
|
|
* have been taken down already. Make sure the queue is stopped,
|
|
|
|
* unregister netdev and i2400m, free and kill.
|
|
|
|
*/
|
|
|
|
static
|
|
|
|
void i2400mu_disconnect(struct usb_interface *iface)
|
|
|
|
{
|
|
|
|
struct i2400mu *i2400mu = usb_get_intfdata(iface);
|
|
|
|
struct i2400m *i2400m = &i2400mu->i2400m;
|
|
|
|
struct net_device *net_dev = i2400m->wimax_dev.net_dev;
|
|
|
|
struct device *dev = &iface->dev;
|
|
|
|
|
|
|
|
d_fnstart(3, dev, "(iface %p i2400m %p)\n", iface, i2400m);
|
|
|
|
|
|
|
|
debugfs_remove_recursive(i2400mu->debugfs_dentry);
|
|
|
|
i2400m_release(i2400m);
|
|
|
|
usb_set_intfdata(iface, NULL);
|
|
|
|
usb_put_dev(i2400mu->usb_dev);
|
|
|
|
free_netdev(net_dev);
|
|
|
|
d_fnend(3, dev, "(iface %p i2400m %p) = void\n", iface, i2400m);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the device ready for USB port or system standby and hibernation
|
|
|
|
*
|
|
|
|
* USB port and system standby are handled the same.
|
|
|
|
*
|
|
|
|
* When the system hibernates, the USB device is powered down and then
|
|
|
|
* up, so we don't really have to do much here, as it will be seen as
|
|
|
|
* a reconnect. Still for simplicity we consider this case the same as
|
|
|
|
* suspend, so that the device has a chance to do notify the base
|
|
|
|
* station (if connected).
|
|
|
|
*
|
|
|
|
* So at the end, the three cases require common handling.
|
|
|
|
*
|
|
|
|
* If at the time of this call the device's firmware is not loaded,
|
2009-09-17 07:10:55 +07:00
|
|
|
* nothing has to be done. Note we can be "loose" about not reading
|
|
|
|
* i2400m->updown under i2400m->init_mutex. If it happens to change
|
|
|
|
* inmediately, other parts of the call flow will fail and effectively
|
|
|
|
* catch it.
|
2008-12-21 07:57:51 +07:00
|
|
|
*
|
|
|
|
* If the firmware is loaded, we need to:
|
|
|
|
*
|
|
|
|
* - tell the device to go into host interface power save mode, wait
|
|
|
|
* for it to ack
|
|
|
|
*
|
|
|
|
* This is quite more interesting than it is; we need to execute a
|
|
|
|
* command, but this time, we don't want the code in usb-{tx,rx}.c
|
|
|
|
* to call the usb_autopm_get/put_interface() barriers as it'd
|
|
|
|
* deadlock, so we need to decrement i2400mu->do_autopm, that acts
|
|
|
|
* as a poor man's semaphore. Ugly, but it works.
|
|
|
|
*
|
|
|
|
* As well, the device might refuse going to sleep for whichever
|
|
|
|
* reason. In this case we just fail. For system suspend/hibernate,
|
2009-11-13 23:53:59 +07:00
|
|
|
* we *can't* fail. We check PM_EVENT_AUTO to see if the
|
2008-12-21 07:57:51 +07:00
|
|
|
* suspend call comes from the USB stack or from the system and act
|
|
|
|
* in consequence.
|
|
|
|
*
|
|
|
|
* - stop the notification endpoint polling
|
|
|
|
*/
|
|
|
|
static
|
|
|
|
int i2400mu_suspend(struct usb_interface *iface, pm_message_t pm_msg)
|
|
|
|
{
|
|
|
|
int result = 0;
|
|
|
|
struct device *dev = &iface->dev;
|
|
|
|
struct i2400mu *i2400mu = usb_get_intfdata(iface);
|
wimax/i2400m: usb: fix device reset on autosuspend while not yet idle
When the i2400m is connected to a network, the host interface (USB)
cannot be suspended. For that to happen, the device has to have
negotiated with the basestation to put the link on IDLE state.
If the host tries to put the device in standby while it is connected
but not idle, the device resets, as the driver should not do that.
To avoid triggering that, when the USB susbsytem requires the driver
to autosuspend the device, the driver checks if the device is not yet
idle. If it is not, the request is requested (will be retried again
later on after the autosuspend timeout). At some point the device will
enter idle and the request will succeed (unless of course, there is
network traffic, but at that point, there is no idle neither in the
link or the host interface).
Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
2009-05-09 05:51:44 +07:00
|
|
|
unsigned is_autosuspend = 0;
|
2008-12-21 07:57:51 +07:00
|
|
|
struct i2400m *i2400m = &i2400mu->i2400m;
|
|
|
|
|
wimax/i2400m: usb: fix device reset on autosuspend while not yet idle
When the i2400m is connected to a network, the host interface (USB)
cannot be suspended. For that to happen, the device has to have
negotiated with the basestation to put the link on IDLE state.
If the host tries to put the device in standby while it is connected
but not idle, the device resets, as the driver should not do that.
To avoid triggering that, when the USB susbsytem requires the driver
to autosuspend the device, the driver checks if the device is not yet
idle. If it is not, the request is requested (will be retried again
later on after the autosuspend timeout). At some point the device will
enter idle and the request will succeed (unless of course, there is
network traffic, but at that point, there is no idle neither in the
link or the host interface).
Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
2009-05-09 05:51:44 +07:00
|
|
|
#ifdef CONFIG_PM
|
2009-11-13 23:53:59 +07:00
|
|
|
if (pm_msg.event & PM_EVENT_AUTO)
|
wimax/i2400m: usb: fix device reset on autosuspend while not yet idle
When the i2400m is connected to a network, the host interface (USB)
cannot be suspended. For that to happen, the device has to have
negotiated with the basestation to put the link on IDLE state.
If the host tries to put the device in standby while it is connected
but not idle, the device resets, as the driver should not do that.
To avoid triggering that, when the USB susbsytem requires the driver
to autosuspend the device, the driver checks if the device is not yet
idle. If it is not, the request is requested (will be retried again
later on after the autosuspend timeout). At some point the device will
enter idle and the request will succeed (unless of course, there is
network traffic, but at that point, there is no idle neither in the
link or the host interface).
Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
2009-05-09 05:51:44 +07:00
|
|
|
is_autosuspend = 1;
|
|
|
|
#endif
|
|
|
|
|
2008-12-21 07:57:51 +07:00
|
|
|
d_fnstart(3, dev, "(iface %p pm_msg %u)\n", iface, pm_msg.event);
|
2009-09-17 07:10:55 +07:00
|
|
|
rmb(); /* see i2400m->updown's documentation */
|
2008-12-21 07:57:51 +07:00
|
|
|
if (i2400m->updown == 0)
|
|
|
|
goto no_firmware;
|
wimax/i2400m: usb: fix device reset on autosuspend while not yet idle
When the i2400m is connected to a network, the host interface (USB)
cannot be suspended. For that to happen, the device has to have
negotiated with the basestation to put the link on IDLE state.
If the host tries to put the device in standby while it is connected
but not idle, the device resets, as the driver should not do that.
To avoid triggering that, when the USB susbsytem requires the driver
to autosuspend the device, the driver checks if the device is not yet
idle. If it is not, the request is requested (will be retried again
later on after the autosuspend timeout). At some point the device will
enter idle and the request will succeed (unless of course, there is
network traffic, but at that point, there is no idle neither in the
link or the host interface).
Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
2009-05-09 05:51:44 +07:00
|
|
|
if (i2400m->state == I2400M_SS_DATA_PATH_CONNECTED && is_autosuspend) {
|
|
|
|
/* ugh -- the device is connected and this suspend
|
|
|
|
* request is an autosuspend one (not a system standby
|
|
|
|
* / hibernate).
|
|
|
|
*
|
|
|
|
* The only way the device can go to standby is if the
|
|
|
|
* link with the base station is in IDLE mode; that
|
|
|
|
* were the case, we'd be in status
|
|
|
|
* I2400M_SS_CONNECTED_IDLE. But we are not.
|
|
|
|
*
|
|
|
|
* If we *tell* him to go power save now, it'll reset
|
|
|
|
* as a precautionary measure, so if this is an
|
|
|
|
* autosuspend thing, say no and it'll come back
|
|
|
|
* later, when the link is IDLE
|
|
|
|
*/
|
|
|
|
result = -EBADF;
|
|
|
|
d_printf(1, dev, "fw up, link up, not-idle, autosuspend: "
|
|
|
|
"not entering powersave\n");
|
|
|
|
goto error_not_now;
|
|
|
|
}
|
|
|
|
d_printf(1, dev, "fw up: entering powersave\n");
|
2008-12-21 07:57:51 +07:00
|
|
|
atomic_dec(&i2400mu->do_autopm);
|
|
|
|
result = i2400m_cmd_enter_powersave(i2400m);
|
|
|
|
atomic_inc(&i2400mu->do_autopm);
|
wimax/i2400m: usb: fix device reset on autosuspend while not yet idle
When the i2400m is connected to a network, the host interface (USB)
cannot be suspended. For that to happen, the device has to have
negotiated with the basestation to put the link on IDLE state.
If the host tries to put the device in standby while it is connected
but not idle, the device resets, as the driver should not do that.
To avoid triggering that, when the USB susbsytem requires the driver
to autosuspend the device, the driver checks if the device is not yet
idle. If it is not, the request is requested (will be retried again
later on after the autosuspend timeout). At some point the device will
enter idle and the request will succeed (unless of course, there is
network traffic, but at that point, there is no idle neither in the
link or the host interface).
Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
2009-05-09 05:51:44 +07:00
|
|
|
if (result < 0 && !is_autosuspend) {
|
2008-12-21 07:57:51 +07:00
|
|
|
/* System suspend, can't fail */
|
|
|
|
dev_err(dev, "failed to suspend, will reset on resume\n");
|
|
|
|
result = 0;
|
|
|
|
}
|
|
|
|
if (result < 0)
|
|
|
|
goto error_enter_powersave;
|
|
|
|
i2400mu_notification_release(i2400mu);
|
wimax/i2400m: usb: fix device reset on autosuspend while not yet idle
When the i2400m is connected to a network, the host interface (USB)
cannot be suspended. For that to happen, the device has to have
negotiated with the basestation to put the link on IDLE state.
If the host tries to put the device in standby while it is connected
but not idle, the device resets, as the driver should not do that.
To avoid triggering that, when the USB susbsytem requires the driver
to autosuspend the device, the driver checks if the device is not yet
idle. If it is not, the request is requested (will be retried again
later on after the autosuspend timeout). At some point the device will
enter idle and the request will succeed (unless of course, there is
network traffic, but at that point, there is no idle neither in the
link or the host interface).
Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
2009-05-09 05:51:44 +07:00
|
|
|
d_printf(1, dev, "powersave requested\n");
|
2008-12-21 07:57:51 +07:00
|
|
|
error_enter_powersave:
|
wimax/i2400m: usb: fix device reset on autosuspend while not yet idle
When the i2400m is connected to a network, the host interface (USB)
cannot be suspended. For that to happen, the device has to have
negotiated with the basestation to put the link on IDLE state.
If the host tries to put the device in standby while it is connected
but not idle, the device resets, as the driver should not do that.
To avoid triggering that, when the USB susbsytem requires the driver
to autosuspend the device, the driver checks if the device is not yet
idle. If it is not, the request is requested (will be retried again
later on after the autosuspend timeout). At some point the device will
enter idle and the request will succeed (unless of course, there is
network traffic, but at that point, there is no idle neither in the
link or the host interface).
Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
2009-05-09 05:51:44 +07:00
|
|
|
error_not_now:
|
2008-12-21 07:57:51 +07:00
|
|
|
no_firmware:
|
|
|
|
d_fnend(3, dev, "(iface %p pm_msg %u) = %d\n",
|
|
|
|
iface, pm_msg.event, result);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static
|
|
|
|
int i2400mu_resume(struct usb_interface *iface)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
struct device *dev = &iface->dev;
|
|
|
|
struct i2400mu *i2400mu = usb_get_intfdata(iface);
|
|
|
|
struct i2400m *i2400m = &i2400mu->i2400m;
|
|
|
|
|
|
|
|
d_fnstart(3, dev, "(iface %p)\n", iface);
|
2009-09-17 07:10:55 +07:00
|
|
|
rmb(); /* see i2400m->updown's documentation */
|
2008-12-21 07:57:51 +07:00
|
|
|
if (i2400m->updown == 0) {
|
|
|
|
d_printf(1, dev, "fw was down, no resume neeed\n");
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
d_printf(1, dev, "fw was up, resuming\n");
|
|
|
|
i2400mu_notification_setup(i2400mu);
|
|
|
|
/* USB has flow control, so we don't need to give it time to
|
|
|
|
* come back; otherwise, we'd use something like a get-state
|
|
|
|
* command... */
|
|
|
|
out:
|
|
|
|
d_fnend(3, dev, "(iface %p) = %d\n", iface, ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-15 05:28:14 +07:00
|
|
|
static
|
|
|
|
int i2400mu_reset_resume(struct usb_interface *iface)
|
|
|
|
{
|
|
|
|
int result;
|
|
|
|
struct device *dev = &iface->dev;
|
|
|
|
struct i2400mu *i2400mu = usb_get_intfdata(iface);
|
|
|
|
struct i2400m *i2400m = &i2400mu->i2400m;
|
|
|
|
|
|
|
|
d_fnstart(3, dev, "(iface %p)\n", iface);
|
|
|
|
result = i2400m_dev_reset_handle(i2400m, "device reset on resume");
|
|
|
|
d_fnend(3, dev, "(iface %p) = %d\n", iface, result);
|
|
|
|
return result < 0 ? result : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-18 05:20:45 +07:00
|
|
|
/*
|
|
|
|
* Another driver or user space is triggering a reset on the device
|
|
|
|
* which contains the interface passed as an argument. Cease IO and
|
|
|
|
* save any device state you need to restore.
|
|
|
|
*
|
|
|
|
* If you need to allocate memory here, use GFP_NOIO or GFP_ATOMIC, if
|
|
|
|
* you are in atomic context.
|
|
|
|
*/
|
|
|
|
static
|
|
|
|
int i2400mu_pre_reset(struct usb_interface *iface)
|
|
|
|
{
|
|
|
|
struct i2400mu *i2400mu = usb_get_intfdata(iface);
|
|
|
|
return i2400m_pre_reset(&i2400mu->i2400m);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The reset has completed. Restore any saved device state and begin
|
|
|
|
* using the device again.
|
|
|
|
*
|
|
|
|
* If you need to allocate memory here, use GFP_NOIO or GFP_ATOMIC, if
|
|
|
|
* you are in atomic context.
|
|
|
|
*/
|
|
|
|
static
|
|
|
|
int i2400mu_post_reset(struct usb_interface *iface)
|
|
|
|
{
|
|
|
|
struct i2400mu *i2400mu = usb_get_intfdata(iface);
|
|
|
|
return i2400m_post_reset(&i2400mu->i2400m);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-12-21 07:57:51 +07:00
|
|
|
static
|
|
|
|
struct usb_device_id i2400mu_id_table[] = {
|
2009-08-13 01:29:46 +07:00
|
|
|
{ USB_DEVICE(0x8086, USB_DEVICE_ID_I6050) },
|
2010-01-21 03:41:13 +07:00
|
|
|
{ USB_DEVICE(0x8086, USB_DEVICE_ID_I6050_2) },
|
2008-12-21 07:57:51 +07:00
|
|
|
{ USB_DEVICE(0x8086, 0x0181) },
|
|
|
|
{ USB_DEVICE(0x8086, 0x1403) },
|
|
|
|
{ USB_DEVICE(0x8086, 0x1405) },
|
|
|
|
{ USB_DEVICE(0x8086, 0x0180) },
|
|
|
|
{ USB_DEVICE(0x8086, 0x0182) },
|
|
|
|
{ USB_DEVICE(0x8086, 0x1406) },
|
|
|
|
{ USB_DEVICE(0x8086, 0x1403) },
|
|
|
|
{ },
|
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(usb, i2400mu_id_table);
|
|
|
|
|
|
|
|
|
|
|
|
static
|
|
|
|
struct usb_driver i2400mu_driver = {
|
|
|
|
.name = KBUILD_MODNAME,
|
|
|
|
.suspend = i2400mu_suspend,
|
|
|
|
.resume = i2400mu_resume,
|
2009-09-15 05:28:14 +07:00
|
|
|
.reset_resume = i2400mu_reset_resume,
|
2008-12-21 07:57:51 +07:00
|
|
|
.probe = i2400mu_probe,
|
|
|
|
.disconnect = i2400mu_disconnect,
|
2009-09-18 05:20:45 +07:00
|
|
|
.pre_reset = i2400mu_pre_reset,
|
|
|
|
.post_reset = i2400mu_post_reset,
|
2008-12-21 07:57:51 +07:00
|
|
|
.id_table = i2400mu_id_table,
|
|
|
|
.supports_autosuspend = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
static
|
|
|
|
int __init i2400mu_driver_init(void)
|
|
|
|
{
|
2009-09-03 05:36:05 +07:00
|
|
|
d_parse_params(D_LEVEL, D_LEVEL_SIZE, i2400mu_debug_params,
|
|
|
|
"i2400m_usb.debug");
|
2008-12-21 07:57:51 +07:00
|
|
|
return usb_register(&i2400mu_driver);
|
|
|
|
}
|
|
|
|
module_init(i2400mu_driver_init);
|
|
|
|
|
|
|
|
|
|
|
|
static
|
|
|
|
void __exit i2400mu_driver_exit(void)
|
|
|
|
{
|
|
|
|
flush_scheduled_work(); /* for the stuff we schedule from sysfs.c */
|
|
|
|
usb_deregister(&i2400mu_driver);
|
|
|
|
}
|
|
|
|
module_exit(i2400mu_driver_exit);
|
|
|
|
|
|
|
|
MODULE_AUTHOR("Intel Corporation <linux-wimax@intel.com>");
|
2009-08-13 01:29:46 +07:00
|
|
|
MODULE_DESCRIPTION("Driver for USB based Intel Wireless WiMAX Connection 2400M "
|
|
|
|
"(5x50 & 6050)");
|
2008-12-21 07:57:51 +07:00
|
|
|
MODULE_LICENSE("GPL");
|
2009-03-01 06:42:47 +07:00
|
|
|
MODULE_FIRMWARE(I2400MU_FW_FILE_NAME_v1_4);
|