2005-05-11 14:19:29 -04:00
|
|
|
/******************************************************************************
|
|
|
|
* cxacru.c - driver for USB ADSL modems based on
|
|
|
|
* Conexant AccessRunner chipset
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004 David Woodhouse, Duncan Sands, Roman Kagan
|
|
|
|
* Copyright (C) 2005 Duncan Sands, Roman Kagan (rkagan % mail ! ru)
|
2007-04-26 03:38:05 -04:00
|
|
|
* Copyright (C) 2007 Simon Arlott
|
2005-05-11 14:19:29 -04:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the Free
|
|
|
|
* Software Foundation; either version 2 of the License, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* 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., 59
|
|
|
|
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Credit is due for Josep Comas, who created the original patch to speedtch.c
|
|
|
|
* to support the different padding used by the AccessRunner (now generalized
|
|
|
|
* into usbatm), and the userspace firmware loading utility.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/moduleparam.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/timer.h>
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/init.h>
|
2007-03-06 05:47:45 -05:00
|
|
|
#include <linux/device.h>
|
2005-05-11 14:19:29 -04:00
|
|
|
#include <linux/firmware.h>
|
2006-01-13 09:52:55 -05:00
|
|
|
#include <linux/mutex.h>
|
2005-05-11 14:19:29 -04:00
|
|
|
|
|
|
|
#include "usbatm.h"
|
|
|
|
|
2007-03-06 05:47:45 -05:00
|
|
|
#define DRIVER_AUTHOR "Roman Kagan, David Woodhouse, Duncan Sands, Simon Arlott"
|
|
|
|
#define DRIVER_VERSION "0.3"
|
2005-05-11 14:19:29 -04:00
|
|
|
#define DRIVER_DESC "Conexant AccessRunner ADSL USB modem driver"
|
|
|
|
|
|
|
|
static const char cxacru_driver_name[] = "cxacru";
|
|
|
|
|
|
|
|
#define CXACRU_EP_CMD 0x01 /* Bulk/interrupt in/out */
|
|
|
|
#define CXACRU_EP_DATA 0x02 /* Bulk in/out */
|
|
|
|
|
|
|
|
#define CMD_PACKET_SIZE 64 /* Should be maxpacket(ep)? */
|
|
|
|
|
|
|
|
/* Addresses */
|
|
|
|
#define PLLFCLK_ADDR 0x00350068
|
|
|
|
#define PLLBCLK_ADDR 0x0035006c
|
|
|
|
#define SDRAMEN_ADDR 0x00350010
|
|
|
|
#define FW_ADDR 0x00801000
|
|
|
|
#define BR_ADDR 0x00180600
|
|
|
|
#define SIG_ADDR 0x00180500
|
|
|
|
#define BR_STACK_ADDR 0x00187f10
|
|
|
|
|
|
|
|
/* Values */
|
|
|
|
#define SDRAM_ENA 0x1
|
|
|
|
|
|
|
|
#define CMD_TIMEOUT 2000 /* msecs */
|
2007-03-06 05:47:45 -05:00
|
|
|
#define POLL_INTERVAL 1 /* secs */
|
2005-05-11 14:19:29 -04:00
|
|
|
|
|
|
|
/* commands for interaction with the modem through the control channel before
|
|
|
|
* firmware is loaded */
|
|
|
|
enum cxacru_fw_request {
|
|
|
|
FW_CMD_ERR,
|
|
|
|
FW_GET_VER,
|
|
|
|
FW_READ_MEM,
|
|
|
|
FW_WRITE_MEM,
|
|
|
|
FW_RMW_MEM,
|
|
|
|
FW_CHECKSUM_MEM,
|
|
|
|
FW_GOTO_MEM,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* commands for interaction with the modem through the control channel once
|
|
|
|
* firmware is loaded */
|
|
|
|
enum cxacru_cm_request {
|
|
|
|
CM_REQUEST_UNDEFINED = 0x80,
|
|
|
|
CM_REQUEST_TEST,
|
|
|
|
CM_REQUEST_CHIP_GET_MAC_ADDRESS,
|
|
|
|
CM_REQUEST_CHIP_GET_DP_VERSIONS,
|
|
|
|
CM_REQUEST_CHIP_ADSL_LINE_START,
|
|
|
|
CM_REQUEST_CHIP_ADSL_LINE_STOP,
|
|
|
|
CM_REQUEST_CHIP_ADSL_LINE_GET_STATUS,
|
|
|
|
CM_REQUEST_CHIP_ADSL_LINE_GET_SPEED,
|
|
|
|
CM_REQUEST_CARD_INFO_GET,
|
|
|
|
CM_REQUEST_CARD_DATA_GET,
|
|
|
|
CM_REQUEST_CARD_DATA_SET,
|
|
|
|
CM_REQUEST_COMMAND_HW_IO,
|
|
|
|
CM_REQUEST_INTERFACE_HW_IO,
|
|
|
|
CM_REQUEST_CARD_SERIAL_DATA_PATH_GET,
|
|
|
|
CM_REQUEST_CARD_SERIAL_DATA_PATH_SET,
|
|
|
|
CM_REQUEST_CARD_CONTROLLER_VERSION_GET,
|
|
|
|
CM_REQUEST_CARD_GET_STATUS,
|
|
|
|
CM_REQUEST_CARD_GET_MAC_ADDRESS,
|
|
|
|
CM_REQUEST_CARD_GET_DATA_LINK_STATUS,
|
|
|
|
CM_REQUEST_MAX,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* reply codes to the commands above */
|
|
|
|
enum cxacru_cm_status {
|
|
|
|
CM_STATUS_UNDEFINED,
|
|
|
|
CM_STATUS_SUCCESS,
|
|
|
|
CM_STATUS_ERROR,
|
|
|
|
CM_STATUS_UNSUPPORTED,
|
|
|
|
CM_STATUS_UNIMPLEMENTED,
|
|
|
|
CM_STATUS_PARAMETER_ERROR,
|
|
|
|
CM_STATUS_DBG_LOOPBACK,
|
|
|
|
CM_STATUS_MAX,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* indices into CARD_INFO_GET return array */
|
|
|
|
enum cxacru_info_idx {
|
|
|
|
CXINF_DOWNSTREAM_RATE,
|
|
|
|
CXINF_UPSTREAM_RATE,
|
|
|
|
CXINF_LINK_STATUS,
|
|
|
|
CXINF_LINE_STATUS,
|
|
|
|
CXINF_MAC_ADDRESS_HIGH,
|
|
|
|
CXINF_MAC_ADDRESS_LOW,
|
|
|
|
CXINF_UPSTREAM_SNR_MARGIN,
|
|
|
|
CXINF_DOWNSTREAM_SNR_MARGIN,
|
|
|
|
CXINF_UPSTREAM_ATTENUATION,
|
|
|
|
CXINF_DOWNSTREAM_ATTENUATION,
|
|
|
|
CXINF_TRANSMITTER_POWER,
|
|
|
|
CXINF_UPSTREAM_BITS_PER_FRAME,
|
|
|
|
CXINF_DOWNSTREAM_BITS_PER_FRAME,
|
|
|
|
CXINF_STARTUP_ATTEMPTS,
|
|
|
|
CXINF_UPSTREAM_CRC_ERRORS,
|
|
|
|
CXINF_DOWNSTREAM_CRC_ERRORS,
|
|
|
|
CXINF_UPSTREAM_FEC_ERRORS,
|
|
|
|
CXINF_DOWNSTREAM_FEC_ERRORS,
|
|
|
|
CXINF_UPSTREAM_HEC_ERRORS,
|
|
|
|
CXINF_DOWNSTREAM_HEC_ERRORS,
|
|
|
|
CXINF_LINE_STARTABLE,
|
|
|
|
CXINF_MODULATION,
|
|
|
|
CXINF_ADSL_HEADEND,
|
|
|
|
CXINF_ADSL_HEADEND_ENVIRONMENT,
|
|
|
|
CXINF_CONTROLLER_VERSION,
|
|
|
|
/* dunno what the missing two mean */
|
|
|
|
CXINF_MAX = 0x1c,
|
|
|
|
};
|
|
|
|
|
2007-04-26 03:38:05 -04:00
|
|
|
enum cxacru_poll_state {
|
|
|
|
CXPOLL_STOPPING,
|
|
|
|
CXPOLL_STOPPED,
|
|
|
|
CXPOLL_POLLING,
|
|
|
|
CXPOLL_SHUTDOWN
|
|
|
|
};
|
|
|
|
|
2005-05-11 14:19:29 -04:00
|
|
|
struct cxacru_modem_type {
|
|
|
|
u32 pll_f_clk;
|
|
|
|
u32 pll_b_clk;
|
|
|
|
int boot_rom_patch;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cxacru_data {
|
|
|
|
struct usbatm_data *usbatm;
|
|
|
|
|
|
|
|
const struct cxacru_modem_type *modem_type;
|
|
|
|
|
|
|
|
int line_status;
|
2007-04-26 03:38:05 -04:00
|
|
|
struct mutex adsl_state_serialize;
|
|
|
|
int adsl_status;
|
2006-11-22 09:57:56 -05:00
|
|
|
struct delayed_work poll_work;
|
2007-03-06 05:47:45 -05:00
|
|
|
u32 card_info[CXINF_MAX];
|
2007-04-26 03:38:05 -04:00
|
|
|
struct mutex poll_state_serialize;
|
|
|
|
int poll_state;
|
2005-05-11 14:19:29 -04:00
|
|
|
|
|
|
|
/* contol handles */
|
2006-01-13 09:52:55 -05:00
|
|
|
struct mutex cm_serialize;
|
2005-05-11 14:19:29 -04:00
|
|
|
u8 *rcv_buf;
|
|
|
|
u8 *snd_buf;
|
|
|
|
struct urb *rcv_urb;
|
|
|
|
struct urb *snd_urb;
|
|
|
|
struct completion rcv_done;
|
|
|
|
struct completion snd_done;
|
|
|
|
};
|
|
|
|
|
2007-04-26 03:38:05 -04:00
|
|
|
static int cxacru_cm(struct cxacru_data *instance, enum cxacru_cm_request cm,
|
|
|
|
u8 *wdata, int wsize, u8 *rdata, int rsize);
|
|
|
|
static void cxacru_poll_status(struct work_struct *work);
|
|
|
|
|
2007-03-06 05:47:45 -05:00
|
|
|
/* Card info exported through sysfs */
|
|
|
|
#define CXACRU__ATTR_INIT(_name) \
|
|
|
|
static DEVICE_ATTR(_name, S_IRUGO, cxacru_sysfs_show_##_name, NULL)
|
|
|
|
|
2007-04-26 03:38:05 -04:00
|
|
|
#define CXACRU_CMD_INIT(_name) \
|
|
|
|
static DEVICE_ATTR(_name, S_IWUSR | S_IRUGO, \
|
|
|
|
cxacru_sysfs_show_##_name, cxacru_sysfs_store_##_name)
|
|
|
|
|
2007-03-06 05:47:45 -05:00
|
|
|
#define CXACRU_ATTR_INIT(_value, _type, _name) \
|
|
|
|
static ssize_t cxacru_sysfs_show_##_name(struct device *dev, \
|
|
|
|
struct device_attribute *attr, char *buf) \
|
|
|
|
{ \
|
|
|
|
struct usb_interface *intf = to_usb_interface(dev); \
|
|
|
|
struct usbatm_data *usbatm_instance = usb_get_intfdata(intf); \
|
|
|
|
struct cxacru_data *instance = usbatm_instance->driver_data; \
|
|
|
|
return cxacru_sysfs_showattr_##_type(instance->card_info[_value], buf); \
|
|
|
|
} \
|
|
|
|
CXACRU__ATTR_INIT(_name)
|
|
|
|
|
|
|
|
#define CXACRU_ATTR_CREATE(_v, _t, _name) CXACRU_DEVICE_CREATE_FILE(_name)
|
2007-04-26 03:38:05 -04:00
|
|
|
#define CXACRU_CMD_CREATE(_name) CXACRU_DEVICE_CREATE_FILE(_name)
|
2007-03-06 05:47:45 -05:00
|
|
|
#define CXACRU__ATTR_CREATE(_name) CXACRU_DEVICE_CREATE_FILE(_name)
|
|
|
|
|
|
|
|
#define CXACRU_ATTR_REMOVE(_v, _t, _name) CXACRU_DEVICE_REMOVE_FILE(_name)
|
2007-04-26 03:38:05 -04:00
|
|
|
#define CXACRU_CMD_REMOVE(_name) CXACRU_DEVICE_REMOVE_FILE(_name)
|
2007-03-06 05:47:45 -05:00
|
|
|
#define CXACRU__ATTR_REMOVE(_name) CXACRU_DEVICE_REMOVE_FILE(_name)
|
|
|
|
|
|
|
|
static ssize_t cxacru_sysfs_showattr_u32(u32 value, char *buf)
|
|
|
|
{
|
|
|
|
return snprintf(buf, PAGE_SIZE, "%u\n", value);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t cxacru_sysfs_showattr_s8(s8 value, char *buf)
|
|
|
|
{
|
|
|
|
return snprintf(buf, PAGE_SIZE, "%d\n", value);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t cxacru_sysfs_showattr_dB(s16 value, char *buf)
|
|
|
|
{
|
|
|
|
if (unlikely(value < 0)) {
|
|
|
|
return snprintf(buf, PAGE_SIZE, "%d.%02u\n",
|
|
|
|
value / 100, -value % 100);
|
|
|
|
} else {
|
|
|
|
return snprintf(buf, PAGE_SIZE, "%d.%02u\n",
|
|
|
|
value / 100, value % 100);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t cxacru_sysfs_showattr_bool(u32 value, char *buf)
|
|
|
|
{
|
|
|
|
switch (value) {
|
|
|
|
case 0: return snprintf(buf, PAGE_SIZE, "no\n");
|
|
|
|
case 1: return snprintf(buf, PAGE_SIZE, "yes\n");
|
|
|
|
default: return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t cxacru_sysfs_showattr_LINK(u32 value, char *buf)
|
|
|
|
{
|
|
|
|
switch (value) {
|
|
|
|
case 1: return snprintf(buf, PAGE_SIZE, "not connected\n");
|
|
|
|
case 2: return snprintf(buf, PAGE_SIZE, "connected\n");
|
|
|
|
case 3: return snprintf(buf, PAGE_SIZE, "lost\n");
|
|
|
|
default: return snprintf(buf, PAGE_SIZE, "unknown (%u)\n", value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t cxacru_sysfs_showattr_LINE(u32 value, char *buf)
|
|
|
|
{
|
|
|
|
switch (value) {
|
|
|
|
case 0: return snprintf(buf, PAGE_SIZE, "down\n");
|
|
|
|
case 1: return snprintf(buf, PAGE_SIZE, "attempting to activate\n");
|
|
|
|
case 2: return snprintf(buf, PAGE_SIZE, "training\n");
|
|
|
|
case 3: return snprintf(buf, PAGE_SIZE, "channel analysis\n");
|
|
|
|
case 4: return snprintf(buf, PAGE_SIZE, "exchange\n");
|
|
|
|
case 5: return snprintf(buf, PAGE_SIZE, "up\n");
|
|
|
|
case 6: return snprintf(buf, PAGE_SIZE, "waiting\n");
|
|
|
|
case 7: return snprintf(buf, PAGE_SIZE, "initialising\n");
|
|
|
|
default: return snprintf(buf, PAGE_SIZE, "unknown (%u)\n", value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t cxacru_sysfs_showattr_MODU(u32 value, char *buf)
|
|
|
|
{
|
|
|
|
switch (value) {
|
|
|
|
case 0: return 0;
|
|
|
|
case 1: return snprintf(buf, PAGE_SIZE, "ANSI T1.413\n");
|
|
|
|
case 2: return snprintf(buf, PAGE_SIZE, "ITU-T G.992.1 (G.DMT)\n");
|
|
|
|
case 3: return snprintf(buf, PAGE_SIZE, "ITU-T G.992.2 (G.LITE)\n");
|
|
|
|
default: return snprintf(buf, PAGE_SIZE, "unknown (%u)\n", value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This could use MAC_ADDRESS_HIGH and MAC_ADDRESS_LOW, but since
|
|
|
|
* this data is already in atm_dev there's no point.
|
|
|
|
*
|
|
|
|
* MAC_ADDRESS_HIGH = 0x????5544
|
|
|
|
* MAC_ADDRESS_LOW = 0x33221100
|
|
|
|
* Where 00-55 are bytes 0-5 of the MAC.
|
|
|
|
*/
|
|
|
|
static ssize_t cxacru_sysfs_show_mac_address(struct device *dev,
|
|
|
|
struct device_attribute *attr, char *buf)
|
|
|
|
{
|
|
|
|
struct usb_interface *intf = to_usb_interface(dev);
|
|
|
|
struct usbatm_data *usbatm_instance = usb_get_intfdata(intf);
|
|
|
|
struct atm_dev *atm_dev = usbatm_instance->atm_dev;
|
|
|
|
|
|
|
|
return snprintf(buf, PAGE_SIZE, "%02x:%02x:%02x:%02x:%02x:%02x\n",
|
|
|
|
atm_dev->esi[0], atm_dev->esi[1], atm_dev->esi[2],
|
|
|
|
atm_dev->esi[3], atm_dev->esi[4], atm_dev->esi[5]);
|
|
|
|
}
|
|
|
|
|
2007-04-26 03:38:05 -04:00
|
|
|
static ssize_t cxacru_sysfs_show_adsl_state(struct device *dev,
|
|
|
|
struct device_attribute *attr, char *buf)
|
|
|
|
{
|
|
|
|
struct usb_interface *intf = to_usb_interface(dev);
|
|
|
|
struct usbatm_data *usbatm_instance = usb_get_intfdata(intf);
|
|
|
|
struct cxacru_data *instance = usbatm_instance->driver_data;
|
|
|
|
u32 value = instance->card_info[CXINF_LINE_STARTABLE];
|
|
|
|
|
|
|
|
switch (value) {
|
|
|
|
case 0: return snprintf(buf, PAGE_SIZE, "running\n");
|
|
|
|
case 1: return snprintf(buf, PAGE_SIZE, "stopped\n");
|
|
|
|
default: return snprintf(buf, PAGE_SIZE, "unknown (%u)\n", value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t cxacru_sysfs_store_adsl_state(struct device *dev,
|
|
|
|
struct device_attribute *attr, const char *buf, size_t count)
|
|
|
|
{
|
|
|
|
struct usb_interface *intf = to_usb_interface(dev);
|
|
|
|
struct usbatm_data *usbatm_instance = usb_get_intfdata(intf);
|
|
|
|
struct cxacru_data *instance = usbatm_instance->driver_data;
|
|
|
|
int ret;
|
|
|
|
int poll = -1;
|
|
|
|
char str_cmd[8];
|
|
|
|
int len = strlen(buf);
|
|
|
|
|
|
|
|
if (!capable(CAP_NET_ADMIN))
|
|
|
|
return -EACCES;
|
|
|
|
|
|
|
|
ret = sscanf(buf, "%7s", str_cmd);
|
|
|
|
if (ret != 1)
|
|
|
|
return -EINVAL;
|
|
|
|
ret = 0;
|
|
|
|
|
|
|
|
if (mutex_lock_interruptible(&instance->adsl_state_serialize))
|
|
|
|
return -ERESTARTSYS;
|
|
|
|
|
|
|
|
if (!strcmp(str_cmd, "stop") || !strcmp(str_cmd, "restart")) {
|
|
|
|
ret = cxacru_cm(instance, CM_REQUEST_CHIP_ADSL_LINE_STOP, NULL, 0, NULL, 0);
|
|
|
|
if (ret < 0) {
|
|
|
|
atm_err(usbatm_instance, "change adsl state:"
|
|
|
|
" CHIP_ADSL_LINE_STOP returned %d\n", ret);
|
|
|
|
|
|
|
|
ret = -EIO;
|
|
|
|
} else {
|
|
|
|
ret = len;
|
|
|
|
poll = CXPOLL_STOPPED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Line status is only updated every second
|
|
|
|
* and the device appears to only react to
|
|
|
|
* START/STOP every second too. Wait 1.5s to
|
|
|
|
* be sure that restart will have an effect. */
|
|
|
|
if (!strcmp(str_cmd, "restart"))
|
|
|
|
msleep(1500);
|
|
|
|
|
|
|
|
if (!strcmp(str_cmd, "start") || !strcmp(str_cmd, "restart")) {
|
|
|
|
ret = cxacru_cm(instance, CM_REQUEST_CHIP_ADSL_LINE_START, NULL, 0, NULL, 0);
|
|
|
|
if (ret < 0) {
|
|
|
|
atm_err(usbatm_instance, "change adsl state:"
|
|
|
|
" CHIP_ADSL_LINE_START returned %d\n", ret);
|
|
|
|
|
|
|
|
ret = -EIO;
|
|
|
|
} else {
|
|
|
|
ret = len;
|
|
|
|
poll = CXPOLL_POLLING;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!strcmp(str_cmd, "poll")) {
|
|
|
|
ret = len;
|
|
|
|
poll = CXPOLL_POLLING;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ret == 0) {
|
|
|
|
ret = -EINVAL;
|
|
|
|
poll = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (poll == CXPOLL_POLLING) {
|
|
|
|
mutex_lock(&instance->poll_state_serialize);
|
|
|
|
switch (instance->poll_state) {
|
|
|
|
case CXPOLL_STOPPED:
|
|
|
|
/* start polling */
|
|
|
|
instance->poll_state = CXPOLL_POLLING;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CXPOLL_STOPPING:
|
|
|
|
/* abort stop request */
|
|
|
|
instance->poll_state = CXPOLL_POLLING;
|
|
|
|
case CXPOLL_POLLING:
|
|
|
|
case CXPOLL_SHUTDOWN:
|
|
|
|
/* don't start polling */
|
|
|
|
poll = -1;
|
|
|
|
}
|
|
|
|
mutex_unlock(&instance->poll_state_serialize);
|
|
|
|
} else if (poll == CXPOLL_STOPPED) {
|
|
|
|
mutex_lock(&instance->poll_state_serialize);
|
|
|
|
/* request stop */
|
|
|
|
if (instance->poll_state == CXPOLL_POLLING)
|
|
|
|
instance->poll_state = CXPOLL_STOPPING;
|
|
|
|
mutex_unlock(&instance->poll_state_serialize);
|
|
|
|
}
|
|
|
|
|
|
|
|
mutex_unlock(&instance->adsl_state_serialize);
|
|
|
|
|
|
|
|
if (poll == CXPOLL_POLLING)
|
|
|
|
cxacru_poll_status(&instance->poll_work.work);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2007-03-06 05:47:45 -05:00
|
|
|
/*
|
|
|
|
* All device attributes are included in CXACRU_ALL_FILES
|
|
|
|
* so that the same list can be used multiple times:
|
|
|
|
* INIT (define the device attributes)
|
|
|
|
* CREATE (create all the device files)
|
|
|
|
* REMOVE (remove all the device files)
|
|
|
|
*
|
|
|
|
* With the last two being defined as needed in the functions
|
|
|
|
* they are used in before calling CXACRU_ALL_FILES()
|
|
|
|
*/
|
|
|
|
#define CXACRU_ALL_FILES(_action) \
|
|
|
|
CXACRU_ATTR_##_action(CXINF_DOWNSTREAM_RATE, u32, downstream_rate); \
|
|
|
|
CXACRU_ATTR_##_action(CXINF_UPSTREAM_RATE, u32, upstream_rate); \
|
|
|
|
CXACRU_ATTR_##_action(CXINF_LINK_STATUS, LINK, link_status); \
|
|
|
|
CXACRU_ATTR_##_action(CXINF_LINE_STATUS, LINE, line_status); \
|
|
|
|
CXACRU__ATTR_##_action( mac_address); \
|
|
|
|
CXACRU_ATTR_##_action(CXINF_UPSTREAM_SNR_MARGIN, dB, upstream_snr_margin); \
|
|
|
|
CXACRU_ATTR_##_action(CXINF_DOWNSTREAM_SNR_MARGIN, dB, downstream_snr_margin); \
|
|
|
|
CXACRU_ATTR_##_action(CXINF_UPSTREAM_ATTENUATION, dB, upstream_attenuation); \
|
|
|
|
CXACRU_ATTR_##_action(CXINF_DOWNSTREAM_ATTENUATION, dB, downstream_attenuation); \
|
|
|
|
CXACRU_ATTR_##_action(CXINF_TRANSMITTER_POWER, s8, transmitter_power); \
|
|
|
|
CXACRU_ATTR_##_action(CXINF_UPSTREAM_BITS_PER_FRAME, u32, upstream_bits_per_frame); \
|
|
|
|
CXACRU_ATTR_##_action(CXINF_DOWNSTREAM_BITS_PER_FRAME, u32, downstream_bits_per_frame); \
|
|
|
|
CXACRU_ATTR_##_action(CXINF_STARTUP_ATTEMPTS, u32, startup_attempts); \
|
|
|
|
CXACRU_ATTR_##_action(CXINF_UPSTREAM_CRC_ERRORS, u32, upstream_crc_errors); \
|
|
|
|
CXACRU_ATTR_##_action(CXINF_DOWNSTREAM_CRC_ERRORS, u32, downstream_crc_errors); \
|
|
|
|
CXACRU_ATTR_##_action(CXINF_UPSTREAM_FEC_ERRORS, u32, upstream_fec_errors); \
|
|
|
|
CXACRU_ATTR_##_action(CXINF_DOWNSTREAM_FEC_ERRORS, u32, downstream_fec_errors); \
|
|
|
|
CXACRU_ATTR_##_action(CXINF_UPSTREAM_HEC_ERRORS, u32, upstream_hec_errors); \
|
|
|
|
CXACRU_ATTR_##_action(CXINF_DOWNSTREAM_HEC_ERRORS, u32, downstream_hec_errors); \
|
|
|
|
CXACRU_ATTR_##_action(CXINF_LINE_STARTABLE, bool, line_startable); \
|
|
|
|
CXACRU_ATTR_##_action(CXINF_MODULATION, MODU, modulation); \
|
|
|
|
CXACRU_ATTR_##_action(CXINF_ADSL_HEADEND, u32, adsl_headend); \
|
|
|
|
CXACRU_ATTR_##_action(CXINF_ADSL_HEADEND_ENVIRONMENT, u32, adsl_headend_environment); \
|
2007-04-26 03:38:05 -04:00
|
|
|
CXACRU_ATTR_##_action(CXINF_CONTROLLER_VERSION, u32, adsl_controller_version); \
|
|
|
|
CXACRU_CMD_##_action( adsl_state);
|
2007-03-06 05:47:45 -05:00
|
|
|
|
|
|
|
CXACRU_ALL_FILES(INIT);
|
|
|
|
|
2005-05-11 14:19:29 -04:00
|
|
|
/* the following three functions are stolen from drivers/usb/core/message.c */
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 09:55:46 -04:00
|
|
|
static void cxacru_blocking_completion(struct urb *urb)
|
2005-05-11 14:19:29 -04:00
|
|
|
{
|
|
|
|
complete((struct completion *)urb->context);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void cxacru_timeout_kill(unsigned long data)
|
|
|
|
{
|
|
|
|
usb_unlink_urb((struct urb *) data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int cxacru_start_wait_urb(struct urb *urb, struct completion *done,
|
|
|
|
int* actual_length)
|
|
|
|
{
|
|
|
|
struct timer_list timer;
|
|
|
|
int status;
|
|
|
|
|
|
|
|
init_timer(&timer);
|
|
|
|
timer.expires = jiffies + msecs_to_jiffies(CMD_TIMEOUT);
|
|
|
|
timer.data = (unsigned long) urb;
|
|
|
|
timer.function = cxacru_timeout_kill;
|
|
|
|
add_timer(&timer);
|
|
|
|
wait_for_completion(done);
|
|
|
|
status = urb->status;
|
|
|
|
if (status == -ECONNRESET)
|
|
|
|
status = -ETIMEDOUT;
|
|
|
|
del_timer_sync(&timer);
|
|
|
|
|
|
|
|
if (actual_length)
|
|
|
|
*actual_length = urb->actual_length;
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int cxacru_cm(struct cxacru_data *instance, enum cxacru_cm_request cm,
|
|
|
|
u8 *wdata, int wsize, u8 *rdata, int rsize)
|
|
|
|
{
|
|
|
|
int ret, actlen;
|
|
|
|
int offb, offd;
|
|
|
|
const int stride = CMD_PACKET_SIZE - 4;
|
|
|
|
u8 *wbuf = instance->snd_buf;
|
|
|
|
u8 *rbuf = instance->rcv_buf;
|
|
|
|
int wbuflen = ((wsize - 1) / stride + 1) * CMD_PACKET_SIZE;
|
|
|
|
int rbuflen = ((rsize - 1) / stride + 1) * CMD_PACKET_SIZE;
|
|
|
|
|
|
|
|
if (wbuflen > PAGE_SIZE || rbuflen > PAGE_SIZE) {
|
|
|
|
dbg("too big transfer requested");
|
|
|
|
ret = -ENOMEM;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
2006-01-13 09:52:55 -05:00
|
|
|
mutex_lock(&instance->cm_serialize);
|
2005-05-11 14:19:29 -04:00
|
|
|
|
|
|
|
/* submit reading urb before the writing one */
|
|
|
|
init_completion(&instance->rcv_done);
|
|
|
|
ret = usb_submit_urb(instance->rcv_urb, GFP_KERNEL);
|
|
|
|
if (ret < 0) {
|
|
|
|
dbg("submitting read urb for cm %#x failed", cm);
|
|
|
|
ret = ret;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
memset(wbuf, 0, wbuflen);
|
|
|
|
/* handle wsize == 0 */
|
|
|
|
wbuf[0] = cm;
|
|
|
|
for (offb = offd = 0; offd < wsize; offd += stride, offb += CMD_PACKET_SIZE) {
|
|
|
|
wbuf[offb] = cm;
|
|
|
|
memcpy(wbuf + offb + 4, wdata + offd, min_t(int, stride, wsize - offd));
|
|
|
|
}
|
|
|
|
|
|
|
|
instance->snd_urb->transfer_buffer_length = wbuflen;
|
|
|
|
init_completion(&instance->snd_done);
|
|
|
|
ret = usb_submit_urb(instance->snd_urb, GFP_KERNEL);
|
|
|
|
if (ret < 0) {
|
|
|
|
dbg("submitting write urb for cm %#x failed", cm);
|
|
|
|
ret = ret;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = cxacru_start_wait_urb(instance->snd_urb, &instance->snd_done, NULL);
|
|
|
|
if (ret < 0) {
|
|
|
|
dbg("sending cm %#x failed", cm);
|
|
|
|
ret = ret;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = cxacru_start_wait_urb(instance->rcv_urb, &instance->rcv_done, &actlen);
|
|
|
|
if (ret < 0) {
|
|
|
|
dbg("receiving cm %#x failed", cm);
|
|
|
|
ret = ret;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
if (actlen % CMD_PACKET_SIZE || !actlen) {
|
|
|
|
dbg("response is not a positive multiple of %d: %#x",
|
|
|
|
CMD_PACKET_SIZE, actlen);
|
|
|
|
ret = -EIO;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check the return status and copy the data to the output buffer, if needed */
|
|
|
|
for (offb = offd = 0; offd < rsize && offb < actlen; offb += CMD_PACKET_SIZE) {
|
|
|
|
if (rbuf[offb] != cm) {
|
|
|
|
dbg("wrong cm %#x in response", rbuf[offb]);
|
|
|
|
ret = -EIO;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
if (rbuf[offb + 1] != CM_STATUS_SUCCESS) {
|
|
|
|
dbg("response failed: %#x", rbuf[offb + 1]);
|
|
|
|
ret = -EIO;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
if (offd >= rsize)
|
|
|
|
break;
|
|
|
|
memcpy(rdata + offd, rbuf + offb + 4, min_t(int, stride, rsize - offd));
|
|
|
|
offd += stride;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = offd;
|
|
|
|
dbg("cm %#x", cm);
|
|
|
|
fail:
|
2006-01-13 09:52:55 -05:00
|
|
|
mutex_unlock(&instance->cm_serialize);
|
2005-05-11 14:19:29 -04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int cxacru_cm_get_array(struct cxacru_data *instance, enum cxacru_cm_request cm,
|
|
|
|
u32 *data, int size)
|
|
|
|
{
|
|
|
|
int ret, len;
|
|
|
|
u32 *buf;
|
|
|
|
int offb, offd;
|
|
|
|
const int stride = CMD_PACKET_SIZE / (4 * 2) - 1;
|
|
|
|
int buflen = ((size - 1) / stride + 1 + size * 2) * 4;
|
|
|
|
|
|
|
|
buf = kmalloc(buflen, GFP_KERNEL);
|
|
|
|
if (!buf)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
ret = cxacru_cm(instance, cm, NULL, 0, (u8 *) buf, buflen);
|
|
|
|
if (ret < 0)
|
|
|
|
goto cleanup;
|
|
|
|
|
|
|
|
/* len > 0 && len % 4 == 0 guaranteed by cxacru_cm() */
|
|
|
|
len = ret / 4;
|
|
|
|
for (offb = 0; offb < len; ) {
|
|
|
|
int l = le32_to_cpu(buf[offb++]);
|
|
|
|
if (l > stride || l > (len - offb) / 2) {
|
|
|
|
dbg("wrong data length %#x in response", l);
|
|
|
|
ret = -EIO;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
while (l--) {
|
|
|
|
offd = le32_to_cpu(buf[offb++]);
|
|
|
|
if (offd >= size) {
|
|
|
|
dbg("wrong index %#x in response", offd);
|
|
|
|
ret = -EIO;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
data[offd] = le32_to_cpu(buf[offb++]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = 0;
|
|
|
|
|
|
|
|
cleanup:
|
|
|
|
kfree(buf);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int cxacru_card_status(struct cxacru_data *instance)
|
|
|
|
{
|
|
|
|
int ret = cxacru_cm(instance, CM_REQUEST_CARD_GET_STATUS, NULL, 0, NULL, 0);
|
|
|
|
if (ret < 0) { /* firmware not loaded */
|
|
|
|
dbg("cxacru_adsl_start: CARD_GET_STATUS returned %d", ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int cxacru_atm_start(struct usbatm_data *usbatm_instance,
|
|
|
|
struct atm_dev *atm_dev)
|
|
|
|
{
|
|
|
|
struct cxacru_data *instance = usbatm_instance->driver_data;
|
|
|
|
/*
|
|
|
|
struct atm_dev *atm_dev = usbatm_instance->atm_dev;
|
|
|
|
*/
|
|
|
|
int ret;
|
2007-04-26 03:38:05 -04:00
|
|
|
int start_polling = 1;
|
2005-05-11 14:19:29 -04:00
|
|
|
|
|
|
|
dbg("cxacru_atm_start");
|
|
|
|
|
|
|
|
/* Read MAC address */
|
|
|
|
ret = cxacru_cm(instance, CM_REQUEST_CARD_GET_MAC_ADDRESS, NULL, 0,
|
|
|
|
atm_dev->esi, sizeof(atm_dev->esi));
|
|
|
|
if (ret < 0) {
|
2006-01-17 05:15:13 -05:00
|
|
|
atm_err(usbatm_instance, "cxacru_atm_start: CARD_GET_MAC_ADDRESS returned %d\n", ret);
|
2005-05-11 14:19:29 -04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* start ADSL */
|
2007-04-26 03:38:05 -04:00
|
|
|
mutex_lock(&instance->adsl_state_serialize);
|
2005-05-11 14:19:29 -04:00
|
|
|
ret = cxacru_cm(instance, CM_REQUEST_CHIP_ADSL_LINE_START, NULL, 0, NULL, 0);
|
|
|
|
if (ret < 0) {
|
2006-01-17 05:15:13 -05:00
|
|
|
atm_err(usbatm_instance, "cxacru_atm_start: CHIP_ADSL_LINE_START returned %d\n", ret);
|
2007-04-26 03:38:05 -04:00
|
|
|
mutex_unlock(&instance->adsl_state_serialize);
|
2005-05-11 14:19:29 -04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Start status polling */
|
2007-04-26 03:38:05 -04:00
|
|
|
mutex_lock(&instance->poll_state_serialize);
|
|
|
|
switch (instance->poll_state) {
|
|
|
|
case CXPOLL_STOPPED:
|
|
|
|
/* start polling */
|
|
|
|
instance->poll_state = CXPOLL_POLLING;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CXPOLL_STOPPING:
|
|
|
|
/* abort stop request */
|
|
|
|
instance->poll_state = CXPOLL_POLLING;
|
|
|
|
case CXPOLL_POLLING:
|
|
|
|
case CXPOLL_SHUTDOWN:
|
|
|
|
/* don't start polling */
|
|
|
|
start_polling = 0;
|
|
|
|
}
|
|
|
|
mutex_unlock(&instance->poll_state_serialize);
|
|
|
|
mutex_unlock(&instance->adsl_state_serialize);
|
|
|
|
|
|
|
|
if (start_polling)
|
|
|
|
cxacru_poll_status(&instance->poll_work.work);
|
2005-05-11 14:19:29 -04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-11-22 09:57:56 -05:00
|
|
|
static void cxacru_poll_status(struct work_struct *work)
|
2005-05-11 14:19:29 -04:00
|
|
|
{
|
2006-11-22 09:57:56 -05:00
|
|
|
struct cxacru_data *instance =
|
|
|
|
container_of(work, struct cxacru_data, poll_work.work);
|
2005-05-11 14:19:29 -04:00
|
|
|
u32 buf[CXINF_MAX] = {};
|
2006-01-17 05:15:13 -05:00
|
|
|
struct usbatm_data *usbatm = instance->usbatm;
|
|
|
|
struct atm_dev *atm_dev = usbatm->atm_dev;
|
2007-04-26 03:38:05 -04:00
|
|
|
int keep_polling = 1;
|
2005-05-11 14:19:29 -04:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = cxacru_cm_get_array(instance, CM_REQUEST_CARD_INFO_GET, buf, CXINF_MAX);
|
|
|
|
if (ret < 0) {
|
2007-04-26 03:38:05 -04:00
|
|
|
if (ret != -ESHUTDOWN)
|
|
|
|
atm_warn(usbatm, "poll status: error %d\n", ret);
|
|
|
|
|
|
|
|
mutex_lock(&instance->poll_state_serialize);
|
|
|
|
if (instance->poll_state != CXPOLL_SHUTDOWN) {
|
|
|
|
instance->poll_state = CXPOLL_STOPPED;
|
|
|
|
|
|
|
|
if (ret != -ESHUTDOWN)
|
|
|
|
atm_warn(usbatm, "polling disabled, set adsl_state"
|
|
|
|
" to 'start' or 'poll' to resume\n");
|
|
|
|
}
|
|
|
|
mutex_unlock(&instance->poll_state_serialize);
|
2005-05-11 14:19:29 -04:00
|
|
|
goto reschedule;
|
|
|
|
}
|
|
|
|
|
2007-03-06 05:47:45 -05:00
|
|
|
memcpy(instance->card_info, buf, sizeof(instance->card_info));
|
|
|
|
|
2007-04-26 03:38:05 -04:00
|
|
|
if (instance->adsl_status != buf[CXINF_LINE_STARTABLE]) {
|
|
|
|
instance->adsl_status = buf[CXINF_LINE_STARTABLE];
|
|
|
|
|
|
|
|
switch (instance->adsl_status) {
|
|
|
|
case 0:
|
|
|
|
atm_printk(KERN_INFO, usbatm, "ADSL state: running\n");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
atm_printk(KERN_INFO, usbatm, "ADSL state: stopped\n");
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
atm_printk(KERN_INFO, usbatm, "Unknown adsl status %02x\n", instance->adsl_status);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-05-11 14:19:29 -04:00
|
|
|
if (instance->line_status == buf[CXINF_LINE_STATUS])
|
|
|
|
goto reschedule;
|
|
|
|
|
|
|
|
instance->line_status = buf[CXINF_LINE_STATUS];
|
|
|
|
switch (instance->line_status) {
|
|
|
|
case 0:
|
|
|
|
atm_dev->signal = ATM_PHY_SIG_LOST;
|
2006-01-17 05:15:13 -05:00
|
|
|
atm_info(usbatm, "ADSL line: down\n");
|
2005-05-11 14:19:29 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
atm_dev->signal = ATM_PHY_SIG_LOST;
|
2006-01-17 05:15:13 -05:00
|
|
|
atm_info(usbatm, "ADSL line: attempting to activate\n");
|
2005-05-11 14:19:29 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
atm_dev->signal = ATM_PHY_SIG_LOST;
|
2006-01-17 05:15:13 -05:00
|
|
|
atm_info(usbatm, "ADSL line: training\n");
|
2005-05-11 14:19:29 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
atm_dev->signal = ATM_PHY_SIG_LOST;
|
2006-01-17 05:15:13 -05:00
|
|
|
atm_info(usbatm, "ADSL line: channel analysis\n");
|
2005-05-11 14:19:29 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
atm_dev->signal = ATM_PHY_SIG_LOST;
|
2006-01-17 05:15:13 -05:00
|
|
|
atm_info(usbatm, "ADSL line: exchange\n");
|
2005-05-11 14:19:29 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
atm_dev->link_rate = buf[CXINF_DOWNSTREAM_RATE] * 1000 / 424;
|
|
|
|
atm_dev->signal = ATM_PHY_SIG_FOUND;
|
|
|
|
|
2006-01-17 05:15:13 -05:00
|
|
|
atm_info(usbatm, "ADSL line: up (%d kb/s down | %d kb/s up)\n",
|
2005-05-11 14:19:29 -04:00
|
|
|
buf[CXINF_DOWNSTREAM_RATE], buf[CXINF_UPSTREAM_RATE]);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 6:
|
|
|
|
atm_dev->signal = ATM_PHY_SIG_LOST;
|
2006-01-17 05:15:13 -05:00
|
|
|
atm_info(usbatm, "ADSL line: waiting\n");
|
2005-05-11 14:19:29 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 7:
|
|
|
|
atm_dev->signal = ATM_PHY_SIG_LOST;
|
2006-01-17 05:15:13 -05:00
|
|
|
atm_info(usbatm, "ADSL line: initializing\n");
|
2005-05-11 14:19:29 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
atm_dev->signal = ATM_PHY_SIG_UNKNOWN;
|
2006-01-17 05:15:13 -05:00
|
|
|
atm_info(usbatm, "Unknown line state %02x\n", instance->line_status);
|
2005-05-11 14:19:29 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
reschedule:
|
2007-04-26 03:38:05 -04:00
|
|
|
|
|
|
|
mutex_lock(&instance->poll_state_serialize);
|
|
|
|
if (instance->poll_state == CXPOLL_STOPPING &&
|
|
|
|
instance->adsl_status == 1 && /* stopped */
|
|
|
|
instance->line_status == 0) /* down */
|
|
|
|
instance->poll_state = CXPOLL_STOPPED;
|
|
|
|
|
|
|
|
if (instance->poll_state == CXPOLL_STOPPED)
|
|
|
|
keep_polling = 0;
|
|
|
|
mutex_unlock(&instance->poll_state_serialize);
|
|
|
|
|
|
|
|
if (keep_polling)
|
|
|
|
schedule_delayed_work(&instance->poll_work,
|
|
|
|
round_jiffies_relative(POLL_INTERVAL*HZ));
|
2005-05-11 14:19:29 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static int cxacru_fw(struct usb_device *usb_dev, enum cxacru_fw_request fw,
|
|
|
|
u8 code1, u8 code2, u32 addr, u8 *data, int size)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
u8 *buf;
|
|
|
|
int offd, offb;
|
|
|
|
const int stride = CMD_PACKET_SIZE - 8;
|
|
|
|
|
|
|
|
buf = (u8 *) __get_free_page(GFP_KERNEL);
|
|
|
|
if (!buf)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
offb = offd = 0;
|
|
|
|
do {
|
|
|
|
int l = min_t(int, stride, size - offd);
|
|
|
|
buf[offb++] = fw;
|
|
|
|
buf[offb++] = l;
|
|
|
|
buf[offb++] = code1;
|
|
|
|
buf[offb++] = code2;
|
|
|
|
*((u32 *) (buf + offb)) = cpu_to_le32(addr);
|
|
|
|
offb += 4;
|
|
|
|
addr += l;
|
|
|
|
if(l)
|
|
|
|
memcpy(buf + offb, data + offd, l);
|
|
|
|
if (l < stride)
|
|
|
|
memset(buf + offb + l, 0, stride - l);
|
|
|
|
offb += stride;
|
|
|
|
offd += stride;
|
|
|
|
if ((offb >= PAGE_SIZE) || (offd >= size)) {
|
|
|
|
ret = usb_bulk_msg(usb_dev, usb_sndbulkpipe(usb_dev, CXACRU_EP_CMD),
|
|
|
|
buf, offb, NULL, CMD_TIMEOUT);
|
|
|
|
if (ret < 0) {
|
|
|
|
dbg("sending fw %#x failed", fw);
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
offb = 0;
|
|
|
|
}
|
|
|
|
} while(offd < size);
|
|
|
|
dbg("sent fw %#x", fw);
|
|
|
|
|
|
|
|
ret = 0;
|
|
|
|
|
|
|
|
cleanup:
|
|
|
|
free_page((unsigned long) buf);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void cxacru_upload_firmware(struct cxacru_data *instance,
|
|
|
|
const struct firmware *fw,
|
|
|
|
const struct firmware *bp,
|
|
|
|
const struct firmware *cf)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
int off;
|
2006-01-17 05:15:13 -05:00
|
|
|
struct usbatm_data *usbatm = instance->usbatm;
|
|
|
|
struct usb_device *usb_dev = usbatm->usb_dev;
|
2005-05-11 14:19:29 -04:00
|
|
|
u16 signature[] = { usb_dev->descriptor.idVendor, usb_dev->descriptor.idProduct };
|
|
|
|
u32 val;
|
|
|
|
|
|
|
|
dbg("cxacru_upload_firmware");
|
|
|
|
|
|
|
|
/* FirmwarePllFClkValue */
|
|
|
|
val = cpu_to_le32(instance->modem_type->pll_f_clk);
|
|
|
|
ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, PLLFCLK_ADDR, (u8 *) &val, 4);
|
|
|
|
if (ret) {
|
2006-01-17 05:15:13 -05:00
|
|
|
usb_err(usbatm, "FirmwarePllFClkValue failed: %d\n", ret);
|
2005-05-11 14:19:29 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FirmwarePllBClkValue */
|
|
|
|
val = cpu_to_le32(instance->modem_type->pll_b_clk);
|
|
|
|
ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, PLLBCLK_ADDR, (u8 *) &val, 4);
|
|
|
|
if (ret) {
|
2006-01-17 05:15:13 -05:00
|
|
|
usb_err(usbatm, "FirmwarePllBClkValue failed: %d\n", ret);
|
2005-05-11 14:19:29 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Enable SDRAM */
|
|
|
|
val = cpu_to_le32(SDRAM_ENA);
|
|
|
|
ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, SDRAMEN_ADDR, (u8 *) &val, 4);
|
|
|
|
if (ret) {
|
2006-01-17 05:15:13 -05:00
|
|
|
usb_err(usbatm, "Enable SDRAM failed: %d\n", ret);
|
2005-05-11 14:19:29 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Firmware */
|
|
|
|
ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, FW_ADDR, fw->data, fw->size);
|
|
|
|
if (ret) {
|
2006-01-17 05:15:13 -05:00
|
|
|
usb_err(usbatm, "Firmware upload failed: %d\n", ret);
|
2005-05-11 14:19:29 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Boot ROM patch */
|
|
|
|
if (instance->modem_type->boot_rom_patch) {
|
|
|
|
ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, BR_ADDR, bp->data, bp->size);
|
|
|
|
if (ret) {
|
2006-01-17 05:15:13 -05:00
|
|
|
usb_err(usbatm, "Boot ROM patching failed: %d\n", ret);
|
2005-05-11 14:19:29 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Signature */
|
|
|
|
ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, SIG_ADDR, (u8 *) signature, 4);
|
|
|
|
if (ret) {
|
2006-01-17 05:15:13 -05:00
|
|
|
usb_err(usbatm, "Signature storing failed: %d\n", ret);
|
2005-05-11 14:19:29 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (instance->modem_type->boot_rom_patch) {
|
|
|
|
val = cpu_to_le32(BR_ADDR);
|
|
|
|
ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, BR_STACK_ADDR, (u8 *) &val, 4);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ret = cxacru_fw(usb_dev, FW_GOTO_MEM, 0x0, 0x0, FW_ADDR, NULL, 0);
|
|
|
|
}
|
|
|
|
if (ret) {
|
2006-01-17 05:15:13 -05:00
|
|
|
usb_err(usbatm, "Passing control to firmware failed: %d\n", ret);
|
2005-05-11 14:19:29 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Delay to allow firmware to start up. */
|
|
|
|
msleep_interruptible(1000);
|
|
|
|
|
|
|
|
usb_clear_halt(usb_dev, usb_sndbulkpipe(usb_dev, CXACRU_EP_CMD));
|
|
|
|
usb_clear_halt(usb_dev, usb_rcvbulkpipe(usb_dev, CXACRU_EP_CMD));
|
|
|
|
usb_clear_halt(usb_dev, usb_sndbulkpipe(usb_dev, CXACRU_EP_DATA));
|
|
|
|
usb_clear_halt(usb_dev, usb_rcvbulkpipe(usb_dev, CXACRU_EP_DATA));
|
|
|
|
|
|
|
|
ret = cxacru_cm(instance, CM_REQUEST_CARD_GET_STATUS, NULL, 0, NULL, 0);
|
|
|
|
if (ret < 0) {
|
2006-01-17 05:15:13 -05:00
|
|
|
usb_err(usbatm, "modem failed to initialize: %d\n", ret);
|
2005-05-11 14:19:29 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Load config data (le32), doing one packet at a time */
|
|
|
|
if (cf)
|
|
|
|
for (off = 0; off < cf->size / 4; ) {
|
|
|
|
u32 buf[CMD_PACKET_SIZE / 4 - 1];
|
|
|
|
int i, len = min_t(int, cf->size / 4 - off, CMD_PACKET_SIZE / 4 / 2 - 1);
|
|
|
|
buf[0] = cpu_to_le32(len);
|
|
|
|
for (i = 0; i < len; i++, off++) {
|
|
|
|
buf[i * 2 + 1] = cpu_to_le32(off);
|
|
|
|
memcpy(buf + i * 2 + 2, cf->data + off * 4, 4);
|
|
|
|
}
|
|
|
|
ret = cxacru_cm(instance, CM_REQUEST_CARD_DATA_SET,
|
|
|
|
(u8 *) buf, len, NULL, 0);
|
|
|
|
if (ret < 0) {
|
2006-01-17 05:15:13 -05:00
|
|
|
usb_err(usbatm, "load config data failed: %d\n", ret);
|
2005-05-11 14:19:29 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
msleep_interruptible(4000);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int cxacru_find_firmware(struct cxacru_data *instance,
|
|
|
|
char* phase, const struct firmware **fw_p)
|
|
|
|
{
|
2006-01-17 05:15:13 -05:00
|
|
|
struct usbatm_data *usbatm = instance->usbatm;
|
|
|
|
struct device *dev = &usbatm->usb_intf->dev;
|
2005-05-11 14:19:29 -04:00
|
|
|
char buf[16];
|
|
|
|
|
|
|
|
sprintf(buf, "cxacru-%s.bin", phase);
|
|
|
|
dbg("cxacru_find_firmware: looking for %s", buf);
|
|
|
|
|
|
|
|
if (request_firmware(fw_p, buf, dev)) {
|
2006-01-17 05:15:13 -05:00
|
|
|
usb_dbg(usbatm, "no stage %s firmware found\n", phase);
|
2005-05-11 14:19:29 -04:00
|
|
|
return -ENOENT;
|
|
|
|
}
|
|
|
|
|
2006-01-17 05:15:13 -05:00
|
|
|
usb_info(usbatm, "found firmware %s\n", buf);
|
2005-05-11 14:19:29 -04:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int cxacru_heavy_init(struct usbatm_data *usbatm_instance,
|
|
|
|
struct usb_interface *usb_intf)
|
|
|
|
{
|
|
|
|
const struct firmware *fw, *bp, *cf;
|
|
|
|
struct cxacru_data *instance = usbatm_instance->driver_data;
|
|
|
|
|
|
|
|
int ret = cxacru_find_firmware(instance, "fw", &fw);
|
|
|
|
if (ret) {
|
2006-01-17 05:15:13 -05:00
|
|
|
usb_warn(usbatm_instance, "firmware (cxacru-fw.bin) unavailable (system misconfigured?)\n");
|
2005-05-11 14:19:29 -04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (instance->modem_type->boot_rom_patch) {
|
|
|
|
ret = cxacru_find_firmware(instance, "bp", &bp);
|
|
|
|
if (ret) {
|
2006-01-17 05:15:13 -05:00
|
|
|
usb_warn(usbatm_instance, "boot ROM patch (cxacru-bp.bin) unavailable (system misconfigured?)\n");
|
2005-05-11 14:19:29 -04:00
|
|
|
release_firmware(fw);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cxacru_find_firmware(instance, "cf", &cf)) /* optional */
|
|
|
|
cf = NULL;
|
|
|
|
|
|
|
|
cxacru_upload_firmware(instance, fw, bp, cf);
|
|
|
|
|
|
|
|
if (cf)
|
|
|
|
release_firmware(cf);
|
|
|
|
if (instance->modem_type->boot_rom_patch)
|
|
|
|
release_firmware(bp);
|
|
|
|
release_firmware(fw);
|
|
|
|
|
|
|
|
ret = cxacru_card_status(instance);
|
|
|
|
if (ret)
|
|
|
|
dbg("modem initialisation failed");
|
|
|
|
else
|
|
|
|
dbg("done setting up the modem");
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int cxacru_bind(struct usbatm_data *usbatm_instance,
|
2006-01-17 05:16:13 -05:00
|
|
|
struct usb_interface *intf, const struct usb_device_id *id)
|
2005-05-11 14:19:29 -04:00
|
|
|
{
|
|
|
|
struct cxacru_data *instance;
|
|
|
|
struct usb_device *usb_dev = interface_to_usbdev(intf);
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/* instance init */
|
2006-01-13 03:38:22 -05:00
|
|
|
instance = kzalloc(sizeof(*instance), GFP_KERNEL);
|
2005-05-11 14:19:29 -04:00
|
|
|
if (!instance) {
|
|
|
|
dbg("cxacru_bind: no memory for instance data");
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
instance->usbatm = usbatm_instance;
|
|
|
|
instance->modem_type = (struct cxacru_modem_type *) id->driver_info;
|
2007-03-06 05:47:45 -05:00
|
|
|
memset(instance->card_info, 0, sizeof(instance->card_info));
|
2005-05-11 14:19:29 -04:00
|
|
|
|
2007-04-26 03:38:05 -04:00
|
|
|
mutex_init(&instance->poll_state_serialize);
|
|
|
|
instance->poll_state = CXPOLL_STOPPED;
|
|
|
|
instance->line_status = -1;
|
|
|
|
instance->adsl_status = -1;
|
|
|
|
|
|
|
|
mutex_init(&instance->adsl_state_serialize);
|
|
|
|
|
2005-05-11 14:19:29 -04:00
|
|
|
instance->rcv_buf = (u8 *) __get_free_page(GFP_KERNEL);
|
|
|
|
if (!instance->rcv_buf) {
|
|
|
|
dbg("cxacru_bind: no memory for rcv_buf");
|
|
|
|
ret = -ENOMEM;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
instance->snd_buf = (u8 *) __get_free_page(GFP_KERNEL);
|
|
|
|
if (!instance->snd_buf) {
|
|
|
|
dbg("cxacru_bind: no memory for snd_buf");
|
|
|
|
ret = -ENOMEM;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
instance->rcv_urb = usb_alloc_urb(0, GFP_KERNEL);
|
|
|
|
if (!instance->rcv_urb) {
|
|
|
|
dbg("cxacru_bind: no memory for rcv_urb");
|
|
|
|
ret = -ENOMEM;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
instance->snd_urb = usb_alloc_urb(0, GFP_KERNEL);
|
|
|
|
if (!instance->snd_urb) {
|
|
|
|
dbg("cxacru_bind: no memory for snd_urb");
|
|
|
|
ret = -ENOMEM;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
2007-03-06 05:47:45 -05:00
|
|
|
#define CXACRU_DEVICE_CREATE_FILE(_name) \
|
|
|
|
ret = device_create_file(&intf->dev, &dev_attr_##_name); \
|
|
|
|
if (unlikely(ret)) \
|
|
|
|
goto fail_sysfs;
|
|
|
|
CXACRU_ALL_FILES(CREATE);
|
|
|
|
#undef CXACRU_DEVICE_CREATE_FILE
|
|
|
|
|
2005-05-11 14:19:29 -04:00
|
|
|
usb_fill_int_urb(instance->rcv_urb,
|
|
|
|
usb_dev, usb_rcvintpipe(usb_dev, CXACRU_EP_CMD),
|
|
|
|
instance->rcv_buf, PAGE_SIZE,
|
|
|
|
cxacru_blocking_completion, &instance->rcv_done, 1);
|
|
|
|
|
|
|
|
usb_fill_int_urb(instance->snd_urb,
|
|
|
|
usb_dev, usb_sndintpipe(usb_dev, CXACRU_EP_CMD),
|
|
|
|
instance->snd_buf, PAGE_SIZE,
|
|
|
|
cxacru_blocking_completion, &instance->snd_done, 4);
|
|
|
|
|
2006-01-13 09:52:55 -05:00
|
|
|
mutex_init(&instance->cm_serialize);
|
2005-05-11 14:19:29 -04:00
|
|
|
|
2006-11-22 09:57:56 -05:00
|
|
|
INIT_DELAYED_WORK(&instance->poll_work, cxacru_poll_status);
|
2005-05-11 14:19:29 -04:00
|
|
|
|
|
|
|
usbatm_instance->driver_data = instance;
|
|
|
|
|
2006-01-17 05:16:13 -05:00
|
|
|
usbatm_instance->flags = (cxacru_card_status(instance) ? 0 : UDSL_SKIP_HEAVY_INIT);
|
2005-05-11 14:19:29 -04:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
2007-03-06 05:47:45 -05:00
|
|
|
fail_sysfs:
|
|
|
|
dbg("cxacru_bind: device_create_file failed (%d)\n", ret);
|
|
|
|
|
|
|
|
#define CXACRU_DEVICE_REMOVE_FILE(_name) \
|
|
|
|
device_remove_file(&intf->dev, &dev_attr_##_name);
|
|
|
|
CXACRU_ALL_FILES(REMOVE);
|
|
|
|
#undef CXACRU_DEVICE_REVOVE_FILE
|
|
|
|
|
2005-05-11 14:19:29 -04:00
|
|
|
fail:
|
|
|
|
free_page((unsigned long) instance->snd_buf);
|
|
|
|
free_page((unsigned long) instance->rcv_buf);
|
|
|
|
usb_free_urb(instance->snd_urb);
|
|
|
|
usb_free_urb(instance->rcv_urb);
|
|
|
|
kfree(instance);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void cxacru_unbind(struct usbatm_data *usbatm_instance,
|
|
|
|
struct usb_interface *intf)
|
|
|
|
{
|
|
|
|
struct cxacru_data *instance = usbatm_instance->driver_data;
|
2007-04-26 03:38:05 -04:00
|
|
|
int is_polling = 1;
|
2005-05-11 14:19:29 -04:00
|
|
|
|
|
|
|
dbg("cxacru_unbind entered");
|
|
|
|
|
|
|
|
if (!instance) {
|
|
|
|
dbg("cxacru_unbind: NULL instance!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-04-26 03:38:05 -04:00
|
|
|
mutex_lock(&instance->poll_state_serialize);
|
|
|
|
BUG_ON(instance->poll_state == CXPOLL_SHUTDOWN);
|
|
|
|
|
|
|
|
/* ensure that status polling continues unless
|
|
|
|
* it has already stopped */
|
|
|
|
if (instance->poll_state == CXPOLL_STOPPED)
|
|
|
|
is_polling = 0;
|
|
|
|
|
|
|
|
/* stop polling from being stopped or started */
|
|
|
|
instance->poll_state = CXPOLL_SHUTDOWN;
|
|
|
|
mutex_unlock(&instance->poll_state_serialize);
|
|
|
|
|
|
|
|
if (is_polling)
|
|
|
|
cancel_rearming_delayed_work(&instance->poll_work);
|
2005-05-11 14:19:29 -04:00
|
|
|
|
|
|
|
usb_kill_urb(instance->snd_urb);
|
|
|
|
usb_kill_urb(instance->rcv_urb);
|
|
|
|
usb_free_urb(instance->snd_urb);
|
|
|
|
usb_free_urb(instance->rcv_urb);
|
|
|
|
|
|
|
|
free_page((unsigned long) instance->snd_buf);
|
|
|
|
free_page((unsigned long) instance->rcv_buf);
|
2007-03-06 05:47:45 -05:00
|
|
|
|
|
|
|
#define CXACRU_DEVICE_REMOVE_FILE(_name) \
|
|
|
|
device_remove_file(&intf->dev, &dev_attr_##_name);
|
|
|
|
CXACRU_ALL_FILES(REMOVE);
|
|
|
|
#undef CXACRU_DEVICE_REVOVE_FILE
|
|
|
|
|
2005-05-11 14:19:29 -04:00
|
|
|
kfree(instance);
|
|
|
|
|
|
|
|
usbatm_instance->driver_data = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct cxacru_modem_type cxacru_cafe = {
|
|
|
|
.pll_f_clk = 0x02d874df,
|
|
|
|
.pll_b_clk = 0x0196a51a,
|
|
|
|
.boot_rom_patch = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct cxacru_modem_type cxacru_cb00 = {
|
|
|
|
.pll_f_clk = 0x5,
|
|
|
|
.pll_b_clk = 0x3,
|
|
|
|
.boot_rom_patch = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct usb_device_id cxacru_usb_ids[] = {
|
|
|
|
{ /* V = Conexant P = ADSL modem (Euphrates project) */
|
|
|
|
USB_DEVICE(0x0572, 0xcafe), .driver_info = (unsigned long) &cxacru_cafe
|
|
|
|
},
|
|
|
|
{ /* V = Conexant P = ADSL modem (Hasbani project) */
|
|
|
|
USB_DEVICE(0x0572, 0xcb00), .driver_info = (unsigned long) &cxacru_cb00
|
|
|
|
},
|
|
|
|
{ /* V = Conexant P = ADSL modem */
|
|
|
|
USB_DEVICE(0x0572, 0xcb01), .driver_info = (unsigned long) &cxacru_cb00
|
|
|
|
},
|
2006-01-17 05:15:13 -05:00
|
|
|
{ /* V = Conexant P = ADSL modem (Well PTI-800) */
|
|
|
|
USB_DEVICE(0x0572, 0xcb02), .driver_info = (unsigned long) &cxacru_cb00
|
|
|
|
},
|
2005-05-11 14:19:29 -04:00
|
|
|
{ /* V = Conexant P = ADSL modem */
|
|
|
|
USB_DEVICE(0x0572, 0xcb06), .driver_info = (unsigned long) &cxacru_cb00
|
|
|
|
},
|
2006-10-05 05:05:50 -04:00
|
|
|
{ /* V = Conexant P = ADSL modem (ZTE ZXDSL 852) */
|
|
|
|
USB_DEVICE(0x0572, 0xcb07), .driver_info = (unsigned long) &cxacru_cb00
|
|
|
|
},
|
2005-05-11 14:19:29 -04:00
|
|
|
{ /* V = Olitec P = ADSL modem version 2 */
|
|
|
|
USB_DEVICE(0x08e3, 0x0100), .driver_info = (unsigned long) &cxacru_cafe
|
|
|
|
},
|
|
|
|
{ /* V = Olitec P = ADSL modem version 3 */
|
|
|
|
USB_DEVICE(0x08e3, 0x0102), .driver_info = (unsigned long) &cxacru_cb00
|
|
|
|
},
|
|
|
|
{ /* V = Trust/Amigo Technology Co. P = AMX-CA86U */
|
|
|
|
USB_DEVICE(0x0eb0, 0x3457), .driver_info = (unsigned long) &cxacru_cafe
|
|
|
|
},
|
|
|
|
{ /* V = Zoom P = 5510 */
|
|
|
|
USB_DEVICE(0x1803, 0x5510), .driver_info = (unsigned long) &cxacru_cb00
|
|
|
|
},
|
|
|
|
{ /* V = Draytek P = Vigor 318 */
|
|
|
|
USB_DEVICE(0x0675, 0x0200), .driver_info = (unsigned long) &cxacru_cb00
|
|
|
|
},
|
|
|
|
{ /* V = Zyxel P = 630-C1 aka OMNI ADSL USB (Annex A) */
|
|
|
|
USB_DEVICE(0x0586, 0x330a), .driver_info = (unsigned long) &cxacru_cb00
|
|
|
|
},
|
|
|
|
{ /* V = Zyxel P = 630-C3 aka OMNI ADSL USB (Annex B) */
|
|
|
|
USB_DEVICE(0x0586, 0x330b), .driver_info = (unsigned long) &cxacru_cb00
|
|
|
|
},
|
|
|
|
{ /* V = Aethra P = Starmodem UM1020 */
|
|
|
|
USB_DEVICE(0x0659, 0x0020), .driver_info = (unsigned long) &cxacru_cb00
|
|
|
|
},
|
|
|
|
{ /* V = Aztech Systems P = ? AKA Pirelli AUA-010 */
|
|
|
|
USB_DEVICE(0x0509, 0x0812), .driver_info = (unsigned long) &cxacru_cb00
|
|
|
|
},
|
|
|
|
{ /* V = Netopia P = Cayman 3341(Annex A)/3351(Annex B) */
|
|
|
|
USB_DEVICE(0x100d, 0xcb01), .driver_info = (unsigned long) &cxacru_cb00
|
|
|
|
},
|
|
|
|
{ /* V = Netopia P = Cayman 3342(Annex A)/3352(Annex B) */
|
|
|
|
USB_DEVICE(0x100d, 0x3342), .driver_info = (unsigned long) &cxacru_cb00
|
|
|
|
},
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
|
|
|
MODULE_DEVICE_TABLE(usb, cxacru_usb_ids);
|
|
|
|
|
|
|
|
static struct usbatm_driver cxacru_driver = {
|
|
|
|
.driver_name = cxacru_driver_name,
|
|
|
|
.bind = cxacru_bind,
|
|
|
|
.heavy_init = cxacru_heavy_init,
|
|
|
|
.unbind = cxacru_unbind,
|
|
|
|
.atm_start = cxacru_atm_start,
|
2006-01-13 04:59:23 -05:00
|
|
|
.bulk_in = CXACRU_EP_DATA,
|
|
|
|
.bulk_out = CXACRU_EP_DATA,
|
2005-05-11 14:19:29 -04:00
|
|
|
.rx_padding = 3,
|
|
|
|
.tx_padding = 11,
|
|
|
|
};
|
|
|
|
|
|
|
|
static int cxacru_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
|
|
|
|
{
|
|
|
|
return usbatm_usb_probe(intf, id, &cxacru_driver);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct usb_driver cxacru_usb_driver = {
|
|
|
|
.name = cxacru_driver_name,
|
|
|
|
.probe = cxacru_usb_probe,
|
|
|
|
.disconnect = usbatm_usb_disconnect,
|
|
|
|
.id_table = cxacru_usb_ids
|
|
|
|
};
|
|
|
|
|
|
|
|
static int __init cxacru_init(void)
|
|
|
|
{
|
|
|
|
return usb_register(&cxacru_usb_driver);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __exit cxacru_cleanup(void)
|
|
|
|
{
|
|
|
|
usb_deregister(&cxacru_usb_driver);
|
|
|
|
}
|
|
|
|
|
|
|
|
module_init(cxacru_init);
|
|
|
|
module_exit(cxacru_cleanup);
|
|
|
|
|
|
|
|
MODULE_AUTHOR(DRIVER_AUTHOR);
|
|
|
|
MODULE_DESCRIPTION(DRIVER_DESC);
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
MODULE_VERSION(DRIVER_VERSION);
|