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: rt2400pci
1062306a36Sopenharmony_ci	Abstract: Data structures and registers for the rt2400pci module.
1162306a36Sopenharmony_ci	Supported chipsets: RT2460.
1262306a36Sopenharmony_ci */
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#ifndef RT2400PCI_H
1562306a36Sopenharmony_ci#define RT2400PCI_H
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci/*
1862306a36Sopenharmony_ci * RF chip defines.
1962306a36Sopenharmony_ci */
2062306a36Sopenharmony_ci#define RF2420				0x0000
2162306a36Sopenharmony_ci#define RF2421				0x0001
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci/*
2462306a36Sopenharmony_ci * Signal information.
2562306a36Sopenharmony_ci * Default offset is required for RSSI <-> dBm conversion.
2662306a36Sopenharmony_ci */
2762306a36Sopenharmony_ci#define DEFAULT_RSSI_OFFSET		100
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci/*
3062306a36Sopenharmony_ci * Register layout information.
3162306a36Sopenharmony_ci */
3262306a36Sopenharmony_ci#define CSR_REG_BASE			0x0000
3362306a36Sopenharmony_ci#define CSR_REG_SIZE			0x014c
3462306a36Sopenharmony_ci#define EEPROM_BASE			0x0000
3562306a36Sopenharmony_ci#define EEPROM_SIZE			0x0100
3662306a36Sopenharmony_ci#define BBP_BASE			0x0000
3762306a36Sopenharmony_ci#define BBP_SIZE			0x0020
3862306a36Sopenharmony_ci#define RF_BASE				0x0004
3962306a36Sopenharmony_ci#define RF_SIZE				0x000c
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci/*
4262306a36Sopenharmony_ci * Number of TX queues.
4362306a36Sopenharmony_ci */
4462306a36Sopenharmony_ci#define NUM_TX_QUEUES			2
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci/*
4762306a36Sopenharmony_ci * Control/Status Registers(CSR).
4862306a36Sopenharmony_ci * Some values are set in TU, whereas 1 TU == 1024 us.
4962306a36Sopenharmony_ci */
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci/*
5262306a36Sopenharmony_ci * CSR0: ASIC revision number.
5362306a36Sopenharmony_ci */
5462306a36Sopenharmony_ci#define CSR0				0x0000
5562306a36Sopenharmony_ci#define CSR0_REVISION			FIELD32(0x0000ffff)
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci/*
5862306a36Sopenharmony_ci * CSR1: System control register.
5962306a36Sopenharmony_ci * SOFT_RESET: Software reset, 1: reset, 0: normal.
6062306a36Sopenharmony_ci * BBP_RESET: Hardware reset, 1: reset, 0, release.
6162306a36Sopenharmony_ci * HOST_READY: Host ready after initialization.
6262306a36Sopenharmony_ci */
6362306a36Sopenharmony_ci#define CSR1				0x0004
6462306a36Sopenharmony_ci#define CSR1_SOFT_RESET			FIELD32(0x00000001)
6562306a36Sopenharmony_ci#define CSR1_BBP_RESET			FIELD32(0x00000002)
6662306a36Sopenharmony_ci#define CSR1_HOST_READY			FIELD32(0x00000004)
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci/*
6962306a36Sopenharmony_ci * CSR2: System admin status register (invalid).
7062306a36Sopenharmony_ci */
7162306a36Sopenharmony_ci#define CSR2				0x0008
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci/*
7462306a36Sopenharmony_ci * CSR3: STA MAC address register 0.
7562306a36Sopenharmony_ci */
7662306a36Sopenharmony_ci#define CSR3				0x000c
7762306a36Sopenharmony_ci#define CSR3_BYTE0			FIELD32(0x000000ff)
7862306a36Sopenharmony_ci#define CSR3_BYTE1			FIELD32(0x0000ff00)
7962306a36Sopenharmony_ci#define CSR3_BYTE2			FIELD32(0x00ff0000)
8062306a36Sopenharmony_ci#define CSR3_BYTE3			FIELD32(0xff000000)
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci/*
8362306a36Sopenharmony_ci * CSR4: STA MAC address register 1.
8462306a36Sopenharmony_ci */
8562306a36Sopenharmony_ci#define CSR4				0x0010
8662306a36Sopenharmony_ci#define CSR4_BYTE4			FIELD32(0x000000ff)
8762306a36Sopenharmony_ci#define CSR4_BYTE5			FIELD32(0x0000ff00)
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci/*
9062306a36Sopenharmony_ci * CSR5: BSSID register 0.
9162306a36Sopenharmony_ci */
9262306a36Sopenharmony_ci#define CSR5				0x0014
9362306a36Sopenharmony_ci#define CSR5_BYTE0			FIELD32(0x000000ff)
9462306a36Sopenharmony_ci#define CSR5_BYTE1			FIELD32(0x0000ff00)
9562306a36Sopenharmony_ci#define CSR5_BYTE2			FIELD32(0x00ff0000)
9662306a36Sopenharmony_ci#define CSR5_BYTE3			FIELD32(0xff000000)
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ci/*
9962306a36Sopenharmony_ci * CSR6: BSSID register 1.
10062306a36Sopenharmony_ci */
10162306a36Sopenharmony_ci#define CSR6				0x0018
10262306a36Sopenharmony_ci#define CSR6_BYTE4			FIELD32(0x000000ff)
10362306a36Sopenharmony_ci#define CSR6_BYTE5			FIELD32(0x0000ff00)
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_ci/*
10662306a36Sopenharmony_ci * CSR7: Interrupt source register.
10762306a36Sopenharmony_ci * Write 1 to clear interrupt.
10862306a36Sopenharmony_ci * TBCN_EXPIRE: Beacon timer expired interrupt.
10962306a36Sopenharmony_ci * TWAKE_EXPIRE: Wakeup timer expired interrupt.
11062306a36Sopenharmony_ci * TATIMW_EXPIRE: Timer of atim window expired interrupt.
11162306a36Sopenharmony_ci * TXDONE_TXRING: Tx ring transmit done interrupt.
11262306a36Sopenharmony_ci * TXDONE_ATIMRING: Atim ring transmit done interrupt.
11362306a36Sopenharmony_ci * TXDONE_PRIORING: Priority ring transmit done interrupt.
11462306a36Sopenharmony_ci * RXDONE: Receive done interrupt.
11562306a36Sopenharmony_ci */
11662306a36Sopenharmony_ci#define CSR7				0x001c
11762306a36Sopenharmony_ci#define CSR7_TBCN_EXPIRE		FIELD32(0x00000001)
11862306a36Sopenharmony_ci#define CSR7_TWAKE_EXPIRE		FIELD32(0x00000002)
11962306a36Sopenharmony_ci#define CSR7_TATIMW_EXPIRE		FIELD32(0x00000004)
12062306a36Sopenharmony_ci#define CSR7_TXDONE_TXRING		FIELD32(0x00000008)
12162306a36Sopenharmony_ci#define CSR7_TXDONE_ATIMRING		FIELD32(0x00000010)
12262306a36Sopenharmony_ci#define CSR7_TXDONE_PRIORING		FIELD32(0x00000020)
12362306a36Sopenharmony_ci#define CSR7_RXDONE			FIELD32(0x00000040)
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ci/*
12662306a36Sopenharmony_ci * CSR8: Interrupt mask register.
12762306a36Sopenharmony_ci * Write 1 to mask interrupt.
12862306a36Sopenharmony_ci * TBCN_EXPIRE: Beacon timer expired interrupt.
12962306a36Sopenharmony_ci * TWAKE_EXPIRE: Wakeup timer expired interrupt.
13062306a36Sopenharmony_ci * TATIMW_EXPIRE: Timer of atim window expired interrupt.
13162306a36Sopenharmony_ci * TXDONE_TXRING: Tx ring transmit done interrupt.
13262306a36Sopenharmony_ci * TXDONE_ATIMRING: Atim ring transmit done interrupt.
13362306a36Sopenharmony_ci * TXDONE_PRIORING: Priority ring transmit done interrupt.
13462306a36Sopenharmony_ci * RXDONE: Receive done interrupt.
13562306a36Sopenharmony_ci */
13662306a36Sopenharmony_ci#define CSR8				0x0020
13762306a36Sopenharmony_ci#define CSR8_TBCN_EXPIRE		FIELD32(0x00000001)
13862306a36Sopenharmony_ci#define CSR8_TWAKE_EXPIRE		FIELD32(0x00000002)
13962306a36Sopenharmony_ci#define CSR8_TATIMW_EXPIRE		FIELD32(0x00000004)
14062306a36Sopenharmony_ci#define CSR8_TXDONE_TXRING		FIELD32(0x00000008)
14162306a36Sopenharmony_ci#define CSR8_TXDONE_ATIMRING		FIELD32(0x00000010)
14262306a36Sopenharmony_ci#define CSR8_TXDONE_PRIORING		FIELD32(0x00000020)
14362306a36Sopenharmony_ci#define CSR8_RXDONE			FIELD32(0x00000040)
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ci/*
14662306a36Sopenharmony_ci * CSR9: Maximum frame length register.
14762306a36Sopenharmony_ci * MAX_FRAME_UNIT: Maximum frame length in 128b unit, default: 12.
14862306a36Sopenharmony_ci */
14962306a36Sopenharmony_ci#define CSR9				0x0024
15062306a36Sopenharmony_ci#define CSR9_MAX_FRAME_UNIT		FIELD32(0x00000f80)
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_ci/*
15362306a36Sopenharmony_ci * CSR11: Back-off control register.
15462306a36Sopenharmony_ci * CWMIN: CWmin. Default cwmin is 31 (2^5 - 1).
15562306a36Sopenharmony_ci * CWMAX: CWmax. Default cwmax is 1023 (2^10 - 1).
15662306a36Sopenharmony_ci * SLOT_TIME: Slot time, default is 20us for 802.11b.
15762306a36Sopenharmony_ci * LONG_RETRY: Long retry count.
15862306a36Sopenharmony_ci * SHORT_RETRY: Short retry count.
15962306a36Sopenharmony_ci */
16062306a36Sopenharmony_ci#define CSR11				0x002c
16162306a36Sopenharmony_ci#define CSR11_CWMIN			FIELD32(0x0000000f)
16262306a36Sopenharmony_ci#define CSR11_CWMAX			FIELD32(0x000000f0)
16362306a36Sopenharmony_ci#define CSR11_SLOT_TIME			FIELD32(0x00001f00)
16462306a36Sopenharmony_ci#define CSR11_LONG_RETRY		FIELD32(0x00ff0000)
16562306a36Sopenharmony_ci#define CSR11_SHORT_RETRY		FIELD32(0xff000000)
16662306a36Sopenharmony_ci
16762306a36Sopenharmony_ci/*
16862306a36Sopenharmony_ci * CSR12: Synchronization configuration register 0.
16962306a36Sopenharmony_ci * All units in 1/16 TU.
17062306a36Sopenharmony_ci * BEACON_INTERVAL: Beacon interval, default is 100 TU.
17162306a36Sopenharmony_ci * CFPMAX_DURATION: Cfp maximum duration, default is 100 TU.
17262306a36Sopenharmony_ci */
17362306a36Sopenharmony_ci#define CSR12				0x0030
17462306a36Sopenharmony_ci#define CSR12_BEACON_INTERVAL		FIELD32(0x0000ffff)
17562306a36Sopenharmony_ci#define CSR12_CFP_MAX_DURATION		FIELD32(0xffff0000)
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ci/*
17862306a36Sopenharmony_ci * CSR13: Synchronization configuration register 1.
17962306a36Sopenharmony_ci * All units in 1/16 TU.
18062306a36Sopenharmony_ci * ATIMW_DURATION: Atim window duration.
18162306a36Sopenharmony_ci * CFP_PERIOD: Cfp period, default is 0 TU.
18262306a36Sopenharmony_ci */
18362306a36Sopenharmony_ci#define CSR13				0x0034
18462306a36Sopenharmony_ci#define CSR13_ATIMW_DURATION		FIELD32(0x0000ffff)
18562306a36Sopenharmony_ci#define CSR13_CFP_PERIOD		FIELD32(0x00ff0000)
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_ci/*
18862306a36Sopenharmony_ci * CSR14: Synchronization control register.
18962306a36Sopenharmony_ci * TSF_COUNT: Enable tsf auto counting.
19062306a36Sopenharmony_ci * TSF_SYNC: Tsf sync, 0: disable, 1: infra, 2: ad-hoc/master mode.
19162306a36Sopenharmony_ci * TBCN: Enable tbcn with reload value.
19262306a36Sopenharmony_ci * TCFP: Enable tcfp & cfp / cp switching.
19362306a36Sopenharmony_ci * TATIMW: Enable tatimw & atim window switching.
19462306a36Sopenharmony_ci * BEACON_GEN: Enable beacon generator.
19562306a36Sopenharmony_ci * CFP_COUNT_PRELOAD: Cfp count preload value.
19662306a36Sopenharmony_ci * TBCM_PRELOAD: Tbcn preload value in units of 64us.
19762306a36Sopenharmony_ci */
19862306a36Sopenharmony_ci#define CSR14				0x0038
19962306a36Sopenharmony_ci#define CSR14_TSF_COUNT			FIELD32(0x00000001)
20062306a36Sopenharmony_ci#define CSR14_TSF_SYNC			FIELD32(0x00000006)
20162306a36Sopenharmony_ci#define CSR14_TBCN			FIELD32(0x00000008)
20262306a36Sopenharmony_ci#define CSR14_TCFP			FIELD32(0x00000010)
20362306a36Sopenharmony_ci#define CSR14_TATIMW			FIELD32(0x00000020)
20462306a36Sopenharmony_ci#define CSR14_BEACON_GEN		FIELD32(0x00000040)
20562306a36Sopenharmony_ci#define CSR14_CFP_COUNT_PRELOAD		FIELD32(0x0000ff00)
20662306a36Sopenharmony_ci#define CSR14_TBCM_PRELOAD		FIELD32(0xffff0000)
20762306a36Sopenharmony_ci
20862306a36Sopenharmony_ci/*
20962306a36Sopenharmony_ci * CSR15: Synchronization status register.
21062306a36Sopenharmony_ci * CFP: ASIC is in contention-free period.
21162306a36Sopenharmony_ci * ATIMW: ASIC is in ATIM window.
21262306a36Sopenharmony_ci * BEACON_SENT: Beacon is send.
21362306a36Sopenharmony_ci */
21462306a36Sopenharmony_ci#define CSR15				0x003c
21562306a36Sopenharmony_ci#define CSR15_CFP			FIELD32(0x00000001)
21662306a36Sopenharmony_ci#define CSR15_ATIMW			FIELD32(0x00000002)
21762306a36Sopenharmony_ci#define CSR15_BEACON_SENT		FIELD32(0x00000004)
21862306a36Sopenharmony_ci
21962306a36Sopenharmony_ci/*
22062306a36Sopenharmony_ci * CSR16: TSF timer register 0.
22162306a36Sopenharmony_ci */
22262306a36Sopenharmony_ci#define CSR16				0x0040
22362306a36Sopenharmony_ci#define CSR16_LOW_TSFTIMER		FIELD32(0xffffffff)
22462306a36Sopenharmony_ci
22562306a36Sopenharmony_ci/*
22662306a36Sopenharmony_ci * CSR17: TSF timer register 1.
22762306a36Sopenharmony_ci */
22862306a36Sopenharmony_ci#define CSR17				0x0044
22962306a36Sopenharmony_ci#define CSR17_HIGH_TSFTIMER		FIELD32(0xffffffff)
23062306a36Sopenharmony_ci
23162306a36Sopenharmony_ci/*
23262306a36Sopenharmony_ci * CSR18: IFS timer register 0.
23362306a36Sopenharmony_ci * SIFS: Sifs, default is 10 us.
23462306a36Sopenharmony_ci * PIFS: Pifs, default is 30 us.
23562306a36Sopenharmony_ci */
23662306a36Sopenharmony_ci#define CSR18				0x0048
23762306a36Sopenharmony_ci#define CSR18_SIFS			FIELD32(0x0000ffff)
23862306a36Sopenharmony_ci#define CSR18_PIFS			FIELD32(0xffff0000)
23962306a36Sopenharmony_ci
24062306a36Sopenharmony_ci/*
24162306a36Sopenharmony_ci * CSR19: IFS timer register 1.
24262306a36Sopenharmony_ci * DIFS: Difs, default is 50 us.
24362306a36Sopenharmony_ci * EIFS: Eifs, default is 364 us.
24462306a36Sopenharmony_ci */
24562306a36Sopenharmony_ci#define CSR19				0x004c
24662306a36Sopenharmony_ci#define CSR19_DIFS			FIELD32(0x0000ffff)
24762306a36Sopenharmony_ci#define CSR19_EIFS			FIELD32(0xffff0000)
24862306a36Sopenharmony_ci
24962306a36Sopenharmony_ci/*
25062306a36Sopenharmony_ci * CSR20: Wakeup timer register.
25162306a36Sopenharmony_ci * DELAY_AFTER_TBCN: Delay after tbcn expired in units of 1/16 TU.
25262306a36Sopenharmony_ci * TBCN_BEFORE_WAKEUP: Number of beacon before wakeup.
25362306a36Sopenharmony_ci * AUTOWAKE: Enable auto wakeup / sleep mechanism.
25462306a36Sopenharmony_ci */
25562306a36Sopenharmony_ci#define CSR20				0x0050
25662306a36Sopenharmony_ci#define CSR20_DELAY_AFTER_TBCN		FIELD32(0x0000ffff)
25762306a36Sopenharmony_ci#define CSR20_TBCN_BEFORE_WAKEUP	FIELD32(0x00ff0000)
25862306a36Sopenharmony_ci#define CSR20_AUTOWAKE			FIELD32(0x01000000)
25962306a36Sopenharmony_ci
26062306a36Sopenharmony_ci/*
26162306a36Sopenharmony_ci * CSR21: EEPROM control register.
26262306a36Sopenharmony_ci * RELOAD: Write 1 to reload eeprom content.
26362306a36Sopenharmony_ci * TYPE_93C46: 1: 93c46, 0:93c66.
26462306a36Sopenharmony_ci */
26562306a36Sopenharmony_ci#define CSR21				0x0054
26662306a36Sopenharmony_ci#define CSR21_RELOAD			FIELD32(0x00000001)
26762306a36Sopenharmony_ci#define CSR21_EEPROM_DATA_CLOCK		FIELD32(0x00000002)
26862306a36Sopenharmony_ci#define CSR21_EEPROM_CHIP_SELECT	FIELD32(0x00000004)
26962306a36Sopenharmony_ci#define CSR21_EEPROM_DATA_IN		FIELD32(0x00000008)
27062306a36Sopenharmony_ci#define CSR21_EEPROM_DATA_OUT		FIELD32(0x00000010)
27162306a36Sopenharmony_ci#define CSR21_TYPE_93C46		FIELD32(0x00000020)
27262306a36Sopenharmony_ci
27362306a36Sopenharmony_ci/*
27462306a36Sopenharmony_ci * CSR22: CFP control register.
27562306a36Sopenharmony_ci * CFP_DURATION_REMAIN: Cfp duration remain, in units of TU.
27662306a36Sopenharmony_ci * RELOAD_CFP_DURATION: Write 1 to reload cfp duration remain.
27762306a36Sopenharmony_ci */
27862306a36Sopenharmony_ci#define CSR22				0x0058
27962306a36Sopenharmony_ci#define CSR22_CFP_DURATION_REMAIN	FIELD32(0x0000ffff)
28062306a36Sopenharmony_ci#define CSR22_RELOAD_CFP_DURATION	FIELD32(0x00010000)
28162306a36Sopenharmony_ci
28262306a36Sopenharmony_ci/*
28362306a36Sopenharmony_ci * Transmit related CSRs.
28462306a36Sopenharmony_ci * Some values are set in TU, whereas 1 TU == 1024 us.
28562306a36Sopenharmony_ci */
28662306a36Sopenharmony_ci
28762306a36Sopenharmony_ci/*
28862306a36Sopenharmony_ci * TXCSR0: TX Control Register.
28962306a36Sopenharmony_ci * KICK_TX: Kick tx ring.
29062306a36Sopenharmony_ci * KICK_ATIM: Kick atim ring.
29162306a36Sopenharmony_ci * KICK_PRIO: Kick priority ring.
29262306a36Sopenharmony_ci * ABORT: Abort all transmit related ring operation.
29362306a36Sopenharmony_ci */
29462306a36Sopenharmony_ci#define TXCSR0				0x0060
29562306a36Sopenharmony_ci#define TXCSR0_KICK_TX			FIELD32(0x00000001)
29662306a36Sopenharmony_ci#define TXCSR0_KICK_ATIM		FIELD32(0x00000002)
29762306a36Sopenharmony_ci#define TXCSR0_KICK_PRIO		FIELD32(0x00000004)
29862306a36Sopenharmony_ci#define TXCSR0_ABORT			FIELD32(0x00000008)
29962306a36Sopenharmony_ci
30062306a36Sopenharmony_ci/*
30162306a36Sopenharmony_ci * TXCSR1: TX Configuration Register.
30262306a36Sopenharmony_ci * ACK_TIMEOUT: Ack timeout, default = sifs + 2*slottime + acktime @ 1mbps.
30362306a36Sopenharmony_ci * ACK_CONSUME_TIME: Ack consume time, default = sifs + acktime @ 1mbps.
30462306a36Sopenharmony_ci * TSF_OFFSET: Insert tsf offset.
30562306a36Sopenharmony_ci * AUTORESPONDER: Enable auto responder which include ack & cts.
30662306a36Sopenharmony_ci */
30762306a36Sopenharmony_ci#define TXCSR1				0x0064
30862306a36Sopenharmony_ci#define TXCSR1_ACK_TIMEOUT		FIELD32(0x000001ff)
30962306a36Sopenharmony_ci#define TXCSR1_ACK_CONSUME_TIME		FIELD32(0x0003fe00)
31062306a36Sopenharmony_ci#define TXCSR1_TSF_OFFSET		FIELD32(0x00fc0000)
31162306a36Sopenharmony_ci#define TXCSR1_AUTORESPONDER		FIELD32(0x01000000)
31262306a36Sopenharmony_ci
31362306a36Sopenharmony_ci/*
31462306a36Sopenharmony_ci * TXCSR2: Tx descriptor configuration register.
31562306a36Sopenharmony_ci * TXD_SIZE: Tx descriptor size, default is 48.
31662306a36Sopenharmony_ci * NUM_TXD: Number of tx entries in ring.
31762306a36Sopenharmony_ci * NUM_ATIM: Number of atim entries in ring.
31862306a36Sopenharmony_ci * NUM_PRIO: Number of priority entries in ring.
31962306a36Sopenharmony_ci */
32062306a36Sopenharmony_ci#define TXCSR2				0x0068
32162306a36Sopenharmony_ci#define TXCSR2_TXD_SIZE			FIELD32(0x000000ff)
32262306a36Sopenharmony_ci#define TXCSR2_NUM_TXD			FIELD32(0x0000ff00)
32362306a36Sopenharmony_ci#define TXCSR2_NUM_ATIM			FIELD32(0x00ff0000)
32462306a36Sopenharmony_ci#define TXCSR2_NUM_PRIO			FIELD32(0xff000000)
32562306a36Sopenharmony_ci
32662306a36Sopenharmony_ci/*
32762306a36Sopenharmony_ci * TXCSR3: TX Ring Base address register.
32862306a36Sopenharmony_ci */
32962306a36Sopenharmony_ci#define TXCSR3				0x006c
33062306a36Sopenharmony_ci#define TXCSR3_TX_RING_REGISTER		FIELD32(0xffffffff)
33162306a36Sopenharmony_ci
33262306a36Sopenharmony_ci/*
33362306a36Sopenharmony_ci * TXCSR4: TX Atim Ring Base address register.
33462306a36Sopenharmony_ci */
33562306a36Sopenharmony_ci#define TXCSR4				0x0070
33662306a36Sopenharmony_ci#define TXCSR4_ATIM_RING_REGISTER	FIELD32(0xffffffff)
33762306a36Sopenharmony_ci
33862306a36Sopenharmony_ci/*
33962306a36Sopenharmony_ci * TXCSR5: TX Prio Ring Base address register.
34062306a36Sopenharmony_ci */
34162306a36Sopenharmony_ci#define TXCSR5				0x0074
34262306a36Sopenharmony_ci#define TXCSR5_PRIO_RING_REGISTER	FIELD32(0xffffffff)
34362306a36Sopenharmony_ci
34462306a36Sopenharmony_ci/*
34562306a36Sopenharmony_ci * TXCSR6: Beacon Base address register.
34662306a36Sopenharmony_ci */
34762306a36Sopenharmony_ci#define TXCSR6				0x0078
34862306a36Sopenharmony_ci#define TXCSR6_BEACON_RING_REGISTER	FIELD32(0xffffffff)
34962306a36Sopenharmony_ci
35062306a36Sopenharmony_ci/*
35162306a36Sopenharmony_ci * TXCSR7: Auto responder control register.
35262306a36Sopenharmony_ci * AR_POWERMANAGEMENT: Auto responder power management bit.
35362306a36Sopenharmony_ci */
35462306a36Sopenharmony_ci#define TXCSR7				0x007c
35562306a36Sopenharmony_ci#define TXCSR7_AR_POWERMANAGEMENT	FIELD32(0x00000001)
35662306a36Sopenharmony_ci
35762306a36Sopenharmony_ci/*
35862306a36Sopenharmony_ci * Receive related CSRs.
35962306a36Sopenharmony_ci * Some values are set in TU, whereas 1 TU == 1024 us.
36062306a36Sopenharmony_ci */
36162306a36Sopenharmony_ci
36262306a36Sopenharmony_ci/*
36362306a36Sopenharmony_ci * RXCSR0: RX Control Register.
36462306a36Sopenharmony_ci * DISABLE_RX: Disable rx engine.
36562306a36Sopenharmony_ci * DROP_CRC: Drop crc error.
36662306a36Sopenharmony_ci * DROP_PHYSICAL: Drop physical error.
36762306a36Sopenharmony_ci * DROP_CONTROL: Drop control frame.
36862306a36Sopenharmony_ci * DROP_NOT_TO_ME: Drop not to me unicast frame.
36962306a36Sopenharmony_ci * DROP_TODS: Drop frame tods bit is true.
37062306a36Sopenharmony_ci * DROP_VERSION_ERROR: Drop version error frame.
37162306a36Sopenharmony_ci * PASS_CRC: Pass all packets with crc attached.
37262306a36Sopenharmony_ci */
37362306a36Sopenharmony_ci#define RXCSR0				0x0080
37462306a36Sopenharmony_ci#define RXCSR0_DISABLE_RX		FIELD32(0x00000001)
37562306a36Sopenharmony_ci#define RXCSR0_DROP_CRC			FIELD32(0x00000002)
37662306a36Sopenharmony_ci#define RXCSR0_DROP_PHYSICAL		FIELD32(0x00000004)
37762306a36Sopenharmony_ci#define RXCSR0_DROP_CONTROL		FIELD32(0x00000008)
37862306a36Sopenharmony_ci#define RXCSR0_DROP_NOT_TO_ME		FIELD32(0x00000010)
37962306a36Sopenharmony_ci#define RXCSR0_DROP_TODS		FIELD32(0x00000020)
38062306a36Sopenharmony_ci#define RXCSR0_DROP_VERSION_ERROR	FIELD32(0x00000040)
38162306a36Sopenharmony_ci#define RXCSR0_PASS_CRC			FIELD32(0x00000080)
38262306a36Sopenharmony_ci
38362306a36Sopenharmony_ci/*
38462306a36Sopenharmony_ci * RXCSR1: RX descriptor configuration register.
38562306a36Sopenharmony_ci * RXD_SIZE: Rx descriptor size, default is 32b.
38662306a36Sopenharmony_ci * NUM_RXD: Number of rx entries in ring.
38762306a36Sopenharmony_ci */
38862306a36Sopenharmony_ci#define RXCSR1				0x0084
38962306a36Sopenharmony_ci#define RXCSR1_RXD_SIZE			FIELD32(0x000000ff)
39062306a36Sopenharmony_ci#define RXCSR1_NUM_RXD			FIELD32(0x0000ff00)
39162306a36Sopenharmony_ci
39262306a36Sopenharmony_ci/*
39362306a36Sopenharmony_ci * RXCSR2: RX Ring base address register.
39462306a36Sopenharmony_ci */
39562306a36Sopenharmony_ci#define RXCSR2				0x0088
39662306a36Sopenharmony_ci#define RXCSR2_RX_RING_REGISTER		FIELD32(0xffffffff)
39762306a36Sopenharmony_ci
39862306a36Sopenharmony_ci/*
39962306a36Sopenharmony_ci * RXCSR3: BBP ID register for Rx operation.
40062306a36Sopenharmony_ci * BBP_ID#: BBP register # id.
40162306a36Sopenharmony_ci * BBP_ID#_VALID: BBP register # id is valid or not.
40262306a36Sopenharmony_ci */
40362306a36Sopenharmony_ci#define RXCSR3				0x0090
40462306a36Sopenharmony_ci#define RXCSR3_BBP_ID0			FIELD32(0x0000007f)
40562306a36Sopenharmony_ci#define RXCSR3_BBP_ID0_VALID		FIELD32(0x00000080)
40662306a36Sopenharmony_ci#define RXCSR3_BBP_ID1			FIELD32(0x00007f00)
40762306a36Sopenharmony_ci#define RXCSR3_BBP_ID1_VALID		FIELD32(0x00008000)
40862306a36Sopenharmony_ci#define RXCSR3_BBP_ID2			FIELD32(0x007f0000)
40962306a36Sopenharmony_ci#define RXCSR3_BBP_ID2_VALID		FIELD32(0x00800000)
41062306a36Sopenharmony_ci#define RXCSR3_BBP_ID3			FIELD32(0x7f000000)
41162306a36Sopenharmony_ci#define RXCSR3_BBP_ID3_VALID		FIELD32(0x80000000)
41262306a36Sopenharmony_ci
41362306a36Sopenharmony_ci/*
41462306a36Sopenharmony_ci * RXCSR4: BBP ID register for Rx operation.
41562306a36Sopenharmony_ci * BBP_ID#: BBP register # id.
41662306a36Sopenharmony_ci * BBP_ID#_VALID: BBP register # id is valid or not.
41762306a36Sopenharmony_ci */
41862306a36Sopenharmony_ci#define RXCSR4				0x0094
41962306a36Sopenharmony_ci#define RXCSR4_BBP_ID4			FIELD32(0x0000007f)
42062306a36Sopenharmony_ci#define RXCSR4_BBP_ID4_VALID		FIELD32(0x00000080)
42162306a36Sopenharmony_ci#define RXCSR4_BBP_ID5			FIELD32(0x00007f00)
42262306a36Sopenharmony_ci#define RXCSR4_BBP_ID5_VALID		FIELD32(0x00008000)
42362306a36Sopenharmony_ci
42462306a36Sopenharmony_ci/*
42562306a36Sopenharmony_ci * ARCSR0: Auto Responder PLCP config register 0.
42662306a36Sopenharmony_ci * ARCSR0_AR_BBP_DATA#: Auto responder BBP register # data.
42762306a36Sopenharmony_ci * ARCSR0_AR_BBP_ID#: Auto responder BBP register # Id.
42862306a36Sopenharmony_ci */
42962306a36Sopenharmony_ci#define ARCSR0				0x0098
43062306a36Sopenharmony_ci#define ARCSR0_AR_BBP_DATA0		FIELD32(0x000000ff)
43162306a36Sopenharmony_ci#define ARCSR0_AR_BBP_ID0		FIELD32(0x0000ff00)
43262306a36Sopenharmony_ci#define ARCSR0_AR_BBP_DATA1		FIELD32(0x00ff0000)
43362306a36Sopenharmony_ci#define ARCSR0_AR_BBP_ID1		FIELD32(0xff000000)
43462306a36Sopenharmony_ci
43562306a36Sopenharmony_ci/*
43662306a36Sopenharmony_ci * ARCSR1: Auto Responder PLCP config register 1.
43762306a36Sopenharmony_ci * ARCSR0_AR_BBP_DATA#: Auto responder BBP register # data.
43862306a36Sopenharmony_ci * ARCSR0_AR_BBP_ID#: Auto responder BBP register # Id.
43962306a36Sopenharmony_ci */
44062306a36Sopenharmony_ci#define ARCSR1				0x009c
44162306a36Sopenharmony_ci#define ARCSR1_AR_BBP_DATA2		FIELD32(0x000000ff)
44262306a36Sopenharmony_ci#define ARCSR1_AR_BBP_ID2		FIELD32(0x0000ff00)
44362306a36Sopenharmony_ci#define ARCSR1_AR_BBP_DATA3		FIELD32(0x00ff0000)
44462306a36Sopenharmony_ci#define ARCSR1_AR_BBP_ID3		FIELD32(0xff000000)
44562306a36Sopenharmony_ci
44662306a36Sopenharmony_ci/*
44762306a36Sopenharmony_ci * Miscellaneous Registers.
44862306a36Sopenharmony_ci * Some values are set in TU, whereas 1 TU == 1024 us.
44962306a36Sopenharmony_ci */
45062306a36Sopenharmony_ci
45162306a36Sopenharmony_ci/*
45262306a36Sopenharmony_ci * PCICSR: PCI control register.
45362306a36Sopenharmony_ci * BIG_ENDIAN: 1: big endian, 0: little endian.
45462306a36Sopenharmony_ci * RX_TRESHOLD: Rx threshold in dw to start pci access
45562306a36Sopenharmony_ci * 0: 16dw (default), 1: 8dw, 2: 4dw, 3: 32dw.
45662306a36Sopenharmony_ci * TX_TRESHOLD: Tx threshold in dw to start pci access
45762306a36Sopenharmony_ci * 0: 0dw (default), 1: 1dw, 2: 4dw, 3: forward.
45862306a36Sopenharmony_ci * BURST_LENTH: Pci burst length 0: 4dw (default, 1: 8dw, 2: 16dw, 3:32dw.
45962306a36Sopenharmony_ci * ENABLE_CLK: Enable clk_run, pci clock can't going down to non-operational.
46062306a36Sopenharmony_ci */
46162306a36Sopenharmony_ci#define PCICSR				0x008c
46262306a36Sopenharmony_ci#define PCICSR_BIG_ENDIAN		FIELD32(0x00000001)
46362306a36Sopenharmony_ci#define PCICSR_RX_TRESHOLD		FIELD32(0x00000006)
46462306a36Sopenharmony_ci#define PCICSR_TX_TRESHOLD		FIELD32(0x00000018)
46562306a36Sopenharmony_ci#define PCICSR_BURST_LENTH		FIELD32(0x00000060)
46662306a36Sopenharmony_ci#define PCICSR_ENABLE_CLK		FIELD32(0x00000080)
46762306a36Sopenharmony_ci
46862306a36Sopenharmony_ci/*
46962306a36Sopenharmony_ci * CNT0: FCS error count.
47062306a36Sopenharmony_ci * FCS_ERROR: FCS error count, cleared when read.
47162306a36Sopenharmony_ci */
47262306a36Sopenharmony_ci#define CNT0				0x00a0
47362306a36Sopenharmony_ci#define CNT0_FCS_ERROR			FIELD32(0x0000ffff)
47462306a36Sopenharmony_ci
47562306a36Sopenharmony_ci/*
47662306a36Sopenharmony_ci * Statistic Register.
47762306a36Sopenharmony_ci * CNT1: PLCP error count.
47862306a36Sopenharmony_ci * CNT2: Long error count.
47962306a36Sopenharmony_ci * CNT3: CCA false alarm count.
48062306a36Sopenharmony_ci * CNT4: Rx FIFO overflow count.
48162306a36Sopenharmony_ci * CNT5: Tx FIFO underrun count.
48262306a36Sopenharmony_ci */
48362306a36Sopenharmony_ci#define TIMECSR2			0x00a8
48462306a36Sopenharmony_ci#define CNT1				0x00ac
48562306a36Sopenharmony_ci#define CNT2				0x00b0
48662306a36Sopenharmony_ci#define TIMECSR3			0x00b4
48762306a36Sopenharmony_ci#define CNT3				0x00b8
48862306a36Sopenharmony_ci#define CNT4				0x00bc
48962306a36Sopenharmony_ci#define CNT5				0x00c0
49062306a36Sopenharmony_ci
49162306a36Sopenharmony_ci/*
49262306a36Sopenharmony_ci * Baseband Control Register.
49362306a36Sopenharmony_ci */
49462306a36Sopenharmony_ci
49562306a36Sopenharmony_ci/*
49662306a36Sopenharmony_ci * PWRCSR0: Power mode configuration register.
49762306a36Sopenharmony_ci */
49862306a36Sopenharmony_ci#define PWRCSR0				0x00c4
49962306a36Sopenharmony_ci
50062306a36Sopenharmony_ci/*
50162306a36Sopenharmony_ci * Power state transition time registers.
50262306a36Sopenharmony_ci */
50362306a36Sopenharmony_ci#define PSCSR0				0x00c8
50462306a36Sopenharmony_ci#define PSCSR1				0x00cc
50562306a36Sopenharmony_ci#define PSCSR2				0x00d0
50662306a36Sopenharmony_ci#define PSCSR3				0x00d4
50762306a36Sopenharmony_ci
50862306a36Sopenharmony_ci/*
50962306a36Sopenharmony_ci * PWRCSR1: Manual power control / status register.
51062306a36Sopenharmony_ci * Allowed state: 0 deep_sleep, 1: sleep, 2: standby, 3: awake.
51162306a36Sopenharmony_ci * SET_STATE: Set state. Write 1 to trigger, self cleared.
51262306a36Sopenharmony_ci * BBP_DESIRE_STATE: BBP desired state.
51362306a36Sopenharmony_ci * RF_DESIRE_STATE: RF desired state.
51462306a36Sopenharmony_ci * BBP_CURR_STATE: BBP current state.
51562306a36Sopenharmony_ci * RF_CURR_STATE: RF current state.
51662306a36Sopenharmony_ci * PUT_TO_SLEEP: Put to sleep. Write 1 to trigger, self cleared.
51762306a36Sopenharmony_ci */
51862306a36Sopenharmony_ci#define PWRCSR1				0x00d8
51962306a36Sopenharmony_ci#define PWRCSR1_SET_STATE		FIELD32(0x00000001)
52062306a36Sopenharmony_ci#define PWRCSR1_BBP_DESIRE_STATE	FIELD32(0x00000006)
52162306a36Sopenharmony_ci#define PWRCSR1_RF_DESIRE_STATE		FIELD32(0x00000018)
52262306a36Sopenharmony_ci#define PWRCSR1_BBP_CURR_STATE		FIELD32(0x00000060)
52362306a36Sopenharmony_ci#define PWRCSR1_RF_CURR_STATE		FIELD32(0x00000180)
52462306a36Sopenharmony_ci#define PWRCSR1_PUT_TO_SLEEP		FIELD32(0x00000200)
52562306a36Sopenharmony_ci
52662306a36Sopenharmony_ci/*
52762306a36Sopenharmony_ci * TIMECSR: Timer control register.
52862306a36Sopenharmony_ci * US_COUNT: 1 us timer count in units of clock cycles.
52962306a36Sopenharmony_ci * US_64_COUNT: 64 us timer count in units of 1 us timer.
53062306a36Sopenharmony_ci * BEACON_EXPECT: Beacon expect window.
53162306a36Sopenharmony_ci */
53262306a36Sopenharmony_ci#define TIMECSR				0x00dc
53362306a36Sopenharmony_ci#define TIMECSR_US_COUNT		FIELD32(0x000000ff)
53462306a36Sopenharmony_ci#define TIMECSR_US_64_COUNT		FIELD32(0x0000ff00)
53562306a36Sopenharmony_ci#define TIMECSR_BEACON_EXPECT		FIELD32(0x00070000)
53662306a36Sopenharmony_ci
53762306a36Sopenharmony_ci/*
53862306a36Sopenharmony_ci * MACCSR0: MAC configuration register 0.
53962306a36Sopenharmony_ci */
54062306a36Sopenharmony_ci#define MACCSR0				0x00e0
54162306a36Sopenharmony_ci
54262306a36Sopenharmony_ci/*
54362306a36Sopenharmony_ci * MACCSR1: MAC configuration register 1.
54462306a36Sopenharmony_ci * KICK_RX: Kick one-shot rx in one-shot rx mode.
54562306a36Sopenharmony_ci * ONESHOT_RXMODE: Enable one-shot rx mode for debugging.
54662306a36Sopenharmony_ci * BBPRX_RESET_MODE: Ralink bbp rx reset mode.
54762306a36Sopenharmony_ci * AUTO_TXBBP: Auto tx logic access bbp control register.
54862306a36Sopenharmony_ci * AUTO_RXBBP: Auto rx logic access bbp control register.
54962306a36Sopenharmony_ci * LOOPBACK: Loopback mode. 0: normal, 1: internal, 2: external, 3:rsvd.
55062306a36Sopenharmony_ci * INTERSIL_IF: Intersil if calibration pin.
55162306a36Sopenharmony_ci */
55262306a36Sopenharmony_ci#define MACCSR1				0x00e4
55362306a36Sopenharmony_ci#define MACCSR1_KICK_RX			FIELD32(0x00000001)
55462306a36Sopenharmony_ci#define MACCSR1_ONESHOT_RXMODE		FIELD32(0x00000002)
55562306a36Sopenharmony_ci#define MACCSR1_BBPRX_RESET_MODE	FIELD32(0x00000004)
55662306a36Sopenharmony_ci#define MACCSR1_AUTO_TXBBP		FIELD32(0x00000008)
55762306a36Sopenharmony_ci#define MACCSR1_AUTO_RXBBP		FIELD32(0x00000010)
55862306a36Sopenharmony_ci#define MACCSR1_LOOPBACK		FIELD32(0x00000060)
55962306a36Sopenharmony_ci#define MACCSR1_INTERSIL_IF		FIELD32(0x00000080)
56062306a36Sopenharmony_ci
56162306a36Sopenharmony_ci/*
56262306a36Sopenharmony_ci * RALINKCSR: Ralink Rx auto-reset BBCR.
56362306a36Sopenharmony_ci * AR_BBP_DATA#: Auto reset BBP register # data.
56462306a36Sopenharmony_ci * AR_BBP_ID#: Auto reset BBP register # id.
56562306a36Sopenharmony_ci */
56662306a36Sopenharmony_ci#define RALINKCSR			0x00e8
56762306a36Sopenharmony_ci#define RALINKCSR_AR_BBP_DATA0		FIELD32(0x000000ff)
56862306a36Sopenharmony_ci#define RALINKCSR_AR_BBP_ID0		FIELD32(0x0000ff00)
56962306a36Sopenharmony_ci#define RALINKCSR_AR_BBP_DATA1		FIELD32(0x00ff0000)
57062306a36Sopenharmony_ci#define RALINKCSR_AR_BBP_ID1		FIELD32(0xff000000)
57162306a36Sopenharmony_ci
57262306a36Sopenharmony_ci/*
57362306a36Sopenharmony_ci * BCNCSR: Beacon interval control register.
57462306a36Sopenharmony_ci * CHANGE: Write one to change beacon interval.
57562306a36Sopenharmony_ci * DELTATIME: The delta time value.
57662306a36Sopenharmony_ci * NUM_BEACON: Number of beacon according to mode.
57762306a36Sopenharmony_ci * MODE: Please refer to asic specs.
57862306a36Sopenharmony_ci * PLUS: Plus or minus delta time value.
57962306a36Sopenharmony_ci */
58062306a36Sopenharmony_ci#define BCNCSR				0x00ec
58162306a36Sopenharmony_ci#define BCNCSR_CHANGE			FIELD32(0x00000001)
58262306a36Sopenharmony_ci#define BCNCSR_DELTATIME		FIELD32(0x0000001e)
58362306a36Sopenharmony_ci#define BCNCSR_NUM_BEACON		FIELD32(0x00001fe0)
58462306a36Sopenharmony_ci#define BCNCSR_MODE			FIELD32(0x00006000)
58562306a36Sopenharmony_ci#define BCNCSR_PLUS			FIELD32(0x00008000)
58662306a36Sopenharmony_ci
58762306a36Sopenharmony_ci/*
58862306a36Sopenharmony_ci * BBP / RF / IF Control Register.
58962306a36Sopenharmony_ci */
59062306a36Sopenharmony_ci
59162306a36Sopenharmony_ci/*
59262306a36Sopenharmony_ci * BBPCSR: BBP serial control register.
59362306a36Sopenharmony_ci * VALUE: Register value to program into BBP.
59462306a36Sopenharmony_ci * REGNUM: Selected BBP register.
59562306a36Sopenharmony_ci * BUSY: 1: asic is busy execute BBP programming.
59662306a36Sopenharmony_ci * WRITE_CONTROL: 1: write BBP, 0: read BBP.
59762306a36Sopenharmony_ci */
59862306a36Sopenharmony_ci#define BBPCSR				0x00f0
59962306a36Sopenharmony_ci#define BBPCSR_VALUE			FIELD32(0x000000ff)
60062306a36Sopenharmony_ci#define BBPCSR_REGNUM			FIELD32(0x00007f00)
60162306a36Sopenharmony_ci#define BBPCSR_BUSY			FIELD32(0x00008000)
60262306a36Sopenharmony_ci#define BBPCSR_WRITE_CONTROL		FIELD32(0x00010000)
60362306a36Sopenharmony_ci
60462306a36Sopenharmony_ci/*
60562306a36Sopenharmony_ci * RFCSR: RF serial control register.
60662306a36Sopenharmony_ci * VALUE: Register value + id to program into rf/if.
60762306a36Sopenharmony_ci * NUMBER_OF_BITS: Number of bits used in value (i:20, rfmd:22).
60862306a36Sopenharmony_ci * IF_SELECT: Chip to program: 0: rf, 1: if.
60962306a36Sopenharmony_ci * PLL_LD: Rf pll_ld status.
61062306a36Sopenharmony_ci * BUSY: 1: asic is busy execute rf programming.
61162306a36Sopenharmony_ci */
61262306a36Sopenharmony_ci#define RFCSR				0x00f4
61362306a36Sopenharmony_ci#define RFCSR_VALUE			FIELD32(0x00ffffff)
61462306a36Sopenharmony_ci#define RFCSR_NUMBER_OF_BITS		FIELD32(0x1f000000)
61562306a36Sopenharmony_ci#define RFCSR_IF_SELECT			FIELD32(0x20000000)
61662306a36Sopenharmony_ci#define RFCSR_PLL_LD			FIELD32(0x40000000)
61762306a36Sopenharmony_ci#define RFCSR_BUSY			FIELD32(0x80000000)
61862306a36Sopenharmony_ci
61962306a36Sopenharmony_ci/*
62062306a36Sopenharmony_ci * LEDCSR: LED control register.
62162306a36Sopenharmony_ci * ON_PERIOD: On period, default 70ms.
62262306a36Sopenharmony_ci * OFF_PERIOD: Off period, default 30ms.
62362306a36Sopenharmony_ci * LINK: 0: linkoff, 1: linkup.
62462306a36Sopenharmony_ci * ACTIVITY: 0: idle, 1: active.
62562306a36Sopenharmony_ci */
62662306a36Sopenharmony_ci#define LEDCSR				0x00f8
62762306a36Sopenharmony_ci#define LEDCSR_ON_PERIOD		FIELD32(0x000000ff)
62862306a36Sopenharmony_ci#define LEDCSR_OFF_PERIOD		FIELD32(0x0000ff00)
62962306a36Sopenharmony_ci#define LEDCSR_LINK			FIELD32(0x00010000)
63062306a36Sopenharmony_ci#define LEDCSR_ACTIVITY			FIELD32(0x00020000)
63162306a36Sopenharmony_ci
63262306a36Sopenharmony_ci/*
63362306a36Sopenharmony_ci * ASIC pointer information.
63462306a36Sopenharmony_ci * RXPTR: Current RX ring address.
63562306a36Sopenharmony_ci * TXPTR: Current Tx ring address.
63662306a36Sopenharmony_ci * PRIPTR: Current Priority ring address.
63762306a36Sopenharmony_ci * ATIMPTR: Current ATIM ring address.
63862306a36Sopenharmony_ci */
63962306a36Sopenharmony_ci#define RXPTR				0x0100
64062306a36Sopenharmony_ci#define TXPTR				0x0104
64162306a36Sopenharmony_ci#define PRIPTR				0x0108
64262306a36Sopenharmony_ci#define ATIMPTR				0x010c
64362306a36Sopenharmony_ci
64462306a36Sopenharmony_ci/*
64562306a36Sopenharmony_ci * GPIO and others.
64662306a36Sopenharmony_ci */
64762306a36Sopenharmony_ci
64862306a36Sopenharmony_ci/*
64962306a36Sopenharmony_ci * GPIOCSR: GPIO control register.
65062306a36Sopenharmony_ci *	GPIOCSR_VALx: Actual GPIO pin x value
65162306a36Sopenharmony_ci *	GPIOCSR_DIRx: GPIO direction: 0 = output; 1 = input
65262306a36Sopenharmony_ci */
65362306a36Sopenharmony_ci#define GPIOCSR				0x0120
65462306a36Sopenharmony_ci#define GPIOCSR_VAL0			FIELD32(0x00000001)
65562306a36Sopenharmony_ci#define GPIOCSR_VAL1			FIELD32(0x00000002)
65662306a36Sopenharmony_ci#define GPIOCSR_VAL2			FIELD32(0x00000004)
65762306a36Sopenharmony_ci#define GPIOCSR_VAL3			FIELD32(0x00000008)
65862306a36Sopenharmony_ci#define GPIOCSR_VAL4			FIELD32(0x00000010)
65962306a36Sopenharmony_ci#define GPIOCSR_VAL5			FIELD32(0x00000020)
66062306a36Sopenharmony_ci#define GPIOCSR_VAL6			FIELD32(0x00000040)
66162306a36Sopenharmony_ci#define GPIOCSR_VAL7			FIELD32(0x00000080)
66262306a36Sopenharmony_ci#define GPIOCSR_DIR0			FIELD32(0x00000100)
66362306a36Sopenharmony_ci#define GPIOCSR_DIR1			FIELD32(0x00000200)
66462306a36Sopenharmony_ci#define GPIOCSR_DIR2			FIELD32(0x00000400)
66562306a36Sopenharmony_ci#define GPIOCSR_DIR3			FIELD32(0x00000800)
66662306a36Sopenharmony_ci#define GPIOCSR_DIR4			FIELD32(0x00001000)
66762306a36Sopenharmony_ci#define GPIOCSR_DIR5			FIELD32(0x00002000)
66862306a36Sopenharmony_ci#define GPIOCSR_DIR6			FIELD32(0x00004000)
66962306a36Sopenharmony_ci#define GPIOCSR_DIR7			FIELD32(0x00008000)
67062306a36Sopenharmony_ci
67162306a36Sopenharmony_ci/*
67262306a36Sopenharmony_ci * BBPPCSR: BBP Pin control register.
67362306a36Sopenharmony_ci */
67462306a36Sopenharmony_ci#define BBPPCSR				0x0124
67562306a36Sopenharmony_ci
67662306a36Sopenharmony_ci/*
67762306a36Sopenharmony_ci * BCNCSR1: Tx BEACON offset time control register.
67862306a36Sopenharmony_ci * PRELOAD: Beacon timer offset in units of usec.
67962306a36Sopenharmony_ci */
68062306a36Sopenharmony_ci#define BCNCSR1				0x0130
68162306a36Sopenharmony_ci#define BCNCSR1_PRELOAD			FIELD32(0x0000ffff)
68262306a36Sopenharmony_ci
68362306a36Sopenharmony_ci/*
68462306a36Sopenharmony_ci * MACCSR2: TX_PE to RX_PE turn-around time control register
68562306a36Sopenharmony_ci * DELAY: RX_PE low width, in units of pci clock cycle.
68662306a36Sopenharmony_ci */
68762306a36Sopenharmony_ci#define MACCSR2				0x0134
68862306a36Sopenharmony_ci#define MACCSR2_DELAY			FIELD32(0x000000ff)
68962306a36Sopenharmony_ci
69062306a36Sopenharmony_ci/*
69162306a36Sopenharmony_ci * ARCSR2: 1 Mbps ACK/CTS PLCP.
69262306a36Sopenharmony_ci */
69362306a36Sopenharmony_ci#define ARCSR2				0x013c
69462306a36Sopenharmony_ci#define ARCSR2_SIGNAL			FIELD32(0x000000ff)
69562306a36Sopenharmony_ci#define ARCSR2_SERVICE			FIELD32(0x0000ff00)
69662306a36Sopenharmony_ci#define ARCSR2_LENGTH_LOW		FIELD32(0x00ff0000)
69762306a36Sopenharmony_ci#define ARCSR2_LENGTH			FIELD32(0xffff0000)
69862306a36Sopenharmony_ci
69962306a36Sopenharmony_ci/*
70062306a36Sopenharmony_ci * ARCSR3: 2 Mbps ACK/CTS PLCP.
70162306a36Sopenharmony_ci */
70262306a36Sopenharmony_ci#define ARCSR3				0x0140
70362306a36Sopenharmony_ci#define ARCSR3_SIGNAL			FIELD32(0x000000ff)
70462306a36Sopenharmony_ci#define ARCSR3_SERVICE			FIELD32(0x0000ff00)
70562306a36Sopenharmony_ci#define ARCSR3_LENGTH			FIELD32(0xffff0000)
70662306a36Sopenharmony_ci
70762306a36Sopenharmony_ci/*
70862306a36Sopenharmony_ci * ARCSR4: 5.5 Mbps ACK/CTS PLCP.
70962306a36Sopenharmony_ci */
71062306a36Sopenharmony_ci#define ARCSR4				0x0144
71162306a36Sopenharmony_ci#define ARCSR4_SIGNAL			FIELD32(0x000000ff)
71262306a36Sopenharmony_ci#define ARCSR4_SERVICE			FIELD32(0x0000ff00)
71362306a36Sopenharmony_ci#define ARCSR4_LENGTH			FIELD32(0xffff0000)
71462306a36Sopenharmony_ci
71562306a36Sopenharmony_ci/*
71662306a36Sopenharmony_ci * ARCSR5: 11 Mbps ACK/CTS PLCP.
71762306a36Sopenharmony_ci */
71862306a36Sopenharmony_ci#define ARCSR5				0x0148
71962306a36Sopenharmony_ci#define ARCSR5_SIGNAL			FIELD32(0x000000ff)
72062306a36Sopenharmony_ci#define ARCSR5_SERVICE			FIELD32(0x0000ff00)
72162306a36Sopenharmony_ci#define ARCSR5_LENGTH			FIELD32(0xffff0000)
72262306a36Sopenharmony_ci
72362306a36Sopenharmony_ci/*
72462306a36Sopenharmony_ci * BBP registers.
72562306a36Sopenharmony_ci * The wordsize of the BBP is 8 bits.
72662306a36Sopenharmony_ci */
72762306a36Sopenharmony_ci
72862306a36Sopenharmony_ci/*
72962306a36Sopenharmony_ci * R1: TX antenna control
73062306a36Sopenharmony_ci */
73162306a36Sopenharmony_ci#define BBP_R1_TX_ANTENNA		FIELD8(0x03)
73262306a36Sopenharmony_ci
73362306a36Sopenharmony_ci/*
73462306a36Sopenharmony_ci * R4: RX antenna control
73562306a36Sopenharmony_ci */
73662306a36Sopenharmony_ci#define BBP_R4_RX_ANTENNA		FIELD8(0x06)
73762306a36Sopenharmony_ci
73862306a36Sopenharmony_ci/*
73962306a36Sopenharmony_ci * RF registers
74062306a36Sopenharmony_ci */
74162306a36Sopenharmony_ci
74262306a36Sopenharmony_ci/*
74362306a36Sopenharmony_ci * RF 1
74462306a36Sopenharmony_ci */
74562306a36Sopenharmony_ci#define RF1_TUNER			FIELD32(0x00020000)
74662306a36Sopenharmony_ci
74762306a36Sopenharmony_ci/*
74862306a36Sopenharmony_ci * RF 3
74962306a36Sopenharmony_ci */
75062306a36Sopenharmony_ci#define RF3_TUNER			FIELD32(0x00000100)
75162306a36Sopenharmony_ci#define RF3_TXPOWER			FIELD32(0x00003e00)
75262306a36Sopenharmony_ci
75362306a36Sopenharmony_ci/*
75462306a36Sopenharmony_ci * EEPROM content.
75562306a36Sopenharmony_ci * The wordsize of the EEPROM is 16 bits.
75662306a36Sopenharmony_ci */
75762306a36Sopenharmony_ci
75862306a36Sopenharmony_ci/*
75962306a36Sopenharmony_ci * HW MAC address.
76062306a36Sopenharmony_ci */
76162306a36Sopenharmony_ci#define EEPROM_MAC_ADDR_0		0x0002
76262306a36Sopenharmony_ci#define EEPROM_MAC_ADDR_BYTE0		FIELD16(0x00ff)
76362306a36Sopenharmony_ci#define EEPROM_MAC_ADDR_BYTE1		FIELD16(0xff00)
76462306a36Sopenharmony_ci#define EEPROM_MAC_ADDR1		0x0003
76562306a36Sopenharmony_ci#define EEPROM_MAC_ADDR_BYTE2		FIELD16(0x00ff)
76662306a36Sopenharmony_ci#define EEPROM_MAC_ADDR_BYTE3		FIELD16(0xff00)
76762306a36Sopenharmony_ci#define EEPROM_MAC_ADDR_2		0x0004
76862306a36Sopenharmony_ci#define EEPROM_MAC_ADDR_BYTE4		FIELD16(0x00ff)
76962306a36Sopenharmony_ci#define EEPROM_MAC_ADDR_BYTE5		FIELD16(0xff00)
77062306a36Sopenharmony_ci
77162306a36Sopenharmony_ci/*
77262306a36Sopenharmony_ci * EEPROM antenna.
77362306a36Sopenharmony_ci * ANTENNA_NUM: Number of antenna's.
77462306a36Sopenharmony_ci * TX_DEFAULT: Default antenna 0: diversity, 1: A, 2: B.
77562306a36Sopenharmony_ci * RX_DEFAULT: Default antenna 0: diversity, 1: A, 2: B.
77662306a36Sopenharmony_ci * RF_TYPE: Rf_type of this adapter.
77762306a36Sopenharmony_ci * LED_MODE: 0: default, 1: TX/RX activity,2: Single (ignore link), 3: rsvd.
77862306a36Sopenharmony_ci * RX_AGCVGC: 0: disable, 1:enable BBP R13 tuning.
77962306a36Sopenharmony_ci * HARDWARE_RADIO: 1: Hardware controlled radio. Read GPIO0.
78062306a36Sopenharmony_ci */
78162306a36Sopenharmony_ci#define EEPROM_ANTENNA			0x0b
78262306a36Sopenharmony_ci#define EEPROM_ANTENNA_NUM		FIELD16(0x0003)
78362306a36Sopenharmony_ci#define EEPROM_ANTENNA_TX_DEFAULT	FIELD16(0x000c)
78462306a36Sopenharmony_ci#define EEPROM_ANTENNA_RX_DEFAULT	FIELD16(0x0030)
78562306a36Sopenharmony_ci#define EEPROM_ANTENNA_RF_TYPE		FIELD16(0x0040)
78662306a36Sopenharmony_ci#define EEPROM_ANTENNA_LED_MODE		FIELD16(0x0180)
78762306a36Sopenharmony_ci#define EEPROM_ANTENNA_RX_AGCVGC_TUNING	FIELD16(0x0200)
78862306a36Sopenharmony_ci#define EEPROM_ANTENNA_HARDWARE_RADIO	FIELD16(0x0400)
78962306a36Sopenharmony_ci
79062306a36Sopenharmony_ci/*
79162306a36Sopenharmony_ci * EEPROM BBP.
79262306a36Sopenharmony_ci */
79362306a36Sopenharmony_ci#define EEPROM_BBP_START		0x0c
79462306a36Sopenharmony_ci#define EEPROM_BBP_SIZE			7
79562306a36Sopenharmony_ci#define EEPROM_BBP_VALUE		FIELD16(0x00ff)
79662306a36Sopenharmony_ci#define EEPROM_BBP_REG_ID		FIELD16(0xff00)
79762306a36Sopenharmony_ci
79862306a36Sopenharmony_ci/*
79962306a36Sopenharmony_ci * EEPROM TXPOWER
80062306a36Sopenharmony_ci */
80162306a36Sopenharmony_ci#define EEPROM_TXPOWER_START		0x13
80262306a36Sopenharmony_ci#define EEPROM_TXPOWER_SIZE		7
80362306a36Sopenharmony_ci#define EEPROM_TXPOWER_1		FIELD16(0x00ff)
80462306a36Sopenharmony_ci#define EEPROM_TXPOWER_2		FIELD16(0xff00)
80562306a36Sopenharmony_ci
80662306a36Sopenharmony_ci/*
80762306a36Sopenharmony_ci * DMA descriptor defines.
80862306a36Sopenharmony_ci */
80962306a36Sopenharmony_ci#define TXD_DESC_SIZE			(8 * sizeof(__le32))
81062306a36Sopenharmony_ci#define RXD_DESC_SIZE			(8 * sizeof(__le32))
81162306a36Sopenharmony_ci
81262306a36Sopenharmony_ci/*
81362306a36Sopenharmony_ci * TX descriptor format for TX, PRIO, ATIM and Beacon Ring.
81462306a36Sopenharmony_ci */
81562306a36Sopenharmony_ci
81662306a36Sopenharmony_ci/*
81762306a36Sopenharmony_ci * Word0
81862306a36Sopenharmony_ci */
81962306a36Sopenharmony_ci#define TXD_W0_OWNER_NIC		FIELD32(0x00000001)
82062306a36Sopenharmony_ci#define TXD_W0_VALID			FIELD32(0x00000002)
82162306a36Sopenharmony_ci#define TXD_W0_RESULT			FIELD32(0x0000001c)
82262306a36Sopenharmony_ci#define TXD_W0_RETRY_COUNT		FIELD32(0x000000e0)
82362306a36Sopenharmony_ci#define TXD_W0_MORE_FRAG		FIELD32(0x00000100)
82462306a36Sopenharmony_ci#define TXD_W0_ACK			FIELD32(0x00000200)
82562306a36Sopenharmony_ci#define TXD_W0_TIMESTAMP		FIELD32(0x00000400)
82662306a36Sopenharmony_ci#define TXD_W0_RTS			FIELD32(0x00000800)
82762306a36Sopenharmony_ci#define TXD_W0_IFS			FIELD32(0x00006000)
82862306a36Sopenharmony_ci#define TXD_W0_RETRY_MODE		FIELD32(0x00008000)
82962306a36Sopenharmony_ci#define TXD_W0_AGC			FIELD32(0x00ff0000)
83062306a36Sopenharmony_ci#define TXD_W0_R2			FIELD32(0xff000000)
83162306a36Sopenharmony_ci
83262306a36Sopenharmony_ci/*
83362306a36Sopenharmony_ci * Word1
83462306a36Sopenharmony_ci */
83562306a36Sopenharmony_ci#define TXD_W1_BUFFER_ADDRESS		FIELD32(0xffffffff)
83662306a36Sopenharmony_ci
83762306a36Sopenharmony_ci/*
83862306a36Sopenharmony_ci * Word2
83962306a36Sopenharmony_ci */
84062306a36Sopenharmony_ci#define TXD_W2_BUFFER_LENGTH		FIELD32(0x0000ffff)
84162306a36Sopenharmony_ci#define TXD_W2_DATABYTE_COUNT		FIELD32(0xffff0000)
84262306a36Sopenharmony_ci
84362306a36Sopenharmony_ci/*
84462306a36Sopenharmony_ci * Word3 & 4: PLCP information
84562306a36Sopenharmony_ci * The PLCP values should be treated as if they were BBP values.
84662306a36Sopenharmony_ci */
84762306a36Sopenharmony_ci#define TXD_W3_PLCP_SIGNAL		FIELD32(0x000000ff)
84862306a36Sopenharmony_ci#define TXD_W3_PLCP_SIGNAL_REGNUM	FIELD32(0x00007f00)
84962306a36Sopenharmony_ci#define TXD_W3_PLCP_SIGNAL_BUSY		FIELD32(0x00008000)
85062306a36Sopenharmony_ci#define TXD_W3_PLCP_SERVICE		FIELD32(0x00ff0000)
85162306a36Sopenharmony_ci#define TXD_W3_PLCP_SERVICE_REGNUM	FIELD32(0x7f000000)
85262306a36Sopenharmony_ci#define TXD_W3_PLCP_SERVICE_BUSY	FIELD32(0x80000000)
85362306a36Sopenharmony_ci
85462306a36Sopenharmony_ci#define TXD_W4_PLCP_LENGTH_LOW		FIELD32(0x000000ff)
85562306a36Sopenharmony_ci#define TXD_W3_PLCP_LENGTH_LOW_REGNUM	FIELD32(0x00007f00)
85662306a36Sopenharmony_ci#define TXD_W3_PLCP_LENGTH_LOW_BUSY	FIELD32(0x00008000)
85762306a36Sopenharmony_ci#define TXD_W4_PLCP_LENGTH_HIGH		FIELD32(0x00ff0000)
85862306a36Sopenharmony_ci#define TXD_W3_PLCP_LENGTH_HIGH_REGNUM	FIELD32(0x7f000000)
85962306a36Sopenharmony_ci#define TXD_W3_PLCP_LENGTH_HIGH_BUSY	FIELD32(0x80000000)
86062306a36Sopenharmony_ci
86162306a36Sopenharmony_ci/*
86262306a36Sopenharmony_ci * Word5
86362306a36Sopenharmony_ci */
86462306a36Sopenharmony_ci#define TXD_W5_BBCR4			FIELD32(0x0000ffff)
86562306a36Sopenharmony_ci#define TXD_W5_AGC_REG			FIELD32(0x007f0000)
86662306a36Sopenharmony_ci#define TXD_W5_AGC_REG_VALID		FIELD32(0x00800000)
86762306a36Sopenharmony_ci#define TXD_W5_XXX_REG			FIELD32(0x7f000000)
86862306a36Sopenharmony_ci#define TXD_W5_XXX_REG_VALID		FIELD32(0x80000000)
86962306a36Sopenharmony_ci
87062306a36Sopenharmony_ci/*
87162306a36Sopenharmony_ci * Word6
87262306a36Sopenharmony_ci */
87362306a36Sopenharmony_ci#define TXD_W6_SK_BUFF			FIELD32(0xffffffff)
87462306a36Sopenharmony_ci
87562306a36Sopenharmony_ci/*
87662306a36Sopenharmony_ci * Word7
87762306a36Sopenharmony_ci */
87862306a36Sopenharmony_ci#define TXD_W7_RESERVED			FIELD32(0xffffffff)
87962306a36Sopenharmony_ci
88062306a36Sopenharmony_ci/*
88162306a36Sopenharmony_ci * RX descriptor format for RX Ring.
88262306a36Sopenharmony_ci */
88362306a36Sopenharmony_ci
88462306a36Sopenharmony_ci/*
88562306a36Sopenharmony_ci * Word0
88662306a36Sopenharmony_ci */
88762306a36Sopenharmony_ci#define RXD_W0_OWNER_NIC		FIELD32(0x00000001)
88862306a36Sopenharmony_ci#define RXD_W0_UNICAST_TO_ME		FIELD32(0x00000002)
88962306a36Sopenharmony_ci#define RXD_W0_MULTICAST		FIELD32(0x00000004)
89062306a36Sopenharmony_ci#define RXD_W0_BROADCAST		FIELD32(0x00000008)
89162306a36Sopenharmony_ci#define RXD_W0_MY_BSS			FIELD32(0x00000010)
89262306a36Sopenharmony_ci#define RXD_W0_CRC_ERROR		FIELD32(0x00000020)
89362306a36Sopenharmony_ci#define RXD_W0_PHYSICAL_ERROR		FIELD32(0x00000080)
89462306a36Sopenharmony_ci#define RXD_W0_DATABYTE_COUNT		FIELD32(0xffff0000)
89562306a36Sopenharmony_ci
89662306a36Sopenharmony_ci/*
89762306a36Sopenharmony_ci * Word1
89862306a36Sopenharmony_ci */
89962306a36Sopenharmony_ci#define RXD_W1_BUFFER_ADDRESS		FIELD32(0xffffffff)
90062306a36Sopenharmony_ci
90162306a36Sopenharmony_ci/*
90262306a36Sopenharmony_ci * Word2
90362306a36Sopenharmony_ci */
90462306a36Sopenharmony_ci#define RXD_W2_BUFFER_LENGTH		FIELD32(0x0000ffff)
90562306a36Sopenharmony_ci#define RXD_W2_BBR0			FIELD32(0x00ff0000)
90662306a36Sopenharmony_ci#define RXD_W2_SIGNAL			FIELD32(0xff000000)
90762306a36Sopenharmony_ci
90862306a36Sopenharmony_ci/*
90962306a36Sopenharmony_ci * Word3
91062306a36Sopenharmony_ci */
91162306a36Sopenharmony_ci#define RXD_W3_RSSI			FIELD32(0x000000ff)
91262306a36Sopenharmony_ci#define RXD_W3_BBR3			FIELD32(0x0000ff00)
91362306a36Sopenharmony_ci#define RXD_W3_BBR4			FIELD32(0x00ff0000)
91462306a36Sopenharmony_ci#define RXD_W3_BBR5			FIELD32(0xff000000)
91562306a36Sopenharmony_ci
91662306a36Sopenharmony_ci/*
91762306a36Sopenharmony_ci * Word4
91862306a36Sopenharmony_ci */
91962306a36Sopenharmony_ci#define RXD_W4_RX_END_TIME		FIELD32(0xffffffff)
92062306a36Sopenharmony_ci
92162306a36Sopenharmony_ci/*
92262306a36Sopenharmony_ci * Word5 & 6 & 7: Reserved
92362306a36Sopenharmony_ci */
92462306a36Sopenharmony_ci#define RXD_W5_RESERVED			FIELD32(0xffffffff)
92562306a36Sopenharmony_ci#define RXD_W6_RESERVED			FIELD32(0xffffffff)
92662306a36Sopenharmony_ci#define RXD_W7_RESERVED			FIELD32(0xffffffff)
92762306a36Sopenharmony_ci
92862306a36Sopenharmony_ci/*
92962306a36Sopenharmony_ci * Macros for converting txpower from EEPROM to mac80211 value
93062306a36Sopenharmony_ci * and from mac80211 value to register value.
93162306a36Sopenharmony_ci * NOTE: Logics in rt2400pci for txpower are reversed
93262306a36Sopenharmony_ci * compared to the other rt2x00 drivers. A higher txpower
93362306a36Sopenharmony_ci * value means that the txpower must be lowered. This is
93462306a36Sopenharmony_ci * important when converting the value coming from the
93562306a36Sopenharmony_ci * mac80211 stack to the rt2400 acceptable value.
93662306a36Sopenharmony_ci */
93762306a36Sopenharmony_ci#define MIN_TXPOWER	31
93862306a36Sopenharmony_ci#define MAX_TXPOWER	62
93962306a36Sopenharmony_ci#define DEFAULT_TXPOWER	39
94062306a36Sopenharmony_ci
94162306a36Sopenharmony_ci#define __CLAMP_TX(__txpower) \
94262306a36Sopenharmony_ci	clamp_t(u8, (__txpower), MIN_TXPOWER, MAX_TXPOWER)
94362306a36Sopenharmony_ci
94462306a36Sopenharmony_ci#define TXPOWER_FROM_DEV(__txpower) \
94562306a36Sopenharmony_ci	((__CLAMP_TX(__txpower) - MAX_TXPOWER) + MIN_TXPOWER)
94662306a36Sopenharmony_ci
94762306a36Sopenharmony_ci#define TXPOWER_TO_DEV(__txpower) \
94862306a36Sopenharmony_ci	(MAX_TXPOWER - (__CLAMP_TX(__txpower) - MIN_TXPOWER))
94962306a36Sopenharmony_ci
95062306a36Sopenharmony_ci#endif /* RT2400PCI_H */
951