1dad0d04fSFariya Fatima /** 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 25dad0d04fSFariya Fatima #define USB_INTERNAL_REG_1 0x25000 26dad0d04fSFariya Fatima #define RSI_USB_READY_MAGIC_NUM 0xab 27dad0d04fSFariya Fatima #define FW_STATUS_REG 0x41050012 28ea0676c4SKarun Eagalapati #define RSI_TA_HOLD_REG 0x22000844 29dad0d04fSFariya Fatima 30dad0d04fSFariya Fatima #define USB_VENDOR_REGISTER_READ 0x15 31dad0d04fSFariya Fatima #define USB_VENDOR_REGISTER_WRITE 0x16 32dad0d04fSFariya Fatima #define RSI_USB_TX_HEAD_ROOM 128 33dad0d04fSFariya Fatima 34dad0d04fSFariya Fatima #define MAX_RX_URBS 1 35dad0d04fSFariya Fatima #define MAX_BULK_EP 8 365d16a1c1SKarun Eagalapati #define WLAN_EP 1 375d16a1c1SKarun Eagalapati #define BT_EP 2 38dad0d04fSFariya Fatima 397bdead7aSamit karwar #define RSI_USB_BUF_SIZE 4096 40523b724aSAmitkumar Karwar #define RSI_USB_CTRL_BUF_SIZE 0x04 417bdead7aSamit karwar 42*1100f81bSPrameela Rani Garnepudi struct rx_usb_ctrl_block { 43*1100f81bSPrameela Rani Garnepudi u8 *data; 44*1100f81bSPrameela Rani Garnepudi struct urb *rx_urb; 45*1100f81bSPrameela Rani Garnepudi u8 *rx_buffer; 46*1100f81bSPrameela Rani Garnepudi u8 ep_num; 47*1100f81bSPrameela Rani Garnepudi u8 pend; 48*1100f81bSPrameela Rani Garnepudi }; 49*1100f81bSPrameela Rani Garnepudi 50dad0d04fSFariya Fatima struct rsi_91x_usbdev { 51dad0d04fSFariya Fatima struct rsi_thread rx_thread; 52dad0d04fSFariya Fatima u8 endpoint; 53dad0d04fSFariya Fatima struct usb_device *usbdev; 54dad0d04fSFariya Fatima struct usb_interface *pfunction; 55*1100f81bSPrameela Rani Garnepudi struct rx_usb_ctrl_block rx_cb[MAX_RX_URBS]; 56dad0d04fSFariya Fatima u8 *tx_buffer; 57dad0d04fSFariya Fatima __le16 bulkin_size; 58dad0d04fSFariya Fatima u8 bulkin_endpoint_addr; 59dad0d04fSFariya Fatima __le16 bulkout_size[MAX_BULK_EP]; 60dad0d04fSFariya Fatima u8 bulkout_endpoint_addr[MAX_BULK_EP]; 61dad0d04fSFariya Fatima u32 tx_blk_size; 62dad0d04fSFariya Fatima u8 write_fail; 63dad0d04fSFariya Fatima }; 64dad0d04fSFariya Fatima 65dad0d04fSFariya Fatima static inline int rsi_usb_check_queue_status(struct rsi_hw *adapter, u8 q_num) 66dad0d04fSFariya Fatima { 67dad0d04fSFariya Fatima /* In USB, there isn't any need to check the queue status */ 68dad0d04fSFariya Fatima return QUEUE_NOT_FULL; 69dad0d04fSFariya Fatima } 70dad0d04fSFariya Fatima 71dad0d04fSFariya Fatima static inline int rsi_usb_event_timeout(struct rsi_hw *adapter) 72dad0d04fSFariya Fatima { 73dad0d04fSFariya Fatima return EVENT_WAIT_FOREVER; 74dad0d04fSFariya Fatima } 75dad0d04fSFariya Fatima 76dad0d04fSFariya Fatima void rsi_usb_rx_thread(struct rsi_common *common); 77dad0d04fSFariya Fatima #endif 78