162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci	Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
462306a36Sopenharmony_ci	<http://rt2x00.serialmonkey.com>
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci/*
962306a36Sopenharmony_ci	Module: rt61pci
1062306a36Sopenharmony_ci	Abstract: Data structures and registers for the rt61pci module.
1162306a36Sopenharmony_ci	Supported chipsets: RT2561, RT2561s, RT2661.
1262306a36Sopenharmony_ci */
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#ifndef RT61PCI_H
1562306a36Sopenharmony_ci#define RT61PCI_H
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci/*
1862306a36Sopenharmony_ci * RT chip PCI IDs.
1962306a36Sopenharmony_ci */
2062306a36Sopenharmony_ci#define RT2561s_PCI_ID			0x0301
2162306a36Sopenharmony_ci#define RT2561_PCI_ID			0x0302
2262306a36Sopenharmony_ci#define RT2661_PCI_ID			0x0401
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci/*
2562306a36Sopenharmony_ci * RF chip defines.
2662306a36Sopenharmony_ci */
2762306a36Sopenharmony_ci#define RF5225				0x0001
2862306a36Sopenharmony_ci#define RF5325				0x0002
2962306a36Sopenharmony_ci#define RF2527				0x0003
3062306a36Sopenharmony_ci#define RF2529				0x0004
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci/*
3362306a36Sopenharmony_ci * Signal information.
3462306a36Sopenharmony_ci * Default offset is required for RSSI <-> dBm conversion.
3562306a36Sopenharmony_ci */
3662306a36Sopenharmony_ci#define DEFAULT_RSSI_OFFSET		120
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci/*
3962306a36Sopenharmony_ci * Register layout information.
4062306a36Sopenharmony_ci */
4162306a36Sopenharmony_ci#define CSR_REG_BASE			0x3000
4262306a36Sopenharmony_ci#define CSR_REG_SIZE			0x04b0
4362306a36Sopenharmony_ci#define EEPROM_BASE			0x0000
4462306a36Sopenharmony_ci#define EEPROM_SIZE			0x0100
4562306a36Sopenharmony_ci#define BBP_BASE			0x0000
4662306a36Sopenharmony_ci#define BBP_SIZE			0x0080
4762306a36Sopenharmony_ci#define RF_BASE				0x0004
4862306a36Sopenharmony_ci#define RF_SIZE				0x0010
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci/*
5162306a36Sopenharmony_ci * Number of TX queues.
5262306a36Sopenharmony_ci */
5362306a36Sopenharmony_ci#define NUM_TX_QUEUES			4
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci/*
5662306a36Sopenharmony_ci * PCI registers.
5762306a36Sopenharmony_ci */
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci/*
6062306a36Sopenharmony_ci * HOST_CMD_CSR: For HOST to interrupt embedded processor
6162306a36Sopenharmony_ci */
6262306a36Sopenharmony_ci#define HOST_CMD_CSR			0x0008
6362306a36Sopenharmony_ci#define HOST_CMD_CSR_HOST_COMMAND	FIELD32(0x0000007f)
6462306a36Sopenharmony_ci#define HOST_CMD_CSR_INTERRUPT_MCU	FIELD32(0x00000080)
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ci/*
6762306a36Sopenharmony_ci * MCU_CNTL_CSR
6862306a36Sopenharmony_ci * SELECT_BANK: Select 8051 program bank.
6962306a36Sopenharmony_ci * RESET: Enable 8051 reset state.
7062306a36Sopenharmony_ci * READY: Ready state for 8051.
7162306a36Sopenharmony_ci */
7262306a36Sopenharmony_ci#define MCU_CNTL_CSR			0x000c
7362306a36Sopenharmony_ci#define MCU_CNTL_CSR_SELECT_BANK	FIELD32(0x00000001)
7462306a36Sopenharmony_ci#define MCU_CNTL_CSR_RESET		FIELD32(0x00000002)
7562306a36Sopenharmony_ci#define MCU_CNTL_CSR_READY		FIELD32(0x00000004)
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci/*
7862306a36Sopenharmony_ci * SOFT_RESET_CSR
7962306a36Sopenharmony_ci * FORCE_CLOCK_ON: Host force MAC clock ON
8062306a36Sopenharmony_ci */
8162306a36Sopenharmony_ci#define SOFT_RESET_CSR			0x0010
8262306a36Sopenharmony_ci#define SOFT_RESET_CSR_FORCE_CLOCK_ON	FIELD32(0x00000002)
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ci/*
8562306a36Sopenharmony_ci * MCU_INT_SOURCE_CSR: MCU interrupt source/mask register.
8662306a36Sopenharmony_ci */
8762306a36Sopenharmony_ci#define MCU_INT_SOURCE_CSR		0x0014
8862306a36Sopenharmony_ci#define MCU_INT_SOURCE_CSR_0		FIELD32(0x00000001)
8962306a36Sopenharmony_ci#define MCU_INT_SOURCE_CSR_1		FIELD32(0x00000002)
9062306a36Sopenharmony_ci#define MCU_INT_SOURCE_CSR_2		FIELD32(0x00000004)
9162306a36Sopenharmony_ci#define MCU_INT_SOURCE_CSR_3		FIELD32(0x00000008)
9262306a36Sopenharmony_ci#define MCU_INT_SOURCE_CSR_4		FIELD32(0x00000010)
9362306a36Sopenharmony_ci#define MCU_INT_SOURCE_CSR_5		FIELD32(0x00000020)
9462306a36Sopenharmony_ci#define MCU_INT_SOURCE_CSR_6		FIELD32(0x00000040)
9562306a36Sopenharmony_ci#define MCU_INT_SOURCE_CSR_7		FIELD32(0x00000080)
9662306a36Sopenharmony_ci#define MCU_INT_SOURCE_CSR_TWAKEUP	FIELD32(0x00000100)
9762306a36Sopenharmony_ci#define MCU_INT_SOURCE_CSR_TBTT_EXPIRE	FIELD32(0x00000200)
9862306a36Sopenharmony_ci
9962306a36Sopenharmony_ci/*
10062306a36Sopenharmony_ci * MCU_INT_MASK_CSR: MCU interrupt source/mask register.
10162306a36Sopenharmony_ci */
10262306a36Sopenharmony_ci#define MCU_INT_MASK_CSR		0x0018
10362306a36Sopenharmony_ci#define MCU_INT_MASK_CSR_0		FIELD32(0x00000001)
10462306a36Sopenharmony_ci#define MCU_INT_MASK_CSR_1		FIELD32(0x00000002)
10562306a36Sopenharmony_ci#define MCU_INT_MASK_CSR_2		FIELD32(0x00000004)
10662306a36Sopenharmony_ci#define MCU_INT_MASK_CSR_3		FIELD32(0x00000008)
10762306a36Sopenharmony_ci#define MCU_INT_MASK_CSR_4		FIELD32(0x00000010)
10862306a36Sopenharmony_ci#define MCU_INT_MASK_CSR_5		FIELD32(0x00000020)
10962306a36Sopenharmony_ci#define MCU_INT_MASK_CSR_6		FIELD32(0x00000040)
11062306a36Sopenharmony_ci#define MCU_INT_MASK_CSR_7		FIELD32(0x00000080)
11162306a36Sopenharmony_ci#define MCU_INT_MASK_CSR_TWAKEUP	FIELD32(0x00000100)
11262306a36Sopenharmony_ci#define MCU_INT_MASK_CSR_TBTT_EXPIRE	FIELD32(0x00000200)
11362306a36Sopenharmony_ci
11462306a36Sopenharmony_ci/*
11562306a36Sopenharmony_ci * PCI_USEC_CSR
11662306a36Sopenharmony_ci */
11762306a36Sopenharmony_ci#define PCI_USEC_CSR			0x001c
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_ci/*
12062306a36Sopenharmony_ci * Security key table memory.
12162306a36Sopenharmony_ci * 16 entries 32-byte for shared key table
12262306a36Sopenharmony_ci * 64 entries 32-byte for pairwise key table
12362306a36Sopenharmony_ci * 64 entries 8-byte for pairwise ta key table
12462306a36Sopenharmony_ci */
12562306a36Sopenharmony_ci#define SHARED_KEY_TABLE_BASE		0x1000
12662306a36Sopenharmony_ci#define PAIRWISE_KEY_TABLE_BASE		0x1200
12762306a36Sopenharmony_ci#define PAIRWISE_TA_TABLE_BASE		0x1a00
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ci#define SHARED_KEY_ENTRY(__idx) \
13062306a36Sopenharmony_ci	(SHARED_KEY_TABLE_BASE + \
13162306a36Sopenharmony_ci		((__idx) * sizeof(struct hw_key_entry)))
13262306a36Sopenharmony_ci#define PAIRWISE_KEY_ENTRY(__idx) \
13362306a36Sopenharmony_ci	(PAIRWISE_KEY_TABLE_BASE + \
13462306a36Sopenharmony_ci		((__idx) * sizeof(struct hw_key_entry)))
13562306a36Sopenharmony_ci#define PAIRWISE_TA_ENTRY(__idx) \
13662306a36Sopenharmony_ci	(PAIRWISE_TA_TABLE_BASE + \
13762306a36Sopenharmony_ci		((__idx) * sizeof(struct hw_pairwise_ta_entry)))
13862306a36Sopenharmony_ci
13962306a36Sopenharmony_cistruct hw_key_entry {
14062306a36Sopenharmony_ci	u8 key[16];
14162306a36Sopenharmony_ci	u8 tx_mic[8];
14262306a36Sopenharmony_ci	u8 rx_mic[8];
14362306a36Sopenharmony_ci} __packed;
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_cistruct hw_pairwise_ta_entry {
14662306a36Sopenharmony_ci	u8 address[6];
14762306a36Sopenharmony_ci	u8 cipher;
14862306a36Sopenharmony_ci	u8 reserved;
14962306a36Sopenharmony_ci} __packed;
15062306a36Sopenharmony_ci
15162306a36Sopenharmony_ci/*
15262306a36Sopenharmony_ci * Other on-chip shared memory space.
15362306a36Sopenharmony_ci */
15462306a36Sopenharmony_ci#define HW_CIS_BASE			0x2000
15562306a36Sopenharmony_ci#define HW_NULL_BASE			0x2b00
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_ci/*
15862306a36Sopenharmony_ci * Since NULL frame won't be that long (256 byte),
15962306a36Sopenharmony_ci * We steal 16 tail bytes to save debugging settings.
16062306a36Sopenharmony_ci */
16162306a36Sopenharmony_ci#define HW_DEBUG_SETTING_BASE		0x2bf0
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_ci/*
16462306a36Sopenharmony_ci * On-chip BEACON frame space.
16562306a36Sopenharmony_ci */
16662306a36Sopenharmony_ci#define HW_BEACON_BASE0			0x2c00
16762306a36Sopenharmony_ci#define HW_BEACON_BASE1			0x2d00
16862306a36Sopenharmony_ci#define HW_BEACON_BASE2			0x2e00
16962306a36Sopenharmony_ci#define HW_BEACON_BASE3			0x2f00
17062306a36Sopenharmony_ci
17162306a36Sopenharmony_ci#define HW_BEACON_OFFSET(__index) \
17262306a36Sopenharmony_ci	(HW_BEACON_BASE0 + (__index * 0x0100))
17362306a36Sopenharmony_ci
17462306a36Sopenharmony_ci/*
17562306a36Sopenharmony_ci * HOST-MCU shared memory.
17662306a36Sopenharmony_ci */
17762306a36Sopenharmony_ci
17862306a36Sopenharmony_ci/*
17962306a36Sopenharmony_ci * H2M_MAILBOX_CSR: Host-to-MCU Mailbox.
18062306a36Sopenharmony_ci */
18162306a36Sopenharmony_ci#define H2M_MAILBOX_CSR			0x2100
18262306a36Sopenharmony_ci#define H2M_MAILBOX_CSR_ARG0		FIELD32(0x000000ff)
18362306a36Sopenharmony_ci#define H2M_MAILBOX_CSR_ARG1		FIELD32(0x0000ff00)
18462306a36Sopenharmony_ci#define H2M_MAILBOX_CSR_CMD_TOKEN	FIELD32(0x00ff0000)
18562306a36Sopenharmony_ci#define H2M_MAILBOX_CSR_OWNER		FIELD32(0xff000000)
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_ci/*
18862306a36Sopenharmony_ci * MCU_LEDCS: LED control for MCU Mailbox.
18962306a36Sopenharmony_ci */
19062306a36Sopenharmony_ci#define MCU_LEDCS_LED_MODE		FIELD16(0x001f)
19162306a36Sopenharmony_ci#define MCU_LEDCS_RADIO_STATUS		FIELD16(0x0020)
19262306a36Sopenharmony_ci#define MCU_LEDCS_LINK_BG_STATUS	FIELD16(0x0040)
19362306a36Sopenharmony_ci#define MCU_LEDCS_LINK_A_STATUS		FIELD16(0x0080)
19462306a36Sopenharmony_ci#define MCU_LEDCS_POLARITY_GPIO_0	FIELD16(0x0100)
19562306a36Sopenharmony_ci#define MCU_LEDCS_POLARITY_GPIO_1	FIELD16(0x0200)
19662306a36Sopenharmony_ci#define MCU_LEDCS_POLARITY_GPIO_2	FIELD16(0x0400)
19762306a36Sopenharmony_ci#define MCU_LEDCS_POLARITY_GPIO_3	FIELD16(0x0800)
19862306a36Sopenharmony_ci#define MCU_LEDCS_POLARITY_GPIO_4	FIELD16(0x1000)
19962306a36Sopenharmony_ci#define MCU_LEDCS_POLARITY_ACT		FIELD16(0x2000)
20062306a36Sopenharmony_ci#define MCU_LEDCS_POLARITY_READY_BG	FIELD16(0x4000)
20162306a36Sopenharmony_ci#define MCU_LEDCS_POLARITY_READY_A	FIELD16(0x8000)
20262306a36Sopenharmony_ci
20362306a36Sopenharmony_ci/*
20462306a36Sopenharmony_ci * M2H_CMD_DONE_CSR.
20562306a36Sopenharmony_ci */
20662306a36Sopenharmony_ci#define M2H_CMD_DONE_CSR		0x2104
20762306a36Sopenharmony_ci
20862306a36Sopenharmony_ci/*
20962306a36Sopenharmony_ci * MCU_TXOP_ARRAY_BASE.
21062306a36Sopenharmony_ci */
21162306a36Sopenharmony_ci#define MCU_TXOP_ARRAY_BASE		0x2110
21262306a36Sopenharmony_ci
21362306a36Sopenharmony_ci/*
21462306a36Sopenharmony_ci * MAC Control/Status Registers(CSR).
21562306a36Sopenharmony_ci * Some values are set in TU, whereas 1 TU == 1024 us.
21662306a36Sopenharmony_ci */
21762306a36Sopenharmony_ci
21862306a36Sopenharmony_ci/*
21962306a36Sopenharmony_ci * MAC_CSR0: ASIC revision number.
22062306a36Sopenharmony_ci */
22162306a36Sopenharmony_ci#define MAC_CSR0			0x3000
22262306a36Sopenharmony_ci#define MAC_CSR0_REVISION		FIELD32(0x0000000f)
22362306a36Sopenharmony_ci#define MAC_CSR0_CHIPSET		FIELD32(0x000ffff0)
22462306a36Sopenharmony_ci
22562306a36Sopenharmony_ci/*
22662306a36Sopenharmony_ci * MAC_CSR1: System control register.
22762306a36Sopenharmony_ci * SOFT_RESET: Software reset bit, 1: reset, 0: normal.
22862306a36Sopenharmony_ci * BBP_RESET: Hardware reset BBP.
22962306a36Sopenharmony_ci * HOST_READY: Host is ready after initialization, 1: ready.
23062306a36Sopenharmony_ci */
23162306a36Sopenharmony_ci#define MAC_CSR1			0x3004
23262306a36Sopenharmony_ci#define MAC_CSR1_SOFT_RESET		FIELD32(0x00000001)
23362306a36Sopenharmony_ci#define MAC_CSR1_BBP_RESET		FIELD32(0x00000002)
23462306a36Sopenharmony_ci#define MAC_CSR1_HOST_READY		FIELD32(0x00000004)
23562306a36Sopenharmony_ci
23662306a36Sopenharmony_ci/*
23762306a36Sopenharmony_ci * MAC_CSR2: STA MAC register 0.
23862306a36Sopenharmony_ci */
23962306a36Sopenharmony_ci#define MAC_CSR2			0x3008
24062306a36Sopenharmony_ci#define MAC_CSR2_BYTE0			FIELD32(0x000000ff)
24162306a36Sopenharmony_ci#define MAC_CSR2_BYTE1			FIELD32(0x0000ff00)
24262306a36Sopenharmony_ci#define MAC_CSR2_BYTE2			FIELD32(0x00ff0000)
24362306a36Sopenharmony_ci#define MAC_CSR2_BYTE3			FIELD32(0xff000000)
24462306a36Sopenharmony_ci
24562306a36Sopenharmony_ci/*
24662306a36Sopenharmony_ci * MAC_CSR3: STA MAC register 1.
24762306a36Sopenharmony_ci * UNICAST_TO_ME_MASK:
24862306a36Sopenharmony_ci *	Used to mask off bits from byte 5 of the MAC address
24962306a36Sopenharmony_ci *	to determine the UNICAST_TO_ME bit for RX frames.
25062306a36Sopenharmony_ci *	The full mask is complemented by BSS_ID_MASK:
25162306a36Sopenharmony_ci *		MASK = BSS_ID_MASK & UNICAST_TO_ME_MASK
25262306a36Sopenharmony_ci */
25362306a36Sopenharmony_ci#define MAC_CSR3			0x300c
25462306a36Sopenharmony_ci#define MAC_CSR3_BYTE4			FIELD32(0x000000ff)
25562306a36Sopenharmony_ci#define MAC_CSR3_BYTE5			FIELD32(0x0000ff00)
25662306a36Sopenharmony_ci#define MAC_CSR3_UNICAST_TO_ME_MASK	FIELD32(0x00ff0000)
25762306a36Sopenharmony_ci
25862306a36Sopenharmony_ci/*
25962306a36Sopenharmony_ci * MAC_CSR4: BSSID register 0.
26062306a36Sopenharmony_ci */
26162306a36Sopenharmony_ci#define MAC_CSR4			0x3010
26262306a36Sopenharmony_ci#define MAC_CSR4_BYTE0			FIELD32(0x000000ff)
26362306a36Sopenharmony_ci#define MAC_CSR4_BYTE1			FIELD32(0x0000ff00)
26462306a36Sopenharmony_ci#define MAC_CSR4_BYTE2			FIELD32(0x00ff0000)
26562306a36Sopenharmony_ci#define MAC_CSR4_BYTE3			FIELD32(0xff000000)
26662306a36Sopenharmony_ci
26762306a36Sopenharmony_ci/*
26862306a36Sopenharmony_ci * MAC_CSR5: BSSID register 1.
26962306a36Sopenharmony_ci * BSS_ID_MASK:
27062306a36Sopenharmony_ci *	This mask is used to mask off bits 0 and 1 of byte 5 of the
27162306a36Sopenharmony_ci *	BSSID. This will make sure that those bits will be ignored
27262306a36Sopenharmony_ci *	when determining the MY_BSS of RX frames.
27362306a36Sopenharmony_ci *		0: 1-BSSID mode (BSS index = 0)
27462306a36Sopenharmony_ci *		1: 2-BSSID mode (BSS index: Byte5, bit 0)
27562306a36Sopenharmony_ci *		2: 2-BSSID mode (BSS index: byte5, bit 1)
27662306a36Sopenharmony_ci *		3: 4-BSSID mode (BSS index: byte5, bit 0 - 1)
27762306a36Sopenharmony_ci */
27862306a36Sopenharmony_ci#define MAC_CSR5			0x3014
27962306a36Sopenharmony_ci#define MAC_CSR5_BYTE4			FIELD32(0x000000ff)
28062306a36Sopenharmony_ci#define MAC_CSR5_BYTE5			FIELD32(0x0000ff00)
28162306a36Sopenharmony_ci#define MAC_CSR5_BSS_ID_MASK		FIELD32(0x00ff0000)
28262306a36Sopenharmony_ci
28362306a36Sopenharmony_ci/*
28462306a36Sopenharmony_ci * MAC_CSR6: Maximum frame length register.
28562306a36Sopenharmony_ci */
28662306a36Sopenharmony_ci#define MAC_CSR6			0x3018
28762306a36Sopenharmony_ci#define MAC_CSR6_MAX_FRAME_UNIT		FIELD32(0x00000fff)
28862306a36Sopenharmony_ci
28962306a36Sopenharmony_ci/*
29062306a36Sopenharmony_ci * MAC_CSR7: Reserved
29162306a36Sopenharmony_ci */
29262306a36Sopenharmony_ci#define MAC_CSR7			0x301c
29362306a36Sopenharmony_ci
29462306a36Sopenharmony_ci/*
29562306a36Sopenharmony_ci * MAC_CSR8: SIFS/EIFS register.
29662306a36Sopenharmony_ci * All units are in US.
29762306a36Sopenharmony_ci */
29862306a36Sopenharmony_ci#define MAC_CSR8			0x3020
29962306a36Sopenharmony_ci#define MAC_CSR8_SIFS			FIELD32(0x000000ff)
30062306a36Sopenharmony_ci#define MAC_CSR8_SIFS_AFTER_RX_OFDM	FIELD32(0x0000ff00)
30162306a36Sopenharmony_ci#define MAC_CSR8_EIFS			FIELD32(0xffff0000)
30262306a36Sopenharmony_ci
30362306a36Sopenharmony_ci/*
30462306a36Sopenharmony_ci * MAC_CSR9: Back-Off control register.
30562306a36Sopenharmony_ci * SLOT_TIME: Slot time, default is 20us for 802.11BG.
30662306a36Sopenharmony_ci * CWMIN: Bit for Cwmin. default Cwmin is 31 (2^5 - 1).
30762306a36Sopenharmony_ci * CWMAX: Bit for Cwmax, default Cwmax is 1023 (2^10 - 1).
30862306a36Sopenharmony_ci * CW_SELECT: 1: CWmin/Cwmax select from register, 0:select from TxD.
30962306a36Sopenharmony_ci */
31062306a36Sopenharmony_ci#define MAC_CSR9			0x3024
31162306a36Sopenharmony_ci#define MAC_CSR9_SLOT_TIME		FIELD32(0x000000ff)
31262306a36Sopenharmony_ci#define MAC_CSR9_CWMIN			FIELD32(0x00000f00)
31362306a36Sopenharmony_ci#define MAC_CSR9_CWMAX			FIELD32(0x0000f000)
31462306a36Sopenharmony_ci#define MAC_CSR9_CW_SELECT		FIELD32(0x00010000)
31562306a36Sopenharmony_ci
31662306a36Sopenharmony_ci/*
31762306a36Sopenharmony_ci * MAC_CSR10: Power state configuration.
31862306a36Sopenharmony_ci */
31962306a36Sopenharmony_ci#define MAC_CSR10			0x3028
32062306a36Sopenharmony_ci
32162306a36Sopenharmony_ci/*
32262306a36Sopenharmony_ci * MAC_CSR11: Power saving transition time register.
32362306a36Sopenharmony_ci * DELAY_AFTER_TBCN: Delay after Tbcn expired in units of TU.
32462306a36Sopenharmony_ci * TBCN_BEFORE_WAKEUP: Number of beacon before wakeup.
32562306a36Sopenharmony_ci * WAKEUP_LATENCY: In unit of TU.
32662306a36Sopenharmony_ci */
32762306a36Sopenharmony_ci#define MAC_CSR11			0x302c
32862306a36Sopenharmony_ci#define MAC_CSR11_DELAY_AFTER_TBCN	FIELD32(0x000000ff)
32962306a36Sopenharmony_ci#define MAC_CSR11_TBCN_BEFORE_WAKEUP	FIELD32(0x00007f00)
33062306a36Sopenharmony_ci#define MAC_CSR11_AUTOWAKE		FIELD32(0x00008000)
33162306a36Sopenharmony_ci#define MAC_CSR11_WAKEUP_LATENCY	FIELD32(0x000f0000)
33262306a36Sopenharmony_ci
33362306a36Sopenharmony_ci/*
33462306a36Sopenharmony_ci * MAC_CSR12: Manual power control / status register (merge CSR20 & PWRCSR1).
33562306a36Sopenharmony_ci * CURRENT_STATE: 0:sleep, 1:awake.
33662306a36Sopenharmony_ci * FORCE_WAKEUP: This has higher priority than PUT_TO_SLEEP.
33762306a36Sopenharmony_ci * BBP_CURRENT_STATE: 0: BBP sleep, 1: BBP awake.
33862306a36Sopenharmony_ci */
33962306a36Sopenharmony_ci#define MAC_CSR12			0x3030
34062306a36Sopenharmony_ci#define MAC_CSR12_CURRENT_STATE		FIELD32(0x00000001)
34162306a36Sopenharmony_ci#define MAC_CSR12_PUT_TO_SLEEP		FIELD32(0x00000002)
34262306a36Sopenharmony_ci#define MAC_CSR12_FORCE_WAKEUP		FIELD32(0x00000004)
34362306a36Sopenharmony_ci#define MAC_CSR12_BBP_CURRENT_STATE	FIELD32(0x00000008)
34462306a36Sopenharmony_ci
34562306a36Sopenharmony_ci/*
34662306a36Sopenharmony_ci * MAC_CSR13: GPIO.
34762306a36Sopenharmony_ci *	MAC_CSR13_VALx: GPIO value
34862306a36Sopenharmony_ci *	MAC_CSR13_DIRx: GPIO direction: 0 = output; 1 = input
34962306a36Sopenharmony_ci */
35062306a36Sopenharmony_ci#define MAC_CSR13			0x3034
35162306a36Sopenharmony_ci#define MAC_CSR13_VAL0			FIELD32(0x00000001)
35262306a36Sopenharmony_ci#define MAC_CSR13_VAL1			FIELD32(0x00000002)
35362306a36Sopenharmony_ci#define MAC_CSR13_VAL2			FIELD32(0x00000004)
35462306a36Sopenharmony_ci#define MAC_CSR13_VAL3			FIELD32(0x00000008)
35562306a36Sopenharmony_ci#define MAC_CSR13_VAL4			FIELD32(0x00000010)
35662306a36Sopenharmony_ci#define MAC_CSR13_VAL5			FIELD32(0x00000020)
35762306a36Sopenharmony_ci#define MAC_CSR13_DIR0			FIELD32(0x00000100)
35862306a36Sopenharmony_ci#define MAC_CSR13_DIR1			FIELD32(0x00000200)
35962306a36Sopenharmony_ci#define MAC_CSR13_DIR2			FIELD32(0x00000400)
36062306a36Sopenharmony_ci#define MAC_CSR13_DIR3			FIELD32(0x00000800)
36162306a36Sopenharmony_ci#define MAC_CSR13_DIR4			FIELD32(0x00001000)
36262306a36Sopenharmony_ci#define MAC_CSR13_DIR5			FIELD32(0x00002000)
36362306a36Sopenharmony_ci
36462306a36Sopenharmony_ci/*
36562306a36Sopenharmony_ci * MAC_CSR14: LED control register.
36662306a36Sopenharmony_ci * ON_PERIOD: On period, default 70ms.
36762306a36Sopenharmony_ci * OFF_PERIOD: Off period, default 30ms.
36862306a36Sopenharmony_ci * HW_LED: HW TX activity, 1: normal OFF, 0: normal ON.
36962306a36Sopenharmony_ci * SW_LED: s/w LED, 1: ON, 0: OFF.
37062306a36Sopenharmony_ci * HW_LED_POLARITY: 0: active low, 1: active high.
37162306a36Sopenharmony_ci */
37262306a36Sopenharmony_ci#define MAC_CSR14			0x3038
37362306a36Sopenharmony_ci#define MAC_CSR14_ON_PERIOD		FIELD32(0x000000ff)
37462306a36Sopenharmony_ci#define MAC_CSR14_OFF_PERIOD		FIELD32(0x0000ff00)
37562306a36Sopenharmony_ci#define MAC_CSR14_HW_LED		FIELD32(0x00010000)
37662306a36Sopenharmony_ci#define MAC_CSR14_SW_LED		FIELD32(0x00020000)
37762306a36Sopenharmony_ci#define MAC_CSR14_HW_LED_POLARITY	FIELD32(0x00040000)
37862306a36Sopenharmony_ci#define MAC_CSR14_SW_LED2		FIELD32(0x00080000)
37962306a36Sopenharmony_ci
38062306a36Sopenharmony_ci/*
38162306a36Sopenharmony_ci * MAC_CSR15: NAV control.
38262306a36Sopenharmony_ci */
38362306a36Sopenharmony_ci#define MAC_CSR15			0x303c
38462306a36Sopenharmony_ci
38562306a36Sopenharmony_ci/*
38662306a36Sopenharmony_ci * TXRX control registers.
38762306a36Sopenharmony_ci * Some values are set in TU, whereas 1 TU == 1024 us.
38862306a36Sopenharmony_ci */
38962306a36Sopenharmony_ci
39062306a36Sopenharmony_ci/*
39162306a36Sopenharmony_ci * TXRX_CSR0: TX/RX configuration register.
39262306a36Sopenharmony_ci * TSF_OFFSET: Default is 24.
39362306a36Sopenharmony_ci * AUTO_TX_SEQ: 1: ASIC auto replace sequence nr in outgoing frame.
39462306a36Sopenharmony_ci * DISABLE_RX: Disable Rx engine.
39562306a36Sopenharmony_ci * DROP_CRC: Drop CRC error.
39662306a36Sopenharmony_ci * DROP_PHYSICAL: Drop physical error.
39762306a36Sopenharmony_ci * DROP_CONTROL: Drop control frame.
39862306a36Sopenharmony_ci * DROP_NOT_TO_ME: Drop not to me unicast frame.
39962306a36Sopenharmony_ci * DROP_TO_DS: Drop fram ToDs bit is true.
40062306a36Sopenharmony_ci * DROP_VERSION_ERROR: Drop version error frame.
40162306a36Sopenharmony_ci * DROP_MULTICAST: Drop multicast frames.
40262306a36Sopenharmony_ci * DROP_BORADCAST: Drop broadcast frames.
40362306a36Sopenharmony_ci * DROP_ACK_CTS: Drop received ACK and CTS.
40462306a36Sopenharmony_ci */
40562306a36Sopenharmony_ci#define TXRX_CSR0			0x3040
40662306a36Sopenharmony_ci#define TXRX_CSR0_RX_ACK_TIMEOUT	FIELD32(0x000001ff)
40762306a36Sopenharmony_ci#define TXRX_CSR0_TSF_OFFSET		FIELD32(0x00007e00)
40862306a36Sopenharmony_ci#define TXRX_CSR0_AUTO_TX_SEQ		FIELD32(0x00008000)
40962306a36Sopenharmony_ci#define TXRX_CSR0_DISABLE_RX		FIELD32(0x00010000)
41062306a36Sopenharmony_ci#define TXRX_CSR0_DROP_CRC		FIELD32(0x00020000)
41162306a36Sopenharmony_ci#define TXRX_CSR0_DROP_PHYSICAL		FIELD32(0x00040000)
41262306a36Sopenharmony_ci#define TXRX_CSR0_DROP_CONTROL		FIELD32(0x00080000)
41362306a36Sopenharmony_ci#define TXRX_CSR0_DROP_NOT_TO_ME	FIELD32(0x00100000)
41462306a36Sopenharmony_ci#define TXRX_CSR0_DROP_TO_DS		FIELD32(0x00200000)
41562306a36Sopenharmony_ci#define TXRX_CSR0_DROP_VERSION_ERROR	FIELD32(0x00400000)
41662306a36Sopenharmony_ci#define TXRX_CSR0_DROP_MULTICAST	FIELD32(0x00800000)
41762306a36Sopenharmony_ci#define TXRX_CSR0_DROP_BROADCAST	FIELD32(0x01000000)
41862306a36Sopenharmony_ci#define TXRX_CSR0_DROP_ACK_CTS		FIELD32(0x02000000)
41962306a36Sopenharmony_ci#define TXRX_CSR0_TX_WITHOUT_WAITING	FIELD32(0x04000000)
42062306a36Sopenharmony_ci
42162306a36Sopenharmony_ci/*
42262306a36Sopenharmony_ci * TXRX_CSR1
42362306a36Sopenharmony_ci */
42462306a36Sopenharmony_ci#define TXRX_CSR1			0x3044
42562306a36Sopenharmony_ci#define TXRX_CSR1_BBP_ID0		FIELD32(0x0000007f)
42662306a36Sopenharmony_ci#define TXRX_CSR1_BBP_ID0_VALID		FIELD32(0x00000080)
42762306a36Sopenharmony_ci#define TXRX_CSR1_BBP_ID1		FIELD32(0x00007f00)
42862306a36Sopenharmony_ci#define TXRX_CSR1_BBP_ID1_VALID		FIELD32(0x00008000)
42962306a36Sopenharmony_ci#define TXRX_CSR1_BBP_ID2		FIELD32(0x007f0000)
43062306a36Sopenharmony_ci#define TXRX_CSR1_BBP_ID2_VALID		FIELD32(0x00800000)
43162306a36Sopenharmony_ci#define TXRX_CSR1_BBP_ID3		FIELD32(0x7f000000)
43262306a36Sopenharmony_ci#define TXRX_CSR1_BBP_ID3_VALID		FIELD32(0x80000000)
43362306a36Sopenharmony_ci
43462306a36Sopenharmony_ci/*
43562306a36Sopenharmony_ci * TXRX_CSR2
43662306a36Sopenharmony_ci */
43762306a36Sopenharmony_ci#define TXRX_CSR2			0x3048
43862306a36Sopenharmony_ci#define TXRX_CSR2_BBP_ID0		FIELD32(0x0000007f)
43962306a36Sopenharmony_ci#define TXRX_CSR2_BBP_ID0_VALID		FIELD32(0x00000080)
44062306a36Sopenharmony_ci#define TXRX_CSR2_BBP_ID1		FIELD32(0x00007f00)
44162306a36Sopenharmony_ci#define TXRX_CSR2_BBP_ID1_VALID		FIELD32(0x00008000)
44262306a36Sopenharmony_ci#define TXRX_CSR2_BBP_ID2		FIELD32(0x007f0000)
44362306a36Sopenharmony_ci#define TXRX_CSR2_BBP_ID2_VALID		FIELD32(0x00800000)
44462306a36Sopenharmony_ci#define TXRX_CSR2_BBP_ID3		FIELD32(0x7f000000)
44562306a36Sopenharmony_ci#define TXRX_CSR2_BBP_ID3_VALID		FIELD32(0x80000000)
44662306a36Sopenharmony_ci
44762306a36Sopenharmony_ci/*
44862306a36Sopenharmony_ci * TXRX_CSR3
44962306a36Sopenharmony_ci */
45062306a36Sopenharmony_ci#define TXRX_CSR3			0x304c
45162306a36Sopenharmony_ci#define TXRX_CSR3_BBP_ID0		FIELD32(0x0000007f)
45262306a36Sopenharmony_ci#define TXRX_CSR3_BBP_ID0_VALID		FIELD32(0x00000080)
45362306a36Sopenharmony_ci#define TXRX_CSR3_BBP_ID1		FIELD32(0x00007f00)
45462306a36Sopenharmony_ci#define TXRX_CSR3_BBP_ID1_VALID		FIELD32(0x00008000)
45562306a36Sopenharmony_ci#define TXRX_CSR3_BBP_ID2		FIELD32(0x007f0000)
45662306a36Sopenharmony_ci#define TXRX_CSR3_BBP_ID2_VALID		FIELD32(0x00800000)
45762306a36Sopenharmony_ci#define TXRX_CSR3_BBP_ID3		FIELD32(0x7f000000)
45862306a36Sopenharmony_ci#define TXRX_CSR3_BBP_ID3_VALID		FIELD32(0x80000000)
45962306a36Sopenharmony_ci
46062306a36Sopenharmony_ci/*
46162306a36Sopenharmony_ci * TXRX_CSR4: Auto-Responder/Tx-retry register.
46262306a36Sopenharmony_ci * AUTORESPOND_PREAMBLE: 0:long, 1:short preamble.
46362306a36Sopenharmony_ci * OFDM_TX_RATE_DOWN: 1:enable.
46462306a36Sopenharmony_ci * OFDM_TX_RATE_STEP: 0:1-step, 1: 2-step, 2:3-step, 3:4-step.
46562306a36Sopenharmony_ci * OFDM_TX_FALLBACK_CCK: 0: Fallback to OFDM 6M only, 1: Fallback to CCK 1M,2M.
46662306a36Sopenharmony_ci */
46762306a36Sopenharmony_ci#define TXRX_CSR4			0x3050
46862306a36Sopenharmony_ci#define TXRX_CSR4_TX_ACK_TIMEOUT	FIELD32(0x000000ff)
46962306a36Sopenharmony_ci#define TXRX_CSR4_CNTL_ACK_POLICY	FIELD32(0x00000700)
47062306a36Sopenharmony_ci#define TXRX_CSR4_ACK_CTS_PSM		FIELD32(0x00010000)
47162306a36Sopenharmony_ci#define TXRX_CSR4_AUTORESPOND_ENABLE	FIELD32(0x00020000)
47262306a36Sopenharmony_ci#define TXRX_CSR4_AUTORESPOND_PREAMBLE	FIELD32(0x00040000)
47362306a36Sopenharmony_ci#define TXRX_CSR4_OFDM_TX_RATE_DOWN	FIELD32(0x00080000)
47462306a36Sopenharmony_ci#define TXRX_CSR4_OFDM_TX_RATE_STEP	FIELD32(0x00300000)
47562306a36Sopenharmony_ci#define TXRX_CSR4_OFDM_TX_FALLBACK_CCK	FIELD32(0x00400000)
47662306a36Sopenharmony_ci#define TXRX_CSR4_LONG_RETRY_LIMIT	FIELD32(0x0f000000)
47762306a36Sopenharmony_ci#define TXRX_CSR4_SHORT_RETRY_LIMIT	FIELD32(0xf0000000)
47862306a36Sopenharmony_ci
47962306a36Sopenharmony_ci/*
48062306a36Sopenharmony_ci * TXRX_CSR5
48162306a36Sopenharmony_ci */
48262306a36Sopenharmony_ci#define TXRX_CSR5			0x3054
48362306a36Sopenharmony_ci
48462306a36Sopenharmony_ci/*
48562306a36Sopenharmony_ci * TXRX_CSR6: ACK/CTS payload consumed time
48662306a36Sopenharmony_ci */
48762306a36Sopenharmony_ci#define TXRX_CSR6			0x3058
48862306a36Sopenharmony_ci
48962306a36Sopenharmony_ci/*
49062306a36Sopenharmony_ci * TXRX_CSR7: OFDM ACK/CTS payload consumed time for 6/9/12/18 mbps.
49162306a36Sopenharmony_ci */
49262306a36Sopenharmony_ci#define TXRX_CSR7			0x305c
49362306a36Sopenharmony_ci#define TXRX_CSR7_ACK_CTS_6MBS		FIELD32(0x000000ff)
49462306a36Sopenharmony_ci#define TXRX_CSR7_ACK_CTS_9MBS		FIELD32(0x0000ff00)
49562306a36Sopenharmony_ci#define TXRX_CSR7_ACK_CTS_12MBS		FIELD32(0x00ff0000)
49662306a36Sopenharmony_ci#define TXRX_CSR7_ACK_CTS_18MBS		FIELD32(0xff000000)
49762306a36Sopenharmony_ci
49862306a36Sopenharmony_ci/*
49962306a36Sopenharmony_ci * TXRX_CSR8: OFDM ACK/CTS payload consumed time for 24/36/48/54 mbps.
50062306a36Sopenharmony_ci */
50162306a36Sopenharmony_ci#define TXRX_CSR8			0x3060
50262306a36Sopenharmony_ci#define TXRX_CSR8_ACK_CTS_24MBS		FIELD32(0x000000ff)
50362306a36Sopenharmony_ci#define TXRX_CSR8_ACK_CTS_36MBS		FIELD32(0x0000ff00)
50462306a36Sopenharmony_ci#define TXRX_CSR8_ACK_CTS_48MBS		FIELD32(0x00ff0000)
50562306a36Sopenharmony_ci#define TXRX_CSR8_ACK_CTS_54MBS		FIELD32(0xff000000)
50662306a36Sopenharmony_ci
50762306a36Sopenharmony_ci/*
50862306a36Sopenharmony_ci * TXRX_CSR9: Synchronization control register.
50962306a36Sopenharmony_ci * BEACON_INTERVAL: In unit of 1/16 TU.
51062306a36Sopenharmony_ci * TSF_TICKING: Enable TSF auto counting.
51162306a36Sopenharmony_ci * TSF_SYNC: Tsf sync, 0: disable, 1: infra, 2: ad-hoc/master mode.
51262306a36Sopenharmony_ci * BEACON_GEN: Enable beacon generator.
51362306a36Sopenharmony_ci */
51462306a36Sopenharmony_ci#define TXRX_CSR9			0x3064
51562306a36Sopenharmony_ci#define TXRX_CSR9_BEACON_INTERVAL	FIELD32(0x0000ffff)
51662306a36Sopenharmony_ci#define TXRX_CSR9_TSF_TICKING		FIELD32(0x00010000)
51762306a36Sopenharmony_ci#define TXRX_CSR9_TSF_SYNC		FIELD32(0x00060000)
51862306a36Sopenharmony_ci#define TXRX_CSR9_TBTT_ENABLE		FIELD32(0x00080000)
51962306a36Sopenharmony_ci#define TXRX_CSR9_BEACON_GEN		FIELD32(0x00100000)
52062306a36Sopenharmony_ci#define TXRX_CSR9_TIMESTAMP_COMPENSATE	FIELD32(0xff000000)
52162306a36Sopenharmony_ci
52262306a36Sopenharmony_ci/*
52362306a36Sopenharmony_ci * TXRX_CSR10: BEACON alignment.
52462306a36Sopenharmony_ci */
52562306a36Sopenharmony_ci#define TXRX_CSR10			0x3068
52662306a36Sopenharmony_ci
52762306a36Sopenharmony_ci/*
52862306a36Sopenharmony_ci * TXRX_CSR11: AES mask.
52962306a36Sopenharmony_ci */
53062306a36Sopenharmony_ci#define TXRX_CSR11			0x306c
53162306a36Sopenharmony_ci
53262306a36Sopenharmony_ci/*
53362306a36Sopenharmony_ci * TXRX_CSR12: TSF low 32.
53462306a36Sopenharmony_ci */
53562306a36Sopenharmony_ci#define TXRX_CSR12			0x3070
53662306a36Sopenharmony_ci#define TXRX_CSR12_LOW_TSFTIMER		FIELD32(0xffffffff)
53762306a36Sopenharmony_ci
53862306a36Sopenharmony_ci/*
53962306a36Sopenharmony_ci * TXRX_CSR13: TSF high 32.
54062306a36Sopenharmony_ci */
54162306a36Sopenharmony_ci#define TXRX_CSR13			0x3074
54262306a36Sopenharmony_ci#define TXRX_CSR13_HIGH_TSFTIMER	FIELD32(0xffffffff)
54362306a36Sopenharmony_ci
54462306a36Sopenharmony_ci/*
54562306a36Sopenharmony_ci * TXRX_CSR14: TBTT timer.
54662306a36Sopenharmony_ci */
54762306a36Sopenharmony_ci#define TXRX_CSR14			0x3078
54862306a36Sopenharmony_ci
54962306a36Sopenharmony_ci/*
55062306a36Sopenharmony_ci * TXRX_CSR15: TKIP MIC priority byte "AND" mask.
55162306a36Sopenharmony_ci */
55262306a36Sopenharmony_ci#define TXRX_CSR15			0x307c
55362306a36Sopenharmony_ci
55462306a36Sopenharmony_ci/*
55562306a36Sopenharmony_ci * PHY control registers.
55662306a36Sopenharmony_ci * Some values are set in TU, whereas 1 TU == 1024 us.
55762306a36Sopenharmony_ci */
55862306a36Sopenharmony_ci
55962306a36Sopenharmony_ci/*
56062306a36Sopenharmony_ci * PHY_CSR0: RF/PS control.
56162306a36Sopenharmony_ci */
56262306a36Sopenharmony_ci#define PHY_CSR0			0x3080
56362306a36Sopenharmony_ci#define PHY_CSR0_PA_PE_BG		FIELD32(0x00010000)
56462306a36Sopenharmony_ci#define PHY_CSR0_PA_PE_A		FIELD32(0x00020000)
56562306a36Sopenharmony_ci
56662306a36Sopenharmony_ci/*
56762306a36Sopenharmony_ci * PHY_CSR1
56862306a36Sopenharmony_ci */
56962306a36Sopenharmony_ci#define PHY_CSR1			0x3084
57062306a36Sopenharmony_ci
57162306a36Sopenharmony_ci/*
57262306a36Sopenharmony_ci * PHY_CSR2: Pre-TX BBP control.
57362306a36Sopenharmony_ci */
57462306a36Sopenharmony_ci#define PHY_CSR2			0x3088
57562306a36Sopenharmony_ci
57662306a36Sopenharmony_ci/*
57762306a36Sopenharmony_ci * PHY_CSR3: BBP serial control register.
57862306a36Sopenharmony_ci * VALUE: Register value to program into BBP.
57962306a36Sopenharmony_ci * REG_NUM: Selected BBP register.
58062306a36Sopenharmony_ci * READ_CONTROL: 0: Write BBP, 1: Read BBP.
58162306a36Sopenharmony_ci * BUSY: 1: ASIC is busy execute BBP programming.
58262306a36Sopenharmony_ci */
58362306a36Sopenharmony_ci#define PHY_CSR3			0x308c
58462306a36Sopenharmony_ci#define PHY_CSR3_VALUE			FIELD32(0x000000ff)
58562306a36Sopenharmony_ci#define PHY_CSR3_REGNUM			FIELD32(0x00007f00)
58662306a36Sopenharmony_ci#define PHY_CSR3_READ_CONTROL		FIELD32(0x00008000)
58762306a36Sopenharmony_ci#define PHY_CSR3_BUSY			FIELD32(0x00010000)
58862306a36Sopenharmony_ci
58962306a36Sopenharmony_ci/*
59062306a36Sopenharmony_ci * PHY_CSR4: RF serial control register
59162306a36Sopenharmony_ci * VALUE: Register value (include register id) serial out to RF/IF chip.
59262306a36Sopenharmony_ci * NUMBER_OF_BITS: Number of bits used in RFRegValue (I:20, RFMD:22).
59362306a36Sopenharmony_ci * IF_SELECT: 1: select IF to program, 0: select RF to program.
59462306a36Sopenharmony_ci * PLL_LD: RF PLL_LD status.
59562306a36Sopenharmony_ci * BUSY: 1: ASIC is busy execute RF programming.
59662306a36Sopenharmony_ci */
59762306a36Sopenharmony_ci#define PHY_CSR4			0x3090
59862306a36Sopenharmony_ci#define PHY_CSR4_VALUE			FIELD32(0x00ffffff)
59962306a36Sopenharmony_ci#define PHY_CSR4_NUMBER_OF_BITS		FIELD32(0x1f000000)
60062306a36Sopenharmony_ci#define PHY_CSR4_IF_SELECT		FIELD32(0x20000000)
60162306a36Sopenharmony_ci#define PHY_CSR4_PLL_LD			FIELD32(0x40000000)
60262306a36Sopenharmony_ci#define PHY_CSR4_BUSY			FIELD32(0x80000000)
60362306a36Sopenharmony_ci
60462306a36Sopenharmony_ci/*
60562306a36Sopenharmony_ci * PHY_CSR5: RX to TX signal switch timing control.
60662306a36Sopenharmony_ci */
60762306a36Sopenharmony_ci#define PHY_CSR5			0x3094
60862306a36Sopenharmony_ci#define PHY_CSR5_IQ_FLIP		FIELD32(0x00000004)
60962306a36Sopenharmony_ci
61062306a36Sopenharmony_ci/*
61162306a36Sopenharmony_ci * PHY_CSR6: TX to RX signal timing control.
61262306a36Sopenharmony_ci */
61362306a36Sopenharmony_ci#define PHY_CSR6			0x3098
61462306a36Sopenharmony_ci#define PHY_CSR6_IQ_FLIP		FIELD32(0x00000004)
61562306a36Sopenharmony_ci
61662306a36Sopenharmony_ci/*
61762306a36Sopenharmony_ci * PHY_CSR7: TX DAC switching timing control.
61862306a36Sopenharmony_ci */
61962306a36Sopenharmony_ci#define PHY_CSR7			0x309c
62062306a36Sopenharmony_ci
62162306a36Sopenharmony_ci/*
62262306a36Sopenharmony_ci * Security control register.
62362306a36Sopenharmony_ci */
62462306a36Sopenharmony_ci
62562306a36Sopenharmony_ci/*
62662306a36Sopenharmony_ci * SEC_CSR0: Shared key table control.
62762306a36Sopenharmony_ci */
62862306a36Sopenharmony_ci#define SEC_CSR0			0x30a0
62962306a36Sopenharmony_ci#define SEC_CSR0_BSS0_KEY0_VALID	FIELD32(0x00000001)
63062306a36Sopenharmony_ci#define SEC_CSR0_BSS0_KEY1_VALID	FIELD32(0x00000002)
63162306a36Sopenharmony_ci#define SEC_CSR0_BSS0_KEY2_VALID	FIELD32(0x00000004)
63262306a36Sopenharmony_ci#define SEC_CSR0_BSS0_KEY3_VALID	FIELD32(0x00000008)
63362306a36Sopenharmony_ci#define SEC_CSR0_BSS1_KEY0_VALID	FIELD32(0x00000010)
63462306a36Sopenharmony_ci#define SEC_CSR0_BSS1_KEY1_VALID	FIELD32(0x00000020)
63562306a36Sopenharmony_ci#define SEC_CSR0_BSS1_KEY2_VALID	FIELD32(0x00000040)
63662306a36Sopenharmony_ci#define SEC_CSR0_BSS1_KEY3_VALID	FIELD32(0x00000080)
63762306a36Sopenharmony_ci#define SEC_CSR0_BSS2_KEY0_VALID	FIELD32(0x00000100)
63862306a36Sopenharmony_ci#define SEC_CSR0_BSS2_KEY1_VALID	FIELD32(0x00000200)
63962306a36Sopenharmony_ci#define SEC_CSR0_BSS2_KEY2_VALID	FIELD32(0x00000400)
64062306a36Sopenharmony_ci#define SEC_CSR0_BSS2_KEY3_VALID	FIELD32(0x00000800)
64162306a36Sopenharmony_ci#define SEC_CSR0_BSS3_KEY0_VALID	FIELD32(0x00001000)
64262306a36Sopenharmony_ci#define SEC_CSR0_BSS3_KEY1_VALID	FIELD32(0x00002000)
64362306a36Sopenharmony_ci#define SEC_CSR0_BSS3_KEY2_VALID	FIELD32(0x00004000)
64462306a36Sopenharmony_ci#define SEC_CSR0_BSS3_KEY3_VALID	FIELD32(0x00008000)
64562306a36Sopenharmony_ci
64662306a36Sopenharmony_ci/*
64762306a36Sopenharmony_ci * SEC_CSR1: Shared key table security mode register.
64862306a36Sopenharmony_ci */
64962306a36Sopenharmony_ci#define SEC_CSR1			0x30a4
65062306a36Sopenharmony_ci#define SEC_CSR1_BSS0_KEY0_CIPHER_ALG	FIELD32(0x00000007)
65162306a36Sopenharmony_ci#define SEC_CSR1_BSS0_KEY1_CIPHER_ALG	FIELD32(0x00000070)
65262306a36Sopenharmony_ci#define SEC_CSR1_BSS0_KEY2_CIPHER_ALG	FIELD32(0x00000700)
65362306a36Sopenharmony_ci#define SEC_CSR1_BSS0_KEY3_CIPHER_ALG	FIELD32(0x00007000)
65462306a36Sopenharmony_ci#define SEC_CSR1_BSS1_KEY0_CIPHER_ALG	FIELD32(0x00070000)
65562306a36Sopenharmony_ci#define SEC_CSR1_BSS1_KEY1_CIPHER_ALG	FIELD32(0x00700000)
65662306a36Sopenharmony_ci#define SEC_CSR1_BSS1_KEY2_CIPHER_ALG	FIELD32(0x07000000)
65762306a36Sopenharmony_ci#define SEC_CSR1_BSS1_KEY3_CIPHER_ALG	FIELD32(0x70000000)
65862306a36Sopenharmony_ci
65962306a36Sopenharmony_ci/*
66062306a36Sopenharmony_ci * Pairwise key table valid bitmap registers.
66162306a36Sopenharmony_ci * SEC_CSR2: pairwise key table valid bitmap 0.
66262306a36Sopenharmony_ci * SEC_CSR3: pairwise key table valid bitmap 1.
66362306a36Sopenharmony_ci */
66462306a36Sopenharmony_ci#define SEC_CSR2			0x30a8
66562306a36Sopenharmony_ci#define SEC_CSR3			0x30ac
66662306a36Sopenharmony_ci
66762306a36Sopenharmony_ci/*
66862306a36Sopenharmony_ci * SEC_CSR4: Pairwise key table lookup control.
66962306a36Sopenharmony_ci */
67062306a36Sopenharmony_ci#define SEC_CSR4			0x30b0
67162306a36Sopenharmony_ci#define SEC_CSR4_ENABLE_BSS0		FIELD32(0x00000001)
67262306a36Sopenharmony_ci#define SEC_CSR4_ENABLE_BSS1		FIELD32(0x00000002)
67362306a36Sopenharmony_ci#define SEC_CSR4_ENABLE_BSS2		FIELD32(0x00000004)
67462306a36Sopenharmony_ci#define SEC_CSR4_ENABLE_BSS3		FIELD32(0x00000008)
67562306a36Sopenharmony_ci
67662306a36Sopenharmony_ci/*
67762306a36Sopenharmony_ci * SEC_CSR5: shared key table security mode register.
67862306a36Sopenharmony_ci */
67962306a36Sopenharmony_ci#define SEC_CSR5			0x30b4
68062306a36Sopenharmony_ci#define SEC_CSR5_BSS2_KEY0_CIPHER_ALG	FIELD32(0x00000007)
68162306a36Sopenharmony_ci#define SEC_CSR5_BSS2_KEY1_CIPHER_ALG	FIELD32(0x00000070)
68262306a36Sopenharmony_ci#define SEC_CSR5_BSS2_KEY2_CIPHER_ALG	FIELD32(0x00000700)
68362306a36Sopenharmony_ci#define SEC_CSR5_BSS2_KEY3_CIPHER_ALG	FIELD32(0x00007000)
68462306a36Sopenharmony_ci#define SEC_CSR5_BSS3_KEY0_CIPHER_ALG	FIELD32(0x00070000)
68562306a36Sopenharmony_ci#define SEC_CSR5_BSS3_KEY1_CIPHER_ALG	FIELD32(0x00700000)
68662306a36Sopenharmony_ci#define SEC_CSR5_BSS3_KEY2_CIPHER_ALG	FIELD32(0x07000000)
68762306a36Sopenharmony_ci#define SEC_CSR5_BSS3_KEY3_CIPHER_ALG	FIELD32(0x70000000)
68862306a36Sopenharmony_ci
68962306a36Sopenharmony_ci/*
69062306a36Sopenharmony_ci * STA control registers.
69162306a36Sopenharmony_ci */
69262306a36Sopenharmony_ci
69362306a36Sopenharmony_ci/*
69462306a36Sopenharmony_ci * STA_CSR0: RX PLCP error count & RX FCS error count.
69562306a36Sopenharmony_ci */
69662306a36Sopenharmony_ci#define STA_CSR0			0x30c0
69762306a36Sopenharmony_ci#define STA_CSR0_FCS_ERROR		FIELD32(0x0000ffff)
69862306a36Sopenharmony_ci#define STA_CSR0_PLCP_ERROR		FIELD32(0xffff0000)
69962306a36Sopenharmony_ci
70062306a36Sopenharmony_ci/*
70162306a36Sopenharmony_ci * STA_CSR1: RX False CCA count & RX LONG frame count.
70262306a36Sopenharmony_ci */
70362306a36Sopenharmony_ci#define STA_CSR1			0x30c4
70462306a36Sopenharmony_ci#define STA_CSR1_PHYSICAL_ERROR		FIELD32(0x0000ffff)
70562306a36Sopenharmony_ci#define STA_CSR1_FALSE_CCA_ERROR	FIELD32(0xffff0000)
70662306a36Sopenharmony_ci
70762306a36Sopenharmony_ci/*
70862306a36Sopenharmony_ci * STA_CSR2: TX Beacon count and RX FIFO overflow count.
70962306a36Sopenharmony_ci */
71062306a36Sopenharmony_ci#define STA_CSR2			0x30c8
71162306a36Sopenharmony_ci#define STA_CSR2_RX_FIFO_OVERFLOW_COUNT	FIELD32(0x0000ffff)
71262306a36Sopenharmony_ci#define STA_CSR2_RX_OVERFLOW_COUNT	FIELD32(0xffff0000)
71362306a36Sopenharmony_ci
71462306a36Sopenharmony_ci/*
71562306a36Sopenharmony_ci * STA_CSR3: TX Beacon count.
71662306a36Sopenharmony_ci */
71762306a36Sopenharmony_ci#define STA_CSR3			0x30cc
71862306a36Sopenharmony_ci#define STA_CSR3_TX_BEACON_COUNT	FIELD32(0x0000ffff)
71962306a36Sopenharmony_ci
72062306a36Sopenharmony_ci/*
72162306a36Sopenharmony_ci * STA_CSR4: TX Result status register.
72262306a36Sopenharmony_ci * VALID: 1:This register contains a valid TX result.
72362306a36Sopenharmony_ci */
72462306a36Sopenharmony_ci#define STA_CSR4			0x30d0
72562306a36Sopenharmony_ci#define STA_CSR4_VALID			FIELD32(0x00000001)
72662306a36Sopenharmony_ci#define STA_CSR4_TX_RESULT		FIELD32(0x0000000e)
72762306a36Sopenharmony_ci#define STA_CSR4_RETRY_COUNT		FIELD32(0x000000f0)
72862306a36Sopenharmony_ci#define STA_CSR4_PID_SUBTYPE		FIELD32(0x00001f00)
72962306a36Sopenharmony_ci#define STA_CSR4_PID_TYPE		FIELD32(0x0000e000)
73062306a36Sopenharmony_ci#define STA_CSR4_TXRATE			FIELD32(0x000f0000)
73162306a36Sopenharmony_ci
73262306a36Sopenharmony_ci/*
73362306a36Sopenharmony_ci * QOS control registers.
73462306a36Sopenharmony_ci */
73562306a36Sopenharmony_ci
73662306a36Sopenharmony_ci/*
73762306a36Sopenharmony_ci * QOS_CSR0: TXOP holder MAC address register.
73862306a36Sopenharmony_ci */
73962306a36Sopenharmony_ci#define QOS_CSR0			0x30e0
74062306a36Sopenharmony_ci#define QOS_CSR0_BYTE0			FIELD32(0x000000ff)
74162306a36Sopenharmony_ci#define QOS_CSR0_BYTE1			FIELD32(0x0000ff00)
74262306a36Sopenharmony_ci#define QOS_CSR0_BYTE2			FIELD32(0x00ff0000)
74362306a36Sopenharmony_ci#define QOS_CSR0_BYTE3			FIELD32(0xff000000)
74462306a36Sopenharmony_ci
74562306a36Sopenharmony_ci/*
74662306a36Sopenharmony_ci * QOS_CSR1: TXOP holder MAC address register.
74762306a36Sopenharmony_ci */
74862306a36Sopenharmony_ci#define QOS_CSR1			0x30e4
74962306a36Sopenharmony_ci#define QOS_CSR1_BYTE4			FIELD32(0x000000ff)
75062306a36Sopenharmony_ci#define QOS_CSR1_BYTE5			FIELD32(0x0000ff00)
75162306a36Sopenharmony_ci
75262306a36Sopenharmony_ci/*
75362306a36Sopenharmony_ci * QOS_CSR2: TXOP holder timeout register.
75462306a36Sopenharmony_ci */
75562306a36Sopenharmony_ci#define QOS_CSR2			0x30e8
75662306a36Sopenharmony_ci
75762306a36Sopenharmony_ci/*
75862306a36Sopenharmony_ci * RX QOS-CFPOLL MAC address register.
75962306a36Sopenharmony_ci * QOS_CSR3: RX QOS-CFPOLL MAC address 0.
76062306a36Sopenharmony_ci * QOS_CSR4: RX QOS-CFPOLL MAC address 1.
76162306a36Sopenharmony_ci */
76262306a36Sopenharmony_ci#define QOS_CSR3			0x30ec
76362306a36Sopenharmony_ci#define QOS_CSR4			0x30f0
76462306a36Sopenharmony_ci
76562306a36Sopenharmony_ci/*
76662306a36Sopenharmony_ci * QOS_CSR5: "QosControl" field of the RX QOS-CFPOLL.
76762306a36Sopenharmony_ci */
76862306a36Sopenharmony_ci#define QOS_CSR5			0x30f4
76962306a36Sopenharmony_ci
77062306a36Sopenharmony_ci/*
77162306a36Sopenharmony_ci * Host DMA registers.
77262306a36Sopenharmony_ci */
77362306a36Sopenharmony_ci
77462306a36Sopenharmony_ci/*
77562306a36Sopenharmony_ci * AC0_BASE_CSR: AC_VO base address.
77662306a36Sopenharmony_ci */
77762306a36Sopenharmony_ci#define AC0_BASE_CSR			0x3400
77862306a36Sopenharmony_ci#define AC0_BASE_CSR_RING_REGISTER	FIELD32(0xffffffff)
77962306a36Sopenharmony_ci
78062306a36Sopenharmony_ci/*
78162306a36Sopenharmony_ci * AC1_BASE_CSR: AC_VI base address.
78262306a36Sopenharmony_ci */
78362306a36Sopenharmony_ci#define AC1_BASE_CSR			0x3404
78462306a36Sopenharmony_ci#define AC1_BASE_CSR_RING_REGISTER	FIELD32(0xffffffff)
78562306a36Sopenharmony_ci
78662306a36Sopenharmony_ci/*
78762306a36Sopenharmony_ci * AC2_BASE_CSR: AC_BE base address.
78862306a36Sopenharmony_ci */
78962306a36Sopenharmony_ci#define AC2_BASE_CSR			0x3408
79062306a36Sopenharmony_ci#define AC2_BASE_CSR_RING_REGISTER	FIELD32(0xffffffff)
79162306a36Sopenharmony_ci
79262306a36Sopenharmony_ci/*
79362306a36Sopenharmony_ci * AC3_BASE_CSR: AC_BK base address.
79462306a36Sopenharmony_ci */
79562306a36Sopenharmony_ci#define AC3_BASE_CSR			0x340c
79662306a36Sopenharmony_ci#define AC3_BASE_CSR_RING_REGISTER	FIELD32(0xffffffff)
79762306a36Sopenharmony_ci
79862306a36Sopenharmony_ci/*
79962306a36Sopenharmony_ci * MGMT_BASE_CSR: MGMT ring base address.
80062306a36Sopenharmony_ci */
80162306a36Sopenharmony_ci#define MGMT_BASE_CSR			0x3410
80262306a36Sopenharmony_ci#define MGMT_BASE_CSR_RING_REGISTER	FIELD32(0xffffffff)
80362306a36Sopenharmony_ci
80462306a36Sopenharmony_ci/*
80562306a36Sopenharmony_ci * TX_RING_CSR0: TX Ring size for AC_VO, AC_VI, AC_BE, AC_BK.
80662306a36Sopenharmony_ci */
80762306a36Sopenharmony_ci#define TX_RING_CSR0			0x3418
80862306a36Sopenharmony_ci#define TX_RING_CSR0_AC0_RING_SIZE	FIELD32(0x000000ff)
80962306a36Sopenharmony_ci#define TX_RING_CSR0_AC1_RING_SIZE	FIELD32(0x0000ff00)
81062306a36Sopenharmony_ci#define TX_RING_CSR0_AC2_RING_SIZE	FIELD32(0x00ff0000)
81162306a36Sopenharmony_ci#define TX_RING_CSR0_AC3_RING_SIZE	FIELD32(0xff000000)
81262306a36Sopenharmony_ci
81362306a36Sopenharmony_ci/*
81462306a36Sopenharmony_ci * TX_RING_CSR1: TX Ring size for MGMT Ring, HCCA Ring
81562306a36Sopenharmony_ci * TXD_SIZE: In unit of 32-bit.
81662306a36Sopenharmony_ci */
81762306a36Sopenharmony_ci#define TX_RING_CSR1			0x341c
81862306a36Sopenharmony_ci#define TX_RING_CSR1_MGMT_RING_SIZE	FIELD32(0x000000ff)
81962306a36Sopenharmony_ci#define TX_RING_CSR1_HCCA_RING_SIZE	FIELD32(0x0000ff00)
82062306a36Sopenharmony_ci#define TX_RING_CSR1_TXD_SIZE		FIELD32(0x003f0000)
82162306a36Sopenharmony_ci
82262306a36Sopenharmony_ci/*
82362306a36Sopenharmony_ci * AIFSN_CSR: AIFSN for each EDCA AC.
82462306a36Sopenharmony_ci * AIFSN0: For AC_VO.
82562306a36Sopenharmony_ci * AIFSN1: For AC_VI.
82662306a36Sopenharmony_ci * AIFSN2: For AC_BE.
82762306a36Sopenharmony_ci * AIFSN3: For AC_BK.
82862306a36Sopenharmony_ci */
82962306a36Sopenharmony_ci#define AIFSN_CSR			0x3420
83062306a36Sopenharmony_ci#define AIFSN_CSR_AIFSN0		FIELD32(0x0000000f)
83162306a36Sopenharmony_ci#define AIFSN_CSR_AIFSN1		FIELD32(0x000000f0)
83262306a36Sopenharmony_ci#define AIFSN_CSR_AIFSN2		FIELD32(0x00000f00)
83362306a36Sopenharmony_ci#define AIFSN_CSR_AIFSN3		FIELD32(0x0000f000)
83462306a36Sopenharmony_ci
83562306a36Sopenharmony_ci/*
83662306a36Sopenharmony_ci * CWMIN_CSR: CWmin for each EDCA AC.
83762306a36Sopenharmony_ci * CWMIN0: For AC_VO.
83862306a36Sopenharmony_ci * CWMIN1: For AC_VI.
83962306a36Sopenharmony_ci * CWMIN2: For AC_BE.
84062306a36Sopenharmony_ci * CWMIN3: For AC_BK.
84162306a36Sopenharmony_ci */
84262306a36Sopenharmony_ci#define CWMIN_CSR			0x3424
84362306a36Sopenharmony_ci#define CWMIN_CSR_CWMIN0		FIELD32(0x0000000f)
84462306a36Sopenharmony_ci#define CWMIN_CSR_CWMIN1		FIELD32(0x000000f0)
84562306a36Sopenharmony_ci#define CWMIN_CSR_CWMIN2		FIELD32(0x00000f00)
84662306a36Sopenharmony_ci#define CWMIN_CSR_CWMIN3		FIELD32(0x0000f000)
84762306a36Sopenharmony_ci
84862306a36Sopenharmony_ci/*
84962306a36Sopenharmony_ci * CWMAX_CSR: CWmax for each EDCA AC.
85062306a36Sopenharmony_ci * CWMAX0: For AC_VO.
85162306a36Sopenharmony_ci * CWMAX1: For AC_VI.
85262306a36Sopenharmony_ci * CWMAX2: For AC_BE.
85362306a36Sopenharmony_ci * CWMAX3: For AC_BK.
85462306a36Sopenharmony_ci */
85562306a36Sopenharmony_ci#define CWMAX_CSR			0x3428
85662306a36Sopenharmony_ci#define CWMAX_CSR_CWMAX0		FIELD32(0x0000000f)
85762306a36Sopenharmony_ci#define CWMAX_CSR_CWMAX1		FIELD32(0x000000f0)
85862306a36Sopenharmony_ci#define CWMAX_CSR_CWMAX2		FIELD32(0x00000f00)
85962306a36Sopenharmony_ci#define CWMAX_CSR_CWMAX3		FIELD32(0x0000f000)
86062306a36Sopenharmony_ci
86162306a36Sopenharmony_ci/*
86262306a36Sopenharmony_ci * TX_DMA_DST_CSR: TX DMA destination
86362306a36Sopenharmony_ci * 0: TX ring0, 1: TX ring1, 2: TX ring2 3: invalid
86462306a36Sopenharmony_ci */
86562306a36Sopenharmony_ci#define TX_DMA_DST_CSR			0x342c
86662306a36Sopenharmony_ci#define TX_DMA_DST_CSR_DEST_AC0		FIELD32(0x00000003)
86762306a36Sopenharmony_ci#define TX_DMA_DST_CSR_DEST_AC1		FIELD32(0x0000000c)
86862306a36Sopenharmony_ci#define TX_DMA_DST_CSR_DEST_AC2		FIELD32(0x00000030)
86962306a36Sopenharmony_ci#define TX_DMA_DST_CSR_DEST_AC3		FIELD32(0x000000c0)
87062306a36Sopenharmony_ci#define TX_DMA_DST_CSR_DEST_MGMT	FIELD32(0x00000300)
87162306a36Sopenharmony_ci
87262306a36Sopenharmony_ci/*
87362306a36Sopenharmony_ci * TX_CNTL_CSR: KICK/Abort TX.
87462306a36Sopenharmony_ci * KICK_TX_AC0: For AC_VO.
87562306a36Sopenharmony_ci * KICK_TX_AC1: For AC_VI.
87662306a36Sopenharmony_ci * KICK_TX_AC2: For AC_BE.
87762306a36Sopenharmony_ci * KICK_TX_AC3: For AC_BK.
87862306a36Sopenharmony_ci * ABORT_TX_AC0: For AC_VO.
87962306a36Sopenharmony_ci * ABORT_TX_AC1: For AC_VI.
88062306a36Sopenharmony_ci * ABORT_TX_AC2: For AC_BE.
88162306a36Sopenharmony_ci * ABORT_TX_AC3: For AC_BK.
88262306a36Sopenharmony_ci */
88362306a36Sopenharmony_ci#define TX_CNTL_CSR			0x3430
88462306a36Sopenharmony_ci#define TX_CNTL_CSR_KICK_TX_AC0		FIELD32(0x00000001)
88562306a36Sopenharmony_ci#define TX_CNTL_CSR_KICK_TX_AC1		FIELD32(0x00000002)
88662306a36Sopenharmony_ci#define TX_CNTL_CSR_KICK_TX_AC2		FIELD32(0x00000004)
88762306a36Sopenharmony_ci#define TX_CNTL_CSR_KICK_TX_AC3		FIELD32(0x00000008)
88862306a36Sopenharmony_ci#define TX_CNTL_CSR_KICK_TX_MGMT	FIELD32(0x00000010)
88962306a36Sopenharmony_ci#define TX_CNTL_CSR_ABORT_TX_AC0	FIELD32(0x00010000)
89062306a36Sopenharmony_ci#define TX_CNTL_CSR_ABORT_TX_AC1	FIELD32(0x00020000)
89162306a36Sopenharmony_ci#define TX_CNTL_CSR_ABORT_TX_AC2	FIELD32(0x00040000)
89262306a36Sopenharmony_ci#define TX_CNTL_CSR_ABORT_TX_AC3	FIELD32(0x00080000)
89362306a36Sopenharmony_ci#define TX_CNTL_CSR_ABORT_TX_MGMT	FIELD32(0x00100000)
89462306a36Sopenharmony_ci
89562306a36Sopenharmony_ci/*
89662306a36Sopenharmony_ci * LOAD_TX_RING_CSR: Load RX desriptor
89762306a36Sopenharmony_ci */
89862306a36Sopenharmony_ci#define LOAD_TX_RING_CSR		0x3434
89962306a36Sopenharmony_ci#define LOAD_TX_RING_CSR_LOAD_TXD_AC0	FIELD32(0x00000001)
90062306a36Sopenharmony_ci#define LOAD_TX_RING_CSR_LOAD_TXD_AC1	FIELD32(0x00000002)
90162306a36Sopenharmony_ci#define LOAD_TX_RING_CSR_LOAD_TXD_AC2	FIELD32(0x00000004)
90262306a36Sopenharmony_ci#define LOAD_TX_RING_CSR_LOAD_TXD_AC3	FIELD32(0x00000008)
90362306a36Sopenharmony_ci#define LOAD_TX_RING_CSR_LOAD_TXD_MGMT	FIELD32(0x00000010)
90462306a36Sopenharmony_ci
90562306a36Sopenharmony_ci/*
90662306a36Sopenharmony_ci * Several read-only registers, for debugging.
90762306a36Sopenharmony_ci */
90862306a36Sopenharmony_ci#define AC0_TXPTR_CSR			0x3438
90962306a36Sopenharmony_ci#define AC1_TXPTR_CSR			0x343c
91062306a36Sopenharmony_ci#define AC2_TXPTR_CSR			0x3440
91162306a36Sopenharmony_ci#define AC3_TXPTR_CSR			0x3444
91262306a36Sopenharmony_ci#define MGMT_TXPTR_CSR			0x3448
91362306a36Sopenharmony_ci
91462306a36Sopenharmony_ci/*
91562306a36Sopenharmony_ci * RX_BASE_CSR
91662306a36Sopenharmony_ci */
91762306a36Sopenharmony_ci#define RX_BASE_CSR			0x3450
91862306a36Sopenharmony_ci#define RX_BASE_CSR_RING_REGISTER	FIELD32(0xffffffff)
91962306a36Sopenharmony_ci
92062306a36Sopenharmony_ci/*
92162306a36Sopenharmony_ci * RX_RING_CSR.
92262306a36Sopenharmony_ci * RXD_SIZE: In unit of 32-bit.
92362306a36Sopenharmony_ci */
92462306a36Sopenharmony_ci#define RX_RING_CSR			0x3454
92562306a36Sopenharmony_ci#define RX_RING_CSR_RING_SIZE		FIELD32(0x000000ff)
92662306a36Sopenharmony_ci#define RX_RING_CSR_RXD_SIZE		FIELD32(0x00003f00)
92762306a36Sopenharmony_ci#define RX_RING_CSR_RXD_WRITEBACK_SIZE	FIELD32(0x00070000)
92862306a36Sopenharmony_ci
92962306a36Sopenharmony_ci/*
93062306a36Sopenharmony_ci * RX_CNTL_CSR
93162306a36Sopenharmony_ci */
93262306a36Sopenharmony_ci#define RX_CNTL_CSR			0x3458
93362306a36Sopenharmony_ci#define RX_CNTL_CSR_ENABLE_RX_DMA	FIELD32(0x00000001)
93462306a36Sopenharmony_ci#define RX_CNTL_CSR_LOAD_RXD		FIELD32(0x00000002)
93562306a36Sopenharmony_ci
93662306a36Sopenharmony_ci/*
93762306a36Sopenharmony_ci * RXPTR_CSR: Read-only, for debugging.
93862306a36Sopenharmony_ci */
93962306a36Sopenharmony_ci#define RXPTR_CSR			0x345c
94062306a36Sopenharmony_ci
94162306a36Sopenharmony_ci/*
94262306a36Sopenharmony_ci * PCI_CFG_CSR
94362306a36Sopenharmony_ci */
94462306a36Sopenharmony_ci#define PCI_CFG_CSR			0x3460
94562306a36Sopenharmony_ci
94662306a36Sopenharmony_ci/*
94762306a36Sopenharmony_ci * BUF_FORMAT_CSR
94862306a36Sopenharmony_ci */
94962306a36Sopenharmony_ci#define BUF_FORMAT_CSR			0x3464
95062306a36Sopenharmony_ci
95162306a36Sopenharmony_ci/*
95262306a36Sopenharmony_ci * INT_SOURCE_CSR: Interrupt source register.
95362306a36Sopenharmony_ci * Write one to clear corresponding bit.
95462306a36Sopenharmony_ci */
95562306a36Sopenharmony_ci#define INT_SOURCE_CSR			0x3468
95662306a36Sopenharmony_ci#define INT_SOURCE_CSR_TXDONE		FIELD32(0x00000001)
95762306a36Sopenharmony_ci#define INT_SOURCE_CSR_RXDONE		FIELD32(0x00000002)
95862306a36Sopenharmony_ci#define INT_SOURCE_CSR_BEACON_DONE	FIELD32(0x00000004)
95962306a36Sopenharmony_ci#define INT_SOURCE_CSR_TX_ABORT_DONE	FIELD32(0x00000010)
96062306a36Sopenharmony_ci#define INT_SOURCE_CSR_AC0_DMA_DONE	FIELD32(0x00010000)
96162306a36Sopenharmony_ci#define INT_SOURCE_CSR_AC1_DMA_DONE	FIELD32(0x00020000)
96262306a36Sopenharmony_ci#define INT_SOURCE_CSR_AC2_DMA_DONE	FIELD32(0x00040000)
96362306a36Sopenharmony_ci#define INT_SOURCE_CSR_AC3_DMA_DONE	FIELD32(0x00080000)
96462306a36Sopenharmony_ci#define INT_SOURCE_CSR_MGMT_DMA_DONE	FIELD32(0x00100000)
96562306a36Sopenharmony_ci#define INT_SOURCE_CSR_HCCA_DMA_DONE	FIELD32(0x00200000)
96662306a36Sopenharmony_ci
96762306a36Sopenharmony_ci/*
96862306a36Sopenharmony_ci * INT_MASK_CSR: Interrupt MASK register. 1: the interrupt is mask OFF.
96962306a36Sopenharmony_ci * MITIGATION_PERIOD: Interrupt mitigation in unit of 32 PCI clock.
97062306a36Sopenharmony_ci */
97162306a36Sopenharmony_ci#define INT_MASK_CSR			0x346c
97262306a36Sopenharmony_ci#define INT_MASK_CSR_TXDONE		FIELD32(0x00000001)
97362306a36Sopenharmony_ci#define INT_MASK_CSR_RXDONE		FIELD32(0x00000002)
97462306a36Sopenharmony_ci#define INT_MASK_CSR_BEACON_DONE	FIELD32(0x00000004)
97562306a36Sopenharmony_ci#define INT_MASK_CSR_TX_ABORT_DONE	FIELD32(0x00000010)
97662306a36Sopenharmony_ci#define INT_MASK_CSR_ENABLE_MITIGATION	FIELD32(0x00000080)
97762306a36Sopenharmony_ci#define INT_MASK_CSR_MITIGATION_PERIOD	FIELD32(0x0000ff00)
97862306a36Sopenharmony_ci#define INT_MASK_CSR_AC0_DMA_DONE	FIELD32(0x00010000)
97962306a36Sopenharmony_ci#define INT_MASK_CSR_AC1_DMA_DONE	FIELD32(0x00020000)
98062306a36Sopenharmony_ci#define INT_MASK_CSR_AC2_DMA_DONE	FIELD32(0x00040000)
98162306a36Sopenharmony_ci#define INT_MASK_CSR_AC3_DMA_DONE	FIELD32(0x00080000)
98262306a36Sopenharmony_ci#define INT_MASK_CSR_MGMT_DMA_DONE	FIELD32(0x00100000)
98362306a36Sopenharmony_ci#define INT_MASK_CSR_HCCA_DMA_DONE	FIELD32(0x00200000)
98462306a36Sopenharmony_ci
98562306a36Sopenharmony_ci/*
98662306a36Sopenharmony_ci * E2PROM_CSR: EEPROM control register.
98762306a36Sopenharmony_ci * RELOAD: Write 1 to reload eeprom content.
98862306a36Sopenharmony_ci * TYPE_93C46: 1: 93c46, 0:93c66.
98962306a36Sopenharmony_ci * LOAD_STATUS: 1:loading, 0:done.
99062306a36Sopenharmony_ci */
99162306a36Sopenharmony_ci#define E2PROM_CSR			0x3470
99262306a36Sopenharmony_ci#define E2PROM_CSR_RELOAD		FIELD32(0x00000001)
99362306a36Sopenharmony_ci#define E2PROM_CSR_DATA_CLOCK		FIELD32(0x00000002)
99462306a36Sopenharmony_ci#define E2PROM_CSR_CHIP_SELECT		FIELD32(0x00000004)
99562306a36Sopenharmony_ci#define E2PROM_CSR_DATA_IN		FIELD32(0x00000008)
99662306a36Sopenharmony_ci#define E2PROM_CSR_DATA_OUT		FIELD32(0x00000010)
99762306a36Sopenharmony_ci#define E2PROM_CSR_TYPE_93C46		FIELD32(0x00000020)
99862306a36Sopenharmony_ci#define E2PROM_CSR_LOAD_STATUS		FIELD32(0x00000040)
99962306a36Sopenharmony_ci
100062306a36Sopenharmony_ci/*
100162306a36Sopenharmony_ci * AC_TXOP_CSR0: AC_VO/AC_VI TXOP register.
100262306a36Sopenharmony_ci * AC0_TX_OP: For AC_VO, in unit of 32us.
100362306a36Sopenharmony_ci * AC1_TX_OP: For AC_VI, in unit of 32us.
100462306a36Sopenharmony_ci */
100562306a36Sopenharmony_ci#define AC_TXOP_CSR0			0x3474
100662306a36Sopenharmony_ci#define AC_TXOP_CSR0_AC0_TX_OP		FIELD32(0x0000ffff)
100762306a36Sopenharmony_ci#define AC_TXOP_CSR0_AC1_TX_OP		FIELD32(0xffff0000)
100862306a36Sopenharmony_ci
100962306a36Sopenharmony_ci/*
101062306a36Sopenharmony_ci * AC_TXOP_CSR1: AC_BE/AC_BK TXOP register.
101162306a36Sopenharmony_ci * AC2_TX_OP: For AC_BE, in unit of 32us.
101262306a36Sopenharmony_ci * AC3_TX_OP: For AC_BK, in unit of 32us.
101362306a36Sopenharmony_ci */
101462306a36Sopenharmony_ci#define AC_TXOP_CSR1			0x3478
101562306a36Sopenharmony_ci#define AC_TXOP_CSR1_AC2_TX_OP		FIELD32(0x0000ffff)
101662306a36Sopenharmony_ci#define AC_TXOP_CSR1_AC3_TX_OP		FIELD32(0xffff0000)
101762306a36Sopenharmony_ci
101862306a36Sopenharmony_ci/*
101962306a36Sopenharmony_ci * DMA_STATUS_CSR
102062306a36Sopenharmony_ci */
102162306a36Sopenharmony_ci#define DMA_STATUS_CSR			0x3480
102262306a36Sopenharmony_ci
102362306a36Sopenharmony_ci/*
102462306a36Sopenharmony_ci * TEST_MODE_CSR
102562306a36Sopenharmony_ci */
102662306a36Sopenharmony_ci#define TEST_MODE_CSR			0x3484
102762306a36Sopenharmony_ci
102862306a36Sopenharmony_ci/*
102962306a36Sopenharmony_ci * UART0_TX_CSR
103062306a36Sopenharmony_ci */
103162306a36Sopenharmony_ci#define UART0_TX_CSR			0x3488
103262306a36Sopenharmony_ci
103362306a36Sopenharmony_ci/*
103462306a36Sopenharmony_ci * UART0_RX_CSR
103562306a36Sopenharmony_ci */
103662306a36Sopenharmony_ci#define UART0_RX_CSR			0x348c
103762306a36Sopenharmony_ci
103862306a36Sopenharmony_ci/*
103962306a36Sopenharmony_ci * UART0_FRAME_CSR
104062306a36Sopenharmony_ci */
104162306a36Sopenharmony_ci#define UART0_FRAME_CSR			0x3490
104262306a36Sopenharmony_ci
104362306a36Sopenharmony_ci/*
104462306a36Sopenharmony_ci * UART0_BUFFER_CSR
104562306a36Sopenharmony_ci */
104662306a36Sopenharmony_ci#define UART0_BUFFER_CSR		0x3494
104762306a36Sopenharmony_ci
104862306a36Sopenharmony_ci/*
104962306a36Sopenharmony_ci * IO_CNTL_CSR
105062306a36Sopenharmony_ci * RF_PS: Set RF interface value to power save
105162306a36Sopenharmony_ci */
105262306a36Sopenharmony_ci#define IO_CNTL_CSR			0x3498
105362306a36Sopenharmony_ci#define IO_CNTL_CSR_RF_PS		FIELD32(0x00000004)
105462306a36Sopenharmony_ci
105562306a36Sopenharmony_ci/*
105662306a36Sopenharmony_ci * UART_INT_SOURCE_CSR
105762306a36Sopenharmony_ci */
105862306a36Sopenharmony_ci#define UART_INT_SOURCE_CSR		0x34a8
105962306a36Sopenharmony_ci
106062306a36Sopenharmony_ci/*
106162306a36Sopenharmony_ci * UART_INT_MASK_CSR
106262306a36Sopenharmony_ci */
106362306a36Sopenharmony_ci#define UART_INT_MASK_CSR		0x34ac
106462306a36Sopenharmony_ci
106562306a36Sopenharmony_ci/*
106662306a36Sopenharmony_ci * PBF_QUEUE_CSR
106762306a36Sopenharmony_ci */
106862306a36Sopenharmony_ci#define PBF_QUEUE_CSR			0x34b0
106962306a36Sopenharmony_ci
107062306a36Sopenharmony_ci/*
107162306a36Sopenharmony_ci * Firmware DMA registers.
107262306a36Sopenharmony_ci * Firmware DMA registers are dedicated for MCU usage
107362306a36Sopenharmony_ci * and should not be touched by host driver.
107462306a36Sopenharmony_ci * Therefore we skip the definition of these registers.
107562306a36Sopenharmony_ci */
107662306a36Sopenharmony_ci#define FW_TX_BASE_CSR			0x34c0
107762306a36Sopenharmony_ci#define FW_TX_START_CSR			0x34c4
107862306a36Sopenharmony_ci#define FW_TX_LAST_CSR			0x34c8
107962306a36Sopenharmony_ci#define FW_MODE_CNTL_CSR		0x34cc
108062306a36Sopenharmony_ci#define FW_TXPTR_CSR			0x34d0
108162306a36Sopenharmony_ci
108262306a36Sopenharmony_ci/*
108362306a36Sopenharmony_ci * 8051 firmware image.
108462306a36Sopenharmony_ci */
108562306a36Sopenharmony_ci#define FIRMWARE_RT2561			"rt2561.bin"
108662306a36Sopenharmony_ci#define FIRMWARE_RT2561s		"rt2561s.bin"
108762306a36Sopenharmony_ci#define FIRMWARE_RT2661			"rt2661.bin"
108862306a36Sopenharmony_ci#define FIRMWARE_IMAGE_BASE		0x4000
108962306a36Sopenharmony_ci
109062306a36Sopenharmony_ci/*
109162306a36Sopenharmony_ci * BBP registers.
109262306a36Sopenharmony_ci * The wordsize of the BBP is 8 bits.
109362306a36Sopenharmony_ci */
109462306a36Sopenharmony_ci
109562306a36Sopenharmony_ci/*
109662306a36Sopenharmony_ci * R2
109762306a36Sopenharmony_ci */
109862306a36Sopenharmony_ci#define BBP_R2_BG_MODE			FIELD8(0x20)
109962306a36Sopenharmony_ci
110062306a36Sopenharmony_ci/*
110162306a36Sopenharmony_ci * R3
110262306a36Sopenharmony_ci */
110362306a36Sopenharmony_ci#define BBP_R3_SMART_MODE		FIELD8(0x01)
110462306a36Sopenharmony_ci
110562306a36Sopenharmony_ci/*
110662306a36Sopenharmony_ci * R4: RX antenna control
110762306a36Sopenharmony_ci * FRAME_END: 1 - DPDT, 0 - SPDT (Only valid for 802.11G, RF2527 & RF2529)
110862306a36Sopenharmony_ci */
110962306a36Sopenharmony_ci
111062306a36Sopenharmony_ci/*
111162306a36Sopenharmony_ci * ANTENNA_CONTROL semantics (guessed):
111262306a36Sopenharmony_ci * 0x1: Software controlled antenna switching (fixed or SW diversity)
111362306a36Sopenharmony_ci * 0x2: Hardware diversity.
111462306a36Sopenharmony_ci */
111562306a36Sopenharmony_ci#define BBP_R4_RX_ANTENNA_CONTROL	FIELD8(0x03)
111662306a36Sopenharmony_ci#define BBP_R4_RX_FRAME_END		FIELD8(0x20)
111762306a36Sopenharmony_ci
111862306a36Sopenharmony_ci/*
111962306a36Sopenharmony_ci * R77
112062306a36Sopenharmony_ci */
112162306a36Sopenharmony_ci#define BBP_R77_RX_ANTENNA		FIELD8(0x03)
112262306a36Sopenharmony_ci
112362306a36Sopenharmony_ci/*
112462306a36Sopenharmony_ci * RF registers
112562306a36Sopenharmony_ci */
112662306a36Sopenharmony_ci
112762306a36Sopenharmony_ci/*
112862306a36Sopenharmony_ci * RF 3
112962306a36Sopenharmony_ci */
113062306a36Sopenharmony_ci#define RF3_TXPOWER			FIELD32(0x00003e00)
113162306a36Sopenharmony_ci
113262306a36Sopenharmony_ci/*
113362306a36Sopenharmony_ci * RF 4
113462306a36Sopenharmony_ci */
113562306a36Sopenharmony_ci#define RF4_FREQ_OFFSET			FIELD32(0x0003f000)
113662306a36Sopenharmony_ci
113762306a36Sopenharmony_ci/*
113862306a36Sopenharmony_ci * EEPROM content.
113962306a36Sopenharmony_ci * The wordsize of the EEPROM is 16 bits.
114062306a36Sopenharmony_ci */
114162306a36Sopenharmony_ci
114262306a36Sopenharmony_ci/*
114362306a36Sopenharmony_ci * HW MAC address.
114462306a36Sopenharmony_ci */
114562306a36Sopenharmony_ci#define EEPROM_MAC_ADDR_0		0x0002
114662306a36Sopenharmony_ci#define EEPROM_MAC_ADDR_BYTE0		FIELD16(0x00ff)
114762306a36Sopenharmony_ci#define EEPROM_MAC_ADDR_BYTE1		FIELD16(0xff00)
114862306a36Sopenharmony_ci#define EEPROM_MAC_ADDR1		0x0003
114962306a36Sopenharmony_ci#define EEPROM_MAC_ADDR_BYTE2		FIELD16(0x00ff)
115062306a36Sopenharmony_ci#define EEPROM_MAC_ADDR_BYTE3		FIELD16(0xff00)
115162306a36Sopenharmony_ci#define EEPROM_MAC_ADDR_2		0x0004
115262306a36Sopenharmony_ci#define EEPROM_MAC_ADDR_BYTE4		FIELD16(0x00ff)
115362306a36Sopenharmony_ci#define EEPROM_MAC_ADDR_BYTE5		FIELD16(0xff00)
115462306a36Sopenharmony_ci
115562306a36Sopenharmony_ci/*
115662306a36Sopenharmony_ci * EEPROM antenna.
115762306a36Sopenharmony_ci * ANTENNA_NUM: Number of antenna's.
115862306a36Sopenharmony_ci * TX_DEFAULT: Default antenna 0: diversity, 1: A, 2: B.
115962306a36Sopenharmony_ci * RX_DEFAULT: Default antenna 0: diversity, 1: A, 2: B.
116062306a36Sopenharmony_ci * FRAME_TYPE: 0: DPDT , 1: SPDT , noted this bit is valid for g only.
116162306a36Sopenharmony_ci * DYN_TXAGC: Dynamic TX AGC control.
116262306a36Sopenharmony_ci * HARDWARE_RADIO: 1: Hardware controlled radio. Read GPIO0.
116362306a36Sopenharmony_ci * RF_TYPE: Rf_type of this adapter.
116462306a36Sopenharmony_ci */
116562306a36Sopenharmony_ci#define EEPROM_ANTENNA			0x0010
116662306a36Sopenharmony_ci#define EEPROM_ANTENNA_NUM		FIELD16(0x0003)
116762306a36Sopenharmony_ci#define EEPROM_ANTENNA_TX_DEFAULT	FIELD16(0x000c)
116862306a36Sopenharmony_ci#define EEPROM_ANTENNA_RX_DEFAULT	FIELD16(0x0030)
116962306a36Sopenharmony_ci#define EEPROM_ANTENNA_FRAME_TYPE	FIELD16(0x0040)
117062306a36Sopenharmony_ci#define EEPROM_ANTENNA_DYN_TXAGC	FIELD16(0x0200)
117162306a36Sopenharmony_ci#define EEPROM_ANTENNA_HARDWARE_RADIO	FIELD16(0x0400)
117262306a36Sopenharmony_ci#define EEPROM_ANTENNA_RF_TYPE		FIELD16(0xf800)
117362306a36Sopenharmony_ci
117462306a36Sopenharmony_ci/*
117562306a36Sopenharmony_ci * EEPROM NIC config.
117662306a36Sopenharmony_ci * ENABLE_DIVERSITY: 1:enable, 0:disable.
117762306a36Sopenharmony_ci * EXTERNAL_LNA_BG: External LNA enable for 2.4G.
117862306a36Sopenharmony_ci * CARDBUS_ACCEL: 0:enable, 1:disable.
117962306a36Sopenharmony_ci * EXTERNAL_LNA_A: External LNA enable for 5G.
118062306a36Sopenharmony_ci */
118162306a36Sopenharmony_ci#define EEPROM_NIC			0x0011
118262306a36Sopenharmony_ci#define EEPROM_NIC_ENABLE_DIVERSITY	FIELD16(0x0001)
118362306a36Sopenharmony_ci#define EEPROM_NIC_TX_DIVERSITY		FIELD16(0x0002)
118462306a36Sopenharmony_ci#define EEPROM_NIC_RX_FIXED		FIELD16(0x0004)
118562306a36Sopenharmony_ci#define EEPROM_NIC_TX_FIXED		FIELD16(0x0008)
118662306a36Sopenharmony_ci#define EEPROM_NIC_EXTERNAL_LNA_BG	FIELD16(0x0010)
118762306a36Sopenharmony_ci#define EEPROM_NIC_CARDBUS_ACCEL	FIELD16(0x0020)
118862306a36Sopenharmony_ci#define EEPROM_NIC_EXTERNAL_LNA_A	FIELD16(0x0040)
118962306a36Sopenharmony_ci
119062306a36Sopenharmony_ci/*
119162306a36Sopenharmony_ci * EEPROM geography.
119262306a36Sopenharmony_ci * GEO_A: Default geographical setting for 5GHz band
119362306a36Sopenharmony_ci * GEO: Default geographical setting.
119462306a36Sopenharmony_ci */
119562306a36Sopenharmony_ci#define EEPROM_GEOGRAPHY		0x0012
119662306a36Sopenharmony_ci#define EEPROM_GEOGRAPHY_GEO_A		FIELD16(0x00ff)
119762306a36Sopenharmony_ci#define EEPROM_GEOGRAPHY_GEO		FIELD16(0xff00)
119862306a36Sopenharmony_ci
119962306a36Sopenharmony_ci/*
120062306a36Sopenharmony_ci * EEPROM BBP.
120162306a36Sopenharmony_ci */
120262306a36Sopenharmony_ci#define EEPROM_BBP_START		0x0013
120362306a36Sopenharmony_ci#define EEPROM_BBP_SIZE			16
120462306a36Sopenharmony_ci#define EEPROM_BBP_VALUE		FIELD16(0x00ff)
120562306a36Sopenharmony_ci#define EEPROM_BBP_REG_ID		FIELD16(0xff00)
120662306a36Sopenharmony_ci
120762306a36Sopenharmony_ci/*
120862306a36Sopenharmony_ci * EEPROM TXPOWER 802.11G
120962306a36Sopenharmony_ci */
121062306a36Sopenharmony_ci#define EEPROM_TXPOWER_G_START		0x0023
121162306a36Sopenharmony_ci#define EEPROM_TXPOWER_G_SIZE		7
121262306a36Sopenharmony_ci#define EEPROM_TXPOWER_G_1		FIELD16(0x00ff)
121362306a36Sopenharmony_ci#define EEPROM_TXPOWER_G_2		FIELD16(0xff00)
121462306a36Sopenharmony_ci
121562306a36Sopenharmony_ci/*
121662306a36Sopenharmony_ci * EEPROM Frequency
121762306a36Sopenharmony_ci */
121862306a36Sopenharmony_ci#define EEPROM_FREQ			0x002f
121962306a36Sopenharmony_ci#define EEPROM_FREQ_OFFSET		FIELD16(0x00ff)
122062306a36Sopenharmony_ci#define EEPROM_FREQ_SEQ_MASK		FIELD16(0xff00)
122162306a36Sopenharmony_ci#define EEPROM_FREQ_SEQ			FIELD16(0x0300)
122262306a36Sopenharmony_ci
122362306a36Sopenharmony_ci/*
122462306a36Sopenharmony_ci * EEPROM LED.
122562306a36Sopenharmony_ci * POLARITY_RDY_G: Polarity RDY_G setting.
122662306a36Sopenharmony_ci * POLARITY_RDY_A: Polarity RDY_A setting.
122762306a36Sopenharmony_ci * POLARITY_ACT: Polarity ACT setting.
122862306a36Sopenharmony_ci * POLARITY_GPIO_0: Polarity GPIO0 setting.
122962306a36Sopenharmony_ci * POLARITY_GPIO_1: Polarity GPIO1 setting.
123062306a36Sopenharmony_ci * POLARITY_GPIO_2: Polarity GPIO2 setting.
123162306a36Sopenharmony_ci * POLARITY_GPIO_3: Polarity GPIO3 setting.
123262306a36Sopenharmony_ci * POLARITY_GPIO_4: Polarity GPIO4 setting.
123362306a36Sopenharmony_ci * LED_MODE: Led mode.
123462306a36Sopenharmony_ci */
123562306a36Sopenharmony_ci#define EEPROM_LED			0x0030
123662306a36Sopenharmony_ci#define EEPROM_LED_POLARITY_RDY_G	FIELD16(0x0001)
123762306a36Sopenharmony_ci#define EEPROM_LED_POLARITY_RDY_A	FIELD16(0x0002)
123862306a36Sopenharmony_ci#define EEPROM_LED_POLARITY_ACT		FIELD16(0x0004)
123962306a36Sopenharmony_ci#define EEPROM_LED_POLARITY_GPIO_0	FIELD16(0x0008)
124062306a36Sopenharmony_ci#define EEPROM_LED_POLARITY_GPIO_1	FIELD16(0x0010)
124162306a36Sopenharmony_ci#define EEPROM_LED_POLARITY_GPIO_2	FIELD16(0x0020)
124262306a36Sopenharmony_ci#define EEPROM_LED_POLARITY_GPIO_3	FIELD16(0x0040)
124362306a36Sopenharmony_ci#define EEPROM_LED_POLARITY_GPIO_4	FIELD16(0x0080)
124462306a36Sopenharmony_ci#define EEPROM_LED_LED_MODE		FIELD16(0x1f00)
124562306a36Sopenharmony_ci
124662306a36Sopenharmony_ci/*
124762306a36Sopenharmony_ci * EEPROM TXPOWER 802.11A
124862306a36Sopenharmony_ci */
124962306a36Sopenharmony_ci#define EEPROM_TXPOWER_A_START		0x0031
125062306a36Sopenharmony_ci#define EEPROM_TXPOWER_A_SIZE		12
125162306a36Sopenharmony_ci#define EEPROM_TXPOWER_A_1		FIELD16(0x00ff)
125262306a36Sopenharmony_ci#define EEPROM_TXPOWER_A_2		FIELD16(0xff00)
125362306a36Sopenharmony_ci
125462306a36Sopenharmony_ci/*
125562306a36Sopenharmony_ci * EEPROM RSSI offset 802.11BG
125662306a36Sopenharmony_ci */
125762306a36Sopenharmony_ci#define EEPROM_RSSI_OFFSET_BG		0x004d
125862306a36Sopenharmony_ci#define EEPROM_RSSI_OFFSET_BG_1		FIELD16(0x00ff)
125962306a36Sopenharmony_ci#define EEPROM_RSSI_OFFSET_BG_2		FIELD16(0xff00)
126062306a36Sopenharmony_ci
126162306a36Sopenharmony_ci/*
126262306a36Sopenharmony_ci * EEPROM RSSI offset 802.11A
126362306a36Sopenharmony_ci */
126462306a36Sopenharmony_ci#define EEPROM_RSSI_OFFSET_A		0x004e
126562306a36Sopenharmony_ci#define EEPROM_RSSI_OFFSET_A_1		FIELD16(0x00ff)
126662306a36Sopenharmony_ci#define EEPROM_RSSI_OFFSET_A_2		FIELD16(0xff00)
126762306a36Sopenharmony_ci
126862306a36Sopenharmony_ci/*
126962306a36Sopenharmony_ci * MCU mailbox commands.
127062306a36Sopenharmony_ci */
127162306a36Sopenharmony_ci#define MCU_SLEEP			0x30
127262306a36Sopenharmony_ci#define MCU_WAKEUP			0x31
127362306a36Sopenharmony_ci#define MCU_LED				0x50
127462306a36Sopenharmony_ci#define MCU_LED_STRENGTH		0x52
127562306a36Sopenharmony_ci
127662306a36Sopenharmony_ci/*
127762306a36Sopenharmony_ci * DMA descriptor defines.
127862306a36Sopenharmony_ci */
127962306a36Sopenharmony_ci#define TXD_DESC_SIZE			(16 * sizeof(__le32))
128062306a36Sopenharmony_ci#define TXINFO_SIZE			(6 * sizeof(__le32))
128162306a36Sopenharmony_ci#define RXD_DESC_SIZE			(16 * sizeof(__le32))
128262306a36Sopenharmony_ci
128362306a36Sopenharmony_ci/*
128462306a36Sopenharmony_ci * TX descriptor format for TX, PRIO and Beacon Ring.
128562306a36Sopenharmony_ci */
128662306a36Sopenharmony_ci
128762306a36Sopenharmony_ci/*
128862306a36Sopenharmony_ci * Word0
128962306a36Sopenharmony_ci * TKIP_MIC: ASIC appends TKIP MIC if TKIP is used.
129062306a36Sopenharmony_ci * KEY_TABLE: Use per-client pairwise KEY table.
129162306a36Sopenharmony_ci * KEY_INDEX:
129262306a36Sopenharmony_ci * Key index (0~31) to the pairwise KEY table.
129362306a36Sopenharmony_ci * 0~3 to shared KEY table 0 (BSS0).
129462306a36Sopenharmony_ci * 4~7 to shared KEY table 1 (BSS1).
129562306a36Sopenharmony_ci * 8~11 to shared KEY table 2 (BSS2).
129662306a36Sopenharmony_ci * 12~15 to shared KEY table 3 (BSS3).
129762306a36Sopenharmony_ci * BURST: Next frame belongs to same "burst" event.
129862306a36Sopenharmony_ci */
129962306a36Sopenharmony_ci#define TXD_W0_OWNER_NIC		FIELD32(0x00000001)
130062306a36Sopenharmony_ci#define TXD_W0_VALID			FIELD32(0x00000002)
130162306a36Sopenharmony_ci#define TXD_W0_MORE_FRAG		FIELD32(0x00000004)
130262306a36Sopenharmony_ci#define TXD_W0_ACK			FIELD32(0x00000008)
130362306a36Sopenharmony_ci#define TXD_W0_TIMESTAMP		FIELD32(0x00000010)
130462306a36Sopenharmony_ci#define TXD_W0_OFDM			FIELD32(0x00000020)
130562306a36Sopenharmony_ci#define TXD_W0_IFS			FIELD32(0x00000040)
130662306a36Sopenharmony_ci#define TXD_W0_RETRY_MODE		FIELD32(0x00000080)
130762306a36Sopenharmony_ci#define TXD_W0_TKIP_MIC			FIELD32(0x00000100)
130862306a36Sopenharmony_ci#define TXD_W0_KEY_TABLE		FIELD32(0x00000200)
130962306a36Sopenharmony_ci#define TXD_W0_KEY_INDEX		FIELD32(0x0000fc00)
131062306a36Sopenharmony_ci#define TXD_W0_DATABYTE_COUNT		FIELD32(0x0fff0000)
131162306a36Sopenharmony_ci#define TXD_W0_BURST			FIELD32(0x10000000)
131262306a36Sopenharmony_ci#define TXD_W0_CIPHER_ALG		FIELD32(0xe0000000)
131362306a36Sopenharmony_ci
131462306a36Sopenharmony_ci/*
131562306a36Sopenharmony_ci * Word1
131662306a36Sopenharmony_ci * HOST_Q_ID: EDCA/HCCA queue ID.
131762306a36Sopenharmony_ci * HW_SEQUENCE: MAC overwrites the frame sequence number.
131862306a36Sopenharmony_ci * BUFFER_COUNT: Number of buffers in this TXD.
131962306a36Sopenharmony_ci */
132062306a36Sopenharmony_ci#define TXD_W1_HOST_Q_ID		FIELD32(0x0000000f)
132162306a36Sopenharmony_ci#define TXD_W1_AIFSN			FIELD32(0x000000f0)
132262306a36Sopenharmony_ci#define TXD_W1_CWMIN			FIELD32(0x00000f00)
132362306a36Sopenharmony_ci#define TXD_W1_CWMAX			FIELD32(0x0000f000)
132462306a36Sopenharmony_ci#define TXD_W1_IV_OFFSET		FIELD32(0x003f0000)
132562306a36Sopenharmony_ci#define TXD_W1_PIGGY_BACK		FIELD32(0x01000000)
132662306a36Sopenharmony_ci#define TXD_W1_HW_SEQUENCE		FIELD32(0x10000000)
132762306a36Sopenharmony_ci#define TXD_W1_BUFFER_COUNT		FIELD32(0xe0000000)
132862306a36Sopenharmony_ci
132962306a36Sopenharmony_ci/*
133062306a36Sopenharmony_ci * Word2: PLCP information
133162306a36Sopenharmony_ci */
133262306a36Sopenharmony_ci#define TXD_W2_PLCP_SIGNAL		FIELD32(0x000000ff)
133362306a36Sopenharmony_ci#define TXD_W2_PLCP_SERVICE		FIELD32(0x0000ff00)
133462306a36Sopenharmony_ci#define TXD_W2_PLCP_LENGTH_LOW		FIELD32(0x00ff0000)
133562306a36Sopenharmony_ci#define TXD_W2_PLCP_LENGTH_HIGH		FIELD32(0xff000000)
133662306a36Sopenharmony_ci
133762306a36Sopenharmony_ci/*
133862306a36Sopenharmony_ci * Word3
133962306a36Sopenharmony_ci */
134062306a36Sopenharmony_ci#define TXD_W3_IV			FIELD32(0xffffffff)
134162306a36Sopenharmony_ci
134262306a36Sopenharmony_ci/*
134362306a36Sopenharmony_ci * Word4
134462306a36Sopenharmony_ci */
134562306a36Sopenharmony_ci#define TXD_W4_EIV			FIELD32(0xffffffff)
134662306a36Sopenharmony_ci
134762306a36Sopenharmony_ci/*
134862306a36Sopenharmony_ci * Word5
134962306a36Sopenharmony_ci * FRAME_OFFSET: Frame start offset inside ASIC TXFIFO (after TXINFO field).
135062306a36Sopenharmony_ci * TXD_W5_PID_SUBTYPE: Driver assigned packet ID index for txdone handler.
135162306a36Sopenharmony_ci * TXD_W5_PID_TYPE: Driver assigned packet ID type for txdone handler.
135262306a36Sopenharmony_ci * WAITING_DMA_DONE_INT: TXD been filled with data
135362306a36Sopenharmony_ci * and waiting for TxDoneISR housekeeping.
135462306a36Sopenharmony_ci */
135562306a36Sopenharmony_ci#define TXD_W5_FRAME_OFFSET		FIELD32(0x000000ff)
135662306a36Sopenharmony_ci#define TXD_W5_PID_SUBTYPE		FIELD32(0x00001f00)
135762306a36Sopenharmony_ci#define TXD_W5_PID_TYPE			FIELD32(0x0000e000)
135862306a36Sopenharmony_ci#define TXD_W5_TX_POWER			FIELD32(0x00ff0000)
135962306a36Sopenharmony_ci#define TXD_W5_WAITING_DMA_DONE_INT	FIELD32(0x01000000)
136062306a36Sopenharmony_ci
136162306a36Sopenharmony_ci/*
136262306a36Sopenharmony_ci * the above 24-byte is called TXINFO and will be DMAed to MAC block
136362306a36Sopenharmony_ci * through TXFIFO. MAC block use this TXINFO to control the transmission
136462306a36Sopenharmony_ci * behavior of this frame.
136562306a36Sopenharmony_ci * The following fields are not used by MAC block.
136662306a36Sopenharmony_ci * They are used by DMA block and HOST driver only.
136762306a36Sopenharmony_ci * Once a frame has been DMA to ASIC, all the following fields are useless
136862306a36Sopenharmony_ci * to ASIC.
136962306a36Sopenharmony_ci */
137062306a36Sopenharmony_ci
137162306a36Sopenharmony_ci/*
137262306a36Sopenharmony_ci * Word6-10: Buffer physical address
137362306a36Sopenharmony_ci */
137462306a36Sopenharmony_ci#define TXD_W6_BUFFER_PHYSICAL_ADDRESS	FIELD32(0xffffffff)
137562306a36Sopenharmony_ci#define TXD_W7_BUFFER_PHYSICAL_ADDRESS	FIELD32(0xffffffff)
137662306a36Sopenharmony_ci#define TXD_W8_BUFFER_PHYSICAL_ADDRESS	FIELD32(0xffffffff)
137762306a36Sopenharmony_ci#define TXD_W9_BUFFER_PHYSICAL_ADDRESS	FIELD32(0xffffffff)
137862306a36Sopenharmony_ci#define TXD_W10_BUFFER_PHYSICAL_ADDRESS	FIELD32(0xffffffff)
137962306a36Sopenharmony_ci
138062306a36Sopenharmony_ci/*
138162306a36Sopenharmony_ci * Word11-13: Buffer length
138262306a36Sopenharmony_ci */
138362306a36Sopenharmony_ci#define TXD_W11_BUFFER_LENGTH0		FIELD32(0x00000fff)
138462306a36Sopenharmony_ci#define TXD_W11_BUFFER_LENGTH1		FIELD32(0x0fff0000)
138562306a36Sopenharmony_ci#define TXD_W12_BUFFER_LENGTH2		FIELD32(0x00000fff)
138662306a36Sopenharmony_ci#define TXD_W12_BUFFER_LENGTH3		FIELD32(0x0fff0000)
138762306a36Sopenharmony_ci#define TXD_W13_BUFFER_LENGTH4		FIELD32(0x00000fff)
138862306a36Sopenharmony_ci
138962306a36Sopenharmony_ci/*
139062306a36Sopenharmony_ci * Word14
139162306a36Sopenharmony_ci */
139262306a36Sopenharmony_ci#define TXD_W14_SK_BUFFER		FIELD32(0xffffffff)
139362306a36Sopenharmony_ci
139462306a36Sopenharmony_ci/*
139562306a36Sopenharmony_ci * Word15
139662306a36Sopenharmony_ci */
139762306a36Sopenharmony_ci#define TXD_W15_NEXT_SK_BUFFER		FIELD32(0xffffffff)
139862306a36Sopenharmony_ci
139962306a36Sopenharmony_ci/*
140062306a36Sopenharmony_ci * RX descriptor format for RX Ring.
140162306a36Sopenharmony_ci */
140262306a36Sopenharmony_ci
140362306a36Sopenharmony_ci/*
140462306a36Sopenharmony_ci * Word0
140562306a36Sopenharmony_ci * CIPHER_ERROR: 1:ICV error, 2:MIC error, 3:invalid key.
140662306a36Sopenharmony_ci * KEY_INDEX: Decryption key actually used.
140762306a36Sopenharmony_ci */
140862306a36Sopenharmony_ci#define RXD_W0_OWNER_NIC		FIELD32(0x00000001)
140962306a36Sopenharmony_ci#define RXD_W0_DROP			FIELD32(0x00000002)
141062306a36Sopenharmony_ci#define RXD_W0_UNICAST_TO_ME		FIELD32(0x00000004)
141162306a36Sopenharmony_ci#define RXD_W0_MULTICAST		FIELD32(0x00000008)
141262306a36Sopenharmony_ci#define RXD_W0_BROADCAST		FIELD32(0x00000010)
141362306a36Sopenharmony_ci#define RXD_W0_MY_BSS			FIELD32(0x00000020)
141462306a36Sopenharmony_ci#define RXD_W0_CRC_ERROR		FIELD32(0x00000040)
141562306a36Sopenharmony_ci#define RXD_W0_OFDM			FIELD32(0x00000080)
141662306a36Sopenharmony_ci#define RXD_W0_CIPHER_ERROR		FIELD32(0x00000300)
141762306a36Sopenharmony_ci#define RXD_W0_KEY_INDEX		FIELD32(0x0000fc00)
141862306a36Sopenharmony_ci#define RXD_W0_DATABYTE_COUNT		FIELD32(0x0fff0000)
141962306a36Sopenharmony_ci#define RXD_W0_CIPHER_ALG		FIELD32(0xe0000000)
142062306a36Sopenharmony_ci
142162306a36Sopenharmony_ci/*
142262306a36Sopenharmony_ci * Word1
142362306a36Sopenharmony_ci * SIGNAL: RX raw data rate reported by BBP.
142462306a36Sopenharmony_ci */
142562306a36Sopenharmony_ci#define RXD_W1_SIGNAL			FIELD32(0x000000ff)
142662306a36Sopenharmony_ci#define RXD_W1_RSSI_AGC			FIELD32(0x00001f00)
142762306a36Sopenharmony_ci#define RXD_W1_RSSI_LNA			FIELD32(0x00006000)
142862306a36Sopenharmony_ci#define RXD_W1_FRAME_OFFSET		FIELD32(0x7f000000)
142962306a36Sopenharmony_ci
143062306a36Sopenharmony_ci/*
143162306a36Sopenharmony_ci * Word2
143262306a36Sopenharmony_ci * IV: Received IV of originally encrypted.
143362306a36Sopenharmony_ci */
143462306a36Sopenharmony_ci#define RXD_W2_IV			FIELD32(0xffffffff)
143562306a36Sopenharmony_ci
143662306a36Sopenharmony_ci/*
143762306a36Sopenharmony_ci * Word3
143862306a36Sopenharmony_ci * EIV: Received EIV of originally encrypted.
143962306a36Sopenharmony_ci */
144062306a36Sopenharmony_ci#define RXD_W3_EIV			FIELD32(0xffffffff)
144162306a36Sopenharmony_ci
144262306a36Sopenharmony_ci/*
144362306a36Sopenharmony_ci * Word4
144462306a36Sopenharmony_ci * ICV: Received ICV of originally encrypted.
144562306a36Sopenharmony_ci * NOTE: This is a guess, the official definition is "reserved"
144662306a36Sopenharmony_ci */
144762306a36Sopenharmony_ci#define RXD_W4_ICV			FIELD32(0xffffffff)
144862306a36Sopenharmony_ci
144962306a36Sopenharmony_ci/*
145062306a36Sopenharmony_ci * the above 20-byte is called RXINFO and will be DMAed to MAC RX block
145162306a36Sopenharmony_ci * and passed to the HOST driver.
145262306a36Sopenharmony_ci * The following fields are for DMA block and HOST usage only.
145362306a36Sopenharmony_ci * Can't be touched by ASIC MAC block.
145462306a36Sopenharmony_ci */
145562306a36Sopenharmony_ci
145662306a36Sopenharmony_ci/*
145762306a36Sopenharmony_ci * Word5
145862306a36Sopenharmony_ci */
145962306a36Sopenharmony_ci#define RXD_W5_BUFFER_PHYSICAL_ADDRESS	FIELD32(0xffffffff)
146062306a36Sopenharmony_ci
146162306a36Sopenharmony_ci/*
146262306a36Sopenharmony_ci * Word6-15: Reserved
146362306a36Sopenharmony_ci */
146462306a36Sopenharmony_ci#define RXD_W6_RESERVED			FIELD32(0xffffffff)
146562306a36Sopenharmony_ci#define RXD_W7_RESERVED			FIELD32(0xffffffff)
146662306a36Sopenharmony_ci#define RXD_W8_RESERVED			FIELD32(0xffffffff)
146762306a36Sopenharmony_ci#define RXD_W9_RESERVED			FIELD32(0xffffffff)
146862306a36Sopenharmony_ci#define RXD_W10_RESERVED		FIELD32(0xffffffff)
146962306a36Sopenharmony_ci#define RXD_W11_RESERVED		FIELD32(0xffffffff)
147062306a36Sopenharmony_ci#define RXD_W12_RESERVED		FIELD32(0xffffffff)
147162306a36Sopenharmony_ci#define RXD_W13_RESERVED		FIELD32(0xffffffff)
147262306a36Sopenharmony_ci#define RXD_W14_RESERVED		FIELD32(0xffffffff)
147362306a36Sopenharmony_ci#define RXD_W15_RESERVED		FIELD32(0xffffffff)
147462306a36Sopenharmony_ci
147562306a36Sopenharmony_ci/*
147662306a36Sopenharmony_ci * Macros for converting txpower from EEPROM to mac80211 value
147762306a36Sopenharmony_ci * and from mac80211 value to register value.
147862306a36Sopenharmony_ci */
147962306a36Sopenharmony_ci#define MIN_TXPOWER	0
148062306a36Sopenharmony_ci#define MAX_TXPOWER	31
148162306a36Sopenharmony_ci#define DEFAULT_TXPOWER	24
148262306a36Sopenharmony_ci
148362306a36Sopenharmony_ci#define TXPOWER_FROM_DEV(__txpower) \
148462306a36Sopenharmony_ci	(((u8)(__txpower)) > MAX_TXPOWER) ? DEFAULT_TXPOWER : (__txpower)
148562306a36Sopenharmony_ci
148662306a36Sopenharmony_ci#define TXPOWER_TO_DEV(__txpower) \
148762306a36Sopenharmony_ci	clamp_t(u8, __txpower, MIN_TXPOWER, MAX_TXPOWER)
148862306a36Sopenharmony_ci
148962306a36Sopenharmony_ci#endif /* RT61PCI_H */
1490