Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
cxacru.c File Reference
#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>
#include <linux/device.h>
#include <linux/firmware.h>
#include <linux/mutex.h>
#include <asm/unaligned.h>
#include "usbatm.h"

Go to the source code of this file.

Data Structures

struct  cxacru_modem_type
 
struct  cxacru_data
 

Macros

#define DRIVER_AUTHOR   "Roman Kagan, David Woodhouse, Duncan Sands, Simon Arlott"
 
#define DRIVER_VERSION   "0.4"
 
#define DRIVER_DESC   "Conexant AccessRunner ADSL USB modem driver"
 
#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)? */
 
#define CMD_MAX_CONFIG   ((CMD_PACKET_SIZE / 4 - 1) / 2)
 
#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
 
#define SDRAM_ENA   0x1
 
#define CMD_TIMEOUT   2000 /* msecs */
 
#define POLL_INTERVAL   1 /* secs */
 
#define CXACRU__ATTR_INIT(_name)   static DEVICE_ATTR(_name, S_IRUGO, cxacru_sysfs_show_##_name, NULL)
 
#define CXACRU_CMD_INIT(_name)
 
#define CXACRU_SET_INIT(_name)
 
#define CXACRU_ATTR_INIT(_value, _type, _name)
 
#define CXACRU_ATTR_CREATE(_v, _t, _name)   CXACRU_DEVICE_CREATE_FILE(_name)
 
#define CXACRU_CMD_CREATE(_name)   CXACRU_DEVICE_CREATE_FILE(_name)
 
#define CXACRU_SET_CREATE(_name)   CXACRU_DEVICE_CREATE_FILE(_name)
 
#define CXACRU__ATTR_CREATE(_name)   CXACRU_DEVICE_CREATE_FILE(_name)
 
#define CXACRU_ATTR_REMOVE(_v, _t, _name)   CXACRU_DEVICE_REMOVE_FILE(_name)
 
#define CXACRU_CMD_REMOVE(_name)   CXACRU_DEVICE_REMOVE_FILE(_name)
 
#define CXACRU_SET_REMOVE(_name)   CXACRU_DEVICE_REMOVE_FILE(_name)
 
#define CXACRU__ATTR_REMOVE(_name)   CXACRU_DEVICE_REMOVE_FILE(_name)
 
#define CXACRU_ALL_FILES(_action)
 
#define CXACRU_DEVICE_REMOVE_FILE(_name)   device_remove_file(&intf->dev, &dev_attr_##_name);
 
#define CXACRU_DEVICE_CREATE_FILE(_name)
 

Enumerations

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
}
 
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
}
 
enum  cxacru_cm_flash { CM_FLASH_READ = 0xa1, CM_FLASH_WRITE = 0xa2 }
 
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
}
 
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, CXINF_MAX = 0x1c
}
 
enum  cxacru_poll_state { CXPOLL_STOPPING, CXPOLL_STOPPED, CXPOLL_POLLING, CXPOLL_SHUTDOWN }
 

Functions

 CXACRU_ALL_FILES (INIT)
 
 MODULE_DEVICE_TABLE (usb, cxacru_usb_ids)
 
 module_usb_driver (cxacru_usb_driver)
 
 MODULE_AUTHOR (DRIVER_AUTHOR)
 
 MODULE_DESCRIPTION (DRIVER_DESC)
 
 MODULE_LICENSE ("GPL")
 
 MODULE_VERSION (DRIVER_VERSION)
 

Macro Definition Documentation

#define BR_ADDR   0x00180600

Definition at line 63 of file cxacru.c.

#define BR_STACK_ADDR   0x00187f10

Definition at line 65 of file cxacru.c.

#define CMD_MAX_CONFIG   ((CMD_PACKET_SIZE / 4 - 1) / 2)

Definition at line 56 of file cxacru.c.

#define CMD_PACKET_SIZE   64 /* Should be maxpacket(ep)? */

Definition at line 55 of file cxacru.c.

#define CMD_TIMEOUT   2000 /* msecs */

Definition at line 70 of file cxacru.c.

#define CXACRU__ATTR_CREATE (   _name)    CXACRU_DEVICE_CREATE_FILE(_name)

Definition at line 242 of file cxacru.c.

#define CXACRU__ATTR_INIT (   _name)    static DEVICE_ATTR(_name, S_IRUGO, cxacru_sysfs_show_##_name, NULL)

Definition at line 214 of file cxacru.c.

#define CXACRU__ATTR_REMOVE (   _name)    CXACRU_DEVICE_REMOVE_FILE(_name)

Definition at line 247 of file cxacru.c.

#define CXACRU_ALL_FILES (   _action)
Value:
CXACRU_ATTR_##_action(CXINF_DOWNSTREAM_RATE, u32, downstream_rate); \
CXACRU_ATTR_##_action(CXINF_UPSTREAM_RATE, u32, upstream_rate); \
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); \
CXACRU_ATTR_##_action(CXINF_CONTROLLER_VERSION, u32, adsl_controller_version); \
CXACRU_CMD_##_action( adsl_state); \
CXACRU_SET_##_action( adsl_config);

