brintos

brintos / linux-shallow public Read only

0
0
Text · 3.7 KiB · b3e66b0 Raw
144 lines · c
1/*2 * Copyright (c) 2010-2011 Atheros Communications Inc.3 *4 * Permission to use, copy, modify, and/or distribute this software for any5 * purpose with or without fee is hereby granted, provided that the above6 * copyright notice and this permission notice appear in all copies.7 *8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.15 */16 17#ifndef HTC_USB_H18#define HTC_USB_H19 20/* old firmware images */21#define FIRMWARE_AR7010_1_1     "htc_7010.fw"22#define FIRMWARE_AR9271         "htc_9271.fw"23 24/* supported Major FW version */25#define MAJOR_VERSION_REQ 126#define MINOR_VERSION_REQ 327/* minimal and maximal supported Minor FW version. */28#define FIRMWARE_MINOR_IDX_MAX  429#define FIRMWARE_MINOR_IDX_MIN  330#define HTC_FW_PATH	"ath9k_htc"31 32#define HTC_9271_MODULE_FW  HTC_FW_PATH "/htc_9271-" \33			__stringify(MAJOR_VERSION_REQ) \34			"." __stringify(FIRMWARE_MINOR_IDX_MAX) ".0.fw"35#define HTC_7010_MODULE_FW  HTC_FW_PATH "/htc_7010-" \36			__stringify(MAJOR_VERSION_REQ) \37			"." __stringify(FIRMWARE_MINOR_IDX_MAX) ".0.fw"38 39extern int htc_use_dev_fw;40 41#define IS_AR7010_DEVICE(_v) (((_v) == AR9280_USB) || ((_v) == AR9287_USB))42 43#define AR9271_FIRMWARE       0x50100044#define AR9271_FIRMWARE_TEXT  0x90300045#define AR7010_FIRMWARE_TEXT  0x90600046 47#define FIRMWARE_DOWNLOAD       0x3048#define FIRMWARE_DOWNLOAD_COMP  0x3149 50#define ATH_USB_RX_STREAM_MODE_TAG 0x4e0051#define ATH_USB_TX_STREAM_MODE_TAG 0x697e52 53/* FIXME: Verify these numbers (with Windows) */54#define MAX_TX_URB_NUM  855#define MAX_TX_BUF_NUM  25656#define MAX_TX_BUF_SIZE 3276857#define MAX_TX_AGGR_NUM 2058 59#define MAX_RX_URB_NUM  860#define MAX_RX_BUF_SIZE 1638461#define MAX_PKT_NUM_IN_TRANSFER 1062 63#define MAX_REG_OUT_URB_NUM  164#define MAX_REG_IN_URB_NUM   6465 66#define MAX_REG_IN_BUF_SIZE 6467 68/* USB Endpoint definition */69#define USB_WLAN_TX_PIPE  170#define USB_WLAN_RX_PIPE  271#define USB_REG_IN_PIPE   372#define USB_REG_OUT_PIPE  473 74#define USB_MSG_TIMEOUT 1000 /* (ms) */75 76#define HIF_USB_MAX_RXPIPES 277#define HIF_USB_MAX_TXPIPES 478 79struct tx_buf {80	u8 *buf;81	u16 len;82	u16 offset;83	struct urb *urb;84	struct sk_buff_head skb_queue;85	struct hif_device_usb *hif_dev;86	struct list_head list;87};88 89struct rx_buf {90	struct sk_buff *skb;91	struct hif_device_usb *hif_dev;92};93 94#define HIF_USB_TX_STOP  BIT(0)95#define HIF_USB_TX_FLUSH BIT(1)96 97struct hif_usb_tx {98	u8 flags;99	u8 tx_buf_cnt;100	u16 tx_skb_cnt;101	struct sk_buff_head tx_skb_queue;102	struct list_head tx_buf;103	struct list_head tx_pending;104	spinlock_t tx_lock;105};106 107struct cmd_buf {108	struct sk_buff *skb;109	struct hif_device_usb *hif_dev;110};111 112#define HIF_USB_START BIT(0)113#define HIF_USB_READY BIT(1)114 115struct hif_device_usb {116	struct usb_device *udev;117	struct usb_interface *interface;118	const struct usb_device_id *usb_device_id;119	const void *fw_data;120	size_t fw_size;121	struct completion fw_done;122	struct htc_target *htc_handle;123	struct hif_usb_tx tx;124	struct usb_anchor regout_submitted;125	struct usb_anchor rx_submitted;126	struct usb_anchor reg_in_submitted;127	struct usb_anchor mgmt_submitted;128	struct sk_buff *remain_skb;129	char fw_name[64];130	int fw_minor_index;131	int rx_remain_len;132	int rx_pkt_len;133	int rx_transfer_len;134	int rx_pad_len;135	spinlock_t rx_lock;136	u8 flags; /* HIF_USB_* */137};138 139int ath9k_hif_usb_init(void);140void ath9k_hif_usb_exit(void);141void ath9k_hif_usb_dealloc_urbs(struct hif_device_usb *hif_dev);142 143#endif /* HTC_USB_H */144