2007-11-15 18:05:47 -05:00
|
|
|
#ifndef _LBS_IF_USB_H
|
|
|
|
#define _LBS_IF_USB_H
|
2007-05-25 12:41:52 -04:00
|
|
|
|
2007-12-11 00:07:58 -05:00
|
|
|
#include <linux/wait.h>
|
|
|
|
#include <linux/timer.h>
|
|
|
|
|
2007-12-11 12:53:43 -05:00
|
|
|
struct lbs_private;
|
|
|
|
|
2007-02-10 09:25:27 -05:00
|
|
|
/**
|
|
|
|
* This file contains definition for USB interface.
|
|
|
|
*/
|
2007-12-14 00:47:05 -05:00
|
|
|
#define CMD_TYPE_REQUEST 0xF00DFACE
|
|
|
|
#define CMD_TYPE_DATA 0xBEADC0DE
|
|
|
|
#define CMD_TYPE_INDICATION 0xBEEFFACE
|
2007-02-10 09:25:27 -05:00
|
|
|
|
2007-12-14 00:47:05 -05:00
|
|
|
#define IPFIELD_ALIGN_OFFSET 2
|
2007-02-10 09:25:27 -05:00
|
|
|
|
2007-12-14 00:47:05 -05:00
|
|
|
#define BOOT_CMD_FW_BY_USB 0x01
|
|
|
|
#define BOOT_CMD_FW_IN_EEPROM 0x02
|
|
|
|
#define BOOT_CMD_UPDATE_BOOT2 0x03
|
|
|
|
#define BOOT_CMD_UPDATE_FW 0x04
|
|
|
|
#define BOOT_CMD_MAGIC_NUMBER 0x4C56524D /* LVRM */
|
2007-02-10 09:25:27 -05:00
|
|
|
|
2007-12-14 00:47:05 -05:00
|
|
|
struct bootcmd
|
2007-02-10 09:25:27 -05:00
|
|
|
{
|
2007-12-14 00:47:05 -05:00
|
|
|
__le32 magic;
|
|
|
|
uint8_t cmd;
|
|
|
|
uint8_t pad[11];
|
2007-02-10 09:25:27 -05:00
|
|
|
};
|
|
|
|
|
2007-12-14 00:47:05 -05:00
|
|
|
#define BOOT_CMD_RESP_OK 0x0001
|
|
|
|
#define BOOT_CMD_RESP_FAIL 0x0000
|
2007-02-10 09:25:27 -05:00
|
|
|
|
2007-12-14 00:47:05 -05:00
|
|
|
struct bootcmdresp
|
2007-02-10 09:25:27 -05:00
|
|
|
{
|
2007-12-14 00:47:05 -05:00
|
|
|
__le32 magic;
|
|
|
|
uint8_t cmd;
|
|
|
|
uint8_t result;
|
|
|
|
uint8_t pad[2];
|
2007-02-10 09:25:27 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
/** USB card description structure*/
|
2007-12-14 00:47:05 -05:00
|
|
|
struct if_usb_card {
|
2007-02-10 09:25:27 -05:00
|
|
|
struct usb_device *udev;
|
|
|
|
struct urb *rx_urb, *tx_urb;
|
2007-12-11 12:53:43 -05:00
|
|
|
struct lbs_private *priv;
|
2007-02-10 09:25:27 -05:00
|
|
|
|
2007-12-14 00:47:05 -05:00
|
|
|
struct sk_buff *rx_skb;
|
|
|
|
uint32_t usb_event_cause;
|
|
|
|
uint8_t usb_int_cause;
|
|
|
|
|
|
|
|
uint8_t ep_in;
|
|
|
|
uint8_t ep_out;
|
2007-02-10 09:25:27 -05:00
|
|
|
|
2007-12-14 00:47:05 -05:00
|
|
|
int8_t bootcmdresp;
|
|
|
|
|
|
|
|
int ep_in_size;
|
|
|
|
|
|
|
|
void *ep_out_buf;
|
|
|
|
int ep_out_size;
|
2007-02-10 09:25:27 -05:00
|
|
|
|
2007-08-20 11:43:25 -04:00
|
|
|
const struct firmware *fw;
|
2007-12-11 00:07:58 -05:00
|
|
|
struct timer_list fw_timeout;
|
|
|
|
wait_queue_head_t fw_wq;
|
2007-12-14 00:47:05 -05:00
|
|
|
uint32_t fwseqnum;
|
|
|
|
uint32_t totalbytes;
|
|
|
|
uint32_t fwlastblksent;
|
|
|
|
uint8_t CRC_OK;
|
|
|
|
uint8_t fwdnldover;
|
|
|
|
uint8_t fwfinalblk;
|
|
|
|
uint8_t surprise_removed;
|
|
|
|
|
2008-01-16 09:52:58 -05:00
|
|
|
__le16 boot2_version;
|
2007-02-10 09:25:27 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
/** fwheader */
|
|
|
|
struct fwheader {
|
2007-05-25 23:36:54 -04:00
|
|
|
__le32 dnldcmd;
|
|
|
|
__le32 baseaddr;
|
|
|
|
__le32 datalength;
|
|
|
|
__le32 CRC;
|
2007-02-10 09:25:27 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#define FW_MAX_DATA_BLK_SIZE 600
|
|
|
|
/** FWData */
|
2007-12-14 00:47:05 -05:00
|
|
|
struct fwdata {
|
|
|
|
struct fwheader hdr;
|
2007-05-25 23:36:54 -04:00
|
|
|
__le32 seqnum;
|
2007-12-14 00:47:05 -05:00
|
|
|
uint8_t data[0];
|
2007-02-10 09:25:27 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
/** fwsyncheader */
|
|
|
|
struct fwsyncheader {
|
2007-05-25 23:36:54 -04:00
|
|
|
__le32 cmd;
|
|
|
|
__le32 seqnum;
|
2007-02-10 09:25:27 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#define FW_HAS_DATA_TO_RECV 0x00000001
|
|
|
|
#define FW_HAS_LAST_BLOCK 0x00000004
|
|
|
|
|
|
|
|
|
2007-05-25 12:41:52 -04:00
|
|
|
#endif
|