xref: /linux/drivers/net/wireless/rsi/rsi_usb.h (revision 03ab8e6297acd1bc0eedaa050e2a1635c576fd11)
130519460SAditya Srivastava /*
2dad0d04fSFariya Fatima  * @section LICENSE
3dad0d04fSFariya Fatima  * Copyright (c) 2014 Redpine Signals Inc.
4dad0d04fSFariya Fatima  *
5dad0d04fSFariya Fatima  * Permission to use, copy, modify, and/or distribute this software for any
6dad0d04fSFariya Fatima  * purpose with or without fee is hereby granted, provided that the above
7dad0d04fSFariya Fatima  * copyright notice and this permission notice appear in all copies.
8dad0d04fSFariya Fatima  *
9dad0d04fSFariya Fatima  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10dad0d04fSFariya Fatima  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11dad0d04fSFariya Fatima  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12dad0d04fSFariya Fatima  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13dad0d04fSFariya Fatima  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14dad0d04fSFariya Fatima  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15dad0d04fSFariya Fatima  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16dad0d04fSFariya Fatima  */
17dad0d04fSFariya Fatima 
18dad0d04fSFariya Fatima #ifndef __RSI_USB_INTF__
19dad0d04fSFariya Fatima #define __RSI_USB_INTF__
20dad0d04fSFariya Fatima 
21dad0d04fSFariya Fatima #include <linux/usb.h>
22dad0d04fSFariya Fatima #include "rsi_main.h"
23dad0d04fSFariya Fatima #include "rsi_common.h"
24dad0d04fSFariya Fatima 
2554fdb318SSiva Rebbagondla #define RSI_USB_VENDOR_ID	0x1618
265850874cSSiva Rebbagondla #define RSI_USB_PID_9113	0x9113
2754fdb318SSiva Rebbagondla #define RSI_USB_PID_9116	0x9116
285850874cSSiva Rebbagondla 
29dad0d04fSFariya Fatima #define USB_INTERNAL_REG_1           0x25000
30dad0d04fSFariya Fatima #define RSI_USB_READY_MAGIC_NUM      0xab
31dad0d04fSFariya Fatima #define FW_STATUS_REG                0x41050012
32ea0676c4SKarun Eagalapati #define RSI_TA_HOLD_REG              0x22000844
3316d3bb7bSAmitkumar Karwar #define RSI_FW_WDT_DISABLE_REQ	     0x69
34dad0d04fSFariya Fatima 
35dad0d04fSFariya Fatima #define USB_VENDOR_REGISTER_READ     0x15
36dad0d04fSFariya Fatima #define USB_VENDOR_REGISTER_WRITE    0x16
37dad0d04fSFariya Fatima #define RSI_USB_TX_HEAD_ROOM         128
38dad0d04fSFariya Fatima 
39a4302bffSSiva Rebbagondla #define MAX_RX_URBS                  2
40dad0d04fSFariya Fatima #define MAX_BULK_EP                  8
415d16a1c1SKarun Eagalapati #define WLAN_EP                      1
425d16a1c1SKarun Eagalapati #define BT_EP                        2
43dad0d04fSFariya Fatima 
447bdead7aSamit karwar #define RSI_USB_BUF_SIZE	     4096
45523b724aSAmitkumar Karwar #define RSI_USB_CTRL_BUF_SIZE	     0x04
467bdead7aSamit karwar 
47*f1cb3476SZekun Shen #define RSI_MAX_RX_USB_PKT_SIZE	3000
48*f1cb3476SZekun Shen 
491100f81bSPrameela Rani Garnepudi struct rx_usb_ctrl_block {
501100f81bSPrameela Rani Garnepudi 	u8 *data;
511100f81bSPrameela Rani Garnepudi 	struct urb *rx_urb;
52a1854faeSPrameela Rani Garnepudi 	struct sk_buff *rx_skb;
531100f81bSPrameela Rani Garnepudi 	u8 ep_num;
541100f81bSPrameela Rani Garnepudi };
551100f81bSPrameela Rani Garnepudi 
56dad0d04fSFariya Fatima struct rsi_91x_usbdev {
57a1854faeSPrameela Rani Garnepudi 	void *priv;
58dad0d04fSFariya Fatima 	struct rsi_thread rx_thread;
59dad0d04fSFariya Fatima 	u8 endpoint;
60dad0d04fSFariya Fatima 	struct usb_device *usbdev;
61dad0d04fSFariya Fatima 	struct usb_interface *pfunction;
621100f81bSPrameela Rani Garnepudi 	struct rx_usb_ctrl_block rx_cb[MAX_RX_URBS];
63dad0d04fSFariya Fatima 	u8 *tx_buffer;
64a4302bffSSiva Rebbagondla 	__le16 bulkin_size[MAX_BULK_EP];
65a4302bffSSiva Rebbagondla 	u8 bulkin_endpoint_addr[MAX_BULK_EP];
66dad0d04fSFariya Fatima 	__le16 bulkout_size[MAX_BULK_EP];
67dad0d04fSFariya Fatima 	u8 bulkout_endpoint_addr[MAX_BULK_EP];
68dad0d04fSFariya Fatima 	u32 tx_blk_size;
69dad0d04fSFariya Fatima 	u8 write_fail;
70a1854faeSPrameela Rani Garnepudi 	struct sk_buff_head rx_q;
71dad0d04fSFariya Fatima };
72dad0d04fSFariya Fatima 
rsi_usb_check_queue_status(struct rsi_hw * adapter,u8 q_num)73dad0d04fSFariya Fatima static inline int rsi_usb_check_queue_status(struct rsi_hw *adapter, u8 q_num)
74dad0d04fSFariya Fatima {
75dad0d04fSFariya Fatima 	/* In USB, there isn't any need to check the queue status */
76dad0d04fSFariya Fatima 	return QUEUE_NOT_FULL;
77dad0d04fSFariya Fatima }
78dad0d04fSFariya Fatima 
rsi_usb_event_timeout(struct rsi_hw * adapter)79dad0d04fSFariya Fatima static inline int rsi_usb_event_timeout(struct rsi_hw *adapter)
80dad0d04fSFariya Fatima {
81dad0d04fSFariya Fatima 	return EVENT_WAIT_FOREVER;
82dad0d04fSFariya Fatima }
83dad0d04fSFariya Fatima 
84dad0d04fSFariya Fatima void rsi_usb_rx_thread(struct rsi_common *common);
85dad0d04fSFariya Fatima #endif
86