/* -*- c-basic-offset: 2 -*- vim:noet:sw=2 */ #ifndef USBXDSL_H #define USBXDSL_H /* Definitions for the 'xdslusb' and 'cxacru' drivers and the programs that want to use them. Copyright 2003 Josep Comas and contributors. 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. */ /* Chipset values */ /* FCLK/BCLK */ #define PLL_FAST_144MHZ_RM 0x00000005 #define PLL_FAST_100MHZ_RM 0x00000003 /* Divide by 3, F=144Mhz, U=72Mhz */ #define PLL_FAST_144MHZ 0x02D874DF /* Divide by 4, B=100Mhz, P=50Mhz */ #define PLL_FAST_100MHZ 0x0196a51a /* Patch and boot possibilities */ #define CXPATCH 1 #define CXJUMP 2 /* ARM940T registers */ /* FCLK PLL Register */ #define ARM_PLL_F 0x00350068 /* BCLK PLL Register */ #define ARM_PLL_B 0x0035006c /* Ext. Memory Control Register */ #define ARM_EMCR 0x00350010 #define SDRAM_ENABLE 0x00000001 /* P52 */ #define BR_ADDRESS 0x00180600 #define WB_SIGN_ADDRESS 0x00180500 #define BR_STACK_ADDRESS 0x00187f10 #define FW_ADDRESS 0x00801000 /* Modem commands */ #define CMD_USB_CMD_ERR 0x00 #define CMD_USB_GET_VER 0x01 #define CMD_USB_READ_MEM 0x02 #define CMD_USB_WRITE_MEM 0x03 #define CMD_USB_RMW_MEM 0x04 #define CMD_USB_CHECKSUM_MEM 0x05 #define CMD_USB_GOTO_MEM 0x06 #define FIRST_CMD 0x80 #define CMD_CHIP_ADSL_LINE_START 0x84 #define CMD_CHIP_ADSL_LINE_STOP 0x85 #define CMD_CARD_INFO_GET 0x88 #define CMD_CARD_DATA_GET 0x89 #define CMD_CARD_DATA_SET 0x8a #define CMD_CARD_SERIAL_DATA_PATH_GET 0x8d #define CMD_CARD_SERIAL_DATA_PATH_SET 0x8e #define CMD_CARD_CONTROLLER_VERSION_GET 0x8f #define CMD_CARD_GET_STATUS 0x90 #define CMD_CARD_GET_MAC_ADDRESS 0x91 #define CMD_CARD_GET_DATA_LINK_STATUS 0x92 #define REPLY_CMD 1 #define ONE_ANSWER 1 #define FOUR_ANSWERS 4 /* USB timeouts and retries */ /* Timeout (ms) for in/out data packets */ #define DATA_TIMEOUT 5000 /* Timeout (ms) for in/out control packets */ #define CTRL_TIMEOUT 1000 /* We get timeout then add additional time */ #define TIMEOUT_ADD 1000 /* Seconds to wait until ADSL line is up */ #define MAX_WAIT_LINE_UP 90 /* Max retries when you send a bulk packet */ #define SEND_BULK_RETRIES 4 /* Max retries when you wait a bulk packet */ #define READ_BULK_RETRIES 4 /* Max retries when you transfer a control message */ #define CTRL_MSG_RETRIES 4 /* USB errors */ /* When we receive a STALL */ #define EPIPE 32 /* When we receive a NAK */ #define ETIMEDOUT 110 /* Messages */ /* Access tyes */ #define MA_BYTE 0 #define MA_WORD 1 #define MA_DWORD 2 /* Max bytes in a message */ #define MAX_MESSAGE_SIZE 64 /* Max data bytes in a message */ #define MAX_DATA_MESSAGE_SIZE 56 /* Max bytes can transfer through USB bus */ #define MAX_DATA_TRANSFER 4096 /* Size of a value */ #define SIZE_VALUE 4 /* USB input and ouput address against modem */ /* IN endpoint address, receive info */ #define USB_IN_INFO 0x81 /* OUT endpoint address, ask info, send firmware */ #define USB_OUT_INFO 0x01 /* IN/OUT endpoint address, receive/send ATM cells */ #define USB_IN_DATA 0x82 #define USB_OUT_DATA 0x02 /* Id of content in a packet that is a reply to 'CMD_CARD_INFO_GET': */ #define INFO_BITRATE_DOWN 0x00 #define INFO_BITRATE_UP 0x01 #define INFO_LINK_STATUS 0x02 #define INFO_LINE_STATUS 0x03 #define INFO_MAC_5TO6 0x04 #define INFO_MAC_1TO4 0x05 #define INFO_CURRENT_MODE 0x15 #define PARAM_OPEN_MODE 0x0a /* Link status */ #define LINK_STATUS_NOT_CONNECTED 1 #define LINK_STATUS_CONNECTED 2 #define LINK_STATUS_LOST 3 /* Line status A possible sequence: 0 -> 1 -> 7 -> 1 -> 2 -> 1 -> 2 -> 3 -> 5 */ #define LINE_STATUS_DOWN 0 #define LINE_STATUS_ATTEMPTING_TO_ACTIVATE 1 #define LINE_STATUS_TRAINING 2 #define LINE_STATUS_CHANNEL_ANALYSIS 3 #define LINE_STATUS_EXCHANGE 4 #define LINE_STATUS_UP 5 #define LINE_STATUS_WAITING 6 #define LINE_STATUS_INITIALIZING 7 /* ADSL open mode. */ #define ADSL_OPEN_AUTO1 0 /* Auto, G.Handshake pref. */ #define ADSL_OPEN_AUTO2 1 /* Auto, T1.413 pref.*/ #define ADSL_OPEN_HAND 2 /* G.Handshake only */ #define ADSL_OPEN_ANSI 3 /* T1.413 only */ #define ADSL_OPEN_GDMT 4 /* G.HS, G.DMT only */ #define ADSL_OPEN_GLITE 5 /* G.HS, G.Lite only */ #define ADSL_OPEN_UNKNOWN 6 /* ADSL protocols. */ #define ADSL_ANSI 1 #define ADSL_GDMT 2 #define ADSL_GLITE 3 /* USBDEVFS IOCTL for the 'xdslusb' or cxacru' drivers. */ #define USBDEVFS_IOCTL _IOWR('U', 18, struct udsl_req) /* Arguments for the 'ioctl' call to the driver. */ struct udsl_req { int ifno; /* Interface # */ int command; void *data; }; /* Data returned in response to a status query. */ struct udsl_info { /* Versions */ unsigned char mod_major; unsigned char mod_minor; unsigned char mod_release; unsigned char mod_speed; /* 'speed' argument */ int hard_version; /* controller version */ char firm_version[5]; /* firmware version */ unsigned char mac[6]; /* MAC address */ /* Trasmission statistics and configuration */ unsigned int atm_cell_tx; unsigned int atm_cell_rx; unsigned int oam_loopback; short vpi; int vci; /* Current status */ int link_status; int line_status; unsigned int open_mode; unsigned int operational_mode; /* Current modulation */ unsigned int data_path; unsigned int startup_attempts; unsigned int line_startable; unsigned int link_lost; int down_bitrate; int up_bitrate; unsigned int adsl_headend; unsigned int adsl_headend_env; /* Advanced */ unsigned char extended_info; int up_snr_margin; int down_snr_margin; unsigned int up_attenuation; unsigned int down_attenuation; int transmitter_power; unsigned int up_bits_frame; unsigned int down_bits_frame; unsigned int up_crc_errors; unsigned int down_crc_errors; unsigned int up_fec_errors; unsigned int down_fec_errors; unsigned int up_hec_errors; unsigned int down_hec_errors; } udsl_modem_info_t; /* Command codes for the 'ioctl'. */ #define USBXDSL_CMD_START 1 #define USBXDSL_CMD_STOP 2 #define USBXDSL_CMD_INFO _IOWR('U',3, \ struct udsl_info) #define USBXDSL_CMD_ADSL_LINE_START 4 #define USBXDSL_CMD_ADSL_LINE_STOP 5 #define USBXDSL_CMD_START_EXTENDED_INFO 6 #define USBXDSL_CMD_STOP_EXTENDED_INFO 7 #define USBXDSL_CMD_CLEAR_COUNTERS 8 #endif