Debian Codegraph @

drivers/net/wireless/marvell/libertas/if_usb.h

raw
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LBS_IF_USB_H
3 #define _LBS_IF_USB_H
4
5 #include <linux/wait.h>
6 #include <linux/timer.h>
7
8 struct lbs_private;
9
10 /*
11 * This file contains definition for USB interface.
12 */
13 #define CMD_TYPE_REQUEST 0xF00DFACE
14 #define CMD_TYPE_DATA 0xBEADC0DE
15 #define CMD_TYPE_INDICATION 0xBEEFFACE
16
17 #define IPFIELD_ALIGN_OFFSET 2
18
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 */
24
25 struct bootcmd
26 {
27 __le32 magic;
28 uint8_t cmd;
29 uint8_t pad[11];
30 };
31
32 #define BOOT_CMD_RESP_OK 0x0001
33 #define BOOT_CMD_RESP_FAIL 0x0000
34 #define BOOT_CMD_RESP_NOT_SUPPORTED 0x0002
35
36 struct bootcmdresp
37 {
38 __le32 magic;
39 uint8_t cmd;
40 uint8_t result;
41 uint8_t pad[2];
42 };
43
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;
50
51 struct usb_anchor rx_submitted;
52 struct usb_anchor tx_submitted;
53
54 struct sk_buff *rx_skb;
55
56 uint8_t ep_in;
57 uint8_t ep_out;
58
59 /* bootcmdresp == 0 means command is pending
60 * bootcmdresp < 0 means error
61 * bootcmdresp > 0 is a BOOT_CMD_RESP_* from firmware
62 */
63 int8_t bootcmdresp;
64
65 int ep_in_size;
66
67 void *ep_out_buf;
68 int ep_out_size;
69
70 const struct firmware *fw;
71 struct timer_list fw_timeout;
72 wait_queue_head_t fw_wq;
73 uint32_t fwseqnum;
74 uint32_t totalbytes;
75 uint32_t fwlastblksent;
76 uint8_t CRC_OK;
77 uint8_t fwdnldover;
78 uint8_t fwfinalblk;
79 uint8_t surprise_removed;
80
81 __le16 boot2_version;
82 };
83
84 /* fwheader */
85 struct fwheader {
86 __le32 dnldcmd;
87 __le32 baseaddr;
88 __le32 datalength;
89 __le32 CRC;
90 };
91
92 #define FW_MAX_DATA_BLK_SIZE 600
93 /* FWData */
94 struct fwdata {
95 struct fwheader hdr;
96 __le32 seqnum;
97 uint8_t data[];
98 };
99
100 /* fwsyncheader */
101 struct fwsyncheader {
102 __le32 cmd;
103 __le32 seqnum;
104 };
105
106 #define FW_HAS_DATA_TO_RECV 0x00000001
107 #define FW_HAS_LAST_BLOCK 0x00000004
108
109
110 #endif