162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * @section LICENSE 362306a36Sopenharmony_ci * Copyright (c) 2014 Redpine Signals Inc. 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any 662306a36Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above 762306a36Sopenharmony_ci * copyright notice and this permission notice appear in all copies. 862306a36Sopenharmony_ci * 962306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 1062306a36Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 1162306a36Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 1262306a36Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 1362306a36Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 1462306a36Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 1562306a36Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 1662306a36Sopenharmony_ci */ 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci#ifndef __RSI_USB_INTF__ 1962306a36Sopenharmony_ci#define __RSI_USB_INTF__ 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci#include <linux/usb.h> 2262306a36Sopenharmony_ci#include "rsi_main.h" 2362306a36Sopenharmony_ci#include "rsi_common.h" 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci#define RSI_USB_VENDOR_ID 0x1618 2662306a36Sopenharmony_ci#define RSI_USB_PID_9113 0x9113 2762306a36Sopenharmony_ci#define RSI_USB_PID_9116 0x9116 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci#define USB_INTERNAL_REG_1 0x25000 3062306a36Sopenharmony_ci#define RSI_USB_READY_MAGIC_NUM 0xab 3162306a36Sopenharmony_ci#define FW_STATUS_REG 0x41050012 3262306a36Sopenharmony_ci#define RSI_TA_HOLD_REG 0x22000844 3362306a36Sopenharmony_ci#define RSI_FW_WDT_DISABLE_REQ 0x69 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ci#define USB_VENDOR_REGISTER_READ 0x15 3662306a36Sopenharmony_ci#define USB_VENDOR_REGISTER_WRITE 0x16 3762306a36Sopenharmony_ci#define RSI_USB_TX_HEAD_ROOM 128 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci#define MAX_RX_URBS 2 4062306a36Sopenharmony_ci#define MAX_BULK_EP 8 4162306a36Sopenharmony_ci#define WLAN_EP 1 4262306a36Sopenharmony_ci#define BT_EP 2 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci#define RSI_USB_BUF_SIZE 4096 4562306a36Sopenharmony_ci#define RSI_USB_CTRL_BUF_SIZE 0x04 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci#define RSI_MAX_RX_USB_PKT_SIZE 3000 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_cistruct rx_usb_ctrl_block { 5062306a36Sopenharmony_ci u8 *data; 5162306a36Sopenharmony_ci struct urb *rx_urb; 5262306a36Sopenharmony_ci struct sk_buff *rx_skb; 5362306a36Sopenharmony_ci u8 ep_num; 5462306a36Sopenharmony_ci}; 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_cistruct rsi_91x_usbdev { 5762306a36Sopenharmony_ci void *priv; 5862306a36Sopenharmony_ci struct rsi_thread rx_thread; 5962306a36Sopenharmony_ci u8 endpoint; 6062306a36Sopenharmony_ci struct usb_device *usbdev; 6162306a36Sopenharmony_ci struct usb_interface *pfunction; 6262306a36Sopenharmony_ci struct rx_usb_ctrl_block rx_cb[MAX_RX_URBS]; 6362306a36Sopenharmony_ci u8 *tx_buffer; 6462306a36Sopenharmony_ci __le16 bulkin_size[MAX_BULK_EP]; 6562306a36Sopenharmony_ci u8 bulkin_endpoint_addr[MAX_BULK_EP]; 6662306a36Sopenharmony_ci __le16 bulkout_size[MAX_BULK_EP]; 6762306a36Sopenharmony_ci u8 bulkout_endpoint_addr[MAX_BULK_EP]; 6862306a36Sopenharmony_ci u32 tx_blk_size; 6962306a36Sopenharmony_ci u8 write_fail; 7062306a36Sopenharmony_ci struct sk_buff_head rx_q; 7162306a36Sopenharmony_ci}; 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_cistatic inline int rsi_usb_check_queue_status(struct rsi_hw *adapter, u8 q_num) 7462306a36Sopenharmony_ci{ 7562306a36Sopenharmony_ci /* In USB, there isn't any need to check the queue status */ 7662306a36Sopenharmony_ci return QUEUE_NOT_FULL; 7762306a36Sopenharmony_ci} 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_cistatic inline int rsi_usb_event_timeout(struct rsi_hw *adapter) 8062306a36Sopenharmony_ci{ 8162306a36Sopenharmony_ci return EVENT_WAIT_FOREVER; 8262306a36Sopenharmony_ci} 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_civoid rsi_usb_rx_thread(struct rsi_common *common); 8562306a36Sopenharmony_ci#endif 86