sfc: Don't use enums as a bitmask.
[zen-stable.git] / drivers / net / wireless / ath / ath9k / hif_usb.h
blob2bdcdbc14b1ea899c687170522e6c3ced11475e2
1 /*
2 * Copyright (c) 2010 Atheros Communications Inc.
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #ifndef HTC_USB_H
18 #define HTC_USB_H
20 #define MAJOR_VERSION_REQ 1
21 #define MINOR_VERSION_REQ 2
23 #define IS_AR7010_DEVICE(_v) (((_v) == AR9280_USB) || ((_v) == AR9287_USB))
25 #define AR9271_FIRMWARE 0x501000
26 #define AR9271_FIRMWARE_TEXT 0x903000
27 #define AR7010_FIRMWARE_TEXT 0x906000
29 #define FIRMWARE_DOWNLOAD 0x30
30 #define FIRMWARE_DOWNLOAD_COMP 0x31
32 #define ATH_USB_RX_STREAM_MODE_TAG 0x4e00
33 #define ATH_USB_TX_STREAM_MODE_TAG 0x697e
35 /* FIXME: Verify these numbers (with Windows) */
36 #define MAX_TX_URB_NUM 8
37 #define MAX_TX_BUF_NUM 256
38 #define MAX_TX_BUF_SIZE 32768
39 #define MAX_TX_AGGR_NUM 20
41 #define MAX_RX_URB_NUM 8
42 #define MAX_RX_BUF_SIZE 16384
43 #define MAX_PKT_NUM_IN_TRANSFER 10
45 #define MAX_REG_OUT_URB_NUM 1
46 #define MAX_REG_IN_URB_NUM 64
48 #define MAX_REG_IN_BUF_SIZE 64
50 /* USB Endpoint definition */
51 #define USB_WLAN_TX_PIPE 1
52 #define USB_WLAN_RX_PIPE 2
53 #define USB_REG_IN_PIPE 3
54 #define USB_REG_OUT_PIPE 4
56 #define HIF_USB_MAX_RXPIPES 2
57 #define HIF_USB_MAX_TXPIPES 4
59 struct tx_buf {
60 u8 *buf;
61 u16 len;
62 u16 offset;
63 struct urb *urb;
64 struct sk_buff_head skb_queue;
65 struct hif_device_usb *hif_dev;
66 struct list_head list;
69 #define HIF_USB_TX_STOP BIT(0)
70 #define HIF_USB_TX_FLUSH BIT(1)
72 struct hif_usb_tx {
73 u8 flags;
74 u8 tx_buf_cnt;
75 u16 tx_skb_cnt;
76 struct sk_buff_head tx_skb_queue;
77 struct list_head tx_buf;
78 struct list_head tx_pending;
79 spinlock_t tx_lock;
82 struct cmd_buf {
83 struct sk_buff *skb;
84 struct hif_device_usb *hif_dev;
87 #define HIF_USB_START BIT(0)
89 struct hif_device_usb {
90 u16 device_id;
91 struct usb_device *udev;
92 struct usb_interface *interface;
93 const struct firmware *firmware;
94 struct htc_target *htc_handle;
95 struct hif_usb_tx tx;
96 struct usb_anchor regout_submitted;
97 struct usb_anchor rx_submitted;
98 struct usb_anchor reg_in_submitted;
99 struct usb_anchor mgmt_submitted;
100 struct sk_buff *remain_skb;
101 const char *fw_name;
102 int rx_remain_len;
103 int rx_pkt_len;
104 int rx_transfer_len;
105 int rx_pad_len;
106 spinlock_t rx_lock;
107 u8 flags; /* HIF_USB_* */
110 int ath9k_hif_usb_init(void);
111 void ath9k_hif_usb_exit(void);
113 #endif /* HTC_USB_H */