2010-03-17 16:55:25 +08:00
|
|
|
/*
|
2011-05-17 16:06:18 +08:00
|
|
|
* Copyright (c) 2010-2011 Atheros Communications Inc.
|
2010-03-17 16:55:25 +08:00
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HTC_USB_H
|
|
|
|
#define HTC_USB_H
|
|
|
|
|
2011-04-20 17:03:28 +08:00
|
|
|
#define MAJOR_VERSION_REQ 1
|
2011-05-17 15:11:20 +08:00
|
|
|
#define MINOR_VERSION_REQ 3
|
2011-04-20 17:03:28 +08:00
|
|
|
|
2010-12-07 19:01:38 +08:00
|
|
|
#define IS_AR7010_DEVICE(_v) (((_v) == AR9280_USB) || ((_v) == AR9287_USB))
|
|
|
|
|
2010-03-17 16:55:25 +08:00
|
|
|
#define AR9271_FIRMWARE 0x501000
|
|
|
|
#define AR9271_FIRMWARE_TEXT 0x903000
|
2010-06-02 18:23:34 +08:00
|
|
|
#define AR7010_FIRMWARE_TEXT 0x906000
|
2010-03-17 16:55:25 +08:00
|
|
|
|
|
|
|
#define FIRMWARE_DOWNLOAD 0x30
|
|
|
|
#define FIRMWARE_DOWNLOAD_COMP 0x31
|
|
|
|
|
|
|
|
#define ATH_USB_RX_STREAM_MODE_TAG 0x4e00
|
|
|
|
#define ATH_USB_TX_STREAM_MODE_TAG 0x697e
|
|
|
|
|
|
|
|
/* FIXME: Verify these numbers (with Windows) */
|
|
|
|
#define MAX_TX_URB_NUM 8
|
2011-04-13 13:55:06 +08:00
|
|
|
#define MAX_TX_BUF_NUM 256
|
2010-03-17 16:55:25 +08:00
|
|
|
#define MAX_TX_BUF_SIZE 32768
|
|
|
|
#define MAX_TX_AGGR_NUM 20
|
|
|
|
|
|
|
|
#define MAX_RX_URB_NUM 8
|
|
|
|
#define MAX_RX_BUF_SIZE 16384
|
2010-04-06 17:58:15 +08:00
|
|
|
#define MAX_PKT_NUM_IN_TRANSFER 10
|
2010-03-17 16:55:25 +08:00
|
|
|
|
|
|
|
#define MAX_REG_OUT_URB_NUM 1
|
2011-04-13 13:55:23 +08:00
|
|
|
#define MAX_REG_IN_URB_NUM 64
|
2010-03-17 16:55:25 +08:00
|
|
|
|
|
|
|
#define MAX_REG_IN_BUF_SIZE 64
|
|
|
|
|
|
|
|
/* USB Endpoint definition */
|
|
|
|
#define USB_WLAN_TX_PIPE 1
|
|
|
|
#define USB_WLAN_RX_PIPE 2
|
|
|
|
#define USB_REG_IN_PIPE 3
|
|
|
|
#define USB_REG_OUT_PIPE 4
|
|
|
|
|
|
|
|
#define HIF_USB_MAX_RXPIPES 2
|
|
|
|
#define HIF_USB_MAX_TXPIPES 4
|
|
|
|
|
|
|
|
struct tx_buf {
|
|
|
|
u8 *buf;
|
|
|
|
u16 len;
|
|
|
|
u16 offset;
|
|
|
|
struct urb *urb;
|
|
|
|
struct sk_buff_head skb_queue;
|
|
|
|
struct hif_device_usb *hif_dev;
|
|
|
|
struct list_head list;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define HIF_USB_TX_STOP BIT(0)
|
2010-12-28 16:58:05 +08:00
|
|
|
#define HIF_USB_TX_FLUSH BIT(1)
|
2010-03-17 16:55:25 +08:00
|
|
|
|
|
|
|
struct hif_usb_tx {
|
|
|
|
u8 flags;
|
|
|
|
u8 tx_buf_cnt;
|
|
|
|
u16 tx_skb_cnt;
|
|
|
|
struct sk_buff_head tx_skb_queue;
|
|
|
|
struct list_head tx_buf;
|
|
|
|
struct list_head tx_pending;
|
|
|
|
spinlock_t tx_lock;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cmd_buf {
|
|
|
|
struct sk_buff *skb;
|
|
|
|
struct hif_device_usb *hif_dev;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define HIF_USB_START BIT(0)
|
2012-08-21 16:04:27 +08:00
|
|
|
#define HIF_USB_READY BIT(1)
|
2010-03-17 16:55:25 +08:00
|
|
|
|
|
|
|
struct hif_device_usb {
|
|
|
|
struct usb_device *udev;
|
|
|
|
struct usb_interface *interface;
|
2012-01-30 16:47:18 +08:00
|
|
|
const struct usb_device_id *usb_device_id;
|
2012-08-21 16:04:27 +08:00
|
|
|
const void *fw_data;
|
|
|
|
size_t fw_size;
|
2012-01-30 16:47:18 +08:00
|
|
|
struct completion fw_done;
|
2010-03-17 16:55:25 +08:00
|
|
|
struct htc_target *htc_handle;
|
|
|
|
struct hif_usb_tx tx;
|
2010-04-06 17:58:17 +08:00
|
|
|
struct usb_anchor regout_submitted;
|
2010-03-29 18:37:15 +08:00
|
|
|
struct usb_anchor rx_submitted;
|
2011-04-13 13:55:23 +08:00
|
|
|
struct usb_anchor reg_in_submitted;
|
2011-04-13 13:56:46 +08:00
|
|
|
struct usb_anchor mgmt_submitted;
|
2010-03-17 16:55:25 +08:00
|
|
|
struct sk_buff *remain_skb;
|
2010-06-02 18:23:30 +08:00
|
|
|
const char *fw_name;
|
2010-03-17 16:55:25 +08:00
|
|
|
int rx_remain_len;
|
|
|
|
int rx_pkt_len;
|
|
|
|
int rx_transfer_len;
|
|
|
|
int rx_pad_len;
|
2010-04-06 17:58:11 +08:00
|
|
|
spinlock_t rx_lock;
|
2010-03-29 18:37:15 +08:00
|
|
|
u8 flags; /* HIF_USB_* */
|
2010-03-17 16:55:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
int ath9k_hif_usb_init(void);
|
|
|
|
void ath9k_hif_usb_exit(void);
|
|
|
|
|
|
|
|
#endif /* HTC_USB_H */
|