Definition at line 525 of file cxacru.c.

#define CXACRU_ATTR_CREATE (   _v,
  _t,
  _name 
)    CXACRU_DEVICE_CREATE_FILE(_name)

Definition at line 239 of file cxacru.c.

#define CXACRU_ATTR_INIT (   _value,
  _type,
  _name 
)
Value:
static ssize_t cxacru_sysfs_show_##_name(struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
struct cxacru_data *instance = to_usbatm_driver_data(\
to_usb_interface(dev)); \
if (instance == NULL) \
return -ENODEV; \
\
return cxacru_sysfs_showattr_##_type(instance->card_info[_value], buf); \
} \
CXACRU__ATTR_INIT(_name)

Definition at line 225 of file cxacru.c.

#define CXACRU_ATTR_REMOVE (   _v,
  _t,
  _name 
)    CXACRU_DEVICE_REMOVE_FILE(_name)

Definition at line 244 of file cxacru.c.

#define CXACRU_CMD_CREATE (   _name)    CXACRU_DEVICE_CREATE_FILE(_name)

Definition at line 240 of file cxacru.c.

#define CXACRU_CMD_INIT (   _name)
Value:
static DEVICE_ATTR(_name, S_IWUSR | S_IRUGO, \
cxacru_sysfs_show_##_name, cxacru_sysfs_store_##_name)

Definition at line 217 of file cxacru.c.

#define CXACRU_CMD_REMOVE (   _name)    CXACRU_DEVICE_REMOVE_FILE(_name)

Definition at line 245 of file cxacru.c.

#define CXACRU_DEVICE_CREATE_FILE (   _name)
Value:
ret = device_create_file(&intf->dev, &dev_attr_##_name); \
if (unlikely(ret)) \
goto fail_sysfs;
#define CXACRU_DEVICE_REMOVE_FILE (   _name)    device_remove_file(&intf->dev, &dev_attr_##_name);
#define CXACRU_EP_CMD   0x01 /* Bulk/interrupt in/out */

Definition at line 52 of file cxacru.c.

#define CXACRU_EP_DATA   0x02 /* Bulk in/out */

Definition at line 53 of file cxacru.c.

#define CXACRU_SET_CREATE (   _name)    CXACRU_DEVICE_CREATE_FILE(_name)

Definition at line 241 of file cxacru.c.

#define CXACRU_SET_INIT (   _name)
Value:
static DEVICE_ATTR(_name, S_IWUSR, \
NULL, cxacru_sysfs_store_##_name)

Definition at line 221 of file cxacru.c.

#define CXACRU_SET_REMOVE (   _name)    CXACRU_DEVICE_REMOVE_FILE(_name)

Definition at line 246 of file cxacru.c.

#define DRIVER_AUTHOR   "Roman Kagan, David Woodhouse, Duncan Sands, Simon Arlott"

Definition at line 46 of file cxacru.c.

#define DRIVER_DESC   "Conexant AccessRunner ADSL USB modem driver"

Definition at line 48 of file cxacru.c.

#define DRIVER_VERSION   "0.4"

Definition at line 47 of file cxacru.c.

#define FW_ADDR   0x00801000

Definition at line 62 of file cxacru.c.

#define PLLBCLK_ADDR   0x0035006c

Definition at line 60 of file cxacru.c.

#define PLLFCLK_ADDR   0x00350068

Definition at line 59 of file cxacru.c.

#define POLL_INTERVAL   1 /* secs */

Definition at line 71 of file cxacru.c.

#define SDRAM_ENA   0x1

Definition at line 68 of file cxacru.c.

#define SDRAMEN_ADDR   0x00350010

Definition at line 61 of file cxacru.c.

#define SIG_ADDR   0x00180500

Definition at line 64 of file cxacru.c.

Enumeration Type Documentation

Enumerator:
CM_FLASH_READ 
CM_FLASH_WRITE 

Definition at line 125 of file cxacru.c.

Enumerator:
CM_REQUEST_UNDEFINED 
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 

Definition at line 87 of file cxacru.c.

Enumerator:
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 

Definition at line 131 of file cxacru.c.

Enumerator:
FW_CMD_ERR 
FW_GET_VER 
FW_READ_MEM 
FW_WRITE_MEM 
FW_RMW_MEM 
FW_CHECKSUM_MEM 
FW_GOTO_MEM 

Definition at line 75 of file cxacru.c.

Enumerator:
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 
CXINF_MAX 

Definition at line 143 of file cxacru.c.

Enumerator:
CXPOLL_STOPPING 
CXPOLL_STOPPED 
CXPOLL_POLLING 
CXPOLL_SHUTDOWN 

Definition at line 173 of file cxacru.c.

Function Documentation

CXACRU_ALL_FILES ( INIT  )
MODULE_AUTHOR ( DRIVER_AUTHOR  )
MODULE_DESCRIPTION ( DRIVER_DESC  )
MODULE_DEVICE_TABLE ( usb  ,
cxacru_usb_ids   
)
MODULE_LICENSE ( "GPL"  )
module_usb_driver ( cxacru_usb_driver  )
MODULE_VERSION ( DRIVER_VERSION  )