Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  *  Copyright (C) 2008, cozybit Inc.
0004  *  Copyright (C) 2003-2006, Marvell International Ltd.
0005  */
0006 #include <linux/wait.h>
0007 #include <linux/timer.h>
0008 
0009 struct lbtf_private;
0010 
0011 /**
0012   * This file contains definition for USB interface.
0013   */
0014 #define CMD_TYPE_REQUEST        0xF00DFACE
0015 #define CMD_TYPE_DATA           0xBEADC0DE
0016 #define CMD_TYPE_INDICATION     0xBEEFFACE
0017 
0018 #define BOOT_CMD_FW_BY_USB      0x01
0019 #define BOOT_CMD_FW_IN_EEPROM       0x02
0020 #define BOOT_CMD_UPDATE_BOOT2       0x03
0021 #define BOOT_CMD_UPDATE_FW      0x04
0022 #define BOOT_CMD_MAGIC_NUMBER       0x4C56524D   /* LVRM */
0023 
0024 struct bootcmd {
0025     __le32  magic;
0026     uint8_t cmd;
0027     uint8_t pad[11];
0028 };
0029 
0030 #define BOOT_CMD_RESP_OK        0x0001
0031 #define BOOT_CMD_RESP_FAIL      0x0000
0032 
0033 struct bootcmdresp {
0034     __le32  magic;
0035     uint8_t cmd;
0036     uint8_t result;
0037     uint8_t pad[2];
0038 };
0039 
0040 /** USB card description structure*/
0041 struct if_usb_card {
0042     struct usb_device *udev;
0043     struct urb *rx_urb, *tx_urb, *cmd_urb;
0044     struct lbtf_private *priv;
0045 
0046     struct sk_buff *rx_skb;
0047 
0048     uint8_t ep_in;
0049     uint8_t ep_out;
0050 
0051     int8_t bootcmdresp;
0052 
0053     int ep_in_size;
0054 
0055     void *ep_out_buf;
0056     int ep_out_size;
0057 
0058     const struct firmware *fw;
0059     struct timer_list fw_timeout;
0060     wait_queue_head_t fw_wq;
0061     uint32_t fwseqnum;
0062     uint32_t totalbytes;
0063     uint32_t fwlastblksent;
0064     uint8_t CRC_OK;
0065     uint8_t fwdnldover;
0066     uint8_t fwfinalblk;
0067 
0068     __le16 boot2_version;
0069 };
0070 
0071 /** fwheader */
0072 struct fwheader {
0073     __le32 dnldcmd;
0074     __le32 baseaddr;
0075     __le32 datalength;
0076     __le32 CRC;
0077 };
0078 
0079 #define FW_MAX_DATA_BLK_SIZE    600
0080 /** FWData */
0081 struct fwdata {
0082     struct fwheader hdr;
0083     __le32 seqnum;
0084     uint8_t data[];
0085 };
0086 
0087 /** fwsyncheader */
0088 struct fwsyncheader {
0089     __le32 cmd;
0090     __le32 seqnum;
0091 };
0092 
0093 #define FW_HAS_DATA_TO_RECV     0x00000001
0094 #define FW_HAS_LAST_BLOCK       0x00000004