18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright (c) 2006 Damien Bergamini <damien.bergamini@free.fr>
38c2ecf20Sopenharmony_ci * Copyright (c) 2006 Sam Leffler, Errno Consulting
48c2ecf20Sopenharmony_ci * Copyright (c) 2007 Christoph Hellwig <hch@lst.de>
58c2ecf20Sopenharmony_ci * Copyright (c) 2008-2009 Weongyo Jeong <weongyo@freebsd.org>
68c2ecf20Sopenharmony_ci * Copyright (c) 2012 Pontus Fuchs <pontus.fuchs@gmail.com>
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any
98c2ecf20Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above
108c2ecf20Sopenharmony_ci * copyright notice and this permission notice appear in all copies.
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
138c2ecf20Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
148c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
158c2ecf20Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
168c2ecf20Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
178c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
188c2ecf20Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
198c2ecf20Sopenharmony_ci */
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/* all fields are big endian */
228c2ecf20Sopenharmony_cistruct ar5523_fwblock {
238c2ecf20Sopenharmony_ci	__be32		flags;
248c2ecf20Sopenharmony_ci#define AR5523_WRITE_BLOCK	(1 << 4)
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci	__be32	len;
278c2ecf20Sopenharmony_ci#define AR5523_MAX_FWBLOCK_SIZE	2048
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci	__be32		total;
308c2ecf20Sopenharmony_ci	__be32		remain;
318c2ecf20Sopenharmony_ci	__be32		rxtotal;
328c2ecf20Sopenharmony_ci	__be32		pad[123];
338c2ecf20Sopenharmony_ci} __packed;
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#define AR5523_MAX_RXCMDSZ	1024
368c2ecf20Sopenharmony_ci#define AR5523_MAX_TXCMDSZ	1024
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_cistruct ar5523_cmd_hdr {
398c2ecf20Sopenharmony_ci	__be32		len;
408c2ecf20Sopenharmony_ci	__be32		code;
418c2ecf20Sopenharmony_ci/* NB: these are defined for rev 1.5 firmware; rev 1.6 is different */
428c2ecf20Sopenharmony_ci/* messages from Host -> Target */
438c2ecf20Sopenharmony_ci#define	WDCMSG_HOST_AVAILABLE		0x01
448c2ecf20Sopenharmony_ci#define WDCMSG_BIND			0x02
458c2ecf20Sopenharmony_ci#define WDCMSG_TARGET_RESET		0x03
468c2ecf20Sopenharmony_ci#define WDCMSG_TARGET_GET_CAPABILITY	0x04
478c2ecf20Sopenharmony_ci#define WDCMSG_TARGET_SET_CONFIG	0x05
488c2ecf20Sopenharmony_ci#define WDCMSG_TARGET_GET_STATUS	0x06
498c2ecf20Sopenharmony_ci#define WDCMSG_TARGET_GET_STATS		0x07
508c2ecf20Sopenharmony_ci#define WDCMSG_TARGET_START		0x08
518c2ecf20Sopenharmony_ci#define WDCMSG_TARGET_STOP		0x09
528c2ecf20Sopenharmony_ci#define WDCMSG_TARGET_ENABLE		0x0a
538c2ecf20Sopenharmony_ci#define WDCMSG_TARGET_DISABLE		0x0b
548c2ecf20Sopenharmony_ci#define	WDCMSG_CREATE_CONNECTION	0x0c
558c2ecf20Sopenharmony_ci#define WDCMSG_UPDATE_CONNECT_ATTR	0x0d
568c2ecf20Sopenharmony_ci#define	WDCMSG_DELETE_CONNECT		0x0e
578c2ecf20Sopenharmony_ci#define	WDCMSG_SEND			0x0f
588c2ecf20Sopenharmony_ci#define WDCMSG_FLUSH			0x10
598c2ecf20Sopenharmony_ci/* messages from Target -> Host */
608c2ecf20Sopenharmony_ci#define	WDCMSG_STATS_UPDATE		0x11
618c2ecf20Sopenharmony_ci#define	WDCMSG_BMISS			0x12
628c2ecf20Sopenharmony_ci#define	WDCMSG_DEVICE_AVAIL		0x13
638c2ecf20Sopenharmony_ci#define	WDCMSG_SEND_COMPLETE		0x14
648c2ecf20Sopenharmony_ci#define	WDCMSG_DATA_AVAIL		0x15
658c2ecf20Sopenharmony_ci#define	WDCMSG_SET_PWR_MODE		0x16
668c2ecf20Sopenharmony_ci#define	WDCMSG_BMISS_ACK		0x17
678c2ecf20Sopenharmony_ci#define	WDCMSG_SET_LED_STEADY		0x18
688c2ecf20Sopenharmony_ci#define	WDCMSG_SET_LED_BLINK		0x19
698c2ecf20Sopenharmony_ci/* more messages */
708c2ecf20Sopenharmony_ci#define	WDCMSG_SETUP_BEACON_DESC	0x1a
718c2ecf20Sopenharmony_ci#define	WDCMSG_BEACON_INIT		0x1b
728c2ecf20Sopenharmony_ci#define	WDCMSG_RESET_KEY_CACHE		0x1c
738c2ecf20Sopenharmony_ci#define	WDCMSG_RESET_KEY_CACHE_ENTRY	0x1d
748c2ecf20Sopenharmony_ci#define	WDCMSG_SET_KEY_CACHE_ENTRY	0x1e
758c2ecf20Sopenharmony_ci#define	WDCMSG_SET_DECOMP_MASK		0x1f
768c2ecf20Sopenharmony_ci#define	WDCMSG_SET_REGULATORY_DOMAIN	0x20
778c2ecf20Sopenharmony_ci#define	WDCMSG_SET_LED_STATE		0x21
788c2ecf20Sopenharmony_ci#define	WDCMSG_WRITE_ASSOCID		0x22
798c2ecf20Sopenharmony_ci#define	WDCMSG_SET_STA_BEACON_TIMERS	0x23
808c2ecf20Sopenharmony_ci#define	WDCMSG_GET_TSF			0x24
818c2ecf20Sopenharmony_ci#define	WDCMSG_RESET_TSF		0x25
828c2ecf20Sopenharmony_ci#define	WDCMSG_SET_ADHOC_MODE		0x26
838c2ecf20Sopenharmony_ci#define	WDCMSG_SET_BASIC_RATE		0x27
848c2ecf20Sopenharmony_ci#define	WDCMSG_MIB_CONTROL		0x28
858c2ecf20Sopenharmony_ci#define	WDCMSG_GET_CHANNEL_DATA		0x29
868c2ecf20Sopenharmony_ci#define	WDCMSG_GET_CUR_RSSI		0x2a
878c2ecf20Sopenharmony_ci#define	WDCMSG_SET_ANTENNA_SWITCH	0x2b
888c2ecf20Sopenharmony_ci#define	WDCMSG_USE_SHORT_SLOT_TIME	0x2f
898c2ecf20Sopenharmony_ci#define	WDCMSG_SET_POWER_MODE		0x30
908c2ecf20Sopenharmony_ci#define	WDCMSG_SETUP_PSPOLL_DESC	0x31
918c2ecf20Sopenharmony_ci#define	WDCMSG_SET_RX_MULTICAST_FILTER	0x32
928c2ecf20Sopenharmony_ci#define	WDCMSG_RX_FILTER		0x33
938c2ecf20Sopenharmony_ci#define	WDCMSG_PER_CALIBRATION		0x34
948c2ecf20Sopenharmony_ci#define	WDCMSG_RESET			0x35
958c2ecf20Sopenharmony_ci#define	WDCMSG_DISABLE			0x36
968c2ecf20Sopenharmony_ci#define	WDCMSG_PHY_DISABLE		0x37
978c2ecf20Sopenharmony_ci#define	WDCMSG_SET_TX_POWER_LIMIT	0x38
988c2ecf20Sopenharmony_ci#define	WDCMSG_SET_TX_QUEUE_PARAMS	0x39
998c2ecf20Sopenharmony_ci#define	WDCMSG_SETUP_TX_QUEUE		0x3a
1008c2ecf20Sopenharmony_ci#define	WDCMSG_RELEASE_TX_QUEUE		0x3b
1018c2ecf20Sopenharmony_ci#define	WDCMSG_SET_DEFAULT_KEY		0x43
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci	__u32		priv;	/* driver private data,
1048c2ecf20Sopenharmony_ci				   don't care about endianess */
1058c2ecf20Sopenharmony_ci	__be32		magic;
1068c2ecf20Sopenharmony_ci	__be32		reserved2[4];
1078c2ecf20Sopenharmony_ci};
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_cistruct ar5523_cmd_host_available {
1108c2ecf20Sopenharmony_ci	__be32	sw_ver_major;
1118c2ecf20Sopenharmony_ci	__be32	sw_ver_minor;
1128c2ecf20Sopenharmony_ci	__be32	sw_ver_patch;
1138c2ecf20Sopenharmony_ci	__be32	sw_ver_build;
1148c2ecf20Sopenharmony_ci} __packed;
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci#define	ATH_SW_VER_MAJOR	1
1178c2ecf20Sopenharmony_ci#define	ATH_SW_VER_MINOR	5
1188c2ecf20Sopenharmony_ci#define	ATH_SW_VER_PATCH	0
1198c2ecf20Sopenharmony_ci#define	ATH_SW_VER_BUILD	9999
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_cistruct ar5523_chunk {
1228c2ecf20Sopenharmony_ci	u8		seqnum;		/* sequence number for ordering */
1238c2ecf20Sopenharmony_ci	u8		flags;
1248c2ecf20Sopenharmony_ci#define	UATH_CFLAGS_FINAL	0x01	/* final chunk of a msg */
1258c2ecf20Sopenharmony_ci#define	UATH_CFLAGS_RXMSG	0x02	/* chunk contains rx completion */
1268c2ecf20Sopenharmony_ci#define	UATH_CFLAGS_DEBUG	0x04	/* for debugging */
1278c2ecf20Sopenharmony_ci	__be16		length;		/* chunk size in bytes */
1288c2ecf20Sopenharmony_ci	/* chunk data follows */
1298c2ecf20Sopenharmony_ci} __packed;
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci/*
1328c2ecf20Sopenharmony_ci * Message format for a WDCMSG_DATA_AVAIL message from Target to Host.
1338c2ecf20Sopenharmony_ci */
1348c2ecf20Sopenharmony_cistruct ar5523_rx_desc {
1358c2ecf20Sopenharmony_ci	__be32	len;		/* msg length including header */
1368c2ecf20Sopenharmony_ci	__be32	code;		/* WDCMSG_DATA_AVAIL */
1378c2ecf20Sopenharmony_ci	__be32	gennum;		/* generation number */
1388c2ecf20Sopenharmony_ci	__be32	status;		/* start of RECEIVE_INFO */
1398c2ecf20Sopenharmony_ci#define	UATH_STATUS_OK			0
1408c2ecf20Sopenharmony_ci#define	UATH_STATUS_STOP_IN_PROGRESS	1
1418c2ecf20Sopenharmony_ci#define	UATH_STATUS_CRC_ERR		2
1428c2ecf20Sopenharmony_ci#define	UATH_STATUS_PHY_ERR		3
1438c2ecf20Sopenharmony_ci#define	UATH_STATUS_DECRYPT_CRC_ERR	4
1448c2ecf20Sopenharmony_ci#define	UATH_STATUS_DECRYPT_MIC_ERR	5
1458c2ecf20Sopenharmony_ci#define	UATH_STATUS_DECOMP_ERR		6
1468c2ecf20Sopenharmony_ci#define	UATH_STATUS_KEY_ERR		7
1478c2ecf20Sopenharmony_ci#define	UATH_STATUS_ERR			8
1488c2ecf20Sopenharmony_ci	__be32	tstamp_low;	/* low-order 32-bits of rx timestamp */
1498c2ecf20Sopenharmony_ci	__be32	tstamp_high;	/* high-order 32-bits of rx timestamp */
1508c2ecf20Sopenharmony_ci	__be32	framelen;	/* frame length */
1518c2ecf20Sopenharmony_ci	__be32	rate;		/* rx rate code */
1528c2ecf20Sopenharmony_ci	__be32	antenna;
1538c2ecf20Sopenharmony_ci	__be32	rssi;
1548c2ecf20Sopenharmony_ci	__be32	channel;
1558c2ecf20Sopenharmony_ci	__be32	phyerror;
1568c2ecf20Sopenharmony_ci	__be32	connix;		/* key table ix for bss traffic */
1578c2ecf20Sopenharmony_ci	__be32	decrypterror;
1588c2ecf20Sopenharmony_ci	__be32	keycachemiss;
1598c2ecf20Sopenharmony_ci	__be32	pad;		/* XXX? */
1608c2ecf20Sopenharmony_ci} __packed;
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_cistruct ar5523_tx_desc {
1638c2ecf20Sopenharmony_ci	__be32	msglen;
1648c2ecf20Sopenharmony_ci	u32	msgid;		/* msg id (supplied by host) */
1658c2ecf20Sopenharmony_ci	__be32	type;		/* opcode: WDMSG_SEND or WDCMSG_FLUSH */
1668c2ecf20Sopenharmony_ci	__be32	txqid;		/* tx queue id and flags */
1678c2ecf20Sopenharmony_ci#define	UATH_TXQID_MASK		0x0f
1688c2ecf20Sopenharmony_ci#define	UATH_TXQID_MINRATE	0x10	/* use min tx rate */
1698c2ecf20Sopenharmony_ci#define	UATH_TXQID_FF		0x20	/* content is fast frame */
1708c2ecf20Sopenharmony_ci	__be32	connid;		/* tx connection id */
1718c2ecf20Sopenharmony_ci#define UATH_ID_INVALID	0xffffffff	/* for sending prior to connection */
1728c2ecf20Sopenharmony_ci	__be32	flags;		/* non-zero if response desired */
1738c2ecf20Sopenharmony_ci#define UATH_TX_NOTIFY	(1 << 24)	/* f/w will send a UATH_NOTIF_TX */
1748c2ecf20Sopenharmony_ci	__be32	buflen;		/* payload length */
1758c2ecf20Sopenharmony_ci} __packed;
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci#define AR5523_ID_BSS		2
1798c2ecf20Sopenharmony_ci#define AR5523_ID_BROADCAST	0xffffffff
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_ci/* structure for command UATH_CMD_WRITE_MAC */
1828c2ecf20Sopenharmony_cistruct ar5523_write_mac {
1838c2ecf20Sopenharmony_ci	__be32	reg;
1848c2ecf20Sopenharmony_ci	__be32	len;
1858c2ecf20Sopenharmony_ci	u8		data[32];
1868c2ecf20Sopenharmony_ci} __packed;
1878c2ecf20Sopenharmony_ci
1888c2ecf20Sopenharmony_cistruct ar5523_cmd_rateset {
1898c2ecf20Sopenharmony_ci	__u8		length;
1908c2ecf20Sopenharmony_ci#define AR5523_MAX_NRATES	32
1918c2ecf20Sopenharmony_ci	__u8		set[AR5523_MAX_NRATES];
1928c2ecf20Sopenharmony_ci};
1938c2ecf20Sopenharmony_ci
1948c2ecf20Sopenharmony_cistruct ar5523_cmd_set_associd {		/* AR5523_WRITE_ASSOCID */
1958c2ecf20Sopenharmony_ci	__be32	defaultrateix;
1968c2ecf20Sopenharmony_ci	__be32	associd;
1978c2ecf20Sopenharmony_ci	__be32	timoffset;
1988c2ecf20Sopenharmony_ci	__be32	turboprime;
1998c2ecf20Sopenharmony_ci	__u8	bssid[6];
2008c2ecf20Sopenharmony_ci} __packed;
2018c2ecf20Sopenharmony_ci
2028c2ecf20Sopenharmony_ci/* structure for command WDCMSG_RESET */
2038c2ecf20Sopenharmony_cistruct ar5523_cmd_reset {
2048c2ecf20Sopenharmony_ci	__be32	flags;		/* channel flags */
2058c2ecf20Sopenharmony_ci#define	UATH_CHAN_TURBO	0x0100
2068c2ecf20Sopenharmony_ci#define	UATH_CHAN_CCK	0x0200
2078c2ecf20Sopenharmony_ci#define	UATH_CHAN_OFDM	0x0400
2088c2ecf20Sopenharmony_ci#define	UATH_CHAN_2GHZ	0x1000
2098c2ecf20Sopenharmony_ci#define	UATH_CHAN_5GHZ	0x2000
2108c2ecf20Sopenharmony_ci	__be32	freq;		/* channel frequency */
2118c2ecf20Sopenharmony_ci	__be32	maxrdpower;
2128c2ecf20Sopenharmony_ci	__be32	cfgctl;
2138c2ecf20Sopenharmony_ci	__be32	twiceantennareduction;
2148c2ecf20Sopenharmony_ci	__be32	channelchange;
2158c2ecf20Sopenharmony_ci	__be32	keeprccontent;
2168c2ecf20Sopenharmony_ci} __packed;
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci/* structure for command WDCMSG_SET_BASIC_RATE */
2198c2ecf20Sopenharmony_cistruct ar5523_cmd_rates {
2208c2ecf20Sopenharmony_ci	__be32	connid;
2218c2ecf20Sopenharmony_ci	__be32	keeprccontent;
2228c2ecf20Sopenharmony_ci	__be32	size;
2238c2ecf20Sopenharmony_ci	struct ar5523_cmd_rateset rateset;
2248c2ecf20Sopenharmony_ci} __packed;
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_cienum {
2278c2ecf20Sopenharmony_ci	WLAN_MODE_NONE = 0,
2288c2ecf20Sopenharmony_ci	WLAN_MODE_11b,
2298c2ecf20Sopenharmony_ci	WLAN_MODE_11a,
2308c2ecf20Sopenharmony_ci	WLAN_MODE_11g,
2318c2ecf20Sopenharmony_ci	WLAN_MODE_11a_TURBO,
2328c2ecf20Sopenharmony_ci	WLAN_MODE_11g_TURBO,
2338c2ecf20Sopenharmony_ci	WLAN_MODE_11a_TURBO_PRIME,
2348c2ecf20Sopenharmony_ci	WLAN_MODE_11g_TURBO_PRIME,
2358c2ecf20Sopenharmony_ci	WLAN_MODE_11a_XR,
2368c2ecf20Sopenharmony_ci	WLAN_MODE_11g_XR,
2378c2ecf20Sopenharmony_ci};
2388c2ecf20Sopenharmony_ci
2398c2ecf20Sopenharmony_cistruct ar5523_cmd_connection_attr {
2408c2ecf20Sopenharmony_ci	__be32	longpreambleonly;
2418c2ecf20Sopenharmony_ci	struct ar5523_cmd_rateset	rateset;
2428c2ecf20Sopenharmony_ci	__be32	wlanmode;
2438c2ecf20Sopenharmony_ci} __packed;
2448c2ecf20Sopenharmony_ci
2458c2ecf20Sopenharmony_ci/* structure for command AR5523_CREATE_CONNECTION */
2468c2ecf20Sopenharmony_cistruct ar5523_cmd_create_connection {
2478c2ecf20Sopenharmony_ci	__be32	connid;
2488c2ecf20Sopenharmony_ci	__be32	bssid;
2498c2ecf20Sopenharmony_ci	__be32	size;
2508c2ecf20Sopenharmony_ci	struct ar5523_cmd_connection_attr	connattr;
2518c2ecf20Sopenharmony_ci} __packed;
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_cistruct ar5523_cmd_ledsteady {		/* WDCMSG_SET_LED_STEADY */
2548c2ecf20Sopenharmony_ci	__be32	lednum;
2558c2ecf20Sopenharmony_ci#define UATH_LED_LINK		0
2568c2ecf20Sopenharmony_ci#define UATH_LED_ACTIVITY	1
2578c2ecf20Sopenharmony_ci	__be32	ledmode;
2588c2ecf20Sopenharmony_ci#define UATH_LED_OFF	0
2598c2ecf20Sopenharmony_ci#define UATH_LED_ON	1
2608c2ecf20Sopenharmony_ci} __packed;
2618c2ecf20Sopenharmony_ci
2628c2ecf20Sopenharmony_cistruct ar5523_cmd_ledblink {		/* WDCMSG_SET_LED_BLINK */
2638c2ecf20Sopenharmony_ci	__be32	lednum;
2648c2ecf20Sopenharmony_ci	__be32	ledmode;
2658c2ecf20Sopenharmony_ci	__be32	blinkrate;
2668c2ecf20Sopenharmony_ci	__be32	slowmode;
2678c2ecf20Sopenharmony_ci} __packed;
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_cistruct ar5523_cmd_ledstate {		/* WDCMSG_SET_LED_STATE */
2708c2ecf20Sopenharmony_ci	__be32	connected;
2718c2ecf20Sopenharmony_ci} __packed;
2728c2ecf20Sopenharmony_ci
2738c2ecf20Sopenharmony_cistruct ar5523_cmd_txq_attr {
2748c2ecf20Sopenharmony_ci	__be32	priority;
2758c2ecf20Sopenharmony_ci	__be32	aifs;
2768c2ecf20Sopenharmony_ci	__be32	logcwmin;
2778c2ecf20Sopenharmony_ci	__be32	logcwmax;
2788c2ecf20Sopenharmony_ci	__be32	bursttime;
2798c2ecf20Sopenharmony_ci	__be32	mode;
2808c2ecf20Sopenharmony_ci	__be32	qflags;
2818c2ecf20Sopenharmony_ci} __packed;
2828c2ecf20Sopenharmony_ci
2838c2ecf20Sopenharmony_cistruct ar5523_cmd_txq_setup {		/* WDCMSG_SETUP_TX_QUEUE */
2848c2ecf20Sopenharmony_ci	__be32	qid;
2858c2ecf20Sopenharmony_ci	__be32	len;
2868c2ecf20Sopenharmony_ci	struct ar5523_cmd_txq_attr attr;
2878c2ecf20Sopenharmony_ci} __packed;
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_cistruct ar5523_cmd_rx_filter {		/* WDCMSG_RX_FILTER */
2908c2ecf20Sopenharmony_ci	__be32	bits;
2918c2ecf20Sopenharmony_ci#define UATH_FILTER_RX_UCAST		0x00000001
2928c2ecf20Sopenharmony_ci#define UATH_FILTER_RX_MCAST		0x00000002
2938c2ecf20Sopenharmony_ci#define UATH_FILTER_RX_BCAST		0x00000004
2948c2ecf20Sopenharmony_ci#define UATH_FILTER_RX_CONTROL		0x00000008
2958c2ecf20Sopenharmony_ci#define UATH_FILTER_RX_BEACON		0x00000010	/* beacon frames */
2968c2ecf20Sopenharmony_ci#define UATH_FILTER_RX_PROM		0x00000020	/* promiscuous mode */
2978c2ecf20Sopenharmony_ci#define UATH_FILTER_RX_PHY_ERR		0x00000040	/* phy errors */
2988c2ecf20Sopenharmony_ci#define UATH_FILTER_RX_PHY_RADAR	0x00000080	/* radar phy errors */
2998c2ecf20Sopenharmony_ci#define UATH_FILTER_RX_XR_POOL		0x00000400	/* XR group polls */
3008c2ecf20Sopenharmony_ci#define UATH_FILTER_RX_PROBE_REQ	0x00000800
3018c2ecf20Sopenharmony_ci	__be32	op;
3028c2ecf20Sopenharmony_ci#define UATH_FILTER_OP_INIT		0x0
3038c2ecf20Sopenharmony_ci#define UATH_FILTER_OP_SET		0x1
3048c2ecf20Sopenharmony_ci#define UATH_FILTER_OP_CLEAR		0x2
3058c2ecf20Sopenharmony_ci#define UATH_FILTER_OP_TEMP		0x3
3068c2ecf20Sopenharmony_ci#define UATH_FILTER_OP_RESTORE		0x4
3078c2ecf20Sopenharmony_ci} __packed;
3088c2ecf20Sopenharmony_ci
3098c2ecf20Sopenharmony_cienum {
3108c2ecf20Sopenharmony_ci	CFG_NONE,			/* Sentinal to indicate "no config" */
3118c2ecf20Sopenharmony_ci	CFG_REG_DOMAIN,			/* Regulatory Domain */
3128c2ecf20Sopenharmony_ci	CFG_RATE_CONTROL_ENABLE,
3138c2ecf20Sopenharmony_ci	CFG_DEF_XMIT_DATA_RATE,		/* NB: if rate control is not enabled */
3148c2ecf20Sopenharmony_ci	CFG_HW_TX_RETRIES,
3158c2ecf20Sopenharmony_ci	CFG_SW_TX_RETRIES,
3168c2ecf20Sopenharmony_ci	CFG_SLOW_CLOCK_ENABLE,
3178c2ecf20Sopenharmony_ci	CFG_COMP_PROC,
3188c2ecf20Sopenharmony_ci	CFG_USER_RTS_THRESHOLD,
3198c2ecf20Sopenharmony_ci	CFG_XR2NORM_RATE_THRESHOLD,
3208c2ecf20Sopenharmony_ci	CFG_XRMODE_SWITCH_COUNT,
3218c2ecf20Sopenharmony_ci	CFG_PROTECTION_TYPE,
3228c2ecf20Sopenharmony_ci	CFG_BURST_SEQ_THRESHOLD,
3238c2ecf20Sopenharmony_ci	CFG_ABOLT,
3248c2ecf20Sopenharmony_ci	CFG_IQ_LOG_COUNT_MAX,
3258c2ecf20Sopenharmony_ci	CFG_MODE_CTS,
3268c2ecf20Sopenharmony_ci	CFG_WME_ENABLED,
3278c2ecf20Sopenharmony_ci	CFG_GPRS_CBR_PERIOD,
3288c2ecf20Sopenharmony_ci	CFG_SERVICE_TYPE,
3298c2ecf20Sopenharmony_ci	/* MAC Address to use.  Overrides EEPROM */
3308c2ecf20Sopenharmony_ci	CFG_MAC_ADDR,
3318c2ecf20Sopenharmony_ci	CFG_DEBUG_EAR,
3328c2ecf20Sopenharmony_ci	CFG_INIT_REGS,
3338c2ecf20Sopenharmony_ci	/* An ID for use in error & debug messages */
3348c2ecf20Sopenharmony_ci	CFG_DEBUG_ID,
3358c2ecf20Sopenharmony_ci	CFG_COMP_WIN_SZ,
3368c2ecf20Sopenharmony_ci	CFG_DIVERSITY_CTL,
3378c2ecf20Sopenharmony_ci	CFG_TP_SCALE,
3388c2ecf20Sopenharmony_ci	CFG_TPC_HALF_DBM5,
3398c2ecf20Sopenharmony_ci	CFG_TPC_HALF_DBM2,
3408c2ecf20Sopenharmony_ci	CFG_OVERRD_TX_POWER,
3418c2ecf20Sopenharmony_ci	CFG_USE_32KHZ_CLOCK,
3428c2ecf20Sopenharmony_ci	CFG_GMODE_PROTECTION,
3438c2ecf20Sopenharmony_ci	CFG_GMODE_PROTECT_RATE_INDEX,
3448c2ecf20Sopenharmony_ci	CFG_GMODE_NON_ERP_PREAMBLE,
3458c2ecf20Sopenharmony_ci	CFG_WDC_TRANSPORT_CHUNK_SIZE,
3468c2ecf20Sopenharmony_ci};
3478c2ecf20Sopenharmony_ci
3488c2ecf20Sopenharmony_cienum {
3498c2ecf20Sopenharmony_ci	/* Sentinal to indicate "no capability" */
3508c2ecf20Sopenharmony_ci	CAP_NONE,
3518c2ecf20Sopenharmony_ci	CAP_ALL,			/* ALL capabilities */
3528c2ecf20Sopenharmony_ci	CAP_TARGET_VERSION,
3538c2ecf20Sopenharmony_ci	CAP_TARGET_REVISION,
3548c2ecf20Sopenharmony_ci	CAP_MAC_VERSION,
3558c2ecf20Sopenharmony_ci	CAP_MAC_REVISION,
3568c2ecf20Sopenharmony_ci	CAP_PHY_REVISION,
3578c2ecf20Sopenharmony_ci	CAP_ANALOG_5GHz_REVISION,
3588c2ecf20Sopenharmony_ci	CAP_ANALOG_2GHz_REVISION,
3598c2ecf20Sopenharmony_ci	/* Target supports WDC message debug features */
3608c2ecf20Sopenharmony_ci	CAP_DEBUG_WDCMSG_SUPPORT,
3618c2ecf20Sopenharmony_ci
3628c2ecf20Sopenharmony_ci	CAP_REG_DOMAIN,
3638c2ecf20Sopenharmony_ci	CAP_COUNTRY_CODE,
3648c2ecf20Sopenharmony_ci	CAP_REG_CAP_BITS,
3658c2ecf20Sopenharmony_ci
3668c2ecf20Sopenharmony_ci	CAP_WIRELESS_MODES,
3678c2ecf20Sopenharmony_ci	CAP_CHAN_SPREAD_SUPPORT,
3688c2ecf20Sopenharmony_ci	CAP_SLEEP_AFTER_BEACON_BROKEN,
3698c2ecf20Sopenharmony_ci	CAP_COMPRESS_SUPPORT,
3708c2ecf20Sopenharmony_ci	CAP_BURST_SUPPORT,
3718c2ecf20Sopenharmony_ci	CAP_FAST_FRAMES_SUPPORT,
3728c2ecf20Sopenharmony_ci	CAP_CHAP_TUNING_SUPPORT,
3738c2ecf20Sopenharmony_ci	CAP_TURBOG_SUPPORT,
3748c2ecf20Sopenharmony_ci	CAP_TURBO_PRIME_SUPPORT,
3758c2ecf20Sopenharmony_ci	CAP_DEVICE_TYPE,
3768c2ecf20Sopenharmony_ci	CAP_XR_SUPPORT,
3778c2ecf20Sopenharmony_ci	CAP_WME_SUPPORT,
3788c2ecf20Sopenharmony_ci	CAP_TOTAL_QUEUES,
3798c2ecf20Sopenharmony_ci	CAP_CONNECTION_ID_MAX,		/* Should absorb CAP_KEY_CACHE_SIZE */
3808c2ecf20Sopenharmony_ci
3818c2ecf20Sopenharmony_ci	CAP_LOW_5GHZ_CHAN,
3828c2ecf20Sopenharmony_ci	CAP_HIGH_5GHZ_CHAN,
3838c2ecf20Sopenharmony_ci	CAP_LOW_2GHZ_CHAN,
3848c2ecf20Sopenharmony_ci	CAP_HIGH_2GHZ_CHAN,
3858c2ecf20Sopenharmony_ci
3868c2ecf20Sopenharmony_ci	CAP_MIC_AES_CCM,
3878c2ecf20Sopenharmony_ci	CAP_MIC_CKIP,
3888c2ecf20Sopenharmony_ci	CAP_MIC_TKIP,
3898c2ecf20Sopenharmony_ci	CAP_MIC_TKIP_WME,
3908c2ecf20Sopenharmony_ci	CAP_CIPHER_AES_CCM,
3918c2ecf20Sopenharmony_ci	CAP_CIPHER_CKIP,
3928c2ecf20Sopenharmony_ci	CAP_CIPHER_TKIP,
3938c2ecf20Sopenharmony_ci
3948c2ecf20Sopenharmony_ci	CAP_TWICE_ANTENNAGAIN_5G,
3958c2ecf20Sopenharmony_ci	CAP_TWICE_ANTENNAGAIN_2G,
3968c2ecf20Sopenharmony_ci};
3978c2ecf20Sopenharmony_ci
3988c2ecf20Sopenharmony_cienum {
3998c2ecf20Sopenharmony_ci	ST_NONE,                    /* Sentinal to indicate "no status" */
4008c2ecf20Sopenharmony_ci	ST_ALL,
4018c2ecf20Sopenharmony_ci	ST_SERVICE_TYPE,
4028c2ecf20Sopenharmony_ci	ST_WLAN_MODE,
4038c2ecf20Sopenharmony_ci	ST_FREQ,
4048c2ecf20Sopenharmony_ci	ST_BAND,
4058c2ecf20Sopenharmony_ci	ST_LAST_RSSI,
4068c2ecf20Sopenharmony_ci	ST_PS_FRAMES_DROPPED,
4078c2ecf20Sopenharmony_ci	ST_CACHED_DEF_ANT,
4088c2ecf20Sopenharmony_ci	ST_COUNT_OTHER_RX_ANT,
4098c2ecf20Sopenharmony_ci	ST_USE_FAST_DIVERSITY,
4108c2ecf20Sopenharmony_ci	ST_MAC_ADDR,
4118c2ecf20Sopenharmony_ci	ST_RX_GENERATION_NUM,
4128c2ecf20Sopenharmony_ci	ST_TX_QUEUE_DEPTH,
4138c2ecf20Sopenharmony_ci	ST_SERIAL_NUMBER,
4148c2ecf20Sopenharmony_ci	ST_WDC_TRANSPORT_CHUNK_SIZE,
4158c2ecf20Sopenharmony_ci};
4168c2ecf20Sopenharmony_ci
4178c2ecf20Sopenharmony_cienum {
4188c2ecf20Sopenharmony_ci	TARGET_DEVICE_AWAKE,
4198c2ecf20Sopenharmony_ci	TARGET_DEVICE_SLEEP,
4208c2ecf20Sopenharmony_ci	TARGET_DEVICE_PWRDN,
4218c2ecf20Sopenharmony_ci	TARGET_DEVICE_PWRSAVE,
4228c2ecf20Sopenharmony_ci	TARGET_DEVICE_SUSPEND,
4238c2ecf20Sopenharmony_ci	TARGET_DEVICE_RESUME,
4248c2ecf20Sopenharmony_ci};
4258c2ecf20Sopenharmony_ci
4268c2ecf20Sopenharmony_ci/* this is in net/ieee80211.h, but that conflicts with the mac80211 headers */
4278c2ecf20Sopenharmony_ci#define IEEE80211_2ADDR_LEN	16
4288c2ecf20Sopenharmony_ci
4298c2ecf20Sopenharmony_ci#define AR5523_MIN_RXBUFSZ				\
4308c2ecf20Sopenharmony_ci	(((sizeof(__be32) + IEEE80211_2ADDR_LEN +	\
4318c2ecf20Sopenharmony_ci	   sizeof(struct ar5523_rx_desc)) + 3) & ~3)
432