Merge tag 'pinctrl-v4.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[linux-2.6-block.git] / drivers / net / wireless / marvell / mwifiex / usb.h
CommitLineData
4daffe35
AK
1/*
2 * This file contains definitions for mwifiex USB interface driver.
3 *
65da33f5 4 * Copyright (C) 2012-2014, Marvell International Ltd.
4daffe35
AK
5 *
6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
8 * (the "License"). You may use, redistribute and/or modify this File in
9 * accordance with the terms and conditions of the License, a copy of which
10 * is available by writing to the Free Software Foundation, Inc.,
11 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
12 * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
13 *
14 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
16 * ARE EXPRESSLY DISCLAIMED. The License provides additional details about
17 * this warranty disclaimer.
18 */
19
20#ifndef _MWIFIEX_USB_H
21#define _MWIFIEX_USB_H
22
23#include <linux/usb.h>
24
68458ded
YAP
25#define USB8XXX_VID 0x1286
26
9e6f3f47
KE
27#define USB8766_PID_1 0x2041
28#define USB8766_PID_2 0x2042
4daffe35
AK
29#define USB8797_PID_1 0x2043
30#define USB8797_PID_2 0x2044
eaa3d9fa
YAP
31#define USB8801_PID_1 0x2049
32#define USB8801_PID_2 0x204a
ce03966a 33#define USB8997_PID_1 0x2052
6d85ef00 34#define USB8997_PID_2 0x204e
eaa3d9fa 35
4daffe35 36
68458ded
YAP
37#define USB8XXX_FW_DNLD 1
38#define USB8XXX_FW_READY 2
39#define USB8XXX_FW_MAX_RETRY 3
4daffe35 40
308fe29e 41#define MWIFIEX_TX_DATA_PORT 2
4daffe35
AK
42#define MWIFIEX_TX_DATA_URB 6
43#define MWIFIEX_RX_DATA_URB 6
44#define MWIFIEX_USB_TIMEOUT 100
45
9e6f3f47 46#define USB8766_DEFAULT_FW_NAME "mrvl/usb8766_uapsta.bin"
4daffe35 47#define USB8797_DEFAULT_FW_NAME "mrvl/usb8797_uapsta.bin"
eaa3d9fa 48#define USB8801_DEFAULT_FW_NAME "mrvl/usb8801_uapsta.bin"
b7450e24 49#define USB8997_DEFAULT_FW_NAME "mrvl/usbusb8997_combo_v4.bin"
4daffe35
AK
50
51#define FW_DNLD_TX_BUF_SIZE 620
52#define FW_DNLD_RX_BUF_SIZE 2048
53#define FW_HAS_LAST_BLOCK 0x00000004
78776467 54#define FW_CMD_7 0x00000007
4daffe35
AK
55
56#define FW_DATA_XMIT_SIZE \
57 (sizeof(struct fw_header) + dlen + sizeof(u32))
58
59struct urb_context {
60 struct mwifiex_adapter *adapter;
61 struct sk_buff *skb;
62 struct urb *urb;
63 u8 ep;
64};
65
308fe29e
ZL
66struct usb_tx_data_port {
67 u8 tx_data_ep;
7e4e5d2c 68 u8 block_status;
308fe29e
ZL
69 atomic_t tx_data_urb_pending;
70 int tx_data_ix;
71 struct urb_context tx_data_list[MWIFIEX_TX_DATA_URB];
72};
73
4daffe35
AK
74struct usb_card_rec {
75 struct mwifiex_adapter *adapter;
76 struct usb_device *udev;
77 struct usb_interface *intf;
78 u8 rx_cmd_ep;
79 struct urb_context rx_cmd;
80 atomic_t rx_cmd_urb_pending;
81 struct urb_context rx_data_list[MWIFIEX_RX_DATA_URB];
82 u8 usb_boot_state;
83 u8 rx_data_ep;
84 atomic_t rx_data_urb_pending;
4daffe35 85 u8 tx_cmd_ep;
4daffe35
AK
86 atomic_t tx_cmd_urb_pending;
87 int bulk_out_maxpktsize;
88 struct urb_context tx_cmd;
7e4e5d2c 89 u8 mc_resync_flag;
308fe29e 90 struct usb_tx_data_port port[MWIFIEX_TX_DATA_PORT];
4daffe35
AK
91};
92
93struct fw_header {
94 __le32 dnld_cmd;
95 __le32 base_addr;
96 __le32 data_len;
97 __le32 crc;
98};
99
100struct fw_sync_header {
101 __le32 cmd;
102 __le32 seq_num;
103};
104
105struct fw_data {
106 struct fw_header fw_hdr;
107 __le32 seq_num;
108 u8 data[1];
109};
110
4daffe35 111#endif /*_MWIFIEX_USB_H */