Linux 4.16.11
[linux/fpc-iii.git] / drivers / net / wireless / marvell / libertas / if_usb.h
blob8dc14bec3e161b2941b882fa11ec4ce16850e9a8
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LBS_IF_USB_H
3 #define _LBS_IF_USB_H
5 #include <linux/wait.h>
6 #include <linux/timer.h>
8 struct lbs_private;
11 * This file contains definition for USB interface.
13 #define CMD_TYPE_REQUEST 0xF00DFACE
14 #define CMD_TYPE_DATA 0xBEADC0DE
15 #define CMD_TYPE_INDICATION 0xBEEFFACE
17 #define IPFIELD_ALIGN_OFFSET 2
19 #define BOOT_CMD_FW_BY_USB 0x01
20 #define BOOT_CMD_FW_IN_EEPROM 0x02
21 #define BOOT_CMD_UPDATE_BOOT2 0x03
22 #define BOOT_CMD_UPDATE_FW 0x04
23 #define BOOT_CMD_MAGIC_NUMBER 0x4C56524D /* LVRM */
25 struct bootcmd
27 __le32 magic;
28 uint8_t cmd;
29 uint8_t pad[11];
32 #define BOOT_CMD_RESP_OK 0x0001
33 #define BOOT_CMD_RESP_FAIL 0x0000
34 #define BOOT_CMD_RESP_NOT_SUPPORTED 0x0002
36 struct bootcmdresp
38 __le32 magic;
39 uint8_t cmd;
40 uint8_t result;
41 uint8_t pad[2];
44 /* USB card description structure*/
45 struct if_usb_card {
46 struct usb_device *udev;
47 uint32_t model; /* MODEL_* */
48 struct urb *rx_urb, *tx_urb;
49 struct lbs_private *priv;
51 struct sk_buff *rx_skb;
53 uint8_t ep_in;
54 uint8_t ep_out;
56 /* bootcmdresp == 0 means command is pending
57 * bootcmdresp < 0 means error
58 * bootcmdresp > 0 is a BOOT_CMD_RESP_* from firmware
60 int8_t bootcmdresp;
62 int ep_in_size;
64 void *ep_out_buf;
65 int ep_out_size;
67 const struct firmware *fw;
68 struct timer_list fw_timeout;
69 wait_queue_head_t fw_wq;
70 uint32_t fwseqnum;
71 uint32_t totalbytes;
72 uint32_t fwlastblksent;
73 uint8_t CRC_OK;
74 uint8_t fwdnldover;
75 uint8_t fwfinalblk;
76 uint8_t surprise_removed;
78 __le16 boot2_version;
81 /* fwheader */
82 struct fwheader {
83 __le32 dnldcmd;
84 __le32 baseaddr;
85 __le32 datalength;
86 __le32 CRC;
89 #define FW_MAX_DATA_BLK_SIZE 600
90 /* FWData */
91 struct fwdata {
92 struct fwheader hdr;
93 __le32 seqnum;
94 uint8_t data[0];
97 /* fwsyncheader */
98 struct fwsyncheader {
99 __le32 cmd;
100 __le32 seqnum;
103 #define FW_HAS_DATA_TO_RECV 0x00000001
104 #define FW_HAS_LAST_BLOCK 0x00000004
107 #endif