Commit | Line | Data |
---|---|---|
30519460 | 1 | /* |
dad0d04f FF |
2 | * @section LICENSE |
3 | * Copyright (c) 2014 Redpine Signals Inc. | |
4 | * | |
5 | * Permission to use, copy, modify, and/or distribute this software for any | |
6 | * purpose with or without fee is hereby granted, provided that the above | |
7 | * copyright notice and this permission notice appear in all copies. | |
8 | * | |
9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
16 | */ | |
17 | ||
18 | #ifndef __RSI_USB_INTF__ | |
19 | #define __RSI_USB_INTF__ | |
20 | ||
21 | #include <linux/usb.h> | |
22 | #include "rsi_main.h" | |
23 | #include "rsi_common.h" | |
24 | ||
54fdb318 | 25 | #define RSI_USB_VENDOR_ID 0x1618 |
5850874c | 26 | #define RSI_USB_PID_9113 0x9113 |
54fdb318 | 27 | #define RSI_USB_PID_9116 0x9116 |
5850874c | 28 | |
dad0d04f FF |
29 | #define USB_INTERNAL_REG_1 0x25000 |
30 | #define RSI_USB_READY_MAGIC_NUM 0xab | |
31 | #define FW_STATUS_REG 0x41050012 | |
ea0676c4 | 32 | #define RSI_TA_HOLD_REG 0x22000844 |
16d3bb7b | 33 | #define RSI_FW_WDT_DISABLE_REQ 0x69 |
dad0d04f FF |
34 | |
35 | #define USB_VENDOR_REGISTER_READ 0x15 | |
36 | #define USB_VENDOR_REGISTER_WRITE 0x16 | |
37 | #define RSI_USB_TX_HEAD_ROOM 128 | |
38 | ||
a4302bff | 39 | #define MAX_RX_URBS 2 |
dad0d04f | 40 | #define MAX_BULK_EP 8 |
5d16a1c1 KE |
41 | #define WLAN_EP 1 |
42 | #define BT_EP 2 | |
dad0d04f | 43 | |
7bdead7a | 44 | #define RSI_USB_BUF_SIZE 4096 |
523b724a | 45 | #define RSI_USB_CTRL_BUF_SIZE 0x04 |
7bdead7a | 46 | |
f1cb3476 ZS |
47 | #define RSI_MAX_RX_USB_PKT_SIZE 3000 |
48 | ||
1100f81b PRG |
49 | struct rx_usb_ctrl_block { |
50 | u8 *data; | |
51 | struct urb *rx_urb; | |
a1854fae | 52 | struct sk_buff *rx_skb; |
1100f81b | 53 | u8 ep_num; |
1100f81b PRG |
54 | }; |
55 | ||
dad0d04f | 56 | struct rsi_91x_usbdev { |
a1854fae | 57 | void *priv; |
dad0d04f FF |
58 | struct rsi_thread rx_thread; |
59 | u8 endpoint; | |
60 | struct usb_device *usbdev; | |
61 | struct usb_interface *pfunction; | |
1100f81b | 62 | struct rx_usb_ctrl_block rx_cb[MAX_RX_URBS]; |
dad0d04f | 63 | u8 *tx_buffer; |
a4302bff SR |
64 | __le16 bulkin_size[MAX_BULK_EP]; |
65 | u8 bulkin_endpoint_addr[MAX_BULK_EP]; | |
dad0d04f FF |
66 | __le16 bulkout_size[MAX_BULK_EP]; |
67 | u8 bulkout_endpoint_addr[MAX_BULK_EP]; | |
68 | u32 tx_blk_size; | |
69 | u8 write_fail; | |
a1854fae | 70 | struct sk_buff_head rx_q; |
dad0d04f FF |
71 | }; |
72 | ||
73 | static inline int rsi_usb_check_queue_status(struct rsi_hw *adapter, u8 q_num) | |
74 | { | |
75 | /* In USB, there isn't any need to check the queue status */ | |
76 | return QUEUE_NOT_FULL; | |
77 | } | |
78 | ||
79 | static inline int rsi_usb_event_timeout(struct rsi_hw *adapter) | |
80 | { | |
81 | return EVENT_WAIT_FOREVER; | |
82 | } | |
83 | ||
dad0d04f FF |
84 | void rsi_usb_rx_thread(struct rsi_common *common); |
85 | #endif |