]> git.ipfire.org Git - thirdparty/kernel/linux.git/blame - drivers/net/wireless/marvell/libertas/if_usb.h
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[thirdparty/kernel/linux.git] / drivers / net / wireless / marvell / libertas / if_usb.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
10078321
HS
2#ifndef _LBS_IF_USB_H
3#define _LBS_IF_USB_H
435a1acb 4
4f82f5c8
DW
5#include <linux/wait.h>
6#include <linux/timer.h>
7
6bc822b5
DW
8struct lbs_private;
9
8973a6e7
RD
10/*
11 * This file contains definition for USB interface.
12 */
eae86bf3
DW
13#define CMD_TYPE_REQUEST 0xF00DFACE
14#define CMD_TYPE_DATA 0xBEADC0DE
15#define CMD_TYPE_INDICATION 0xBEEFFACE
876c9d3a 16
eae86bf3 17#define IPFIELD_ALIGN_OFFSET 2
876c9d3a 18
eae86bf3
DW
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 */
876c9d3a 24
eae86bf3 25struct bootcmd
876c9d3a 26{
eae86bf3
DW
27 __le32 magic;
28 uint8_t cmd;
29 uint8_t pad[11];
876c9d3a
MT
30};
31
eae86bf3
DW
32#define BOOT_CMD_RESP_OK 0x0001
33#define BOOT_CMD_RESP_FAIL 0x0000
1556c0f2 34#define BOOT_CMD_RESP_NOT_SUPPORTED 0x0002
876c9d3a 35
eae86bf3 36struct bootcmdresp
876c9d3a 37{
eae86bf3
DW
38 __le32 magic;
39 uint8_t cmd;
40 uint8_t result;
41 uint8_t pad[2];
876c9d3a
MT
42};
43
8973a6e7 44/* USB card description structure*/
eae86bf3 45struct if_usb_card {
876c9d3a 46 struct usb_device *udev;
5cddea81 47 uint32_t model; /* MODEL_* */
876c9d3a 48 struct urb *rx_urb, *tx_urb;
6bc822b5 49 struct lbs_private *priv;
876c9d3a 50
eae86bf3 51 struct sk_buff *rx_skb;
eae86bf3
DW
52
53 uint8_t ep_in;
54 uint8_t ep_out;
876c9d3a 55
1556c0f2
BC
56 /* bootcmdresp == 0 means command is pending
57 * bootcmdresp < 0 means error
58 * bootcmdresp > 0 is a BOOT_CMD_RESP_* from firmware
59 */
eae86bf3
DW
60 int8_t bootcmdresp;
61
62 int ep_in_size;
63
64 void *ep_out_buf;
65 int ep_out_size;
876c9d3a 66
954ee164 67 const struct firmware *fw;
4f82f5c8
DW
68 struct timer_list fw_timeout;
69 wait_queue_head_t fw_wq;
eae86bf3
DW
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;
77
4365929d 78 __le16 boot2_version;
876c9d3a
MT
79};
80
8973a6e7 81/* fwheader */
876c9d3a 82struct fwheader {
981f187b
DW
83 __le32 dnldcmd;
84 __le32 baseaddr;
85 __le32 datalength;
86 __le32 CRC;
876c9d3a
MT
87};
88
89#define FW_MAX_DATA_BLK_SIZE 600
8973a6e7 90/* FWData */
eae86bf3
DW
91struct fwdata {
92 struct fwheader hdr;
981f187b 93 __le32 seqnum;
eae86bf3 94 uint8_t data[0];
876c9d3a
MT
95};
96
8973a6e7 97/* fwsyncheader */
876c9d3a 98struct fwsyncheader {
981f187b
DW
99 __le32 cmd;
100 __le32 seqnum;
876c9d3a
MT
101};
102
103#define FW_HAS_DATA_TO_RECV 0x00000001
104#define FW_HAS_LAST_BLOCK 0x00000004
105
876c9d3a 106
435a1acb 107#endif