18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci	Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
48c2ecf20Sopenharmony_ci	<http://rt2x00.serialmonkey.com>
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci/*
98c2ecf20Sopenharmony_ci	Module: rt73usb
108c2ecf20Sopenharmony_ci	Abstract: Data structures and registers for the rt73usb module.
118c2ecf20Sopenharmony_ci	Supported chipsets: rt2571W & rt2671.
128c2ecf20Sopenharmony_ci */
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#ifndef RT73USB_H
158c2ecf20Sopenharmony_ci#define RT73USB_H
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci/*
188c2ecf20Sopenharmony_ci * RF chip defines.
198c2ecf20Sopenharmony_ci */
208c2ecf20Sopenharmony_ci#define RF5226				0x0001
218c2ecf20Sopenharmony_ci#define RF2528				0x0002
228c2ecf20Sopenharmony_ci#define RF5225				0x0003
238c2ecf20Sopenharmony_ci#define RF2527				0x0004
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/*
268c2ecf20Sopenharmony_ci * Signal information.
278c2ecf20Sopenharmony_ci * Default offset is required for RSSI <-> dBm conversion.
288c2ecf20Sopenharmony_ci */
298c2ecf20Sopenharmony_ci#define DEFAULT_RSSI_OFFSET		120
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci/*
328c2ecf20Sopenharmony_ci * Register layout information.
338c2ecf20Sopenharmony_ci */
348c2ecf20Sopenharmony_ci#define CSR_REG_BASE			0x3000
358c2ecf20Sopenharmony_ci#define CSR_REG_SIZE			0x04b0
368c2ecf20Sopenharmony_ci#define EEPROM_BASE			0x0000
378c2ecf20Sopenharmony_ci#define EEPROM_SIZE			0x0100
388c2ecf20Sopenharmony_ci#define BBP_BASE			0x0000
398c2ecf20Sopenharmony_ci#define BBP_SIZE			0x0080
408c2ecf20Sopenharmony_ci#define RF_BASE				0x0004
418c2ecf20Sopenharmony_ci#define RF_SIZE				0x0010
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci/*
448c2ecf20Sopenharmony_ci * Number of TX queues.
458c2ecf20Sopenharmony_ci */
468c2ecf20Sopenharmony_ci#define NUM_TX_QUEUES			4
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci/*
498c2ecf20Sopenharmony_ci * USB registers.
508c2ecf20Sopenharmony_ci */
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci/*
538c2ecf20Sopenharmony_ci * MCU_LEDCS: LED control for MCU Mailbox.
548c2ecf20Sopenharmony_ci */
558c2ecf20Sopenharmony_ci#define MCU_LEDCS_LED_MODE		FIELD16(0x001f)
568c2ecf20Sopenharmony_ci#define MCU_LEDCS_RADIO_STATUS		FIELD16(0x0020)
578c2ecf20Sopenharmony_ci#define MCU_LEDCS_LINK_BG_STATUS	FIELD16(0x0040)
588c2ecf20Sopenharmony_ci#define MCU_LEDCS_LINK_A_STATUS		FIELD16(0x0080)
598c2ecf20Sopenharmony_ci#define MCU_LEDCS_POLARITY_GPIO_0	FIELD16(0x0100)
608c2ecf20Sopenharmony_ci#define MCU_LEDCS_POLARITY_GPIO_1	FIELD16(0x0200)
618c2ecf20Sopenharmony_ci#define MCU_LEDCS_POLARITY_GPIO_2	FIELD16(0x0400)
628c2ecf20Sopenharmony_ci#define MCU_LEDCS_POLARITY_GPIO_3	FIELD16(0x0800)
638c2ecf20Sopenharmony_ci#define MCU_LEDCS_POLARITY_GPIO_4	FIELD16(0x1000)
648c2ecf20Sopenharmony_ci#define MCU_LEDCS_POLARITY_ACT		FIELD16(0x2000)
658c2ecf20Sopenharmony_ci#define MCU_LEDCS_POLARITY_READY_BG	FIELD16(0x4000)
668c2ecf20Sopenharmony_ci#define MCU_LEDCS_POLARITY_READY_A	FIELD16(0x8000)
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci/*
698c2ecf20Sopenharmony_ci * 8051 firmware image.
708c2ecf20Sopenharmony_ci */
718c2ecf20Sopenharmony_ci#define FIRMWARE_RT2571			"rt73.bin"
728c2ecf20Sopenharmony_ci#define FIRMWARE_IMAGE_BASE		0x0800
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci/*
758c2ecf20Sopenharmony_ci * Security key table memory.
768c2ecf20Sopenharmony_ci * 16 entries 32-byte for shared key table
778c2ecf20Sopenharmony_ci * 64 entries 32-byte for pairwise key table
788c2ecf20Sopenharmony_ci * 64 entries 8-byte for pairwise ta key table
798c2ecf20Sopenharmony_ci */
808c2ecf20Sopenharmony_ci#define SHARED_KEY_TABLE_BASE		0x1000
818c2ecf20Sopenharmony_ci#define PAIRWISE_KEY_TABLE_BASE		0x1200
828c2ecf20Sopenharmony_ci#define PAIRWISE_TA_TABLE_BASE		0x1a00
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci#define SHARED_KEY_ENTRY(__idx) \
858c2ecf20Sopenharmony_ci	( SHARED_KEY_TABLE_BASE + \
868c2ecf20Sopenharmony_ci		((__idx) * sizeof(struct hw_key_entry)) )
878c2ecf20Sopenharmony_ci#define PAIRWISE_KEY_ENTRY(__idx) \
888c2ecf20Sopenharmony_ci	( PAIRWISE_KEY_TABLE_BASE + \
898c2ecf20Sopenharmony_ci		((__idx) * sizeof(struct hw_key_entry)) )
908c2ecf20Sopenharmony_ci#define PAIRWISE_TA_ENTRY(__idx) \
918c2ecf20Sopenharmony_ci	( PAIRWISE_TA_TABLE_BASE + \
928c2ecf20Sopenharmony_ci		((__idx) * sizeof(struct hw_pairwise_ta_entry)) )
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_cistruct hw_key_entry {
958c2ecf20Sopenharmony_ci	u8 key[16];
968c2ecf20Sopenharmony_ci	u8 tx_mic[8];
978c2ecf20Sopenharmony_ci	u8 rx_mic[8];
988c2ecf20Sopenharmony_ci} __packed;
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_cistruct hw_pairwise_ta_entry {
1018c2ecf20Sopenharmony_ci	u8 address[6];
1028c2ecf20Sopenharmony_ci	u8 cipher;
1038c2ecf20Sopenharmony_ci	u8 reserved;
1048c2ecf20Sopenharmony_ci} __packed;
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci/*
1078c2ecf20Sopenharmony_ci * Since NULL frame won't be that long (256 byte),
1088c2ecf20Sopenharmony_ci * We steal 16 tail bytes to save debugging settings.
1098c2ecf20Sopenharmony_ci */
1108c2ecf20Sopenharmony_ci#define HW_DEBUG_SETTING_BASE		0x2bf0
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci/*
1138c2ecf20Sopenharmony_ci * On-chip BEACON frame space.
1148c2ecf20Sopenharmony_ci */
1158c2ecf20Sopenharmony_ci#define HW_BEACON_BASE0			0x2400
1168c2ecf20Sopenharmony_ci#define HW_BEACON_BASE1			0x2500
1178c2ecf20Sopenharmony_ci#define HW_BEACON_BASE2			0x2600
1188c2ecf20Sopenharmony_ci#define HW_BEACON_BASE3			0x2700
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci#define HW_BEACON_OFFSET(__index) \
1218c2ecf20Sopenharmony_ci	( HW_BEACON_BASE0 + (__index * 0x0100) )
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci/*
1248c2ecf20Sopenharmony_ci * MAC Control/Status Registers(CSR).
1258c2ecf20Sopenharmony_ci * Some values are set in TU, whereas 1 TU == 1024 us.
1268c2ecf20Sopenharmony_ci */
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci/*
1298c2ecf20Sopenharmony_ci * MAC_CSR0: ASIC revision number.
1308c2ecf20Sopenharmony_ci */
1318c2ecf20Sopenharmony_ci#define MAC_CSR0			0x3000
1328c2ecf20Sopenharmony_ci#define MAC_CSR0_REVISION		FIELD32(0x0000000f)
1338c2ecf20Sopenharmony_ci#define MAC_CSR0_CHIPSET		FIELD32(0x000ffff0)
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_ci/*
1368c2ecf20Sopenharmony_ci * MAC_CSR1: System control register.
1378c2ecf20Sopenharmony_ci * SOFT_RESET: Software reset bit, 1: reset, 0: normal.
1388c2ecf20Sopenharmony_ci * BBP_RESET: Hardware reset BBP.
1398c2ecf20Sopenharmony_ci * HOST_READY: Host is ready after initialization, 1: ready.
1408c2ecf20Sopenharmony_ci */
1418c2ecf20Sopenharmony_ci#define MAC_CSR1			0x3004
1428c2ecf20Sopenharmony_ci#define MAC_CSR1_SOFT_RESET		FIELD32(0x00000001)
1438c2ecf20Sopenharmony_ci#define MAC_CSR1_BBP_RESET		FIELD32(0x00000002)
1448c2ecf20Sopenharmony_ci#define MAC_CSR1_HOST_READY		FIELD32(0x00000004)
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ci/*
1478c2ecf20Sopenharmony_ci * MAC_CSR2: STA MAC register 0.
1488c2ecf20Sopenharmony_ci */
1498c2ecf20Sopenharmony_ci#define MAC_CSR2			0x3008
1508c2ecf20Sopenharmony_ci#define MAC_CSR2_BYTE0			FIELD32(0x000000ff)
1518c2ecf20Sopenharmony_ci#define MAC_CSR2_BYTE1			FIELD32(0x0000ff00)
1528c2ecf20Sopenharmony_ci#define MAC_CSR2_BYTE2			FIELD32(0x00ff0000)
1538c2ecf20Sopenharmony_ci#define MAC_CSR2_BYTE3			FIELD32(0xff000000)
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ci/*
1568c2ecf20Sopenharmony_ci * MAC_CSR3: STA MAC register 1.
1578c2ecf20Sopenharmony_ci * UNICAST_TO_ME_MASK:
1588c2ecf20Sopenharmony_ci *	Used to mask off bits from byte 5 of the MAC address
1598c2ecf20Sopenharmony_ci *	to determine the UNICAST_TO_ME bit for RX frames.
1608c2ecf20Sopenharmony_ci *	The full mask is complemented by BSS_ID_MASK:
1618c2ecf20Sopenharmony_ci *		MASK = BSS_ID_MASK & UNICAST_TO_ME_MASK
1628c2ecf20Sopenharmony_ci */
1638c2ecf20Sopenharmony_ci#define MAC_CSR3			0x300c
1648c2ecf20Sopenharmony_ci#define MAC_CSR3_BYTE4			FIELD32(0x000000ff)
1658c2ecf20Sopenharmony_ci#define MAC_CSR3_BYTE5			FIELD32(0x0000ff00)
1668c2ecf20Sopenharmony_ci#define MAC_CSR3_UNICAST_TO_ME_MASK	FIELD32(0x00ff0000)
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_ci/*
1698c2ecf20Sopenharmony_ci * MAC_CSR4: BSSID register 0.
1708c2ecf20Sopenharmony_ci */
1718c2ecf20Sopenharmony_ci#define MAC_CSR4			0x3010
1728c2ecf20Sopenharmony_ci#define MAC_CSR4_BYTE0			FIELD32(0x000000ff)
1738c2ecf20Sopenharmony_ci#define MAC_CSR4_BYTE1			FIELD32(0x0000ff00)
1748c2ecf20Sopenharmony_ci#define MAC_CSR4_BYTE2			FIELD32(0x00ff0000)
1758c2ecf20Sopenharmony_ci#define MAC_CSR4_BYTE3			FIELD32(0xff000000)
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci/*
1788c2ecf20Sopenharmony_ci * MAC_CSR5: BSSID register 1.
1798c2ecf20Sopenharmony_ci * BSS_ID_MASK:
1808c2ecf20Sopenharmony_ci *	This mask is used to mask off bits 0 and 1 of byte 5 of the
1818c2ecf20Sopenharmony_ci *	BSSID. This will make sure that those bits will be ignored
1828c2ecf20Sopenharmony_ci *	when determining the MY_BSS of RX frames.
1838c2ecf20Sopenharmony_ci *		0: 1-BSSID mode (BSS index = 0)
1848c2ecf20Sopenharmony_ci *		1: 2-BSSID mode (BSS index: Byte5, bit 0)
1858c2ecf20Sopenharmony_ci *		2: 2-BSSID mode (BSS index: byte5, bit 1)
1868c2ecf20Sopenharmony_ci *		3: 4-BSSID mode (BSS index: byte5, bit 0 - 1)
1878c2ecf20Sopenharmony_ci */
1888c2ecf20Sopenharmony_ci#define MAC_CSR5			0x3014
1898c2ecf20Sopenharmony_ci#define MAC_CSR5_BYTE4			FIELD32(0x000000ff)
1908c2ecf20Sopenharmony_ci#define MAC_CSR5_BYTE5			FIELD32(0x0000ff00)
1918c2ecf20Sopenharmony_ci#define MAC_CSR5_BSS_ID_MASK		FIELD32(0x00ff0000)
1928c2ecf20Sopenharmony_ci
1938c2ecf20Sopenharmony_ci/*
1948c2ecf20Sopenharmony_ci * MAC_CSR6: Maximum frame length register.
1958c2ecf20Sopenharmony_ci */
1968c2ecf20Sopenharmony_ci#define MAC_CSR6			0x3018
1978c2ecf20Sopenharmony_ci#define MAC_CSR6_MAX_FRAME_UNIT		FIELD32(0x00000fff)
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_ci/*
2008c2ecf20Sopenharmony_ci * MAC_CSR7: Reserved
2018c2ecf20Sopenharmony_ci */
2028c2ecf20Sopenharmony_ci#define MAC_CSR7			0x301c
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci/*
2058c2ecf20Sopenharmony_ci * MAC_CSR8: SIFS/EIFS register.
2068c2ecf20Sopenharmony_ci * All units are in US.
2078c2ecf20Sopenharmony_ci */
2088c2ecf20Sopenharmony_ci#define MAC_CSR8			0x3020
2098c2ecf20Sopenharmony_ci#define MAC_CSR8_SIFS			FIELD32(0x000000ff)
2108c2ecf20Sopenharmony_ci#define MAC_CSR8_SIFS_AFTER_RX_OFDM	FIELD32(0x0000ff00)
2118c2ecf20Sopenharmony_ci#define MAC_CSR8_EIFS			FIELD32(0xffff0000)
2128c2ecf20Sopenharmony_ci
2138c2ecf20Sopenharmony_ci/*
2148c2ecf20Sopenharmony_ci * MAC_CSR9: Back-Off control register.
2158c2ecf20Sopenharmony_ci * SLOT_TIME: Slot time, default is 20us for 802.11BG.
2168c2ecf20Sopenharmony_ci * CWMIN: Bit for Cwmin. default Cwmin is 31 (2^5 - 1).
2178c2ecf20Sopenharmony_ci * CWMAX: Bit for Cwmax, default Cwmax is 1023 (2^10 - 1).
2188c2ecf20Sopenharmony_ci * CW_SELECT: 1: CWmin/Cwmax select from register, 0:select from TxD.
2198c2ecf20Sopenharmony_ci */
2208c2ecf20Sopenharmony_ci#define MAC_CSR9			0x3024
2218c2ecf20Sopenharmony_ci#define MAC_CSR9_SLOT_TIME		FIELD32(0x000000ff)
2228c2ecf20Sopenharmony_ci#define MAC_CSR9_CWMIN			FIELD32(0x00000f00)
2238c2ecf20Sopenharmony_ci#define MAC_CSR9_CWMAX			FIELD32(0x0000f000)
2248c2ecf20Sopenharmony_ci#define MAC_CSR9_CW_SELECT		FIELD32(0x00010000)
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_ci/*
2278c2ecf20Sopenharmony_ci * MAC_CSR10: Power state configuration.
2288c2ecf20Sopenharmony_ci */
2298c2ecf20Sopenharmony_ci#define MAC_CSR10			0x3028
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_ci/*
2328c2ecf20Sopenharmony_ci * MAC_CSR11: Power saving transition time register.
2338c2ecf20Sopenharmony_ci * DELAY_AFTER_TBCN: Delay after Tbcn expired in units of TU.
2348c2ecf20Sopenharmony_ci * TBCN_BEFORE_WAKEUP: Number of beacon before wakeup.
2358c2ecf20Sopenharmony_ci * WAKEUP_LATENCY: In unit of TU.
2368c2ecf20Sopenharmony_ci */
2378c2ecf20Sopenharmony_ci#define MAC_CSR11			0x302c
2388c2ecf20Sopenharmony_ci#define MAC_CSR11_DELAY_AFTER_TBCN	FIELD32(0x000000ff)
2398c2ecf20Sopenharmony_ci#define MAC_CSR11_TBCN_BEFORE_WAKEUP	FIELD32(0x00007f00)
2408c2ecf20Sopenharmony_ci#define MAC_CSR11_AUTOWAKE		FIELD32(0x00008000)
2418c2ecf20Sopenharmony_ci#define MAC_CSR11_WAKEUP_LATENCY	FIELD32(0x000f0000)
2428c2ecf20Sopenharmony_ci
2438c2ecf20Sopenharmony_ci/*
2448c2ecf20Sopenharmony_ci * MAC_CSR12: Manual power control / status register (merge CSR20 & PWRCSR1).
2458c2ecf20Sopenharmony_ci * CURRENT_STATE: 0:sleep, 1:awake.
2468c2ecf20Sopenharmony_ci * FORCE_WAKEUP: This has higher priority than PUT_TO_SLEEP.
2478c2ecf20Sopenharmony_ci * BBP_CURRENT_STATE: 0: BBP sleep, 1: BBP awake.
2488c2ecf20Sopenharmony_ci */
2498c2ecf20Sopenharmony_ci#define MAC_CSR12			0x3030
2508c2ecf20Sopenharmony_ci#define MAC_CSR12_CURRENT_STATE		FIELD32(0x00000001)
2518c2ecf20Sopenharmony_ci#define MAC_CSR12_PUT_TO_SLEEP		FIELD32(0x00000002)
2528c2ecf20Sopenharmony_ci#define MAC_CSR12_FORCE_WAKEUP		FIELD32(0x00000004)
2538c2ecf20Sopenharmony_ci#define MAC_CSR12_BBP_CURRENT_STATE	FIELD32(0x00000008)
2548c2ecf20Sopenharmony_ci
2558c2ecf20Sopenharmony_ci/*
2568c2ecf20Sopenharmony_ci * MAC_CSR13: GPIO.
2578c2ecf20Sopenharmony_ci *	MAC_CSR13_VALx: GPIO value
2588c2ecf20Sopenharmony_ci *	MAC_CSR13_DIRx: GPIO direction: 0 = input; 1 = output
2598c2ecf20Sopenharmony_ci */
2608c2ecf20Sopenharmony_ci#define MAC_CSR13			0x3034
2618c2ecf20Sopenharmony_ci#define MAC_CSR13_VAL0			FIELD32(0x00000001)
2628c2ecf20Sopenharmony_ci#define MAC_CSR13_VAL1			FIELD32(0x00000002)
2638c2ecf20Sopenharmony_ci#define MAC_CSR13_VAL2			FIELD32(0x00000004)
2648c2ecf20Sopenharmony_ci#define MAC_CSR13_VAL3			FIELD32(0x00000008)
2658c2ecf20Sopenharmony_ci#define MAC_CSR13_VAL4			FIELD32(0x00000010)
2668c2ecf20Sopenharmony_ci#define MAC_CSR13_VAL5			FIELD32(0x00000020)
2678c2ecf20Sopenharmony_ci#define MAC_CSR13_VAL6			FIELD32(0x00000040)
2688c2ecf20Sopenharmony_ci#define MAC_CSR13_VAL7			FIELD32(0x00000080)
2698c2ecf20Sopenharmony_ci#define MAC_CSR13_DIR0			FIELD32(0x00000100)
2708c2ecf20Sopenharmony_ci#define MAC_CSR13_DIR1			FIELD32(0x00000200)
2718c2ecf20Sopenharmony_ci#define MAC_CSR13_DIR2			FIELD32(0x00000400)
2728c2ecf20Sopenharmony_ci#define MAC_CSR13_DIR3			FIELD32(0x00000800)
2738c2ecf20Sopenharmony_ci#define MAC_CSR13_DIR4			FIELD32(0x00001000)
2748c2ecf20Sopenharmony_ci#define MAC_CSR13_DIR5			FIELD32(0x00002000)
2758c2ecf20Sopenharmony_ci#define MAC_CSR13_DIR6			FIELD32(0x00004000)
2768c2ecf20Sopenharmony_ci#define MAC_CSR13_DIR7			FIELD32(0x00008000)
2778c2ecf20Sopenharmony_ci
2788c2ecf20Sopenharmony_ci/*
2798c2ecf20Sopenharmony_ci * MAC_CSR14: LED control register.
2808c2ecf20Sopenharmony_ci * ON_PERIOD: On period, default 70ms.
2818c2ecf20Sopenharmony_ci * OFF_PERIOD: Off period, default 30ms.
2828c2ecf20Sopenharmony_ci * HW_LED: HW TX activity, 1: normal OFF, 0: normal ON.
2838c2ecf20Sopenharmony_ci * SW_LED: s/w LED, 1: ON, 0: OFF.
2848c2ecf20Sopenharmony_ci * HW_LED_POLARITY: 0: active low, 1: active high.
2858c2ecf20Sopenharmony_ci */
2868c2ecf20Sopenharmony_ci#define MAC_CSR14			0x3038
2878c2ecf20Sopenharmony_ci#define MAC_CSR14_ON_PERIOD		FIELD32(0x000000ff)
2888c2ecf20Sopenharmony_ci#define MAC_CSR14_OFF_PERIOD		FIELD32(0x0000ff00)
2898c2ecf20Sopenharmony_ci#define MAC_CSR14_HW_LED		FIELD32(0x00010000)
2908c2ecf20Sopenharmony_ci#define MAC_CSR14_SW_LED		FIELD32(0x00020000)
2918c2ecf20Sopenharmony_ci#define MAC_CSR14_HW_LED_POLARITY	FIELD32(0x00040000)
2928c2ecf20Sopenharmony_ci#define MAC_CSR14_SW_LED2		FIELD32(0x00080000)
2938c2ecf20Sopenharmony_ci
2948c2ecf20Sopenharmony_ci/*
2958c2ecf20Sopenharmony_ci * MAC_CSR15: NAV control.
2968c2ecf20Sopenharmony_ci */
2978c2ecf20Sopenharmony_ci#define MAC_CSR15			0x303c
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_ci/*
3008c2ecf20Sopenharmony_ci * TXRX control registers.
3018c2ecf20Sopenharmony_ci * Some values are set in TU, whereas 1 TU == 1024 us.
3028c2ecf20Sopenharmony_ci */
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_ci/*
3058c2ecf20Sopenharmony_ci * TXRX_CSR0: TX/RX configuration register.
3068c2ecf20Sopenharmony_ci * TSF_OFFSET: Default is 24.
3078c2ecf20Sopenharmony_ci * AUTO_TX_SEQ: 1: ASIC auto replace sequence nr in outgoing frame.
3088c2ecf20Sopenharmony_ci * DISABLE_RX: Disable Rx engine.
3098c2ecf20Sopenharmony_ci * DROP_CRC: Drop CRC error.
3108c2ecf20Sopenharmony_ci * DROP_PHYSICAL: Drop physical error.
3118c2ecf20Sopenharmony_ci * DROP_CONTROL: Drop control frame.
3128c2ecf20Sopenharmony_ci * DROP_NOT_TO_ME: Drop not to me unicast frame.
3138c2ecf20Sopenharmony_ci * DROP_TO_DS: Drop fram ToDs bit is true.
3148c2ecf20Sopenharmony_ci * DROP_VERSION_ERROR: Drop version error frame.
3158c2ecf20Sopenharmony_ci * DROP_MULTICAST: Drop multicast frames.
3168c2ecf20Sopenharmony_ci * DROP_BORADCAST: Drop broadcast frames.
3178c2ecf20Sopenharmony_ci * DROP_ACK_CTS: Drop received ACK and CTS.
3188c2ecf20Sopenharmony_ci */
3198c2ecf20Sopenharmony_ci#define TXRX_CSR0			0x3040
3208c2ecf20Sopenharmony_ci#define TXRX_CSR0_RX_ACK_TIMEOUT	FIELD32(0x000001ff)
3218c2ecf20Sopenharmony_ci#define TXRX_CSR0_TSF_OFFSET		FIELD32(0x00007e00)
3228c2ecf20Sopenharmony_ci#define TXRX_CSR0_AUTO_TX_SEQ		FIELD32(0x00008000)
3238c2ecf20Sopenharmony_ci#define TXRX_CSR0_DISABLE_RX		FIELD32(0x00010000)
3248c2ecf20Sopenharmony_ci#define TXRX_CSR0_DROP_CRC		FIELD32(0x00020000)
3258c2ecf20Sopenharmony_ci#define TXRX_CSR0_DROP_PHYSICAL		FIELD32(0x00040000)
3268c2ecf20Sopenharmony_ci#define TXRX_CSR0_DROP_CONTROL		FIELD32(0x00080000)
3278c2ecf20Sopenharmony_ci#define TXRX_CSR0_DROP_NOT_TO_ME	FIELD32(0x00100000)
3288c2ecf20Sopenharmony_ci#define TXRX_CSR0_DROP_TO_DS		FIELD32(0x00200000)
3298c2ecf20Sopenharmony_ci#define TXRX_CSR0_DROP_VERSION_ERROR	FIELD32(0x00400000)
3308c2ecf20Sopenharmony_ci#define TXRX_CSR0_DROP_MULTICAST	FIELD32(0x00800000)
3318c2ecf20Sopenharmony_ci#define TXRX_CSR0_DROP_BROADCAST	FIELD32(0x01000000)
3328c2ecf20Sopenharmony_ci#define TXRX_CSR0_DROP_ACK_CTS		FIELD32(0x02000000)
3338c2ecf20Sopenharmony_ci#define TXRX_CSR0_TX_WITHOUT_WAITING	FIELD32(0x04000000)
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci/*
3368c2ecf20Sopenharmony_ci * TXRX_CSR1
3378c2ecf20Sopenharmony_ci */
3388c2ecf20Sopenharmony_ci#define TXRX_CSR1			0x3044
3398c2ecf20Sopenharmony_ci#define TXRX_CSR1_BBP_ID0		FIELD32(0x0000007f)
3408c2ecf20Sopenharmony_ci#define TXRX_CSR1_BBP_ID0_VALID		FIELD32(0x00000080)
3418c2ecf20Sopenharmony_ci#define TXRX_CSR1_BBP_ID1		FIELD32(0x00007f00)
3428c2ecf20Sopenharmony_ci#define TXRX_CSR1_BBP_ID1_VALID		FIELD32(0x00008000)
3438c2ecf20Sopenharmony_ci#define TXRX_CSR1_BBP_ID2		FIELD32(0x007f0000)
3448c2ecf20Sopenharmony_ci#define TXRX_CSR1_BBP_ID2_VALID		FIELD32(0x00800000)
3458c2ecf20Sopenharmony_ci#define TXRX_CSR1_BBP_ID3		FIELD32(0x7f000000)
3468c2ecf20Sopenharmony_ci#define TXRX_CSR1_BBP_ID3_VALID		FIELD32(0x80000000)
3478c2ecf20Sopenharmony_ci
3488c2ecf20Sopenharmony_ci/*
3498c2ecf20Sopenharmony_ci * TXRX_CSR2
3508c2ecf20Sopenharmony_ci */
3518c2ecf20Sopenharmony_ci#define TXRX_CSR2			0x3048
3528c2ecf20Sopenharmony_ci#define TXRX_CSR2_BBP_ID0		FIELD32(0x0000007f)
3538c2ecf20Sopenharmony_ci#define TXRX_CSR2_BBP_ID0_VALID		FIELD32(0x00000080)
3548c2ecf20Sopenharmony_ci#define TXRX_CSR2_BBP_ID1		FIELD32(0x00007f00)
3558c2ecf20Sopenharmony_ci#define TXRX_CSR2_BBP_ID1_VALID		FIELD32(0x00008000)
3568c2ecf20Sopenharmony_ci#define TXRX_CSR2_BBP_ID2		FIELD32(0x007f0000)
3578c2ecf20Sopenharmony_ci#define TXRX_CSR2_BBP_ID2_VALID		FIELD32(0x00800000)
3588c2ecf20Sopenharmony_ci#define TXRX_CSR2_BBP_ID3		FIELD32(0x7f000000)
3598c2ecf20Sopenharmony_ci#define TXRX_CSR2_BBP_ID3_VALID		FIELD32(0x80000000)
3608c2ecf20Sopenharmony_ci
3618c2ecf20Sopenharmony_ci/*
3628c2ecf20Sopenharmony_ci * TXRX_CSR3
3638c2ecf20Sopenharmony_ci */
3648c2ecf20Sopenharmony_ci#define TXRX_CSR3			0x304c
3658c2ecf20Sopenharmony_ci#define TXRX_CSR3_BBP_ID0		FIELD32(0x0000007f)
3668c2ecf20Sopenharmony_ci#define TXRX_CSR3_BBP_ID0_VALID		FIELD32(0x00000080)
3678c2ecf20Sopenharmony_ci#define TXRX_CSR3_BBP_ID1		FIELD32(0x00007f00)
3688c2ecf20Sopenharmony_ci#define TXRX_CSR3_BBP_ID1_VALID		FIELD32(0x00008000)
3698c2ecf20Sopenharmony_ci#define TXRX_CSR3_BBP_ID2		FIELD32(0x007f0000)
3708c2ecf20Sopenharmony_ci#define TXRX_CSR3_BBP_ID2_VALID		FIELD32(0x00800000)
3718c2ecf20Sopenharmony_ci#define TXRX_CSR3_BBP_ID3		FIELD32(0x7f000000)
3728c2ecf20Sopenharmony_ci#define TXRX_CSR3_BBP_ID3_VALID		FIELD32(0x80000000)
3738c2ecf20Sopenharmony_ci
3748c2ecf20Sopenharmony_ci/*
3758c2ecf20Sopenharmony_ci * TXRX_CSR4: Auto-Responder/Tx-retry register.
3768c2ecf20Sopenharmony_ci * AUTORESPOND_PREAMBLE: 0:long, 1:short preamble.
3778c2ecf20Sopenharmony_ci * OFDM_TX_RATE_DOWN: 1:enable.
3788c2ecf20Sopenharmony_ci * OFDM_TX_RATE_STEP: 0:1-step, 1: 2-step, 2:3-step, 3:4-step.
3798c2ecf20Sopenharmony_ci * OFDM_TX_FALLBACK_CCK: 0: Fallback to OFDM 6M only, 1: Fallback to CCK 1M,2M.
3808c2ecf20Sopenharmony_ci */
3818c2ecf20Sopenharmony_ci#define TXRX_CSR4			0x3050
3828c2ecf20Sopenharmony_ci#define TXRX_CSR4_TX_ACK_TIMEOUT	FIELD32(0x000000ff)
3838c2ecf20Sopenharmony_ci#define TXRX_CSR4_CNTL_ACK_POLICY	FIELD32(0x00000700)
3848c2ecf20Sopenharmony_ci#define TXRX_CSR4_ACK_CTS_PSM		FIELD32(0x00010000)
3858c2ecf20Sopenharmony_ci#define TXRX_CSR4_AUTORESPOND_ENABLE	FIELD32(0x00020000)
3868c2ecf20Sopenharmony_ci#define TXRX_CSR4_AUTORESPOND_PREAMBLE	FIELD32(0x00040000)
3878c2ecf20Sopenharmony_ci#define TXRX_CSR4_OFDM_TX_RATE_DOWN	FIELD32(0x00080000)
3888c2ecf20Sopenharmony_ci#define TXRX_CSR4_OFDM_TX_RATE_STEP	FIELD32(0x00300000)
3898c2ecf20Sopenharmony_ci#define TXRX_CSR4_OFDM_TX_FALLBACK_CCK	FIELD32(0x00400000)
3908c2ecf20Sopenharmony_ci#define TXRX_CSR4_LONG_RETRY_LIMIT	FIELD32(0x0f000000)
3918c2ecf20Sopenharmony_ci#define TXRX_CSR4_SHORT_RETRY_LIMIT	FIELD32(0xf0000000)
3928c2ecf20Sopenharmony_ci
3938c2ecf20Sopenharmony_ci/*
3948c2ecf20Sopenharmony_ci * TXRX_CSR5
3958c2ecf20Sopenharmony_ci */
3968c2ecf20Sopenharmony_ci#define TXRX_CSR5			0x3054
3978c2ecf20Sopenharmony_ci
3988c2ecf20Sopenharmony_ci/*
3998c2ecf20Sopenharmony_ci * TXRX_CSR6: ACK/CTS payload consumed time
4008c2ecf20Sopenharmony_ci */
4018c2ecf20Sopenharmony_ci#define TXRX_CSR6			0x3058
4028c2ecf20Sopenharmony_ci
4038c2ecf20Sopenharmony_ci/*
4048c2ecf20Sopenharmony_ci * TXRX_CSR7: OFDM ACK/CTS payload consumed time for 6/9/12/18 mbps.
4058c2ecf20Sopenharmony_ci */
4068c2ecf20Sopenharmony_ci#define TXRX_CSR7			0x305c
4078c2ecf20Sopenharmony_ci#define TXRX_CSR7_ACK_CTS_6MBS		FIELD32(0x000000ff)
4088c2ecf20Sopenharmony_ci#define TXRX_CSR7_ACK_CTS_9MBS		FIELD32(0x0000ff00)
4098c2ecf20Sopenharmony_ci#define TXRX_CSR7_ACK_CTS_12MBS		FIELD32(0x00ff0000)
4108c2ecf20Sopenharmony_ci#define TXRX_CSR7_ACK_CTS_18MBS		FIELD32(0xff000000)
4118c2ecf20Sopenharmony_ci
4128c2ecf20Sopenharmony_ci/*
4138c2ecf20Sopenharmony_ci * TXRX_CSR8: OFDM ACK/CTS payload consumed time for 24/36/48/54 mbps.
4148c2ecf20Sopenharmony_ci */
4158c2ecf20Sopenharmony_ci#define TXRX_CSR8			0x3060
4168c2ecf20Sopenharmony_ci#define TXRX_CSR8_ACK_CTS_24MBS		FIELD32(0x000000ff)
4178c2ecf20Sopenharmony_ci#define TXRX_CSR8_ACK_CTS_36MBS		FIELD32(0x0000ff00)
4188c2ecf20Sopenharmony_ci#define TXRX_CSR8_ACK_CTS_48MBS		FIELD32(0x00ff0000)
4198c2ecf20Sopenharmony_ci#define TXRX_CSR8_ACK_CTS_54MBS		FIELD32(0xff000000)
4208c2ecf20Sopenharmony_ci
4218c2ecf20Sopenharmony_ci/*
4228c2ecf20Sopenharmony_ci * TXRX_CSR9: Synchronization control register.
4238c2ecf20Sopenharmony_ci * BEACON_INTERVAL: In unit of 1/16 TU.
4248c2ecf20Sopenharmony_ci * TSF_TICKING: Enable TSF auto counting.
4258c2ecf20Sopenharmony_ci * TSF_SYNC: Tsf sync, 0: disable, 1: infra, 2: ad-hoc/master mode.
4268c2ecf20Sopenharmony_ci * BEACON_GEN: Enable beacon generator.
4278c2ecf20Sopenharmony_ci */
4288c2ecf20Sopenharmony_ci#define TXRX_CSR9			0x3064
4298c2ecf20Sopenharmony_ci#define TXRX_CSR9_BEACON_INTERVAL	FIELD32(0x0000ffff)
4308c2ecf20Sopenharmony_ci#define TXRX_CSR9_TSF_TICKING		FIELD32(0x00010000)
4318c2ecf20Sopenharmony_ci#define TXRX_CSR9_TSF_SYNC		FIELD32(0x00060000)
4328c2ecf20Sopenharmony_ci#define TXRX_CSR9_TBTT_ENABLE		FIELD32(0x00080000)
4338c2ecf20Sopenharmony_ci#define TXRX_CSR9_BEACON_GEN		FIELD32(0x00100000)
4348c2ecf20Sopenharmony_ci#define TXRX_CSR9_TIMESTAMP_COMPENSATE	FIELD32(0xff000000)
4358c2ecf20Sopenharmony_ci
4368c2ecf20Sopenharmony_ci/*
4378c2ecf20Sopenharmony_ci * TXRX_CSR10: BEACON alignment.
4388c2ecf20Sopenharmony_ci */
4398c2ecf20Sopenharmony_ci#define TXRX_CSR10			0x3068
4408c2ecf20Sopenharmony_ci
4418c2ecf20Sopenharmony_ci/*
4428c2ecf20Sopenharmony_ci * TXRX_CSR11: AES mask.
4438c2ecf20Sopenharmony_ci */
4448c2ecf20Sopenharmony_ci#define TXRX_CSR11			0x306c
4458c2ecf20Sopenharmony_ci
4468c2ecf20Sopenharmony_ci/*
4478c2ecf20Sopenharmony_ci * TXRX_CSR12: TSF low 32.
4488c2ecf20Sopenharmony_ci */
4498c2ecf20Sopenharmony_ci#define TXRX_CSR12			0x3070
4508c2ecf20Sopenharmony_ci#define TXRX_CSR12_LOW_TSFTIMER		FIELD32(0xffffffff)
4518c2ecf20Sopenharmony_ci
4528c2ecf20Sopenharmony_ci/*
4538c2ecf20Sopenharmony_ci * TXRX_CSR13: TSF high 32.
4548c2ecf20Sopenharmony_ci */
4558c2ecf20Sopenharmony_ci#define TXRX_CSR13			0x3074
4568c2ecf20Sopenharmony_ci#define TXRX_CSR13_HIGH_TSFTIMER	FIELD32(0xffffffff)
4578c2ecf20Sopenharmony_ci
4588c2ecf20Sopenharmony_ci/*
4598c2ecf20Sopenharmony_ci * TXRX_CSR14: TBTT timer.
4608c2ecf20Sopenharmony_ci */
4618c2ecf20Sopenharmony_ci#define TXRX_CSR14			0x3078
4628c2ecf20Sopenharmony_ci
4638c2ecf20Sopenharmony_ci/*
4648c2ecf20Sopenharmony_ci * TXRX_CSR15: TKIP MIC priority byte "AND" mask.
4658c2ecf20Sopenharmony_ci */
4668c2ecf20Sopenharmony_ci#define TXRX_CSR15			0x307c
4678c2ecf20Sopenharmony_ci
4688c2ecf20Sopenharmony_ci/*
4698c2ecf20Sopenharmony_ci * PHY control registers.
4708c2ecf20Sopenharmony_ci * Some values are set in TU, whereas 1 TU == 1024 us.
4718c2ecf20Sopenharmony_ci */
4728c2ecf20Sopenharmony_ci
4738c2ecf20Sopenharmony_ci/*
4748c2ecf20Sopenharmony_ci * PHY_CSR0: RF/PS control.
4758c2ecf20Sopenharmony_ci */
4768c2ecf20Sopenharmony_ci#define PHY_CSR0			0x3080
4778c2ecf20Sopenharmony_ci#define PHY_CSR0_PA_PE_BG		FIELD32(0x00010000)
4788c2ecf20Sopenharmony_ci#define PHY_CSR0_PA_PE_A		FIELD32(0x00020000)
4798c2ecf20Sopenharmony_ci
4808c2ecf20Sopenharmony_ci/*
4818c2ecf20Sopenharmony_ci * PHY_CSR1
4828c2ecf20Sopenharmony_ci */
4838c2ecf20Sopenharmony_ci#define PHY_CSR1			0x3084
4848c2ecf20Sopenharmony_ci#define PHY_CSR1_RF_RPI			FIELD32(0x00010000)
4858c2ecf20Sopenharmony_ci
4868c2ecf20Sopenharmony_ci/*
4878c2ecf20Sopenharmony_ci * PHY_CSR2: Pre-TX BBP control.
4888c2ecf20Sopenharmony_ci */
4898c2ecf20Sopenharmony_ci#define PHY_CSR2			0x3088
4908c2ecf20Sopenharmony_ci
4918c2ecf20Sopenharmony_ci/*
4928c2ecf20Sopenharmony_ci * PHY_CSR3: BBP serial control register.
4938c2ecf20Sopenharmony_ci * VALUE: Register value to program into BBP.
4948c2ecf20Sopenharmony_ci * REG_NUM: Selected BBP register.
4958c2ecf20Sopenharmony_ci * READ_CONTROL: 0: Write BBP, 1: Read BBP.
4968c2ecf20Sopenharmony_ci * BUSY: 1: ASIC is busy execute BBP programming.
4978c2ecf20Sopenharmony_ci */
4988c2ecf20Sopenharmony_ci#define PHY_CSR3			0x308c
4998c2ecf20Sopenharmony_ci#define PHY_CSR3_VALUE			FIELD32(0x000000ff)
5008c2ecf20Sopenharmony_ci#define PHY_CSR3_REGNUM			FIELD32(0x00007f00)
5018c2ecf20Sopenharmony_ci#define PHY_CSR3_READ_CONTROL		FIELD32(0x00008000)
5028c2ecf20Sopenharmony_ci#define PHY_CSR3_BUSY			FIELD32(0x00010000)
5038c2ecf20Sopenharmony_ci
5048c2ecf20Sopenharmony_ci/*
5058c2ecf20Sopenharmony_ci * PHY_CSR4: RF serial control register
5068c2ecf20Sopenharmony_ci * VALUE: Register value (include register id) serial out to RF/IF chip.
5078c2ecf20Sopenharmony_ci * NUMBER_OF_BITS: Number of bits used in RFRegValue (I:20, RFMD:22).
5088c2ecf20Sopenharmony_ci * IF_SELECT: 1: select IF to program, 0: select RF to program.
5098c2ecf20Sopenharmony_ci * PLL_LD: RF PLL_LD status.
5108c2ecf20Sopenharmony_ci * BUSY: 1: ASIC is busy execute RF programming.
5118c2ecf20Sopenharmony_ci */
5128c2ecf20Sopenharmony_ci#define PHY_CSR4			0x3090
5138c2ecf20Sopenharmony_ci#define PHY_CSR4_VALUE			FIELD32(0x00ffffff)
5148c2ecf20Sopenharmony_ci#define PHY_CSR4_NUMBER_OF_BITS		FIELD32(0x1f000000)
5158c2ecf20Sopenharmony_ci#define PHY_CSR4_IF_SELECT		FIELD32(0x20000000)
5168c2ecf20Sopenharmony_ci#define PHY_CSR4_PLL_LD			FIELD32(0x40000000)
5178c2ecf20Sopenharmony_ci#define PHY_CSR4_BUSY			FIELD32(0x80000000)
5188c2ecf20Sopenharmony_ci
5198c2ecf20Sopenharmony_ci/*
5208c2ecf20Sopenharmony_ci * PHY_CSR5: RX to TX signal switch timing control.
5218c2ecf20Sopenharmony_ci */
5228c2ecf20Sopenharmony_ci#define PHY_CSR5			0x3094
5238c2ecf20Sopenharmony_ci#define PHY_CSR5_IQ_FLIP		FIELD32(0x00000004)
5248c2ecf20Sopenharmony_ci
5258c2ecf20Sopenharmony_ci/*
5268c2ecf20Sopenharmony_ci * PHY_CSR6: TX to RX signal timing control.
5278c2ecf20Sopenharmony_ci */
5288c2ecf20Sopenharmony_ci#define PHY_CSR6			0x3098
5298c2ecf20Sopenharmony_ci#define PHY_CSR6_IQ_FLIP		FIELD32(0x00000004)
5308c2ecf20Sopenharmony_ci
5318c2ecf20Sopenharmony_ci/*
5328c2ecf20Sopenharmony_ci * PHY_CSR7: TX DAC switching timing control.
5338c2ecf20Sopenharmony_ci */
5348c2ecf20Sopenharmony_ci#define PHY_CSR7			0x309c
5358c2ecf20Sopenharmony_ci
5368c2ecf20Sopenharmony_ci/*
5378c2ecf20Sopenharmony_ci * Security control register.
5388c2ecf20Sopenharmony_ci */
5398c2ecf20Sopenharmony_ci
5408c2ecf20Sopenharmony_ci/*
5418c2ecf20Sopenharmony_ci * SEC_CSR0: Shared key table control.
5428c2ecf20Sopenharmony_ci */
5438c2ecf20Sopenharmony_ci#define SEC_CSR0			0x30a0
5448c2ecf20Sopenharmony_ci#define SEC_CSR0_BSS0_KEY0_VALID	FIELD32(0x00000001)
5458c2ecf20Sopenharmony_ci#define SEC_CSR0_BSS0_KEY1_VALID	FIELD32(0x00000002)
5468c2ecf20Sopenharmony_ci#define SEC_CSR0_BSS0_KEY2_VALID	FIELD32(0x00000004)
5478c2ecf20Sopenharmony_ci#define SEC_CSR0_BSS0_KEY3_VALID	FIELD32(0x00000008)
5488c2ecf20Sopenharmony_ci#define SEC_CSR0_BSS1_KEY0_VALID	FIELD32(0x00000010)
5498c2ecf20Sopenharmony_ci#define SEC_CSR0_BSS1_KEY1_VALID	FIELD32(0x00000020)
5508c2ecf20Sopenharmony_ci#define SEC_CSR0_BSS1_KEY2_VALID	FIELD32(0x00000040)
5518c2ecf20Sopenharmony_ci#define SEC_CSR0_BSS1_KEY3_VALID	FIELD32(0x00000080)
5528c2ecf20Sopenharmony_ci#define SEC_CSR0_BSS2_KEY0_VALID	FIELD32(0x00000100)
5538c2ecf20Sopenharmony_ci#define SEC_CSR0_BSS2_KEY1_VALID	FIELD32(0x00000200)
5548c2ecf20Sopenharmony_ci#define SEC_CSR0_BSS2_KEY2_VALID	FIELD32(0x00000400)
5558c2ecf20Sopenharmony_ci#define SEC_CSR0_BSS2_KEY3_VALID	FIELD32(0x00000800)
5568c2ecf20Sopenharmony_ci#define SEC_CSR0_BSS3_KEY0_VALID	FIELD32(0x00001000)
5578c2ecf20Sopenharmony_ci#define SEC_CSR0_BSS3_KEY1_VALID	FIELD32(0x00002000)
5588c2ecf20Sopenharmony_ci#define SEC_CSR0_BSS3_KEY2_VALID	FIELD32(0x00004000)
5598c2ecf20Sopenharmony_ci#define SEC_CSR0_BSS3_KEY3_VALID	FIELD32(0x00008000)
5608c2ecf20Sopenharmony_ci
5618c2ecf20Sopenharmony_ci/*
5628c2ecf20Sopenharmony_ci * SEC_CSR1: Shared key table security mode register.
5638c2ecf20Sopenharmony_ci */
5648c2ecf20Sopenharmony_ci#define SEC_CSR1			0x30a4
5658c2ecf20Sopenharmony_ci#define SEC_CSR1_BSS0_KEY0_CIPHER_ALG	FIELD32(0x00000007)
5668c2ecf20Sopenharmony_ci#define SEC_CSR1_BSS0_KEY1_CIPHER_ALG	FIELD32(0x00000070)
5678c2ecf20Sopenharmony_ci#define SEC_CSR1_BSS0_KEY2_CIPHER_ALG	FIELD32(0x00000700)
5688c2ecf20Sopenharmony_ci#define SEC_CSR1_BSS0_KEY3_CIPHER_ALG	FIELD32(0x00007000)
5698c2ecf20Sopenharmony_ci#define SEC_CSR1_BSS1_KEY0_CIPHER_ALG	FIELD32(0x00070000)
5708c2ecf20Sopenharmony_ci#define SEC_CSR1_BSS1_KEY1_CIPHER_ALG	FIELD32(0x00700000)
5718c2ecf20Sopenharmony_ci#define SEC_CSR1_BSS1_KEY2_CIPHER_ALG	FIELD32(0x07000000)
5728c2ecf20Sopenharmony_ci#define SEC_CSR1_BSS1_KEY3_CIPHER_ALG	FIELD32(0x70000000)
5738c2ecf20Sopenharmony_ci
5748c2ecf20Sopenharmony_ci/*
5758c2ecf20Sopenharmony_ci * Pairwise key table valid bitmap registers.
5768c2ecf20Sopenharmony_ci * SEC_CSR2: pairwise key table valid bitmap 0.
5778c2ecf20Sopenharmony_ci * SEC_CSR3: pairwise key table valid bitmap 1.
5788c2ecf20Sopenharmony_ci */
5798c2ecf20Sopenharmony_ci#define SEC_CSR2			0x30a8
5808c2ecf20Sopenharmony_ci#define SEC_CSR3			0x30ac
5818c2ecf20Sopenharmony_ci
5828c2ecf20Sopenharmony_ci/*
5838c2ecf20Sopenharmony_ci * SEC_CSR4: Pairwise key table lookup control.
5848c2ecf20Sopenharmony_ci */
5858c2ecf20Sopenharmony_ci#define SEC_CSR4			0x30b0
5868c2ecf20Sopenharmony_ci#define SEC_CSR4_ENABLE_BSS0		FIELD32(0x00000001)
5878c2ecf20Sopenharmony_ci#define SEC_CSR4_ENABLE_BSS1		FIELD32(0x00000002)
5888c2ecf20Sopenharmony_ci#define SEC_CSR4_ENABLE_BSS2		FIELD32(0x00000004)
5898c2ecf20Sopenharmony_ci#define SEC_CSR4_ENABLE_BSS3		FIELD32(0x00000008)
5908c2ecf20Sopenharmony_ci
5918c2ecf20Sopenharmony_ci/*
5928c2ecf20Sopenharmony_ci * SEC_CSR5: shared key table security mode register.
5938c2ecf20Sopenharmony_ci */
5948c2ecf20Sopenharmony_ci#define SEC_CSR5			0x30b4
5958c2ecf20Sopenharmony_ci#define SEC_CSR5_BSS2_KEY0_CIPHER_ALG	FIELD32(0x00000007)
5968c2ecf20Sopenharmony_ci#define SEC_CSR5_BSS2_KEY1_CIPHER_ALG	FIELD32(0x00000070)
5978c2ecf20Sopenharmony_ci#define SEC_CSR5_BSS2_KEY2_CIPHER_ALG	FIELD32(0x00000700)
5988c2ecf20Sopenharmony_ci#define SEC_CSR5_BSS2_KEY3_CIPHER_ALG	FIELD32(0x00007000)
5998c2ecf20Sopenharmony_ci#define SEC_CSR5_BSS3_KEY0_CIPHER_ALG	FIELD32(0x00070000)
6008c2ecf20Sopenharmony_ci#define SEC_CSR5_BSS3_KEY1_CIPHER_ALG	FIELD32(0x00700000)
6018c2ecf20Sopenharmony_ci#define SEC_CSR5_BSS3_KEY2_CIPHER_ALG	FIELD32(0x07000000)
6028c2ecf20Sopenharmony_ci#define SEC_CSR5_BSS3_KEY3_CIPHER_ALG	FIELD32(0x70000000)
6038c2ecf20Sopenharmony_ci
6048c2ecf20Sopenharmony_ci/*
6058c2ecf20Sopenharmony_ci * STA control registers.
6068c2ecf20Sopenharmony_ci */
6078c2ecf20Sopenharmony_ci
6088c2ecf20Sopenharmony_ci/*
6098c2ecf20Sopenharmony_ci * STA_CSR0: RX PLCP error count & RX FCS error count.
6108c2ecf20Sopenharmony_ci */
6118c2ecf20Sopenharmony_ci#define STA_CSR0			0x30c0
6128c2ecf20Sopenharmony_ci#define STA_CSR0_FCS_ERROR		FIELD32(0x0000ffff)
6138c2ecf20Sopenharmony_ci#define STA_CSR0_PLCP_ERROR		FIELD32(0xffff0000)
6148c2ecf20Sopenharmony_ci
6158c2ecf20Sopenharmony_ci/*
6168c2ecf20Sopenharmony_ci * STA_CSR1: RX False CCA count & RX LONG frame count.
6178c2ecf20Sopenharmony_ci */
6188c2ecf20Sopenharmony_ci#define STA_CSR1			0x30c4
6198c2ecf20Sopenharmony_ci#define STA_CSR1_PHYSICAL_ERROR		FIELD32(0x0000ffff)
6208c2ecf20Sopenharmony_ci#define STA_CSR1_FALSE_CCA_ERROR	FIELD32(0xffff0000)
6218c2ecf20Sopenharmony_ci
6228c2ecf20Sopenharmony_ci/*
6238c2ecf20Sopenharmony_ci * STA_CSR2: TX Beacon count and RX FIFO overflow count.
6248c2ecf20Sopenharmony_ci */
6258c2ecf20Sopenharmony_ci#define STA_CSR2			0x30c8
6268c2ecf20Sopenharmony_ci#define STA_CSR2_RX_FIFO_OVERFLOW_COUNT	FIELD32(0x0000ffff)
6278c2ecf20Sopenharmony_ci#define STA_CSR2_RX_OVERFLOW_COUNT	FIELD32(0xffff0000)
6288c2ecf20Sopenharmony_ci
6298c2ecf20Sopenharmony_ci/*
6308c2ecf20Sopenharmony_ci * STA_CSR3: TX Beacon count.
6318c2ecf20Sopenharmony_ci */
6328c2ecf20Sopenharmony_ci#define STA_CSR3			0x30cc
6338c2ecf20Sopenharmony_ci#define STA_CSR3_TX_BEACON_COUNT	FIELD32(0x0000ffff)
6348c2ecf20Sopenharmony_ci
6358c2ecf20Sopenharmony_ci/*
6368c2ecf20Sopenharmony_ci * STA_CSR4: TX Retry count.
6378c2ecf20Sopenharmony_ci */
6388c2ecf20Sopenharmony_ci#define STA_CSR4			0x30d0
6398c2ecf20Sopenharmony_ci#define STA_CSR4_TX_NO_RETRY_COUNT	FIELD32(0x0000ffff)
6408c2ecf20Sopenharmony_ci#define STA_CSR4_TX_ONE_RETRY_COUNT	FIELD32(0xffff0000)
6418c2ecf20Sopenharmony_ci
6428c2ecf20Sopenharmony_ci/*
6438c2ecf20Sopenharmony_ci * STA_CSR5: TX Retry count.
6448c2ecf20Sopenharmony_ci */
6458c2ecf20Sopenharmony_ci#define STA_CSR5			0x30d4
6468c2ecf20Sopenharmony_ci#define STA_CSR4_TX_MULTI_RETRY_COUNT	FIELD32(0x0000ffff)
6478c2ecf20Sopenharmony_ci#define STA_CSR4_TX_RETRY_FAIL_COUNT	FIELD32(0xffff0000)
6488c2ecf20Sopenharmony_ci
6498c2ecf20Sopenharmony_ci/*
6508c2ecf20Sopenharmony_ci * QOS control registers.
6518c2ecf20Sopenharmony_ci */
6528c2ecf20Sopenharmony_ci
6538c2ecf20Sopenharmony_ci/*
6548c2ecf20Sopenharmony_ci * QOS_CSR1: TXOP holder MAC address register.
6558c2ecf20Sopenharmony_ci */
6568c2ecf20Sopenharmony_ci#define QOS_CSR1			0x30e4
6578c2ecf20Sopenharmony_ci#define QOS_CSR1_BYTE4			FIELD32(0x000000ff)
6588c2ecf20Sopenharmony_ci#define QOS_CSR1_BYTE5			FIELD32(0x0000ff00)
6598c2ecf20Sopenharmony_ci
6608c2ecf20Sopenharmony_ci/*
6618c2ecf20Sopenharmony_ci * QOS_CSR2: TXOP holder timeout register.
6628c2ecf20Sopenharmony_ci */
6638c2ecf20Sopenharmony_ci#define QOS_CSR2			0x30e8
6648c2ecf20Sopenharmony_ci
6658c2ecf20Sopenharmony_ci/*
6668c2ecf20Sopenharmony_ci * RX QOS-CFPOLL MAC address register.
6678c2ecf20Sopenharmony_ci * QOS_CSR3: RX QOS-CFPOLL MAC address 0.
6688c2ecf20Sopenharmony_ci * QOS_CSR4: RX QOS-CFPOLL MAC address 1.
6698c2ecf20Sopenharmony_ci */
6708c2ecf20Sopenharmony_ci#define QOS_CSR3			0x30ec
6718c2ecf20Sopenharmony_ci#define QOS_CSR4			0x30f0
6728c2ecf20Sopenharmony_ci
6738c2ecf20Sopenharmony_ci/*
6748c2ecf20Sopenharmony_ci * QOS_CSR5: "QosControl" field of the RX QOS-CFPOLL.
6758c2ecf20Sopenharmony_ci */
6768c2ecf20Sopenharmony_ci#define QOS_CSR5			0x30f4
6778c2ecf20Sopenharmony_ci
6788c2ecf20Sopenharmony_ci/*
6798c2ecf20Sopenharmony_ci * WMM Scheduler Register
6808c2ecf20Sopenharmony_ci */
6818c2ecf20Sopenharmony_ci
6828c2ecf20Sopenharmony_ci/*
6838c2ecf20Sopenharmony_ci * AIFSN_CSR: AIFSN for each EDCA AC.
6848c2ecf20Sopenharmony_ci * AIFSN0: For AC_VO.
6858c2ecf20Sopenharmony_ci * AIFSN1: For AC_VI.
6868c2ecf20Sopenharmony_ci * AIFSN2: For AC_BE.
6878c2ecf20Sopenharmony_ci * AIFSN3: For AC_BK.
6888c2ecf20Sopenharmony_ci */
6898c2ecf20Sopenharmony_ci#define AIFSN_CSR			0x0400
6908c2ecf20Sopenharmony_ci#define AIFSN_CSR_AIFSN0		FIELD32(0x0000000f)
6918c2ecf20Sopenharmony_ci#define AIFSN_CSR_AIFSN1		FIELD32(0x000000f0)
6928c2ecf20Sopenharmony_ci#define AIFSN_CSR_AIFSN2		FIELD32(0x00000f00)
6938c2ecf20Sopenharmony_ci#define AIFSN_CSR_AIFSN3		FIELD32(0x0000f000)
6948c2ecf20Sopenharmony_ci
6958c2ecf20Sopenharmony_ci/*
6968c2ecf20Sopenharmony_ci * CWMIN_CSR: CWmin for each EDCA AC.
6978c2ecf20Sopenharmony_ci * CWMIN0: For AC_VO.
6988c2ecf20Sopenharmony_ci * CWMIN1: For AC_VI.
6998c2ecf20Sopenharmony_ci * CWMIN2: For AC_BE.
7008c2ecf20Sopenharmony_ci * CWMIN3: For AC_BK.
7018c2ecf20Sopenharmony_ci */
7028c2ecf20Sopenharmony_ci#define CWMIN_CSR			0x0404
7038c2ecf20Sopenharmony_ci#define CWMIN_CSR_CWMIN0		FIELD32(0x0000000f)
7048c2ecf20Sopenharmony_ci#define CWMIN_CSR_CWMIN1		FIELD32(0x000000f0)
7058c2ecf20Sopenharmony_ci#define CWMIN_CSR_CWMIN2		FIELD32(0x00000f00)
7068c2ecf20Sopenharmony_ci#define CWMIN_CSR_CWMIN3		FIELD32(0x0000f000)
7078c2ecf20Sopenharmony_ci
7088c2ecf20Sopenharmony_ci/*
7098c2ecf20Sopenharmony_ci * CWMAX_CSR: CWmax for each EDCA AC.
7108c2ecf20Sopenharmony_ci * CWMAX0: For AC_VO.
7118c2ecf20Sopenharmony_ci * CWMAX1: For AC_VI.
7128c2ecf20Sopenharmony_ci * CWMAX2: For AC_BE.
7138c2ecf20Sopenharmony_ci * CWMAX3: For AC_BK.
7148c2ecf20Sopenharmony_ci */
7158c2ecf20Sopenharmony_ci#define CWMAX_CSR			0x0408
7168c2ecf20Sopenharmony_ci#define CWMAX_CSR_CWMAX0		FIELD32(0x0000000f)
7178c2ecf20Sopenharmony_ci#define CWMAX_CSR_CWMAX1		FIELD32(0x000000f0)
7188c2ecf20Sopenharmony_ci#define CWMAX_CSR_CWMAX2		FIELD32(0x00000f00)
7198c2ecf20Sopenharmony_ci#define CWMAX_CSR_CWMAX3		FIELD32(0x0000f000)
7208c2ecf20Sopenharmony_ci
7218c2ecf20Sopenharmony_ci/*
7228c2ecf20Sopenharmony_ci * AC_TXOP_CSR0: AC_VO/AC_VI TXOP register.
7238c2ecf20Sopenharmony_ci * AC0_TX_OP: For AC_VO, in unit of 32us.
7248c2ecf20Sopenharmony_ci * AC1_TX_OP: For AC_VI, in unit of 32us.
7258c2ecf20Sopenharmony_ci */
7268c2ecf20Sopenharmony_ci#define AC_TXOP_CSR0			0x040c
7278c2ecf20Sopenharmony_ci#define AC_TXOP_CSR0_AC0_TX_OP		FIELD32(0x0000ffff)
7288c2ecf20Sopenharmony_ci#define AC_TXOP_CSR0_AC1_TX_OP		FIELD32(0xffff0000)
7298c2ecf20Sopenharmony_ci
7308c2ecf20Sopenharmony_ci/*
7318c2ecf20Sopenharmony_ci * AC_TXOP_CSR1: AC_BE/AC_BK TXOP register.
7328c2ecf20Sopenharmony_ci * AC2_TX_OP: For AC_BE, in unit of 32us.
7338c2ecf20Sopenharmony_ci * AC3_TX_OP: For AC_BK, in unit of 32us.
7348c2ecf20Sopenharmony_ci */
7358c2ecf20Sopenharmony_ci#define AC_TXOP_CSR1			0x0410
7368c2ecf20Sopenharmony_ci#define AC_TXOP_CSR1_AC2_TX_OP		FIELD32(0x0000ffff)
7378c2ecf20Sopenharmony_ci#define AC_TXOP_CSR1_AC3_TX_OP		FIELD32(0xffff0000)
7388c2ecf20Sopenharmony_ci
7398c2ecf20Sopenharmony_ci/*
7408c2ecf20Sopenharmony_ci * BBP registers.
7418c2ecf20Sopenharmony_ci * The wordsize of the BBP is 8 bits.
7428c2ecf20Sopenharmony_ci */
7438c2ecf20Sopenharmony_ci
7448c2ecf20Sopenharmony_ci/*
7458c2ecf20Sopenharmony_ci * R2
7468c2ecf20Sopenharmony_ci */
7478c2ecf20Sopenharmony_ci#define BBP_R2_BG_MODE			FIELD8(0x20)
7488c2ecf20Sopenharmony_ci
7498c2ecf20Sopenharmony_ci/*
7508c2ecf20Sopenharmony_ci * R3
7518c2ecf20Sopenharmony_ci */
7528c2ecf20Sopenharmony_ci#define BBP_R3_SMART_MODE		FIELD8(0x01)
7538c2ecf20Sopenharmony_ci
7548c2ecf20Sopenharmony_ci/*
7558c2ecf20Sopenharmony_ci * R4: RX antenna control
7568c2ecf20Sopenharmony_ci * FRAME_END: 1 - DPDT, 0 - SPDT (Only valid for 802.11G, RF2527 & RF2529)
7578c2ecf20Sopenharmony_ci */
7588c2ecf20Sopenharmony_ci
7598c2ecf20Sopenharmony_ci/*
7608c2ecf20Sopenharmony_ci * ANTENNA_CONTROL semantics (guessed):
7618c2ecf20Sopenharmony_ci * 0x1: Software controlled antenna switching (fixed or SW diversity)
7628c2ecf20Sopenharmony_ci * 0x2: Hardware diversity.
7638c2ecf20Sopenharmony_ci */
7648c2ecf20Sopenharmony_ci#define BBP_R4_RX_ANTENNA_CONTROL	FIELD8(0x03)
7658c2ecf20Sopenharmony_ci#define BBP_R4_RX_FRAME_END		FIELD8(0x20)
7668c2ecf20Sopenharmony_ci
7678c2ecf20Sopenharmony_ci/*
7688c2ecf20Sopenharmony_ci * R77
7698c2ecf20Sopenharmony_ci */
7708c2ecf20Sopenharmony_ci#define BBP_R77_RX_ANTENNA		FIELD8(0x03)
7718c2ecf20Sopenharmony_ci
7728c2ecf20Sopenharmony_ci/*
7738c2ecf20Sopenharmony_ci * RF registers
7748c2ecf20Sopenharmony_ci */
7758c2ecf20Sopenharmony_ci
7768c2ecf20Sopenharmony_ci/*
7778c2ecf20Sopenharmony_ci * RF 3
7788c2ecf20Sopenharmony_ci */
7798c2ecf20Sopenharmony_ci#define RF3_TXPOWER			FIELD32(0x00003e00)
7808c2ecf20Sopenharmony_ci
7818c2ecf20Sopenharmony_ci/*
7828c2ecf20Sopenharmony_ci * RF 4
7838c2ecf20Sopenharmony_ci */
7848c2ecf20Sopenharmony_ci#define RF4_FREQ_OFFSET			FIELD32(0x0003f000)
7858c2ecf20Sopenharmony_ci
7868c2ecf20Sopenharmony_ci/*
7878c2ecf20Sopenharmony_ci * EEPROM content.
7888c2ecf20Sopenharmony_ci * The wordsize of the EEPROM is 16 bits.
7898c2ecf20Sopenharmony_ci */
7908c2ecf20Sopenharmony_ci
7918c2ecf20Sopenharmony_ci/*
7928c2ecf20Sopenharmony_ci * HW MAC address.
7938c2ecf20Sopenharmony_ci */
7948c2ecf20Sopenharmony_ci#define EEPROM_MAC_ADDR_0		0x0002
7958c2ecf20Sopenharmony_ci#define EEPROM_MAC_ADDR_BYTE0		FIELD16(0x00ff)
7968c2ecf20Sopenharmony_ci#define EEPROM_MAC_ADDR_BYTE1		FIELD16(0xff00)
7978c2ecf20Sopenharmony_ci#define EEPROM_MAC_ADDR1		0x0003
7988c2ecf20Sopenharmony_ci#define EEPROM_MAC_ADDR_BYTE2		FIELD16(0x00ff)
7998c2ecf20Sopenharmony_ci#define EEPROM_MAC_ADDR_BYTE3		FIELD16(0xff00)
8008c2ecf20Sopenharmony_ci#define EEPROM_MAC_ADDR_2		0x0004
8018c2ecf20Sopenharmony_ci#define EEPROM_MAC_ADDR_BYTE4		FIELD16(0x00ff)
8028c2ecf20Sopenharmony_ci#define EEPROM_MAC_ADDR_BYTE5		FIELD16(0xff00)
8038c2ecf20Sopenharmony_ci
8048c2ecf20Sopenharmony_ci/*
8058c2ecf20Sopenharmony_ci * EEPROM antenna.
8068c2ecf20Sopenharmony_ci * ANTENNA_NUM: Number of antennas.
8078c2ecf20Sopenharmony_ci * TX_DEFAULT: Default antenna 0: diversity, 1: A, 2: B.
8088c2ecf20Sopenharmony_ci * RX_DEFAULT: Default antenna 0: diversity, 1: A, 2: B.
8098c2ecf20Sopenharmony_ci * FRAME_TYPE: 0: DPDT , 1: SPDT , noted this bit is valid for g only.
8108c2ecf20Sopenharmony_ci * DYN_TXAGC: Dynamic TX AGC control.
8118c2ecf20Sopenharmony_ci * HARDWARE_RADIO: 1: Hardware controlled radio. Read GPIO0.
8128c2ecf20Sopenharmony_ci * RF_TYPE: Rf_type of this adapter.
8138c2ecf20Sopenharmony_ci */
8148c2ecf20Sopenharmony_ci#define EEPROM_ANTENNA			0x0010
8158c2ecf20Sopenharmony_ci#define EEPROM_ANTENNA_NUM		FIELD16(0x0003)
8168c2ecf20Sopenharmony_ci#define EEPROM_ANTENNA_TX_DEFAULT	FIELD16(0x000c)
8178c2ecf20Sopenharmony_ci#define EEPROM_ANTENNA_RX_DEFAULT	FIELD16(0x0030)
8188c2ecf20Sopenharmony_ci#define EEPROM_ANTENNA_FRAME_TYPE	FIELD16(0x0040)
8198c2ecf20Sopenharmony_ci#define EEPROM_ANTENNA_DYN_TXAGC	FIELD16(0x0200)
8208c2ecf20Sopenharmony_ci#define EEPROM_ANTENNA_HARDWARE_RADIO	FIELD16(0x0400)
8218c2ecf20Sopenharmony_ci#define EEPROM_ANTENNA_RF_TYPE		FIELD16(0xf800)
8228c2ecf20Sopenharmony_ci
8238c2ecf20Sopenharmony_ci/*
8248c2ecf20Sopenharmony_ci * EEPROM NIC config.
8258c2ecf20Sopenharmony_ci * EXTERNAL_LNA: External LNA.
8268c2ecf20Sopenharmony_ci */
8278c2ecf20Sopenharmony_ci#define EEPROM_NIC			0x0011
8288c2ecf20Sopenharmony_ci#define EEPROM_NIC_EXTERNAL_LNA		FIELD16(0x0010)
8298c2ecf20Sopenharmony_ci
8308c2ecf20Sopenharmony_ci/*
8318c2ecf20Sopenharmony_ci * EEPROM geography.
8328c2ecf20Sopenharmony_ci * GEO_A: Default geographical setting for 5GHz band
8338c2ecf20Sopenharmony_ci * GEO: Default geographical setting.
8348c2ecf20Sopenharmony_ci */
8358c2ecf20Sopenharmony_ci#define EEPROM_GEOGRAPHY		0x0012
8368c2ecf20Sopenharmony_ci#define EEPROM_GEOGRAPHY_GEO_A		FIELD16(0x00ff)
8378c2ecf20Sopenharmony_ci#define EEPROM_GEOGRAPHY_GEO		FIELD16(0xff00)
8388c2ecf20Sopenharmony_ci
8398c2ecf20Sopenharmony_ci/*
8408c2ecf20Sopenharmony_ci * EEPROM BBP.
8418c2ecf20Sopenharmony_ci */
8428c2ecf20Sopenharmony_ci#define EEPROM_BBP_START		0x0013
8438c2ecf20Sopenharmony_ci#define EEPROM_BBP_SIZE			16
8448c2ecf20Sopenharmony_ci#define EEPROM_BBP_VALUE		FIELD16(0x00ff)
8458c2ecf20Sopenharmony_ci#define EEPROM_BBP_REG_ID		FIELD16(0xff00)
8468c2ecf20Sopenharmony_ci
8478c2ecf20Sopenharmony_ci/*
8488c2ecf20Sopenharmony_ci * EEPROM TXPOWER 802.11G
8498c2ecf20Sopenharmony_ci */
8508c2ecf20Sopenharmony_ci#define EEPROM_TXPOWER_G_START		0x0023
8518c2ecf20Sopenharmony_ci#define EEPROM_TXPOWER_G_SIZE		7
8528c2ecf20Sopenharmony_ci#define EEPROM_TXPOWER_G_1		FIELD16(0x00ff)
8538c2ecf20Sopenharmony_ci#define EEPROM_TXPOWER_G_2		FIELD16(0xff00)
8548c2ecf20Sopenharmony_ci
8558c2ecf20Sopenharmony_ci/*
8568c2ecf20Sopenharmony_ci * EEPROM Frequency
8578c2ecf20Sopenharmony_ci */
8588c2ecf20Sopenharmony_ci#define EEPROM_FREQ			0x002f
8598c2ecf20Sopenharmony_ci#define EEPROM_FREQ_OFFSET		FIELD16(0x00ff)
8608c2ecf20Sopenharmony_ci#define EEPROM_FREQ_SEQ_MASK		FIELD16(0xff00)
8618c2ecf20Sopenharmony_ci#define EEPROM_FREQ_SEQ			FIELD16(0x0300)
8628c2ecf20Sopenharmony_ci
8638c2ecf20Sopenharmony_ci/*
8648c2ecf20Sopenharmony_ci * EEPROM LED.
8658c2ecf20Sopenharmony_ci * POLARITY_RDY_G: Polarity RDY_G setting.
8668c2ecf20Sopenharmony_ci * POLARITY_RDY_A: Polarity RDY_A setting.
8678c2ecf20Sopenharmony_ci * POLARITY_ACT: Polarity ACT setting.
8688c2ecf20Sopenharmony_ci * POLARITY_GPIO_0: Polarity GPIO0 setting.
8698c2ecf20Sopenharmony_ci * POLARITY_GPIO_1: Polarity GPIO1 setting.
8708c2ecf20Sopenharmony_ci * POLARITY_GPIO_2: Polarity GPIO2 setting.
8718c2ecf20Sopenharmony_ci * POLARITY_GPIO_3: Polarity GPIO3 setting.
8728c2ecf20Sopenharmony_ci * POLARITY_GPIO_4: Polarity GPIO4 setting.
8738c2ecf20Sopenharmony_ci * LED_MODE: Led mode.
8748c2ecf20Sopenharmony_ci */
8758c2ecf20Sopenharmony_ci#define EEPROM_LED			0x0030
8768c2ecf20Sopenharmony_ci#define EEPROM_LED_POLARITY_RDY_G	FIELD16(0x0001)
8778c2ecf20Sopenharmony_ci#define EEPROM_LED_POLARITY_RDY_A	FIELD16(0x0002)
8788c2ecf20Sopenharmony_ci#define EEPROM_LED_POLARITY_ACT		FIELD16(0x0004)
8798c2ecf20Sopenharmony_ci#define EEPROM_LED_POLARITY_GPIO_0	FIELD16(0x0008)
8808c2ecf20Sopenharmony_ci#define EEPROM_LED_POLARITY_GPIO_1	FIELD16(0x0010)
8818c2ecf20Sopenharmony_ci#define EEPROM_LED_POLARITY_GPIO_2	FIELD16(0x0020)
8828c2ecf20Sopenharmony_ci#define EEPROM_LED_POLARITY_GPIO_3	FIELD16(0x0040)
8838c2ecf20Sopenharmony_ci#define EEPROM_LED_POLARITY_GPIO_4	FIELD16(0x0080)
8848c2ecf20Sopenharmony_ci#define EEPROM_LED_LED_MODE		FIELD16(0x1f00)
8858c2ecf20Sopenharmony_ci
8868c2ecf20Sopenharmony_ci/*
8878c2ecf20Sopenharmony_ci * EEPROM TXPOWER 802.11A
8888c2ecf20Sopenharmony_ci */
8898c2ecf20Sopenharmony_ci#define EEPROM_TXPOWER_A_START		0x0031
8908c2ecf20Sopenharmony_ci#define EEPROM_TXPOWER_A_SIZE		12
8918c2ecf20Sopenharmony_ci#define EEPROM_TXPOWER_A_1		FIELD16(0x00ff)
8928c2ecf20Sopenharmony_ci#define EEPROM_TXPOWER_A_2		FIELD16(0xff00)
8938c2ecf20Sopenharmony_ci
8948c2ecf20Sopenharmony_ci/*
8958c2ecf20Sopenharmony_ci * EEPROM RSSI offset 802.11BG
8968c2ecf20Sopenharmony_ci */
8978c2ecf20Sopenharmony_ci#define EEPROM_RSSI_OFFSET_BG		0x004d
8988c2ecf20Sopenharmony_ci#define EEPROM_RSSI_OFFSET_BG_1		FIELD16(0x00ff)
8998c2ecf20Sopenharmony_ci#define EEPROM_RSSI_OFFSET_BG_2		FIELD16(0xff00)
9008c2ecf20Sopenharmony_ci
9018c2ecf20Sopenharmony_ci/*
9028c2ecf20Sopenharmony_ci * EEPROM RSSI offset 802.11A
9038c2ecf20Sopenharmony_ci */
9048c2ecf20Sopenharmony_ci#define EEPROM_RSSI_OFFSET_A		0x004e
9058c2ecf20Sopenharmony_ci#define EEPROM_RSSI_OFFSET_A_1		FIELD16(0x00ff)
9068c2ecf20Sopenharmony_ci#define EEPROM_RSSI_OFFSET_A_2		FIELD16(0xff00)
9078c2ecf20Sopenharmony_ci
9088c2ecf20Sopenharmony_ci/*
9098c2ecf20Sopenharmony_ci * DMA descriptor defines.
9108c2ecf20Sopenharmony_ci */
9118c2ecf20Sopenharmony_ci#define TXD_DESC_SIZE			( 6 * sizeof(__le32) )
9128c2ecf20Sopenharmony_ci#define TXINFO_SIZE			( 6 * sizeof(__le32) )
9138c2ecf20Sopenharmony_ci#define RXD_DESC_SIZE			( 6 * sizeof(__le32) )
9148c2ecf20Sopenharmony_ci
9158c2ecf20Sopenharmony_ci/*
9168c2ecf20Sopenharmony_ci * TX descriptor format for TX, PRIO and Beacon Ring.
9178c2ecf20Sopenharmony_ci */
9188c2ecf20Sopenharmony_ci
9198c2ecf20Sopenharmony_ci/*
9208c2ecf20Sopenharmony_ci * Word0
9218c2ecf20Sopenharmony_ci * BURST: Next frame belongs to same "burst" event.
9228c2ecf20Sopenharmony_ci * TKIP_MIC: ASIC appends TKIP MIC if TKIP is used.
9238c2ecf20Sopenharmony_ci * KEY_TABLE: Use per-client pairwise KEY table.
9248c2ecf20Sopenharmony_ci * KEY_INDEX:
9258c2ecf20Sopenharmony_ci * Key index (0~31) to the pairwise KEY table.
9268c2ecf20Sopenharmony_ci * 0~3 to shared KEY table 0 (BSS0).
9278c2ecf20Sopenharmony_ci * 4~7 to shared KEY table 1 (BSS1).
9288c2ecf20Sopenharmony_ci * 8~11 to shared KEY table 2 (BSS2).
9298c2ecf20Sopenharmony_ci * 12~15 to shared KEY table 3 (BSS3).
9308c2ecf20Sopenharmony_ci * BURST2: For backward compatibility, set to same value as BURST.
9318c2ecf20Sopenharmony_ci */
9328c2ecf20Sopenharmony_ci#define TXD_W0_BURST			FIELD32(0x00000001)
9338c2ecf20Sopenharmony_ci#define TXD_W0_VALID			FIELD32(0x00000002)
9348c2ecf20Sopenharmony_ci#define TXD_W0_MORE_FRAG		FIELD32(0x00000004)
9358c2ecf20Sopenharmony_ci#define TXD_W0_ACK			FIELD32(0x00000008)
9368c2ecf20Sopenharmony_ci#define TXD_W0_TIMESTAMP		FIELD32(0x00000010)
9378c2ecf20Sopenharmony_ci#define TXD_W0_OFDM			FIELD32(0x00000020)
9388c2ecf20Sopenharmony_ci#define TXD_W0_IFS			FIELD32(0x00000040)
9398c2ecf20Sopenharmony_ci#define TXD_W0_RETRY_MODE		FIELD32(0x00000080)
9408c2ecf20Sopenharmony_ci#define TXD_W0_TKIP_MIC			FIELD32(0x00000100)
9418c2ecf20Sopenharmony_ci#define TXD_W0_KEY_TABLE		FIELD32(0x00000200)
9428c2ecf20Sopenharmony_ci#define TXD_W0_KEY_INDEX		FIELD32(0x0000fc00)
9438c2ecf20Sopenharmony_ci#define TXD_W0_DATABYTE_COUNT		FIELD32(0x0fff0000)
9448c2ecf20Sopenharmony_ci#define TXD_W0_BURST2			FIELD32(0x10000000)
9458c2ecf20Sopenharmony_ci#define TXD_W0_CIPHER_ALG		FIELD32(0xe0000000)
9468c2ecf20Sopenharmony_ci
9478c2ecf20Sopenharmony_ci/*
9488c2ecf20Sopenharmony_ci * Word1
9498c2ecf20Sopenharmony_ci * HOST_Q_ID: EDCA/HCCA queue ID.
9508c2ecf20Sopenharmony_ci * HW_SEQUENCE: MAC overwrites the frame sequence number.
9518c2ecf20Sopenharmony_ci * BUFFER_COUNT: Number of buffers in this TXD.
9528c2ecf20Sopenharmony_ci */
9538c2ecf20Sopenharmony_ci#define TXD_W1_HOST_Q_ID		FIELD32(0x0000000f)
9548c2ecf20Sopenharmony_ci#define TXD_W1_AIFSN			FIELD32(0x000000f0)
9558c2ecf20Sopenharmony_ci#define TXD_W1_CWMIN			FIELD32(0x00000f00)
9568c2ecf20Sopenharmony_ci#define TXD_W1_CWMAX			FIELD32(0x0000f000)
9578c2ecf20Sopenharmony_ci#define TXD_W1_IV_OFFSET		FIELD32(0x003f0000)
9588c2ecf20Sopenharmony_ci#define TXD_W1_HW_SEQUENCE		FIELD32(0x10000000)
9598c2ecf20Sopenharmony_ci#define TXD_W1_BUFFER_COUNT		FIELD32(0xe0000000)
9608c2ecf20Sopenharmony_ci
9618c2ecf20Sopenharmony_ci/*
9628c2ecf20Sopenharmony_ci * Word2: PLCP information
9638c2ecf20Sopenharmony_ci */
9648c2ecf20Sopenharmony_ci#define TXD_W2_PLCP_SIGNAL		FIELD32(0x000000ff)
9658c2ecf20Sopenharmony_ci#define TXD_W2_PLCP_SERVICE		FIELD32(0x0000ff00)
9668c2ecf20Sopenharmony_ci#define TXD_W2_PLCP_LENGTH_LOW		FIELD32(0x00ff0000)
9678c2ecf20Sopenharmony_ci#define TXD_W2_PLCP_LENGTH_HIGH		FIELD32(0xff000000)
9688c2ecf20Sopenharmony_ci
9698c2ecf20Sopenharmony_ci/*
9708c2ecf20Sopenharmony_ci * Word3
9718c2ecf20Sopenharmony_ci */
9728c2ecf20Sopenharmony_ci#define TXD_W3_IV			FIELD32(0xffffffff)
9738c2ecf20Sopenharmony_ci
9748c2ecf20Sopenharmony_ci/*
9758c2ecf20Sopenharmony_ci * Word4
9768c2ecf20Sopenharmony_ci */
9778c2ecf20Sopenharmony_ci#define TXD_W4_EIV			FIELD32(0xffffffff)
9788c2ecf20Sopenharmony_ci
9798c2ecf20Sopenharmony_ci/*
9808c2ecf20Sopenharmony_ci * Word5
9818c2ecf20Sopenharmony_ci * FRAME_OFFSET: Frame start offset inside ASIC TXFIFO (after TXINFO field).
9828c2ecf20Sopenharmony_ci * PACKET_ID: Driver assigned packet ID to categorize TXResult in interrupt.
9838c2ecf20Sopenharmony_ci * WAITING_DMA_DONE_INT: TXD been filled with data
9848c2ecf20Sopenharmony_ci * and waiting for TxDoneISR housekeeping.
9858c2ecf20Sopenharmony_ci */
9868c2ecf20Sopenharmony_ci#define TXD_W5_FRAME_OFFSET		FIELD32(0x000000ff)
9878c2ecf20Sopenharmony_ci#define TXD_W5_PACKET_ID		FIELD32(0x0000ff00)
9888c2ecf20Sopenharmony_ci#define TXD_W5_TX_POWER			FIELD32(0x00ff0000)
9898c2ecf20Sopenharmony_ci#define TXD_W5_WAITING_DMA_DONE_INT	FIELD32(0x01000000)
9908c2ecf20Sopenharmony_ci
9918c2ecf20Sopenharmony_ci/*
9928c2ecf20Sopenharmony_ci * RX descriptor format for RX Ring.
9938c2ecf20Sopenharmony_ci */
9948c2ecf20Sopenharmony_ci
9958c2ecf20Sopenharmony_ci/*
9968c2ecf20Sopenharmony_ci * Word0
9978c2ecf20Sopenharmony_ci * CIPHER_ERROR: 1:ICV error, 2:MIC error, 3:invalid key.
9988c2ecf20Sopenharmony_ci * KEY_INDEX: Decryption key actually used.
9998c2ecf20Sopenharmony_ci */
10008c2ecf20Sopenharmony_ci#define RXD_W0_OWNER_NIC		FIELD32(0x00000001)
10018c2ecf20Sopenharmony_ci#define RXD_W0_DROP			FIELD32(0x00000002)
10028c2ecf20Sopenharmony_ci#define RXD_W0_UNICAST_TO_ME		FIELD32(0x00000004)
10038c2ecf20Sopenharmony_ci#define RXD_W0_MULTICAST		FIELD32(0x00000008)
10048c2ecf20Sopenharmony_ci#define RXD_W0_BROADCAST		FIELD32(0x00000010)
10058c2ecf20Sopenharmony_ci#define RXD_W0_MY_BSS			FIELD32(0x00000020)
10068c2ecf20Sopenharmony_ci#define RXD_W0_CRC_ERROR		FIELD32(0x00000040)
10078c2ecf20Sopenharmony_ci#define RXD_W0_OFDM			FIELD32(0x00000080)
10088c2ecf20Sopenharmony_ci#define RXD_W0_CIPHER_ERROR		FIELD32(0x00000300)
10098c2ecf20Sopenharmony_ci#define RXD_W0_KEY_INDEX		FIELD32(0x0000fc00)
10108c2ecf20Sopenharmony_ci#define RXD_W0_DATABYTE_COUNT		FIELD32(0x0fff0000)
10118c2ecf20Sopenharmony_ci#define RXD_W0_CIPHER_ALG		FIELD32(0xe0000000)
10128c2ecf20Sopenharmony_ci
10138c2ecf20Sopenharmony_ci/*
10148c2ecf20Sopenharmony_ci * WORD1
10158c2ecf20Sopenharmony_ci * SIGNAL: RX raw data rate reported by BBP.
10168c2ecf20Sopenharmony_ci * RSSI: RSSI reported by BBP.
10178c2ecf20Sopenharmony_ci */
10188c2ecf20Sopenharmony_ci#define RXD_W1_SIGNAL			FIELD32(0x000000ff)
10198c2ecf20Sopenharmony_ci#define RXD_W1_RSSI_AGC			FIELD32(0x00001f00)
10208c2ecf20Sopenharmony_ci#define RXD_W1_RSSI_LNA			FIELD32(0x00006000)
10218c2ecf20Sopenharmony_ci#define RXD_W1_FRAME_OFFSET		FIELD32(0x7f000000)
10228c2ecf20Sopenharmony_ci
10238c2ecf20Sopenharmony_ci/*
10248c2ecf20Sopenharmony_ci * Word2
10258c2ecf20Sopenharmony_ci * IV: Received IV of originally encrypted.
10268c2ecf20Sopenharmony_ci */
10278c2ecf20Sopenharmony_ci#define RXD_W2_IV			FIELD32(0xffffffff)
10288c2ecf20Sopenharmony_ci
10298c2ecf20Sopenharmony_ci/*
10308c2ecf20Sopenharmony_ci * Word3
10318c2ecf20Sopenharmony_ci * EIV: Received EIV of originally encrypted.
10328c2ecf20Sopenharmony_ci */
10338c2ecf20Sopenharmony_ci#define RXD_W3_EIV			FIELD32(0xffffffff)
10348c2ecf20Sopenharmony_ci
10358c2ecf20Sopenharmony_ci/*
10368c2ecf20Sopenharmony_ci * Word4
10378c2ecf20Sopenharmony_ci * ICV: Received ICV of originally encrypted.
10388c2ecf20Sopenharmony_ci * NOTE: This is a guess, the official definition is "reserved"
10398c2ecf20Sopenharmony_ci */
10408c2ecf20Sopenharmony_ci#define RXD_W4_ICV			FIELD32(0xffffffff)
10418c2ecf20Sopenharmony_ci
10428c2ecf20Sopenharmony_ci/*
10438c2ecf20Sopenharmony_ci * the above 20-byte is called RXINFO and will be DMAed to MAC RX block
10448c2ecf20Sopenharmony_ci * and passed to the HOST driver.
10458c2ecf20Sopenharmony_ci * The following fields are for DMA block and HOST usage only.
10468c2ecf20Sopenharmony_ci * Can't be touched by ASIC MAC block.
10478c2ecf20Sopenharmony_ci */
10488c2ecf20Sopenharmony_ci
10498c2ecf20Sopenharmony_ci/*
10508c2ecf20Sopenharmony_ci * Word5
10518c2ecf20Sopenharmony_ci */
10528c2ecf20Sopenharmony_ci#define RXD_W5_RESERVED			FIELD32(0xffffffff)
10538c2ecf20Sopenharmony_ci
10548c2ecf20Sopenharmony_ci/*
10558c2ecf20Sopenharmony_ci * Macros for converting txpower from EEPROM to mac80211 value
10568c2ecf20Sopenharmony_ci * and from mac80211 value to register value.
10578c2ecf20Sopenharmony_ci */
10588c2ecf20Sopenharmony_ci#define MIN_TXPOWER	0
10598c2ecf20Sopenharmony_ci#define MAX_TXPOWER	31
10608c2ecf20Sopenharmony_ci#define DEFAULT_TXPOWER	24
10618c2ecf20Sopenharmony_ci
10628c2ecf20Sopenharmony_ci#define TXPOWER_FROM_DEV(__txpower) \
10638c2ecf20Sopenharmony_ci	(((u8)(__txpower)) > MAX_TXPOWER) ? DEFAULT_TXPOWER : (__txpower)
10648c2ecf20Sopenharmony_ci
10658c2ecf20Sopenharmony_ci#define TXPOWER_TO_DEV(__txpower) \
10668c2ecf20Sopenharmony_ci	clamp_t(char, __txpower, MIN_TXPOWER, MAX_TXPOWER)
10678c2ecf20Sopenharmony_ci
10688c2ecf20Sopenharmony_ci#endif /* RT73USB_H */
1069