• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * This file contains definitions for mwifiex USB interface driver.
3  *
4  * Copyright (C) 2012, Marvell International Ltd.
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 
25 #define USB8797_VID		0x1286
26 #define USB8797_PID_1		0x2043
27 #define USB8797_PID_2		0x2044
28 
29 #define USB8797_FW_DNLD		1
30 #define USB8797_FW_READY	2
31 #define USB8797_FW_MAX_RETRY	3
32 
33 #define MWIFIEX_TX_DATA_URB	6
34 #define MWIFIEX_RX_DATA_URB	6
35 #define MWIFIEX_USB_TIMEOUT	100
36 
37 #define USB8797_DEFAULT_FW_NAME	"mrvl/usb8797_uapsta.bin"
38 
39 #define FW_DNLD_TX_BUF_SIZE	620
40 #define FW_DNLD_RX_BUF_SIZE	2048
41 #define FW_HAS_LAST_BLOCK	0x00000004
42 
43 #define FW_DATA_XMIT_SIZE \
44 	(sizeof(struct fw_header) + dlen + sizeof(u32))
45 
46 struct urb_context {
47 	struct mwifiex_adapter *adapter;
48 	struct sk_buff *skb;
49 	struct urb *urb;
50 	u8 ep;
51 };
52 
53 struct usb_card_rec {
54 	struct mwifiex_adapter *adapter;
55 	struct usb_device *udev;
56 	struct usb_interface *intf;
57 	u8 rx_cmd_ep;
58 	struct urb_context rx_cmd;
59 	atomic_t rx_cmd_urb_pending;
60 	struct urb_context rx_data_list[MWIFIEX_RX_DATA_URB];
61 	u8 usb_boot_state;
62 	u8 rx_data_ep;
63 	atomic_t rx_data_urb_pending;
64 	u8 tx_data_ep;
65 	u8 tx_cmd_ep;
66 	atomic_t tx_data_urb_pending;
67 	atomic_t tx_cmd_urb_pending;
68 	int bulk_out_maxpktsize;
69 	struct urb_context tx_cmd;
70 	int tx_data_ix;
71 	struct urb_context tx_data_list[MWIFIEX_TX_DATA_URB];
72 };
73 
74 struct fw_header {
75 	__le32 dnld_cmd;
76 	__le32 base_addr;
77 	__le32 data_len;
78 	__le32 crc;
79 };
80 
81 struct fw_sync_header {
82 	__le32 cmd;
83 	__le32 seq_num;
84 };
85 
86 struct fw_data {
87 	struct fw_header fw_hdr;
88 	__le32 seq_num;
89 	u8 data[1];
90 };
91 
92 /* This function is called after the card has woken up. */
93 static inline int
mwifiex_pm_wakeup_card_complete(struct mwifiex_adapter * adapter)94 mwifiex_pm_wakeup_card_complete(struct mwifiex_adapter *adapter)
95 {
96 	return 0;
97 }
98 
99 #endif /*_MWIFIEX_USB_H */
100