Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * @section LICENSE
0003  * Copyright (c) 2014 Redpine Signals Inc.
0004  *
0005  * Permission to use, copy, modify, and/or distribute this software for any
0006  * purpose with or without fee is hereby granted, provided that the above
0007  * copyright notice and this permission notice appear in all copies.
0008  *
0009  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
0010  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
0011  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
0012  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
0013  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
0014  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
0015  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
0016  */
0017 
0018 #ifndef __RSI_USB_INTF__
0019 #define __RSI_USB_INTF__
0020 
0021 #include <linux/usb.h>
0022 #include "rsi_main.h"
0023 #include "rsi_common.h"
0024 
0025 #define RSI_USB_VENDOR_ID   0x1618
0026 #define RSI_USB_PID_9113    0x9113
0027 #define RSI_USB_PID_9116    0x9116
0028 
0029 #define USB_INTERNAL_REG_1           0x25000
0030 #define RSI_USB_READY_MAGIC_NUM      0xab
0031 #define FW_STATUS_REG                0x41050012
0032 #define RSI_TA_HOLD_REG              0x22000844
0033 #define RSI_FW_WDT_DISABLE_REQ       0x69
0034 
0035 #define USB_VENDOR_REGISTER_READ     0x15
0036 #define USB_VENDOR_REGISTER_WRITE    0x16
0037 #define RSI_USB_TX_HEAD_ROOM         128
0038 
0039 #define MAX_RX_URBS                  2
0040 #define MAX_BULK_EP                  8
0041 #define WLAN_EP                      1
0042 #define BT_EP                        2
0043 
0044 #define RSI_USB_BUF_SIZE         4096
0045 #define RSI_USB_CTRL_BUF_SIZE        0x04
0046 
0047 #define RSI_MAX_RX_USB_PKT_SIZE 3000
0048 
0049 struct rx_usb_ctrl_block {
0050     u8 *data;
0051     struct urb *rx_urb;
0052     struct sk_buff *rx_skb;
0053     u8 ep_num;
0054 };
0055 
0056 struct rsi_91x_usbdev {
0057     void *priv;
0058     struct rsi_thread rx_thread;
0059     u8 endpoint;
0060     struct usb_device *usbdev;
0061     struct usb_interface *pfunction;
0062     struct rx_usb_ctrl_block rx_cb[MAX_RX_URBS];
0063     u8 *tx_buffer;
0064     __le16 bulkin_size[MAX_BULK_EP];
0065     u8 bulkin_endpoint_addr[MAX_BULK_EP];
0066     __le16 bulkout_size[MAX_BULK_EP];
0067     u8 bulkout_endpoint_addr[MAX_BULK_EP];
0068     u32 tx_blk_size;
0069     u8 write_fail;
0070     struct sk_buff_head rx_q;
0071 };
0072 
0073 static inline int rsi_usb_check_queue_status(struct rsi_hw *adapter, u8 q_num)
0074 {
0075     /* In USB, there isn't any need to check the queue status */
0076     return QUEUE_NOT_FULL;
0077 }
0078 
0079 static inline int rsi_usb_event_timeout(struct rsi_hw *adapter)
0080 {
0081     return EVENT_WAIT_FOREVER;
0082 }
0083 
0084 void rsi_usb_rx_thread(struct rsi_common *common);
0085 #endif