blob: b4e9246bbcdc9080d3b9bddec7e0f3aab1d16fa1 [file] [log] [blame]
Amitkumar Karwar4daffe32012-04-18 20:08:28 -07001/*
2 * This file contains definitions for mwifiex USB interface driver.
3 *
Xinming Hu65da33f2014-06-19 21:38:57 -07004 * Copyright (C) 2012-2014, Marvell International Ltd.
Amitkumar Karwar4daffe32012-04-18 20:08:28 -07005 *
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
Yogesh Ashok Powar68458de2014-01-09 19:36:55 -080025#define USB8XXX_VID 0x1286
26
Kristian Evensen9e6f3f42014-11-20 16:52:58 +010027#define USB8766_PID_1 0x2041
28#define USB8766_PID_2 0x2042
Amitkumar Karwar4daffe32012-04-18 20:08:28 -070029#define USB8797_PID_1 0x2043
30#define USB8797_PID_2 0x2044
Yogesh Ashok Powareaa3d9f2015-01-23 17:09:18 +053031#define USB8801_PID_1 0x2049
32#define USB8801_PID_2 0x204a
Amitkumar Karwarce039662015-09-10 07:27:34 -070033#define USB8997_PID_1 0x2052
Zhaoyang Liu6d85ef02015-08-05 06:09:40 -070034#define USB8997_PID_2 0x204e
Yogesh Ashok Powareaa3d9f2015-01-23 17:09:18 +053035
Amitkumar Karwar4daffe32012-04-18 20:08:28 -070036
Yogesh Ashok Powar68458de2014-01-09 19:36:55 -080037#define USB8XXX_FW_DNLD 1
38#define USB8XXX_FW_READY 2
39#define USB8XXX_FW_MAX_RETRY 3
Amitkumar Karwar4daffe32012-04-18 20:08:28 -070040
Zhaoyang Liu308fe292015-09-18 06:32:16 -070041#define MWIFIEX_TX_DATA_PORT 2
Amitkumar Karwar4daffe32012-04-18 20:08:28 -070042#define MWIFIEX_TX_DATA_URB 6
43#define MWIFIEX_RX_DATA_URB 6
44#define MWIFIEX_USB_TIMEOUT 100
45
Kristian Evensen9e6f3f42014-11-20 16:52:58 +010046#define USB8766_DEFAULT_FW_NAME "mrvl/usb8766_uapsta.bin"
Amitkumar Karwar4daffe32012-04-18 20:08:28 -070047#define USB8797_DEFAULT_FW_NAME "mrvl/usb8797_uapsta.bin"
Yogesh Ashok Powareaa3d9f2015-01-23 17:09:18 +053048#define USB8801_DEFAULT_FW_NAME "mrvl/usb8801_uapsta.bin"
Zhaoyang Liu6d85ef02015-08-05 06:09:40 -070049#define USB8997_DEFAULT_FW_NAME "mrvl/usb8997_uapsta.bin"
Amitkumar Karwar4daffe32012-04-18 20:08:28 -070050
51#define FW_DNLD_TX_BUF_SIZE 620
52#define FW_DNLD_RX_BUF_SIZE 2048
53#define FW_HAS_LAST_BLOCK 0x00000004
54
55#define FW_DATA_XMIT_SIZE \
56 (sizeof(struct fw_header) + dlen + sizeof(u32))
57
58struct urb_context {
59 struct mwifiex_adapter *adapter;
60 struct sk_buff *skb;
61 struct urb *urb;
62 u8 ep;
63};
64
Zhaoyang Liu308fe292015-09-18 06:32:16 -070065struct usb_tx_data_port {
66 u8 tx_data_ep;
Zhaoyang Liu7e4e5d22015-09-18 06:32:17 -070067 u8 block_status;
Zhaoyang Liu308fe292015-09-18 06:32:16 -070068 atomic_t tx_data_urb_pending;
69 int tx_data_ix;
70 struct urb_context tx_data_list[MWIFIEX_TX_DATA_URB];
71};
72
Amitkumar Karwar4daffe32012-04-18 20:08:28 -070073struct usb_card_rec {
74 struct mwifiex_adapter *adapter;
75 struct usb_device *udev;
76 struct usb_interface *intf;
77 u8 rx_cmd_ep;
78 struct urb_context rx_cmd;
79 atomic_t rx_cmd_urb_pending;
80 struct urb_context rx_data_list[MWIFIEX_RX_DATA_URB];
81 u8 usb_boot_state;
82 u8 rx_data_ep;
83 atomic_t rx_data_urb_pending;
Amitkumar Karwar4daffe32012-04-18 20:08:28 -070084 u8 tx_cmd_ep;
Amitkumar Karwar4daffe32012-04-18 20:08:28 -070085 atomic_t tx_cmd_urb_pending;
86 int bulk_out_maxpktsize;
87 struct urb_context tx_cmd;
Zhaoyang Liu7e4e5d22015-09-18 06:32:17 -070088 u8 mc_resync_flag;
Zhaoyang Liu308fe292015-09-18 06:32:16 -070089 struct usb_tx_data_port port[MWIFIEX_TX_DATA_PORT];
Amitkumar Karwar4daffe32012-04-18 20:08:28 -070090};
91
92struct fw_header {
93 __le32 dnld_cmd;
94 __le32 base_addr;
95 __le32 data_len;
96 __le32 crc;
97};
98
99struct fw_sync_header {
100 __le32 cmd;
101 __le32 seq_num;
102};
103
104struct fw_data {
105 struct fw_header fw_hdr;
106 __le32 seq_num;
107 u8 data[1];
108};
109
Amitkumar Karwar4daffe32012-04-18 20:08:28 -0700110#endif /*_MWIFIEX_USB_H */