162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright (c) 2006 Damien Bergamini <damien.bergamini@free.fr>
362306a36Sopenharmony_ci * Copyright (c) 2006 Sam Leffler, Errno Consulting
462306a36Sopenharmony_ci * Copyright (c) 2007 Christoph Hellwig <hch@lst.de>
562306a36Sopenharmony_ci * Copyright (c) 2008-2009 Weongyo Jeong <weongyo@freebsd.org>
662306a36Sopenharmony_ci * Copyright (c) 2012 Pontus Fuchs <pontus.fuchs@gmail.com>
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any
962306a36Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above
1062306a36Sopenharmony_ci * copyright notice and this permission notice appear in all copies.
1162306a36Sopenharmony_ci *
1262306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1362306a36Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1462306a36Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1562306a36Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1662306a36Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1762306a36Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1862306a36Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1962306a36Sopenharmony_ci */
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci/* all fields are big endian */
2262306a36Sopenharmony_cistruct ar5523_fwblock {
2362306a36Sopenharmony_ci	__be32		flags;
2462306a36Sopenharmony_ci#define AR5523_WRITE_BLOCK	(1 << 4)
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci	__be32	len;
2762306a36Sopenharmony_ci#define AR5523_MAX_FWBLOCK_SIZE	2048
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci	__be32		total;
3062306a36Sopenharmony_ci	__be32		remain;
3162306a36Sopenharmony_ci	__be32		rxtotal;
3262306a36Sopenharmony_ci	__be32		pad[123];
3362306a36Sopenharmony_ci} __packed;
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci#define AR5523_MAX_RXCMDSZ	1024
3662306a36Sopenharmony_ci#define AR5523_MAX_TXCMDSZ	1024
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_cistruct ar5523_cmd_hdr {
3962306a36Sopenharmony_ci	__be32		len;
4062306a36Sopenharmony_ci	__be32		code;
4162306a36Sopenharmony_ci/* NB: these are defined for rev 1.5 firmware; rev 1.6 is different */
4262306a36Sopenharmony_ci/* messages from Host -> Target */
4362306a36Sopenharmony_ci#define	WDCMSG_HOST_AVAILABLE		0x01
4462306a36Sopenharmony_ci#define WDCMSG_BIND			0x02
4562306a36Sopenharmony_ci#define WDCMSG_TARGET_RESET		0x03
4662306a36Sopenharmony_ci#define WDCMSG_TARGET_GET_CAPABILITY	0x04
4762306a36Sopenharmony_ci#define WDCMSG_TARGET_SET_CONFIG	0x05
4862306a36Sopenharmony_ci#define WDCMSG_TARGET_GET_STATUS	0x06
4962306a36Sopenharmony_ci#define WDCMSG_TARGET_GET_STATS		0x07
5062306a36Sopenharmony_ci#define WDCMSG_TARGET_START		0x08
5162306a36Sopenharmony_ci#define WDCMSG_TARGET_STOP		0x09
5262306a36Sopenharmony_ci#define WDCMSG_TARGET_ENABLE		0x0a
5362306a36Sopenharmony_ci#define WDCMSG_TARGET_DISABLE		0x0b
5462306a36Sopenharmony_ci#define	WDCMSG_CREATE_CONNECTION	0x0c
5562306a36Sopenharmony_ci#define WDCMSG_UPDATE_CONNECT_ATTR	0x0d
5662306a36Sopenharmony_ci#define	WDCMSG_DELETE_CONNECT		0x0e
5762306a36Sopenharmony_ci#define	WDCMSG_SEND			0x0f
5862306a36Sopenharmony_ci#define WDCMSG_FLUSH			0x10
5962306a36Sopenharmony_ci/* messages from Target -> Host */
6062306a36Sopenharmony_ci#define	WDCMSG_STATS_UPDATE		0x11
6162306a36Sopenharmony_ci#define	WDCMSG_BMISS			0x12
6262306a36Sopenharmony_ci#define	WDCMSG_DEVICE_AVAIL		0x13
6362306a36Sopenharmony_ci#define	WDCMSG_SEND_COMPLETE		0x14
6462306a36Sopenharmony_ci#define	WDCMSG_DATA_AVAIL		0x15
6562306a36Sopenharmony_ci#define	WDCMSG_SET_PWR_MODE		0x16
6662306a36Sopenharmony_ci#define	WDCMSG_BMISS_ACK		0x17
6762306a36Sopenharmony_ci#define	WDCMSG_SET_LED_STEADY		0x18
6862306a36Sopenharmony_ci#define	WDCMSG_SET_LED_BLINK		0x19
6962306a36Sopenharmony_ci/* more messages */
7062306a36Sopenharmony_ci#define	WDCMSG_SETUP_BEACON_DESC	0x1a
7162306a36Sopenharmony_ci#define	WDCMSG_BEACON_INIT		0x1b
7262306a36Sopenharmony_ci#define	WDCMSG_RESET_KEY_CACHE		0x1c
7362306a36Sopenharmony_ci#define	WDCMSG_RESET_KEY_CACHE_ENTRY	0x1d
7462306a36Sopenharmony_ci#define	WDCMSG_SET_KEY_CACHE_ENTRY	0x1e
7562306a36Sopenharmony_ci#define	WDCMSG_SET_DECOMP_MASK		0x1f
7662306a36Sopenharmony_ci#define	WDCMSG_SET_REGULATORY_DOMAIN	0x20
7762306a36Sopenharmony_ci#define	WDCMSG_SET_LED_STATE		0x21
7862306a36Sopenharmony_ci#define	WDCMSG_WRITE_ASSOCID		0x22
7962306a36Sopenharmony_ci#define	WDCMSG_SET_STA_BEACON_TIMERS	0x23
8062306a36Sopenharmony_ci#define	WDCMSG_GET_TSF			0x24
8162306a36Sopenharmony_ci#define	WDCMSG_RESET_TSF		0x25
8262306a36Sopenharmony_ci#define	WDCMSG_SET_ADHOC_MODE		0x26
8362306a36Sopenharmony_ci#define	WDCMSG_SET_BASIC_RATE		0x27
8462306a36Sopenharmony_ci#define	WDCMSG_MIB_CONTROL		0x28
8562306a36Sopenharmony_ci#define	WDCMSG_GET_CHANNEL_DATA		0x29
8662306a36Sopenharmony_ci#define	WDCMSG_GET_CUR_RSSI		0x2a
8762306a36Sopenharmony_ci#define	WDCMSG_SET_ANTENNA_SWITCH	0x2b
8862306a36Sopenharmony_ci#define	WDCMSG_USE_SHORT_SLOT_TIME	0x2f
8962306a36Sopenharmony_ci#define	WDCMSG_SET_POWER_MODE		0x30
9062306a36Sopenharmony_ci#define	WDCMSG_SETUP_PSPOLL_DESC	0x31
9162306a36Sopenharmony_ci#define	WDCMSG_SET_RX_MULTICAST_FILTER	0x32
9262306a36Sopenharmony_ci#define	WDCMSG_RX_FILTER		0x33
9362306a36Sopenharmony_ci#define	WDCMSG_PER_CALIBRATION		0x34
9462306a36Sopenharmony_ci#define	WDCMSG_RESET			0x35
9562306a36Sopenharmony_ci#define	WDCMSG_DISABLE			0x36
9662306a36Sopenharmony_ci#define	WDCMSG_PHY_DISABLE		0x37
9762306a36Sopenharmony_ci#define	WDCMSG_SET_TX_POWER_LIMIT	0x38
9862306a36Sopenharmony_ci#define	WDCMSG_SET_TX_QUEUE_PARAMS	0x39
9962306a36Sopenharmony_ci#define	WDCMSG_SETUP_TX_QUEUE		0x3a
10062306a36Sopenharmony_ci#define	WDCMSG_RELEASE_TX_QUEUE		0x3b
10162306a36Sopenharmony_ci#define	WDCMSG_SET_DEFAULT_KEY		0x43
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci	__u32		priv;	/* driver private data,
10462306a36Sopenharmony_ci				   don't care about endianess */
10562306a36Sopenharmony_ci	__be32		magic;
10662306a36Sopenharmony_ci	__be32		reserved2[4];
10762306a36Sopenharmony_ci};
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_cistruct ar5523_cmd_host_available {
11062306a36Sopenharmony_ci	__be32	sw_ver_major;
11162306a36Sopenharmony_ci	__be32	sw_ver_minor;
11262306a36Sopenharmony_ci	__be32	sw_ver_patch;
11362306a36Sopenharmony_ci	__be32	sw_ver_build;
11462306a36Sopenharmony_ci} __packed;
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ci#define	ATH_SW_VER_MAJOR	1
11762306a36Sopenharmony_ci#define	ATH_SW_VER_MINOR	5
11862306a36Sopenharmony_ci#define	ATH_SW_VER_PATCH	0
11962306a36Sopenharmony_ci#define	ATH_SW_VER_BUILD	9999
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_cistruct ar5523_chunk {
12262306a36Sopenharmony_ci	u8		seqnum;		/* sequence number for ordering */
12362306a36Sopenharmony_ci	u8		flags;
12462306a36Sopenharmony_ci#define	UATH_CFLAGS_FINAL	0x01	/* final chunk of a msg */
12562306a36Sopenharmony_ci#define	UATH_CFLAGS_RXMSG	0x02	/* chunk contains rx completion */
12662306a36Sopenharmony_ci#define	UATH_CFLAGS_DEBUG	0x04	/* for debugging */
12762306a36Sopenharmony_ci	__be16		length;		/* chunk size in bytes */
12862306a36Sopenharmony_ci	/* chunk data follows */
12962306a36Sopenharmony_ci} __packed;
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ci/*
13262306a36Sopenharmony_ci * Message format for a WDCMSG_DATA_AVAIL message from Target to Host.
13362306a36Sopenharmony_ci */
13462306a36Sopenharmony_cistruct ar5523_rx_desc {
13562306a36Sopenharmony_ci	__be32	len;		/* msg length including header */
13662306a36Sopenharmony_ci	__be32	code;		/* WDCMSG_DATA_AVAIL */
13762306a36Sopenharmony_ci	__be32	gennum;		/* generation number */
13862306a36Sopenharmony_ci	__be32	status;		/* start of RECEIVE_INFO */
13962306a36Sopenharmony_ci#define	UATH_STATUS_OK			0
14062306a36Sopenharmony_ci#define	UATH_STATUS_STOP_IN_PROGRESS	1
14162306a36Sopenharmony_ci#define	UATH_STATUS_CRC_ERR		2
14262306a36Sopenharmony_ci#define	UATH_STATUS_PHY_ERR		3
14362306a36Sopenharmony_ci#define	UATH_STATUS_DECRYPT_CRC_ERR	4
14462306a36Sopenharmony_ci#define	UATH_STATUS_DECRYPT_MIC_ERR	5
14562306a36Sopenharmony_ci#define	UATH_STATUS_DECOMP_ERR		6
14662306a36Sopenharmony_ci#define	UATH_STATUS_KEY_ERR		7
14762306a36Sopenharmony_ci#define	UATH_STATUS_ERR			8
14862306a36Sopenharmony_ci	__be32	tstamp_low;	/* low-order 32-bits of rx timestamp */
14962306a36Sopenharmony_ci	__be32	tstamp_high;	/* high-order 32-bits of rx timestamp */
15062306a36Sopenharmony_ci	__be32	framelen;	/* frame length */
15162306a36Sopenharmony_ci	__be32	rate;		/* rx rate code */
15262306a36Sopenharmony_ci	__be32	antenna;
15362306a36Sopenharmony_ci	__be32	rssi;
15462306a36Sopenharmony_ci	__be32	channel;
15562306a36Sopenharmony_ci	__be32	phyerror;
15662306a36Sopenharmony_ci	__be32	connix;		/* key table ix for bss traffic */
15762306a36Sopenharmony_ci	__be32	decrypterror;
15862306a36Sopenharmony_ci	__be32	keycachemiss;
15962306a36Sopenharmony_ci	__be32	pad;		/* XXX? */
16062306a36Sopenharmony_ci} __packed;
16162306a36Sopenharmony_ci
16262306a36Sopenharmony_cistruct ar5523_tx_desc {
16362306a36Sopenharmony_ci	__be32	msglen;
16462306a36Sopenharmony_ci	u32	msgid;		/* msg id (supplied by host) */
16562306a36Sopenharmony_ci	__be32	type;		/* opcode: WDMSG_SEND or WDCMSG_FLUSH */
16662306a36Sopenharmony_ci	__be32	txqid;		/* tx queue id and flags */
16762306a36Sopenharmony_ci#define	UATH_TXQID_MASK		0x0f
16862306a36Sopenharmony_ci#define	UATH_TXQID_MINRATE	0x10	/* use min tx rate */
16962306a36Sopenharmony_ci#define	UATH_TXQID_FF		0x20	/* content is fast frame */
17062306a36Sopenharmony_ci	__be32	connid;		/* tx connection id */
17162306a36Sopenharmony_ci#define UATH_ID_INVALID	0xffffffff	/* for sending prior to connection */
17262306a36Sopenharmony_ci	__be32	flags;		/* non-zero if response desired */
17362306a36Sopenharmony_ci#define UATH_TX_NOTIFY	(1 << 24)	/* f/w will send a UATH_NOTIF_TX */
17462306a36Sopenharmony_ci	__be32	buflen;		/* payload length */
17562306a36Sopenharmony_ci} __packed;
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ci
17862306a36Sopenharmony_ci#define AR5523_ID_BSS		2
17962306a36Sopenharmony_ci#define AR5523_ID_BROADCAST	0xffffffff
18062306a36Sopenharmony_ci
18162306a36Sopenharmony_ci/* structure for command UATH_CMD_WRITE_MAC */
18262306a36Sopenharmony_cistruct ar5523_write_mac {
18362306a36Sopenharmony_ci	__be32	reg;
18462306a36Sopenharmony_ci	__be32	len;
18562306a36Sopenharmony_ci	u8		data[32];
18662306a36Sopenharmony_ci} __packed;
18762306a36Sopenharmony_ci
18862306a36Sopenharmony_cistruct ar5523_cmd_rateset {
18962306a36Sopenharmony_ci	__u8		length;
19062306a36Sopenharmony_ci#define AR5523_MAX_NRATES	32
19162306a36Sopenharmony_ci	__u8		set[AR5523_MAX_NRATES];
19262306a36Sopenharmony_ci};
19362306a36Sopenharmony_ci
19462306a36Sopenharmony_cistruct ar5523_cmd_set_associd {		/* AR5523_WRITE_ASSOCID */
19562306a36Sopenharmony_ci	__be32	defaultrateix;
19662306a36Sopenharmony_ci	__be32	associd;
19762306a36Sopenharmony_ci	__be32	timoffset;
19862306a36Sopenharmony_ci	__be32	turboprime;
19962306a36Sopenharmony_ci	__u8	bssid[6];
20062306a36Sopenharmony_ci} __packed;
20162306a36Sopenharmony_ci
20262306a36Sopenharmony_ci/* structure for command WDCMSG_RESET */
20362306a36Sopenharmony_cistruct ar5523_cmd_reset {
20462306a36Sopenharmony_ci	__be32	flags;		/* channel flags */
20562306a36Sopenharmony_ci#define	UATH_CHAN_TURBO	0x0100
20662306a36Sopenharmony_ci#define	UATH_CHAN_CCK	0x0200
20762306a36Sopenharmony_ci#define	UATH_CHAN_OFDM	0x0400
20862306a36Sopenharmony_ci#define	UATH_CHAN_2GHZ	0x1000
20962306a36Sopenharmony_ci#define	UATH_CHAN_5GHZ	0x2000
21062306a36Sopenharmony_ci	__be32	freq;		/* channel frequency */
21162306a36Sopenharmony_ci	__be32	maxrdpower;
21262306a36Sopenharmony_ci	__be32	cfgctl;
21362306a36Sopenharmony_ci	__be32	twiceantennareduction;
21462306a36Sopenharmony_ci	__be32	channelchange;
21562306a36Sopenharmony_ci	__be32	keeprccontent;
21662306a36Sopenharmony_ci} __packed;
21762306a36Sopenharmony_ci
21862306a36Sopenharmony_ci/* structure for command WDCMSG_SET_BASIC_RATE */
21962306a36Sopenharmony_cistruct ar5523_cmd_rates {
22062306a36Sopenharmony_ci	__be32	connid;
22162306a36Sopenharmony_ci	__be32	keeprccontent;
22262306a36Sopenharmony_ci	__be32	size;
22362306a36Sopenharmony_ci	struct ar5523_cmd_rateset rateset;
22462306a36Sopenharmony_ci} __packed;
22562306a36Sopenharmony_ci
22662306a36Sopenharmony_cienum {
22762306a36Sopenharmony_ci	WLAN_MODE_NONE = 0,
22862306a36Sopenharmony_ci	WLAN_MODE_11b,
22962306a36Sopenharmony_ci	WLAN_MODE_11a,
23062306a36Sopenharmony_ci	WLAN_MODE_11g,
23162306a36Sopenharmony_ci	WLAN_MODE_11a_TURBO,
23262306a36Sopenharmony_ci	WLAN_MODE_11g_TURBO,
23362306a36Sopenharmony_ci	WLAN_MODE_11a_TURBO_PRIME,
23462306a36Sopenharmony_ci	WLAN_MODE_11g_TURBO_PRIME,
23562306a36Sopenharmony_ci	WLAN_MODE_11a_XR,
23662306a36Sopenharmony_ci	WLAN_MODE_11g_XR,
23762306a36Sopenharmony_ci};
23862306a36Sopenharmony_ci
23962306a36Sopenharmony_cistruct ar5523_cmd_connection_attr {
24062306a36Sopenharmony_ci	__be32	longpreambleonly;
24162306a36Sopenharmony_ci	struct ar5523_cmd_rateset	rateset;
24262306a36Sopenharmony_ci	__be32	wlanmode;
24362306a36Sopenharmony_ci} __packed;
24462306a36Sopenharmony_ci
24562306a36Sopenharmony_ci/* structure for command AR5523_CREATE_CONNECTION */
24662306a36Sopenharmony_cistruct ar5523_cmd_create_connection {
24762306a36Sopenharmony_ci	__be32	connid;
24862306a36Sopenharmony_ci	__be32	bssid;
24962306a36Sopenharmony_ci	__be32	size;
25062306a36Sopenharmony_ci	struct ar5523_cmd_connection_attr	connattr;
25162306a36Sopenharmony_ci} __packed;
25262306a36Sopenharmony_ci
25362306a36Sopenharmony_cistruct ar5523_cmd_ledsteady {		/* WDCMSG_SET_LED_STEADY */
25462306a36Sopenharmony_ci	__be32	lednum;
25562306a36Sopenharmony_ci#define UATH_LED_LINK		0
25662306a36Sopenharmony_ci#define UATH_LED_ACTIVITY	1
25762306a36Sopenharmony_ci	__be32	ledmode;
25862306a36Sopenharmony_ci#define UATH_LED_OFF	0
25962306a36Sopenharmony_ci#define UATH_LED_ON	1
26062306a36Sopenharmony_ci} __packed;
26162306a36Sopenharmony_ci
26262306a36Sopenharmony_cistruct ar5523_cmd_ledblink {		/* WDCMSG_SET_LED_BLINK */
26362306a36Sopenharmony_ci	__be32	lednum;
26462306a36Sopenharmony_ci	__be32	ledmode;
26562306a36Sopenharmony_ci	__be32	blinkrate;
26662306a36Sopenharmony_ci	__be32	slowmode;
26762306a36Sopenharmony_ci} __packed;
26862306a36Sopenharmony_ci
26962306a36Sopenharmony_cistruct ar5523_cmd_ledstate {		/* WDCMSG_SET_LED_STATE */
27062306a36Sopenharmony_ci	__be32	connected;
27162306a36Sopenharmony_ci} __packed;
27262306a36Sopenharmony_ci
27362306a36Sopenharmony_cistruct ar5523_cmd_txq_attr {
27462306a36Sopenharmony_ci	__be32	priority;
27562306a36Sopenharmony_ci	__be32	aifs;
27662306a36Sopenharmony_ci	__be32	logcwmin;
27762306a36Sopenharmony_ci	__be32	logcwmax;
27862306a36Sopenharmony_ci	__be32	bursttime;
27962306a36Sopenharmony_ci	__be32	mode;
28062306a36Sopenharmony_ci	__be32	qflags;
28162306a36Sopenharmony_ci} __packed;
28262306a36Sopenharmony_ci
28362306a36Sopenharmony_cistruct ar5523_cmd_txq_setup {		/* WDCMSG_SETUP_TX_QUEUE */
28462306a36Sopenharmony_ci	__be32	qid;
28562306a36Sopenharmony_ci	__be32	len;
28662306a36Sopenharmony_ci	struct ar5523_cmd_txq_attr attr;
28762306a36Sopenharmony_ci} __packed;
28862306a36Sopenharmony_ci
28962306a36Sopenharmony_cistruct ar5523_cmd_rx_filter {		/* WDCMSG_RX_FILTER */
29062306a36Sopenharmony_ci	__be32	bits;
29162306a36Sopenharmony_ci#define UATH_FILTER_RX_UCAST		0x00000001
29262306a36Sopenharmony_ci#define UATH_FILTER_RX_MCAST		0x00000002
29362306a36Sopenharmony_ci#define UATH_FILTER_RX_BCAST		0x00000004
29462306a36Sopenharmony_ci#define UATH_FILTER_RX_CONTROL		0x00000008
29562306a36Sopenharmony_ci#define UATH_FILTER_RX_BEACON		0x00000010	/* beacon frames */
29662306a36Sopenharmony_ci#define UATH_FILTER_RX_PROM		0x00000020	/* promiscuous mode */
29762306a36Sopenharmony_ci#define UATH_FILTER_RX_PHY_ERR		0x00000040	/* phy errors */
29862306a36Sopenharmony_ci#define UATH_FILTER_RX_PHY_RADAR	0x00000080	/* radar phy errors */
29962306a36Sopenharmony_ci#define UATH_FILTER_RX_XR_POOL		0x00000400	/* XR group polls */
30062306a36Sopenharmony_ci#define UATH_FILTER_RX_PROBE_REQ	0x00000800
30162306a36Sopenharmony_ci	__be32	op;
30262306a36Sopenharmony_ci#define UATH_FILTER_OP_INIT		0x0
30362306a36Sopenharmony_ci#define UATH_FILTER_OP_SET		0x1
30462306a36Sopenharmony_ci#define UATH_FILTER_OP_CLEAR		0x2
30562306a36Sopenharmony_ci#define UATH_FILTER_OP_TEMP		0x3
30662306a36Sopenharmony_ci#define UATH_FILTER_OP_RESTORE		0x4
30762306a36Sopenharmony_ci} __packed;
30862306a36Sopenharmony_ci
30962306a36Sopenharmony_cienum {
31062306a36Sopenharmony_ci	CFG_NONE,			/* Sentinal to indicate "no config" */
31162306a36Sopenharmony_ci	CFG_REG_DOMAIN,			/* Regulatory Domain */
31262306a36Sopenharmony_ci	CFG_RATE_CONTROL_ENABLE,
31362306a36Sopenharmony_ci	CFG_DEF_XMIT_DATA_RATE,		/* NB: if rate control is not enabled */
31462306a36Sopenharmony_ci	CFG_HW_TX_RETRIES,
31562306a36Sopenharmony_ci	CFG_SW_TX_RETRIES,
31662306a36Sopenharmony_ci	CFG_SLOW_CLOCK_ENABLE,
31762306a36Sopenharmony_ci	CFG_COMP_PROC,
31862306a36Sopenharmony_ci	CFG_USER_RTS_THRESHOLD,
31962306a36Sopenharmony_ci	CFG_XR2NORM_RATE_THRESHOLD,
32062306a36Sopenharmony_ci	CFG_XRMODE_SWITCH_COUNT,
32162306a36Sopenharmony_ci	CFG_PROTECTION_TYPE,
32262306a36Sopenharmony_ci	CFG_BURST_SEQ_THRESHOLD,
32362306a36Sopenharmony_ci	CFG_ABOLT,
32462306a36Sopenharmony_ci	CFG_IQ_LOG_COUNT_MAX,
32562306a36Sopenharmony_ci	CFG_MODE_CTS,
32662306a36Sopenharmony_ci	CFG_WME_ENABLED,
32762306a36Sopenharmony_ci	CFG_GPRS_CBR_PERIOD,
32862306a36Sopenharmony_ci	CFG_SERVICE_TYPE,
32962306a36Sopenharmony_ci	/* MAC Address to use.  Overrides EEPROM */
33062306a36Sopenharmony_ci	CFG_MAC_ADDR,
33162306a36Sopenharmony_ci	CFG_DEBUG_EAR,
33262306a36Sopenharmony_ci	CFG_INIT_REGS,
33362306a36Sopenharmony_ci	/* An ID for use in error & debug messages */
33462306a36Sopenharmony_ci	CFG_DEBUG_ID,
33562306a36Sopenharmony_ci	CFG_COMP_WIN_SZ,
33662306a36Sopenharmony_ci	CFG_DIVERSITY_CTL,
33762306a36Sopenharmony_ci	CFG_TP_SCALE,
33862306a36Sopenharmony_ci	CFG_TPC_HALF_DBM5,
33962306a36Sopenharmony_ci	CFG_TPC_HALF_DBM2,
34062306a36Sopenharmony_ci	CFG_OVERRD_TX_POWER,
34162306a36Sopenharmony_ci	CFG_USE_32KHZ_CLOCK,
34262306a36Sopenharmony_ci	CFG_GMODE_PROTECTION,
34362306a36Sopenharmony_ci	CFG_GMODE_PROTECT_RATE_INDEX,
34462306a36Sopenharmony_ci	CFG_GMODE_NON_ERP_PREAMBLE,
34562306a36Sopenharmony_ci	CFG_WDC_TRANSPORT_CHUNK_SIZE,
34662306a36Sopenharmony_ci};
34762306a36Sopenharmony_ci
34862306a36Sopenharmony_cienum {
34962306a36Sopenharmony_ci	/* Sentinal to indicate "no capability" */
35062306a36Sopenharmony_ci	CAP_NONE,
35162306a36Sopenharmony_ci	CAP_ALL,			/* ALL capabilities */
35262306a36Sopenharmony_ci	CAP_TARGET_VERSION,
35362306a36Sopenharmony_ci	CAP_TARGET_REVISION,
35462306a36Sopenharmony_ci	CAP_MAC_VERSION,
35562306a36Sopenharmony_ci	CAP_MAC_REVISION,
35662306a36Sopenharmony_ci	CAP_PHY_REVISION,
35762306a36Sopenharmony_ci	CAP_ANALOG_5GHz_REVISION,
35862306a36Sopenharmony_ci	CAP_ANALOG_2GHz_REVISION,
35962306a36Sopenharmony_ci	/* Target supports WDC message debug features */
36062306a36Sopenharmony_ci	CAP_DEBUG_WDCMSG_SUPPORT,
36162306a36Sopenharmony_ci
36262306a36Sopenharmony_ci	CAP_REG_DOMAIN,
36362306a36Sopenharmony_ci	CAP_COUNTRY_CODE,
36462306a36Sopenharmony_ci	CAP_REG_CAP_BITS,
36562306a36Sopenharmony_ci
36662306a36Sopenharmony_ci	CAP_WIRELESS_MODES,
36762306a36Sopenharmony_ci	CAP_CHAN_SPREAD_SUPPORT,
36862306a36Sopenharmony_ci	CAP_SLEEP_AFTER_BEACON_BROKEN,
36962306a36Sopenharmony_ci	CAP_COMPRESS_SUPPORT,
37062306a36Sopenharmony_ci	CAP_BURST_SUPPORT,
37162306a36Sopenharmony_ci	CAP_FAST_FRAMES_SUPPORT,
37262306a36Sopenharmony_ci	CAP_CHAP_TUNING_SUPPORT,
37362306a36Sopenharmony_ci	CAP_TURBOG_SUPPORT,
37462306a36Sopenharmony_ci	CAP_TURBO_PRIME_SUPPORT,
37562306a36Sopenharmony_ci	CAP_DEVICE_TYPE,
37662306a36Sopenharmony_ci	CAP_XR_SUPPORT,
37762306a36Sopenharmony_ci	CAP_WME_SUPPORT,
37862306a36Sopenharmony_ci	CAP_TOTAL_QUEUES,
37962306a36Sopenharmony_ci	CAP_CONNECTION_ID_MAX,		/* Should absorb CAP_KEY_CACHE_SIZE */
38062306a36Sopenharmony_ci
38162306a36Sopenharmony_ci	CAP_LOW_5GHZ_CHAN,
38262306a36Sopenharmony_ci	CAP_HIGH_5GHZ_CHAN,
38362306a36Sopenharmony_ci	CAP_LOW_2GHZ_CHAN,
38462306a36Sopenharmony_ci	CAP_HIGH_2GHZ_CHAN,
38562306a36Sopenharmony_ci
38662306a36Sopenharmony_ci	CAP_MIC_AES_CCM,
38762306a36Sopenharmony_ci	CAP_MIC_CKIP,
38862306a36Sopenharmony_ci	CAP_MIC_TKIP,
38962306a36Sopenharmony_ci	CAP_MIC_TKIP_WME,
39062306a36Sopenharmony_ci	CAP_CIPHER_AES_CCM,
39162306a36Sopenharmony_ci	CAP_CIPHER_CKIP,
39262306a36Sopenharmony_ci	CAP_CIPHER_TKIP,
39362306a36Sopenharmony_ci
39462306a36Sopenharmony_ci	CAP_TWICE_ANTENNAGAIN_5G,
39562306a36Sopenharmony_ci	CAP_TWICE_ANTENNAGAIN_2G,
39662306a36Sopenharmony_ci};
39762306a36Sopenharmony_ci
39862306a36Sopenharmony_cienum {
39962306a36Sopenharmony_ci	ST_NONE,                    /* Sentinal to indicate "no status" */
40062306a36Sopenharmony_ci	ST_ALL,
40162306a36Sopenharmony_ci	ST_SERVICE_TYPE,
40262306a36Sopenharmony_ci	ST_WLAN_MODE,
40362306a36Sopenharmony_ci	ST_FREQ,
40462306a36Sopenharmony_ci	ST_BAND,
40562306a36Sopenharmony_ci	ST_LAST_RSSI,
40662306a36Sopenharmony_ci	ST_PS_FRAMES_DROPPED,
40762306a36Sopenharmony_ci	ST_CACHED_DEF_ANT,
40862306a36Sopenharmony_ci	ST_COUNT_OTHER_RX_ANT,
40962306a36Sopenharmony_ci	ST_USE_FAST_DIVERSITY,
41062306a36Sopenharmony_ci	ST_MAC_ADDR,
41162306a36Sopenharmony_ci	ST_RX_GENERATION_NUM,
41262306a36Sopenharmony_ci	ST_TX_QUEUE_DEPTH,
41362306a36Sopenharmony_ci	ST_SERIAL_NUMBER,
41462306a36Sopenharmony_ci	ST_WDC_TRANSPORT_CHUNK_SIZE,
41562306a36Sopenharmony_ci};
41662306a36Sopenharmony_ci
41762306a36Sopenharmony_cienum {
41862306a36Sopenharmony_ci	TARGET_DEVICE_AWAKE,
41962306a36Sopenharmony_ci	TARGET_DEVICE_SLEEP,
42062306a36Sopenharmony_ci	TARGET_DEVICE_PWRDN,
42162306a36Sopenharmony_ci	TARGET_DEVICE_PWRSAVE,
42262306a36Sopenharmony_ci	TARGET_DEVICE_SUSPEND,
42362306a36Sopenharmony_ci	TARGET_DEVICE_RESUME,
42462306a36Sopenharmony_ci};
42562306a36Sopenharmony_ci
42662306a36Sopenharmony_ci/* this is in net/ieee80211.h, but that conflicts with the mac80211 headers */
42762306a36Sopenharmony_ci#define IEEE80211_2ADDR_LEN	16
42862306a36Sopenharmony_ci
42962306a36Sopenharmony_ci#define AR5523_MIN_RXBUFSZ				\
43062306a36Sopenharmony_ci	(((sizeof(__be32) + IEEE80211_2ADDR_LEN +	\
43162306a36Sopenharmony_ci	   sizeof(struct ar5523_rx_desc)) + 3) & ~3)
432