treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_391.RULE
[linux-2.6-block.git] / drivers / net / wireless / marvell / mwifiex / usb.h
CommitLineData
828c91f7 1/* SPDX-License-Identifier: GPL-2.0-only */
4daffe35
AK
2/*
3 * This file contains definitions for mwifiex USB interface driver.
4 *
932183aa 5 * Copyright 2011-2020 NXP
4daffe35
AK
6 */
7
8#ifndef _MWIFIEX_USB_H
9#define _MWIFIEX_USB_H
10
4a79aa17 11#include <linux/completion.h>
4daffe35
AK
12#include <linux/usb.h>
13
68458ded
YAP
14#define USB8XXX_VID 0x1286
15
9e6f3f47
KE
16#define USB8766_PID_1 0x2041
17#define USB8766_PID_2 0x2042
4daffe35
AK
18#define USB8797_PID_1 0x2043
19#define USB8797_PID_2 0x2044
eaa3d9fa
YAP
20#define USB8801_PID_1 0x2049
21#define USB8801_PID_2 0x204a
ce03966a 22#define USB8997_PID_1 0x2052
6d85ef00 23#define USB8997_PID_2 0x204e
eaa3d9fa 24
4daffe35 25
68458ded
YAP
26#define USB8XXX_FW_DNLD 1
27#define USB8XXX_FW_READY 2
28#define USB8XXX_FW_MAX_RETRY 3
4daffe35 29
308fe29e 30#define MWIFIEX_TX_DATA_PORT 2
4daffe35
AK
31#define MWIFIEX_TX_DATA_URB 6
32#define MWIFIEX_RX_DATA_URB 6
33#define MWIFIEX_USB_TIMEOUT 100
34
9e6f3f47 35#define USB8766_DEFAULT_FW_NAME "mrvl/usb8766_uapsta.bin"
4daffe35 36#define USB8797_DEFAULT_FW_NAME "mrvl/usb8797_uapsta.bin"
eaa3d9fa 37#define USB8801_DEFAULT_FW_NAME "mrvl/usb8801_uapsta.bin"
b7450e24 38#define USB8997_DEFAULT_FW_NAME "mrvl/usbusb8997_combo_v4.bin"
4daffe35
AK
39
40#define FW_DNLD_TX_BUF_SIZE 620
41#define FW_DNLD_RX_BUF_SIZE 2048
42#define FW_HAS_LAST_BLOCK 0x00000004
78776467 43#define FW_CMD_7 0x00000007
4daffe35
AK
44
45#define FW_DATA_XMIT_SIZE \
46 (sizeof(struct fw_header) + dlen + sizeof(u32))
47
48struct urb_context {
49 struct mwifiex_adapter *adapter;
50 struct sk_buff *skb;
51 struct urb *urb;
52 u8 ep;
53};
54
a2ca85ad
XH
55#define MWIFIEX_USB_TX_AGGR_TMO_MIN 1
56#define MWIFIEX_USB_TX_AGGR_TMO_MAX 4
57
58struct tx_aggr_tmr_cnxt {
59 struct mwifiex_adapter *adapter;
60 struct usb_tx_data_port *port;
61 struct timer_list hold_timer;
62 bool is_hold_timer_set;
63 u32 hold_tmo_msecs;
64};
65
c5994293
XH
66struct usb_tx_aggr {
67 struct sk_buff_head aggr_list;
68 int aggr_len;
69 int aggr_num;
a2ca85ad 70 struct tx_aggr_tmr_cnxt timer_cnxt;
c5994293
XH
71};
72
308fe29e
ZL
73struct usb_tx_data_port {
74 u8 tx_data_ep;
7e4e5d2c 75 u8 block_status;
308fe29e
ZL
76 atomic_t tx_data_urb_pending;
77 int tx_data_ix;
78 struct urb_context tx_data_list[MWIFIEX_TX_DATA_URB];
c5994293
XH
79 /* usb tx aggregation*/
80 struct usb_tx_aggr tx_aggr;
81 struct sk_buff *skb_aggr[MWIFIEX_TX_DATA_URB];
a2ca85ad
XH
82 /* lock for protect tx aggregation data path*/
83 spinlock_t tx_aggr_lock;
308fe29e
ZL
84};
85
4daffe35
AK
86struct usb_card_rec {
87 struct mwifiex_adapter *adapter;
88 struct usb_device *udev;
89 struct usb_interface *intf;
4a79aa17 90 struct completion fw_done;
4daffe35
AK
91 u8 rx_cmd_ep;
92 struct urb_context rx_cmd;
93 atomic_t rx_cmd_urb_pending;
94 struct urb_context rx_data_list[MWIFIEX_RX_DATA_URB];
95 u8 usb_boot_state;
96 u8 rx_data_ep;
97 atomic_t rx_data_urb_pending;
4daffe35 98 u8 tx_cmd_ep;
4daffe35
AK
99 atomic_t tx_cmd_urb_pending;
100 int bulk_out_maxpktsize;
101 struct urb_context tx_cmd;
7e4e5d2c 102 u8 mc_resync_flag;
308fe29e 103 struct usb_tx_data_port port[MWIFIEX_TX_DATA_PORT];
182f5696
GB
104 int rx_cmd_ep_type;
105 u8 rx_cmd_interval;
106 int tx_cmd_ep_type;
107 u8 tx_cmd_interval;
4daffe35
AK
108};
109
110struct fw_header {
111 __le32 dnld_cmd;
112 __le32 base_addr;
113 __le32 data_len;
114 __le32 crc;
115};
116
117struct fw_sync_header {
118 __le32 cmd;
119 __le32 seq_num;
5c0b8798 120} __packed;
4daffe35
AK
121
122struct fw_data {
123 struct fw_header fw_hdr;
124 __le32 seq_num;
090f2c5d 125 u8 data[];
5c0b8798 126} __packed;
4daffe35 127
4daffe35 128#endif /*_MWIFIEX_USB_H */