162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * This file is part of wl12xx
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (c) 1998-2007 Texas Instruments Incorporated
662306a36Sopenharmony_ci * Copyright (C) 2008 Nokia Corporation
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#ifndef __REG_H__
1062306a36Sopenharmony_ci#define __REG_H__
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#include <linux/bitops.h>
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#define REGISTERS_BASE 0x00300000
1562306a36Sopenharmony_ci#define DRPW_BASE      0x00310000
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci#define REGISTERS_DOWN_SIZE 0x00008800
1862306a36Sopenharmony_ci#define REGISTERS_WORK_SIZE 0x0000b000
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci#define HW_ACCESS_ELP_CTRL_REG_ADDR         0x1FFFC
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci/* ELP register commands */
2362306a36Sopenharmony_ci#define ELPCTRL_WAKE_UP             0x1
2462306a36Sopenharmony_ci#define ELPCTRL_WAKE_UP_WLAN_READY  0x5
2562306a36Sopenharmony_ci#define ELPCTRL_SLEEP               0x0
2662306a36Sopenharmony_ci/* ELP WLAN_READY bit */
2762306a36Sopenharmony_ci#define ELPCTRL_WLAN_READY          0x2
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci/* Device Configuration registers*/
3062306a36Sopenharmony_ci#define SOR_CFG                        (REGISTERS_BASE + 0x0800)
3162306a36Sopenharmony_ci#define ECPU_CTRL                      (REGISTERS_BASE + 0x0804)
3262306a36Sopenharmony_ci#define HI_CFG                         (REGISTERS_BASE + 0x0808)
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci/* EEPROM registers */
3562306a36Sopenharmony_ci#define EE_START                       (REGISTERS_BASE + 0x080C)
3662306a36Sopenharmony_ci#define EE_CTL                         (REGISTERS_BASE + 0x2000)
3762306a36Sopenharmony_ci#define EE_DATA                        (REGISTERS_BASE + 0x2004)
3862306a36Sopenharmony_ci#define EE_ADDR                        (REGISTERS_BASE + 0x2008)
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci#define EE_CTL_READ                   2
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci#define CHIP_ID_B                      (REGISTERS_BASE + 0x5674)
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci#define CHIP_ID_1251_PG10	           (0x7010101)
4562306a36Sopenharmony_ci#define CHIP_ID_1251_PG11	           (0x7020101)
4662306a36Sopenharmony_ci#define CHIP_ID_1251_PG12	           (0x7030101)
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci#define ENABLE                         (REGISTERS_BASE + 0x5450)
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci/* Power Management registers */
5162306a36Sopenharmony_ci#define ELP_CFG_MODE                   (REGISTERS_BASE + 0x5804)
5262306a36Sopenharmony_ci#define ELP_CMD                        (REGISTERS_BASE + 0x5808)
5362306a36Sopenharmony_ci#define PLL_CAL_TIME                   (REGISTERS_BASE + 0x5810)
5462306a36Sopenharmony_ci#define CLK_REQ_TIME                   (REGISTERS_BASE + 0x5814)
5562306a36Sopenharmony_ci#define CLK_BUF_TIME                   (REGISTERS_BASE + 0x5818)
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci#define CFG_PLL_SYNC_CNT               (REGISTERS_BASE + 0x5820)
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci/* Scratch Pad registers*/
6062306a36Sopenharmony_ci#define SCR_PAD0                       (REGISTERS_BASE + 0x5608)
6162306a36Sopenharmony_ci#define SCR_PAD1                       (REGISTERS_BASE + 0x560C)
6262306a36Sopenharmony_ci#define SCR_PAD2                       (REGISTERS_BASE + 0x5610)
6362306a36Sopenharmony_ci#define SCR_PAD3                       (REGISTERS_BASE + 0x5614)
6462306a36Sopenharmony_ci#define SCR_PAD4                       (REGISTERS_BASE + 0x5618)
6562306a36Sopenharmony_ci#define SCR_PAD4_SET                   (REGISTERS_BASE + 0x561C)
6662306a36Sopenharmony_ci#define SCR_PAD4_CLR                   (REGISTERS_BASE + 0x5620)
6762306a36Sopenharmony_ci#define SCR_PAD5                       (REGISTERS_BASE + 0x5624)
6862306a36Sopenharmony_ci#define SCR_PAD5_SET                   (REGISTERS_BASE + 0x5628)
6962306a36Sopenharmony_ci#define SCR_PAD5_CLR                   (REGISTERS_BASE + 0x562C)
7062306a36Sopenharmony_ci#define SCR_PAD6                       (REGISTERS_BASE + 0x5630)
7162306a36Sopenharmony_ci#define SCR_PAD7                       (REGISTERS_BASE + 0x5634)
7262306a36Sopenharmony_ci#define SCR_PAD8                       (REGISTERS_BASE + 0x5638)
7362306a36Sopenharmony_ci#define SCR_PAD9                       (REGISTERS_BASE + 0x563C)
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci/* Spare registers*/
7662306a36Sopenharmony_ci#define SPARE_A1                       (REGISTERS_BASE + 0x0994)
7762306a36Sopenharmony_ci#define SPARE_A2                       (REGISTERS_BASE + 0x0998)
7862306a36Sopenharmony_ci#define SPARE_A3                       (REGISTERS_BASE + 0x099C)
7962306a36Sopenharmony_ci#define SPARE_A4                       (REGISTERS_BASE + 0x09A0)
8062306a36Sopenharmony_ci#define SPARE_A5                       (REGISTERS_BASE + 0x09A4)
8162306a36Sopenharmony_ci#define SPARE_A6                       (REGISTERS_BASE + 0x09A8)
8262306a36Sopenharmony_ci#define SPARE_A7                       (REGISTERS_BASE + 0x09AC)
8362306a36Sopenharmony_ci#define SPARE_A8                       (REGISTERS_BASE + 0x09B0)
8462306a36Sopenharmony_ci#define SPARE_B1                       (REGISTERS_BASE + 0x5420)
8562306a36Sopenharmony_ci#define SPARE_B2                       (REGISTERS_BASE + 0x5424)
8662306a36Sopenharmony_ci#define SPARE_B3                       (REGISTERS_BASE + 0x5428)
8762306a36Sopenharmony_ci#define SPARE_B4                       (REGISTERS_BASE + 0x542C)
8862306a36Sopenharmony_ci#define SPARE_B5                       (REGISTERS_BASE + 0x5430)
8962306a36Sopenharmony_ci#define SPARE_B6                       (REGISTERS_BASE + 0x5434)
9062306a36Sopenharmony_ci#define SPARE_B7                       (REGISTERS_BASE + 0x5438)
9162306a36Sopenharmony_ci#define SPARE_B8                       (REGISTERS_BASE + 0x543C)
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_cienum wl12xx_acx_int_reg {
9462306a36Sopenharmony_ci	ACX_REG_INTERRUPT_TRIG,
9562306a36Sopenharmony_ci	ACX_REG_INTERRUPT_TRIG_H,
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci/*=============================================
9862306a36Sopenharmony_ci  Host Interrupt Mask Register - 32bit (RW)
9962306a36Sopenharmony_ci  ------------------------------------------
10062306a36Sopenharmony_ci  Setting a bit in this register masks the
10162306a36Sopenharmony_ci  corresponding interrupt to the host.
10262306a36Sopenharmony_ci  0 - RX0		- Rx first dubble buffer Data Interrupt
10362306a36Sopenharmony_ci  1 - TXD		- Tx Data Interrupt
10462306a36Sopenharmony_ci  2 - TXXFR		- Tx Transfer Interrupt
10562306a36Sopenharmony_ci  3 - RX1		- Rx second dubble buffer Data Interrupt
10662306a36Sopenharmony_ci  4 - RXXFR		- Rx Transfer Interrupt
10762306a36Sopenharmony_ci  5 - EVENT_A	- Event Mailbox interrupt
10862306a36Sopenharmony_ci  6 - EVENT_B	- Event Mailbox interrupt
10962306a36Sopenharmony_ci  7 - WNONHST	- Wake On Host Interrupt
11062306a36Sopenharmony_ci  8 - TRACE_A	- Debug Trace interrupt
11162306a36Sopenharmony_ci  9 - TRACE_B	- Debug Trace interrupt
11262306a36Sopenharmony_ci 10 - CDCMP		- Command Complete Interrupt
11362306a36Sopenharmony_ci 11 -
11462306a36Sopenharmony_ci 12 -
11562306a36Sopenharmony_ci 13 -
11662306a36Sopenharmony_ci 14 - ICOMP		- Initialization Complete Interrupt
11762306a36Sopenharmony_ci 16 - SG SE		- Soft Gemini - Sense enable interrupt
11862306a36Sopenharmony_ci 17 - SG SD		- Soft Gemini - Sense disable interrupt
11962306a36Sopenharmony_ci 18 -			-
12062306a36Sopenharmony_ci 19 -			-
12162306a36Sopenharmony_ci 20 -			-
12262306a36Sopenharmony_ci 21-			-
12362306a36Sopenharmony_ci Default: 0x0001
12462306a36Sopenharmony_ci*==============================================*/
12562306a36Sopenharmony_ci	ACX_REG_INTERRUPT_MASK,
12662306a36Sopenharmony_ci
12762306a36Sopenharmony_ci/*=============================================
12862306a36Sopenharmony_ci  Host Interrupt Mask Set 16bit, (Write only)
12962306a36Sopenharmony_ci  ------------------------------------------
13062306a36Sopenharmony_ci Setting a bit in this register sets
13162306a36Sopenharmony_ci the corresponding bin in ACX_HINT_MASK register
13262306a36Sopenharmony_ci without effecting the mask
13362306a36Sopenharmony_ci state of other bits (0 = no effect).
13462306a36Sopenharmony_ci==============================================*/
13562306a36Sopenharmony_ci	ACX_REG_HINT_MASK_SET,
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_ci/*=============================================
13862306a36Sopenharmony_ci  Host Interrupt Mask Clear 16bit,(Write only)
13962306a36Sopenharmony_ci  ------------------------------------------
14062306a36Sopenharmony_ci Setting a bit in this register clears
14162306a36Sopenharmony_ci the corresponding bin in ACX_HINT_MASK register
14262306a36Sopenharmony_ci without effecting the mask
14362306a36Sopenharmony_ci state of other bits (0 = no effect).
14462306a36Sopenharmony_ci=============================================*/
14562306a36Sopenharmony_ci	ACX_REG_HINT_MASK_CLR,
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_ci/*=============================================
14862306a36Sopenharmony_ci  Host Interrupt Status Nondestructive Read
14962306a36Sopenharmony_ci  16bit,(Read only)
15062306a36Sopenharmony_ci  ------------------------------------------
15162306a36Sopenharmony_ci The host can read this register to determine
15262306a36Sopenharmony_ci which interrupts are active.
15362306a36Sopenharmony_ci Reading this register doesn't
15462306a36Sopenharmony_ci effect its content.
15562306a36Sopenharmony_ci=============================================*/
15662306a36Sopenharmony_ci	ACX_REG_INTERRUPT_NO_CLEAR,
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_ci/*=============================================
15962306a36Sopenharmony_ci  Host Interrupt Status Clear on Read  Register
16062306a36Sopenharmony_ci  16bit,(Read only)
16162306a36Sopenharmony_ci  ------------------------------------------
16262306a36Sopenharmony_ci The host can read this register to determine
16362306a36Sopenharmony_ci which interrupts are active.
16462306a36Sopenharmony_ci Reading this register clears it,
16562306a36Sopenharmony_ci thus making all interrupts inactive.
16662306a36Sopenharmony_ci==============================================*/
16762306a36Sopenharmony_ci	ACX_REG_INTERRUPT_CLEAR,
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_ci/*=============================================
17062306a36Sopenharmony_ci  Host Interrupt Acknowledge Register
17162306a36Sopenharmony_ci  16bit,(Write only)
17262306a36Sopenharmony_ci  ------------------------------------------
17362306a36Sopenharmony_ci The host can set individual bits in this
17462306a36Sopenharmony_ci register to clear (acknowledge) the corresp.
17562306a36Sopenharmony_ci interrupt status bits in the HINT_STS_CLR and
17662306a36Sopenharmony_ci HINT_STS_ND registers, thus making the
17762306a36Sopenharmony_ci assotiated interrupt inactive. (0-no effect)
17862306a36Sopenharmony_ci==============================================*/
17962306a36Sopenharmony_ci	ACX_REG_INTERRUPT_ACK,
18062306a36Sopenharmony_ci
18162306a36Sopenharmony_ci/*===============================================
18262306a36Sopenharmony_ci   Host Software Reset - 32bit RW
18362306a36Sopenharmony_ci ------------------------------------------
18462306a36Sopenharmony_ci    [31:1] Reserved
18562306a36Sopenharmony_ci    0  SOFT_RESET Soft Reset  - When this bit is set,
18662306a36Sopenharmony_ci    it holds the Wlan hardware in a soft reset state.
18762306a36Sopenharmony_ci    This reset disables all MAC and baseband processor
18862306a36Sopenharmony_ci    clocks except the CardBus/PCI interface clock.
18962306a36Sopenharmony_ci    It also initializes all MAC state machines except
19062306a36Sopenharmony_ci    the host interface. It does not reload the
19162306a36Sopenharmony_ci    contents of the EEPROM. When this bit is cleared
19262306a36Sopenharmony_ci    (not self-clearing), the Wlan hardware
19362306a36Sopenharmony_ci    exits the software reset state.
19462306a36Sopenharmony_ci===============================================*/
19562306a36Sopenharmony_ci	ACX_REG_SLV_SOFT_RESET,
19662306a36Sopenharmony_ci
19762306a36Sopenharmony_ci/*===============================================
19862306a36Sopenharmony_ci EEPROM Burst Read Start  - 32bit RW
19962306a36Sopenharmony_ci ------------------------------------------
20062306a36Sopenharmony_ci [31:1] Reserved
20162306a36Sopenharmony_ci 0  ACX_EE_START -  EEPROM Burst Read Start 0
20262306a36Sopenharmony_ci Setting this bit starts a burst read from
20362306a36Sopenharmony_ci the external EEPROM.
20462306a36Sopenharmony_ci If this bit is set (after reset) before an EEPROM read/write,
20562306a36Sopenharmony_ci the burst read starts at EEPROM address 0.
20662306a36Sopenharmony_ci Otherwise, it starts at the address
20762306a36Sopenharmony_ci following the address of the previous access.
20862306a36Sopenharmony_ci TheWlan hardware hardware clears this bit automatically.
20962306a36Sopenharmony_ci
21062306a36Sopenharmony_ci Default: 0x00000000
21162306a36Sopenharmony_ci*================================================*/
21262306a36Sopenharmony_ci	ACX_REG_EE_START,
21362306a36Sopenharmony_ci
21462306a36Sopenharmony_ci/* Embedded ARM CPU Control */
21562306a36Sopenharmony_ci
21662306a36Sopenharmony_ci/*===============================================
21762306a36Sopenharmony_ci Halt eCPU   - 32bit RW
21862306a36Sopenharmony_ci ------------------------------------------
21962306a36Sopenharmony_ci 0 HALT_ECPU Halt Embedded CPU - This bit is the
22062306a36Sopenharmony_ci complement of bit 1 (MDATA2) in the SOR_CFG register.
22162306a36Sopenharmony_ci During a hardware reset, this bit holds
22262306a36Sopenharmony_ci the inverse of MDATA2.
22362306a36Sopenharmony_ci When downloading firmware from the host,
22462306a36Sopenharmony_ci set this bit (pull down MDATA2).
22562306a36Sopenharmony_ci The host clears this bit after downloading the firmware into
22662306a36Sopenharmony_ci zero-wait-state SSRAM.
22762306a36Sopenharmony_ci When loading firmware from Flash, clear this bit (pull up MDATA2)
22862306a36Sopenharmony_ci so that the eCPU can run the bootloader code in Flash
22962306a36Sopenharmony_ci HALT_ECPU eCPU State
23062306a36Sopenharmony_ci --------------------
23162306a36Sopenharmony_ci 1 halt eCPU
23262306a36Sopenharmony_ci 0 enable eCPU
23362306a36Sopenharmony_ci ===============================================*/
23462306a36Sopenharmony_ci	ACX_REG_ECPU_CONTROL,
23562306a36Sopenharmony_ci
23662306a36Sopenharmony_ci	ACX_REG_TABLE_LEN
23762306a36Sopenharmony_ci};
23862306a36Sopenharmony_ci
23962306a36Sopenharmony_ci#define ACX_SLV_SOFT_RESET_BIT   BIT(0)
24062306a36Sopenharmony_ci#define ACX_REG_EEPROM_START_BIT BIT(0)
24162306a36Sopenharmony_ci
24262306a36Sopenharmony_ci/* Command/Information Mailbox Pointers */
24362306a36Sopenharmony_ci
24462306a36Sopenharmony_ci/*===============================================
24562306a36Sopenharmony_ci  Command Mailbox Pointer - 32bit RW
24662306a36Sopenharmony_ci ------------------------------------------
24762306a36Sopenharmony_ci This register holds the start address of
24862306a36Sopenharmony_ci the command mailbox located in the Wlan hardware memory.
24962306a36Sopenharmony_ci The host must read this pointer after a reset to
25062306a36Sopenharmony_ci find the location of the command mailbox.
25162306a36Sopenharmony_ci The Wlan hardware initializes the command mailbox
25262306a36Sopenharmony_ci pointer with the default address of the command mailbox.
25362306a36Sopenharmony_ci The command mailbox pointer is not valid until after
25462306a36Sopenharmony_ci the host receives the Init Complete interrupt from
25562306a36Sopenharmony_ci the Wlan hardware.
25662306a36Sopenharmony_ci ===============================================*/
25762306a36Sopenharmony_ci#define REG_COMMAND_MAILBOX_PTR				(SCR_PAD0)
25862306a36Sopenharmony_ci
25962306a36Sopenharmony_ci/*===============================================
26062306a36Sopenharmony_ci  Information Mailbox Pointer - 32bit RW
26162306a36Sopenharmony_ci ------------------------------------------
26262306a36Sopenharmony_ci This register holds the start address of
26362306a36Sopenharmony_ci the information mailbox located in the Wlan hardware memory.
26462306a36Sopenharmony_ci The host must read this pointer after a reset to find
26562306a36Sopenharmony_ci the location of the information mailbox.
26662306a36Sopenharmony_ci The Wlan hardware initializes the information mailbox pointer
26762306a36Sopenharmony_ci with the default address of the information mailbox.
26862306a36Sopenharmony_ci The information mailbox pointer is not valid
26962306a36Sopenharmony_ci until after the host receives the Init Complete interrupt from
27062306a36Sopenharmony_ci the Wlan hardware.
27162306a36Sopenharmony_ci ===============================================*/
27262306a36Sopenharmony_ci#define REG_EVENT_MAILBOX_PTR				(SCR_PAD1)
27362306a36Sopenharmony_ci
27462306a36Sopenharmony_ci
27562306a36Sopenharmony_ci/* Misc */
27662306a36Sopenharmony_ci
27762306a36Sopenharmony_ci#define REG_ENABLE_TX_RX				(ENABLE)
27862306a36Sopenharmony_ci/*
27962306a36Sopenharmony_ci * Rx configuration (filter) information element
28062306a36Sopenharmony_ci * ---------------------------------------------
28162306a36Sopenharmony_ci */
28262306a36Sopenharmony_ci#define REG_RX_CONFIG				(RX_CFG)
28362306a36Sopenharmony_ci#define REG_RX_FILTER				(RX_FILTER_CFG)
28462306a36Sopenharmony_ci
28562306a36Sopenharmony_ci
28662306a36Sopenharmony_ci#define RX_CFG_ENABLE_PHY_HEADER_PLCP	 0x0002
28762306a36Sopenharmony_ci
28862306a36Sopenharmony_ci/* promiscuous - receives all valid frames */
28962306a36Sopenharmony_ci#define RX_CFG_PROMISCUOUS		 0x0008
29062306a36Sopenharmony_ci
29162306a36Sopenharmony_ci/* receives frames from any BSSID */
29262306a36Sopenharmony_ci#define RX_CFG_BSSID			 0x0020
29362306a36Sopenharmony_ci
29462306a36Sopenharmony_ci/* receives frames destined to any MAC address */
29562306a36Sopenharmony_ci#define RX_CFG_MAC			 0x0010
29662306a36Sopenharmony_ci
29762306a36Sopenharmony_ci#define RX_CFG_ENABLE_ONLY_MY_DEST_MAC	 0x0010
29862306a36Sopenharmony_ci#define RX_CFG_ENABLE_ANY_DEST_MAC	 0x0000
29962306a36Sopenharmony_ci#define RX_CFG_ENABLE_ONLY_MY_BSSID	 0x0020
30062306a36Sopenharmony_ci#define RX_CFG_ENABLE_ANY_BSSID		 0x0000
30162306a36Sopenharmony_ci
30262306a36Sopenharmony_ci/* discards all broadcast frames */
30362306a36Sopenharmony_ci#define RX_CFG_DISABLE_BCAST		 0x0200
30462306a36Sopenharmony_ci
30562306a36Sopenharmony_ci#define RX_CFG_ENABLE_ONLY_MY_SSID	 0x0400
30662306a36Sopenharmony_ci#define RX_CFG_ENABLE_RX_CMPLT_FCS_ERROR 0x0800
30762306a36Sopenharmony_ci#define RX_CFG_COPY_RX_STATUS		 0x2000
30862306a36Sopenharmony_ci#define RX_CFG_TSF			 0x10000
30962306a36Sopenharmony_ci
31062306a36Sopenharmony_ci#define RX_CONFIG_OPTION_ANY_DST_MY_BSS	 (RX_CFG_ENABLE_ANY_DEST_MAC | \
31162306a36Sopenharmony_ci					  RX_CFG_ENABLE_ONLY_MY_BSSID)
31262306a36Sopenharmony_ci
31362306a36Sopenharmony_ci#define RX_CONFIG_OPTION_MY_DST_ANY_BSS	 (RX_CFG_ENABLE_ONLY_MY_DEST_MAC\
31462306a36Sopenharmony_ci					  | RX_CFG_ENABLE_ANY_BSSID)
31562306a36Sopenharmony_ci
31662306a36Sopenharmony_ci#define RX_CONFIG_OPTION_ANY_DST_ANY_BSS (RX_CFG_ENABLE_ANY_DEST_MAC | \
31762306a36Sopenharmony_ci					  RX_CFG_ENABLE_ANY_BSSID)
31862306a36Sopenharmony_ci
31962306a36Sopenharmony_ci#define RX_CONFIG_OPTION_MY_DST_MY_BSS	 (RX_CFG_ENABLE_ONLY_MY_DEST_MAC\
32062306a36Sopenharmony_ci					  | RX_CFG_ENABLE_ONLY_MY_BSSID)
32162306a36Sopenharmony_ci
32262306a36Sopenharmony_ci#define RX_CONFIG_OPTION_FOR_SCAN  (RX_CFG_ENABLE_PHY_HEADER_PLCP \
32362306a36Sopenharmony_ci				    | RX_CFG_ENABLE_RX_CMPLT_FCS_ERROR \
32462306a36Sopenharmony_ci				    | RX_CFG_COPY_RX_STATUS | RX_CFG_TSF)
32562306a36Sopenharmony_ci
32662306a36Sopenharmony_ci#define RX_CONFIG_OPTION_FOR_MEASUREMENT (RX_CFG_ENABLE_ANY_DEST_MAC)
32762306a36Sopenharmony_ci
32862306a36Sopenharmony_ci#define RX_CONFIG_OPTION_FOR_JOIN	 (RX_CFG_ENABLE_ONLY_MY_BSSID | \
32962306a36Sopenharmony_ci					  RX_CFG_ENABLE_ONLY_MY_DEST_MAC)
33062306a36Sopenharmony_ci
33162306a36Sopenharmony_ci#define RX_CONFIG_OPTION_FOR_IBSS_JOIN   (RX_CFG_ENABLE_ONLY_MY_SSID | \
33262306a36Sopenharmony_ci					  RX_CFG_ENABLE_ONLY_MY_DEST_MAC)
33362306a36Sopenharmony_ci
33462306a36Sopenharmony_ci#define RX_FILTER_OPTION_DEF	      (CFG_RX_MGMT_EN | CFG_RX_DATA_EN\
33562306a36Sopenharmony_ci				       | CFG_RX_CTL_EN | CFG_RX_BCN_EN\
33662306a36Sopenharmony_ci				       | CFG_RX_AUTH_EN | CFG_RX_ASSOC_EN)
33762306a36Sopenharmony_ci
33862306a36Sopenharmony_ci#define RX_FILTER_OPTION_FILTER_ALL	 0
33962306a36Sopenharmony_ci
34062306a36Sopenharmony_ci#define RX_FILTER_OPTION_DEF_PRSP_BCN  (CFG_RX_PRSP_EN | CFG_RX_MGMT_EN\
34162306a36Sopenharmony_ci					| CFG_RX_RCTS_ACK | CFG_RX_BCN_EN)
34262306a36Sopenharmony_ci
34362306a36Sopenharmony_ci#define RX_FILTER_OPTION_JOIN	     (CFG_RX_MGMT_EN | CFG_RX_DATA_EN\
34462306a36Sopenharmony_ci				      | CFG_RX_BCN_EN | CFG_RX_AUTH_EN\
34562306a36Sopenharmony_ci				      | CFG_RX_ASSOC_EN | CFG_RX_RCTS_ACK\
34662306a36Sopenharmony_ci				      | CFG_RX_PRSP_EN)
34762306a36Sopenharmony_ci
34862306a36Sopenharmony_ci
34962306a36Sopenharmony_ci/*===============================================
35062306a36Sopenharmony_ci EEPROM Read/Write Request 32bit RW
35162306a36Sopenharmony_ci ------------------------------------------
35262306a36Sopenharmony_ci 1 EE_READ - EEPROM Read Request 1 - Setting this bit
35362306a36Sopenharmony_ci loads a single byte of data into the EE_DATA
35462306a36Sopenharmony_ci register from the EEPROM location specified in
35562306a36Sopenharmony_ci the EE_ADDR register.
35662306a36Sopenharmony_ci The Wlan hardware hardware clears this bit automatically.
35762306a36Sopenharmony_ci EE_DATA is valid when this bit is cleared.
35862306a36Sopenharmony_ci
35962306a36Sopenharmony_ci 0 EE_WRITE  - EEPROM Write Request  - Setting this bit
36062306a36Sopenharmony_ci writes a single byte of data from the EE_DATA register into the
36162306a36Sopenharmony_ci EEPROM location specified in the EE_ADDR register.
36262306a36Sopenharmony_ci The Wlan hardware hardware clears this bit automatically.
36362306a36Sopenharmony_ci*===============================================*/
36462306a36Sopenharmony_ci#define EE_CTL                              (REGISTERS_BASE + 0x2000)
36562306a36Sopenharmony_ci#define ACX_EE_CTL_REG                      EE_CTL
36662306a36Sopenharmony_ci#define EE_WRITE                            0x00000001ul
36762306a36Sopenharmony_ci#define EE_READ                             0x00000002ul
36862306a36Sopenharmony_ci
36962306a36Sopenharmony_ci/*===============================================
37062306a36Sopenharmony_ci  EEPROM Address  - 32bit RW
37162306a36Sopenharmony_ci  ------------------------------------------
37262306a36Sopenharmony_ci  This register specifies the address
37362306a36Sopenharmony_ci  within the EEPROM from/to which to read/write data.
37462306a36Sopenharmony_ci  ===============================================*/
37562306a36Sopenharmony_ci#define EE_ADDR                             (REGISTERS_BASE + 0x2008)
37662306a36Sopenharmony_ci#define ACX_EE_ADDR_REG                     EE_ADDR
37762306a36Sopenharmony_ci
37862306a36Sopenharmony_ci/*===============================================
37962306a36Sopenharmony_ci  EEPROM Data  - 32bit RW
38062306a36Sopenharmony_ci  ------------------------------------------
38162306a36Sopenharmony_ci  This register either holds the read 8 bits of
38262306a36Sopenharmony_ci  data from the EEPROM or the write data
38362306a36Sopenharmony_ci  to be written to the EEPROM.
38462306a36Sopenharmony_ci  ===============================================*/
38562306a36Sopenharmony_ci#define EE_DATA                             (REGISTERS_BASE + 0x2004)
38662306a36Sopenharmony_ci#define ACX_EE_DATA_REG                     EE_DATA
38762306a36Sopenharmony_ci
38862306a36Sopenharmony_ci#define EEPROM_ACCESS_TO                    10000   /* timeout counter */
38962306a36Sopenharmony_ci#define START_EEPROM_MGR                    0x00000001
39062306a36Sopenharmony_ci
39162306a36Sopenharmony_ci/*===============================================
39262306a36Sopenharmony_ci  EEPROM Base Address  - 32bit RW
39362306a36Sopenharmony_ci  ------------------------------------------
39462306a36Sopenharmony_ci  This register holds the upper nine bits
39562306a36Sopenharmony_ci  [23:15] of the 24-bit Wlan hardware memory
39662306a36Sopenharmony_ci  address for burst reads from EEPROM accesses.
39762306a36Sopenharmony_ci  The EEPROM provides the lower 15 bits of this address.
39862306a36Sopenharmony_ci  The MSB of the address from the EEPROM is ignored.
39962306a36Sopenharmony_ci  ===============================================*/
40062306a36Sopenharmony_ci#define ACX_EE_CFG                          EE_CFG
40162306a36Sopenharmony_ci
40262306a36Sopenharmony_ci/*===============================================
40362306a36Sopenharmony_ci  GPIO Output Values  -32bit, RW
40462306a36Sopenharmony_ci  ------------------------------------------
40562306a36Sopenharmony_ci  [31:16]  Reserved
40662306a36Sopenharmony_ci  [15: 0]  Specify the output values (at the output driver inputs) for
40762306a36Sopenharmony_ci  GPIO[15:0], respectively.
40862306a36Sopenharmony_ci  ===============================================*/
40962306a36Sopenharmony_ci#define ACX_GPIO_OUT_REG            GPIO_OUT
41062306a36Sopenharmony_ci#define ACX_MAX_GPIO_LINES          15
41162306a36Sopenharmony_ci
41262306a36Sopenharmony_ci/*===============================================
41362306a36Sopenharmony_ci  Contention window  -32bit, RW
41462306a36Sopenharmony_ci  ------------------------------------------
41562306a36Sopenharmony_ci  [31:26]  Reserved
41662306a36Sopenharmony_ci  [25:16]  Max (0x3ff)
41762306a36Sopenharmony_ci  [15:07]  Reserved
41862306a36Sopenharmony_ci  [06:00]  Current contention window value - default is 0x1F
41962306a36Sopenharmony_ci  ===============================================*/
42062306a36Sopenharmony_ci#define ACX_CONT_WIND_CFG_REG    CONT_WIND_CFG
42162306a36Sopenharmony_ci#define ACX_CONT_WIND_MIN_MASK   0x0000007f
42262306a36Sopenharmony_ci#define ACX_CONT_WIND_MAX        0x03ff0000
42362306a36Sopenharmony_ci
42462306a36Sopenharmony_ci/*===============================================
42562306a36Sopenharmony_ci  HI_CFG Interface Configuration Register Values
42662306a36Sopenharmony_ci  ------------------------------------------
42762306a36Sopenharmony_ci  ===============================================*/
42862306a36Sopenharmony_ci#define HI_CFG_UART_ENABLE          0x00000004
42962306a36Sopenharmony_ci#define HI_CFG_RST232_ENABLE        0x00000008
43062306a36Sopenharmony_ci#define HI_CFG_CLOCK_REQ_SELECT     0x00000010
43162306a36Sopenharmony_ci#define HI_CFG_HOST_INT_ENABLE      0x00000020
43262306a36Sopenharmony_ci#define HI_CFG_VLYNQ_OUTPUT_ENABLE  0x00000040
43362306a36Sopenharmony_ci#define HI_CFG_HOST_INT_ACTIVE_LOW  0x00000080
43462306a36Sopenharmony_ci#define HI_CFG_UART_TX_OUT_GPIO_15  0x00000100
43562306a36Sopenharmony_ci#define HI_CFG_UART_TX_OUT_GPIO_14  0x00000200
43662306a36Sopenharmony_ci#define HI_CFG_UART_TX_OUT_GPIO_7   0x00000400
43762306a36Sopenharmony_ci
43862306a36Sopenharmony_ci/*
43962306a36Sopenharmony_ci * NOTE: USE_ACTIVE_HIGH compilation flag should be defined in makefile
44062306a36Sopenharmony_ci *       for platforms using active high interrupt level
44162306a36Sopenharmony_ci */
44262306a36Sopenharmony_ci#ifdef USE_ACTIVE_HIGH
44362306a36Sopenharmony_ci#define HI_CFG_DEF_VAL              \
44462306a36Sopenharmony_ci	(HI_CFG_UART_ENABLE |        \
44562306a36Sopenharmony_ci	HI_CFG_RST232_ENABLE |      \
44662306a36Sopenharmony_ci	HI_CFG_CLOCK_REQ_SELECT |   \
44762306a36Sopenharmony_ci	HI_CFG_HOST_INT_ENABLE)
44862306a36Sopenharmony_ci#else
44962306a36Sopenharmony_ci#define HI_CFG_DEF_VAL              \
45062306a36Sopenharmony_ci	(HI_CFG_UART_ENABLE |        \
45162306a36Sopenharmony_ci	HI_CFG_RST232_ENABLE |      \
45262306a36Sopenharmony_ci	HI_CFG_CLOCK_REQ_SELECT |   \
45362306a36Sopenharmony_ci	HI_CFG_HOST_INT_ENABLE)
45462306a36Sopenharmony_ci
45562306a36Sopenharmony_ci#endif
45662306a36Sopenharmony_ci
45762306a36Sopenharmony_ci#define REF_FREQ_19_2                       0
45862306a36Sopenharmony_ci#define REF_FREQ_26_0                       1
45962306a36Sopenharmony_ci#define REF_FREQ_38_4                       2
46062306a36Sopenharmony_ci#define REF_FREQ_40_0                       3
46162306a36Sopenharmony_ci#define REF_FREQ_33_6                       4
46262306a36Sopenharmony_ci#define REF_FREQ_NUM                        5
46362306a36Sopenharmony_ci
46462306a36Sopenharmony_ci#define LUT_PARAM_INTEGER_DIVIDER           0
46562306a36Sopenharmony_ci#define LUT_PARAM_FRACTIONAL_DIVIDER        1
46662306a36Sopenharmony_ci#define LUT_PARAM_ATTN_BB                   2
46762306a36Sopenharmony_ci#define LUT_PARAM_ALPHA_BB                  3
46862306a36Sopenharmony_ci#define LUT_PARAM_STOP_TIME_BB              4
46962306a36Sopenharmony_ci#define LUT_PARAM_BB_PLL_LOOP_FILTER        5
47062306a36Sopenharmony_ci#define LUT_PARAM_NUM                       6
47162306a36Sopenharmony_ci
47262306a36Sopenharmony_ci#define ACX_EEPROMLESS_IND_REG              (SCR_PAD4)
47362306a36Sopenharmony_ci#define USE_EEPROM                          0
47462306a36Sopenharmony_ci#define SOFT_RESET_MAX_TIME                 1000000
47562306a36Sopenharmony_ci#define SOFT_RESET_STALL_TIME               1000
47662306a36Sopenharmony_ci#define NVS_DATA_BUNDARY_ALIGNMENT          4
47762306a36Sopenharmony_ci
47862306a36Sopenharmony_ci
47962306a36Sopenharmony_ci/* Firmware image load chunk size */
48062306a36Sopenharmony_ci#define CHUNK_SIZE          512
48162306a36Sopenharmony_ci
48262306a36Sopenharmony_ci/* Firmware image header size */
48362306a36Sopenharmony_ci#define FW_HDR_SIZE 8
48462306a36Sopenharmony_ci
48562306a36Sopenharmony_ci#define ECPU_CONTROL_HALT					0x00000101
48662306a36Sopenharmony_ci
48762306a36Sopenharmony_ci
48862306a36Sopenharmony_ci/******************************************************************************
48962306a36Sopenharmony_ci
49062306a36Sopenharmony_ci    CHANNELS, BAND & REG DOMAINS definitions
49162306a36Sopenharmony_ci
49262306a36Sopenharmony_ci******************************************************************************/
49362306a36Sopenharmony_ci
49462306a36Sopenharmony_ci
49562306a36Sopenharmony_cienum {
49662306a36Sopenharmony_ci	RADIO_BAND_2_4GHZ = 0,  /* 2.4 Ghz band */
49762306a36Sopenharmony_ci	RADIO_BAND_5GHZ = 1,    /* 5 Ghz band */
49862306a36Sopenharmony_ci	RADIO_BAND_JAPAN_4_9_GHZ = 2,
49962306a36Sopenharmony_ci	DEFAULT_BAND = RADIO_BAND_2_4GHZ,
50062306a36Sopenharmony_ci	INVALID_BAND = 0xFE,
50162306a36Sopenharmony_ci	MAX_RADIO_BANDS = 0xFF
50262306a36Sopenharmony_ci};
50362306a36Sopenharmony_ci
50462306a36Sopenharmony_cienum {
50562306a36Sopenharmony_ci	NO_RATE      = 0,
50662306a36Sopenharmony_ci	RATE_1MBPS   = 0x0A,
50762306a36Sopenharmony_ci	RATE_2MBPS   = 0x14,
50862306a36Sopenharmony_ci	RATE_5_5MBPS = 0x37,
50962306a36Sopenharmony_ci	RATE_6MBPS   = 0x0B,
51062306a36Sopenharmony_ci	RATE_9MBPS   = 0x0F,
51162306a36Sopenharmony_ci	RATE_11MBPS  = 0x6E,
51262306a36Sopenharmony_ci	RATE_12MBPS  = 0x0A,
51362306a36Sopenharmony_ci	RATE_18MBPS  = 0x0E,
51462306a36Sopenharmony_ci	RATE_22MBPS  = 0xDC,
51562306a36Sopenharmony_ci	RATE_24MBPS  = 0x09,
51662306a36Sopenharmony_ci	RATE_36MBPS  = 0x0D,
51762306a36Sopenharmony_ci	RATE_48MBPS  = 0x08,
51862306a36Sopenharmony_ci	RATE_54MBPS  = 0x0C
51962306a36Sopenharmony_ci};
52062306a36Sopenharmony_ci
52162306a36Sopenharmony_cienum {
52262306a36Sopenharmony_ci	RATE_INDEX_1MBPS   =  0,
52362306a36Sopenharmony_ci	RATE_INDEX_2MBPS   =  1,
52462306a36Sopenharmony_ci	RATE_INDEX_5_5MBPS =  2,
52562306a36Sopenharmony_ci	RATE_INDEX_6MBPS   =  3,
52662306a36Sopenharmony_ci	RATE_INDEX_9MBPS   =  4,
52762306a36Sopenharmony_ci	RATE_INDEX_11MBPS  =  5,
52862306a36Sopenharmony_ci	RATE_INDEX_12MBPS  =  6,
52962306a36Sopenharmony_ci	RATE_INDEX_18MBPS  =  7,
53062306a36Sopenharmony_ci	RATE_INDEX_22MBPS  =  8,
53162306a36Sopenharmony_ci	RATE_INDEX_24MBPS  =  9,
53262306a36Sopenharmony_ci	RATE_INDEX_36MBPS  =  10,
53362306a36Sopenharmony_ci	RATE_INDEX_48MBPS  =  11,
53462306a36Sopenharmony_ci	RATE_INDEX_54MBPS  =  12,
53562306a36Sopenharmony_ci	RATE_INDEX_MAX     =  RATE_INDEX_54MBPS,
53662306a36Sopenharmony_ci	MAX_RATE_INDEX,
53762306a36Sopenharmony_ci	INVALID_RATE_INDEX = MAX_RATE_INDEX,
53862306a36Sopenharmony_ci	RATE_INDEX_ENUM_MAX_SIZE = 0x7FFFFFFF
53962306a36Sopenharmony_ci};
54062306a36Sopenharmony_ci
54162306a36Sopenharmony_cienum {
54262306a36Sopenharmony_ci	RATE_MASK_1MBPS = 0x1,
54362306a36Sopenharmony_ci	RATE_MASK_2MBPS = 0x2,
54462306a36Sopenharmony_ci	RATE_MASK_5_5MBPS = 0x4,
54562306a36Sopenharmony_ci	RATE_MASK_11MBPS = 0x20,
54662306a36Sopenharmony_ci};
54762306a36Sopenharmony_ci
54862306a36Sopenharmony_ci#define SHORT_PREAMBLE_BIT   BIT(0) /* CCK or Barker depending on the rate */
54962306a36Sopenharmony_ci#define OFDM_RATE_BIT        BIT(6)
55062306a36Sopenharmony_ci#define PBCC_RATE_BIT        BIT(7)
55162306a36Sopenharmony_ci
55262306a36Sopenharmony_cienum {
55362306a36Sopenharmony_ci	CCK_LONG = 0,
55462306a36Sopenharmony_ci	CCK_SHORT = SHORT_PREAMBLE_BIT,
55562306a36Sopenharmony_ci	PBCC_LONG = PBCC_RATE_BIT,
55662306a36Sopenharmony_ci	PBCC_SHORT = PBCC_RATE_BIT | SHORT_PREAMBLE_BIT,
55762306a36Sopenharmony_ci	OFDM = OFDM_RATE_BIT
55862306a36Sopenharmony_ci};
55962306a36Sopenharmony_ci
56062306a36Sopenharmony_ci/******************************************************************************
56162306a36Sopenharmony_ci
56262306a36Sopenharmony_ciTransmit-Descriptor RATE-SET field definitions...
56362306a36Sopenharmony_ci
56462306a36Sopenharmony_ciDefine a new "Rate-Set" for TX path that incorporates the
56562306a36Sopenharmony_ciRate & Modulation info into a single 16-bit field.
56662306a36Sopenharmony_ci
56762306a36Sopenharmony_ciTxdRateSet_t:
56862306a36Sopenharmony_cib15   - Indicates Preamble type (1=SHORT, 0=LONG).
56962306a36Sopenharmony_ci	Notes:
57062306a36Sopenharmony_ci	Must be LONG (0) for 1Mbps rate.
57162306a36Sopenharmony_ci	Does not apply (set to 0) for RevG-OFDM rates.
57262306a36Sopenharmony_cib14   - Indicates PBCC encoding (1=PBCC, 0=not).
57362306a36Sopenharmony_ci	Notes:
57462306a36Sopenharmony_ci	Does not apply (set to 0) for rates 1 and 2 Mbps.
57562306a36Sopenharmony_ci	Does not apply (set to 0) for RevG-OFDM rates.
57662306a36Sopenharmony_cib13    - Unused (set to 0).
57762306a36Sopenharmony_cib12-b0 - Supported Rate indicator bits as defined below.
57862306a36Sopenharmony_ci
57962306a36Sopenharmony_ci******************************************************************************/
58062306a36Sopenharmony_ci
58162306a36Sopenharmony_ci
58262306a36Sopenharmony_ci/*************************************************************************
58362306a36Sopenharmony_ci
58462306a36Sopenharmony_ci    Interrupt Trigger Register (Host -> WiLink)
58562306a36Sopenharmony_ci
58662306a36Sopenharmony_ci**************************************************************************/
58762306a36Sopenharmony_ci
58862306a36Sopenharmony_ci/* Hardware to Embedded CPU Interrupts - first 32-bit register set */
58962306a36Sopenharmony_ci
59062306a36Sopenharmony_ci/*
59162306a36Sopenharmony_ci * Host Command Interrupt. Setting this bit masks
59262306a36Sopenharmony_ci * the interrupt that the host issues to inform
59362306a36Sopenharmony_ci * the FW that it has sent a command
59462306a36Sopenharmony_ci * to the Wlan hardware Command Mailbox.
59562306a36Sopenharmony_ci */
59662306a36Sopenharmony_ci#define INTR_TRIG_CMD       BIT(0)
59762306a36Sopenharmony_ci
59862306a36Sopenharmony_ci/*
59962306a36Sopenharmony_ci * Host Event Acknowlegde Interrupt. The host
60062306a36Sopenharmony_ci * sets this bit to acknowledge that it received
60162306a36Sopenharmony_ci * the unsolicited information from the event
60262306a36Sopenharmony_ci * mailbox.
60362306a36Sopenharmony_ci */
60462306a36Sopenharmony_ci#define INTR_TRIG_EVENT_ACK BIT(1)
60562306a36Sopenharmony_ci
60662306a36Sopenharmony_ci/*
60762306a36Sopenharmony_ci * The host sets this bit to inform the Wlan
60862306a36Sopenharmony_ci * FW that a TX packet is in the XFER
60962306a36Sopenharmony_ci * Buffer #0.
61062306a36Sopenharmony_ci */
61162306a36Sopenharmony_ci#define INTR_TRIG_TX_PROC0 BIT(2)
61262306a36Sopenharmony_ci
61362306a36Sopenharmony_ci/*
61462306a36Sopenharmony_ci * The host sets this bit to inform the FW
61562306a36Sopenharmony_ci * that it read a packet from RX XFER
61662306a36Sopenharmony_ci * Buffer #0.
61762306a36Sopenharmony_ci */
61862306a36Sopenharmony_ci#define INTR_TRIG_RX_PROC0 BIT(3)
61962306a36Sopenharmony_ci
62062306a36Sopenharmony_ci#define INTR_TRIG_DEBUG_ACK BIT(4)
62162306a36Sopenharmony_ci
62262306a36Sopenharmony_ci#define INTR_TRIG_STATE_CHANGED BIT(5)
62362306a36Sopenharmony_ci
62462306a36Sopenharmony_ci
62562306a36Sopenharmony_ci/* Hardware to Embedded CPU Interrupts - second 32-bit register set */
62662306a36Sopenharmony_ci
62762306a36Sopenharmony_ci/*
62862306a36Sopenharmony_ci * The host sets this bit to inform the FW
62962306a36Sopenharmony_ci * that it read a packet from RX XFER
63062306a36Sopenharmony_ci * Buffer #1.
63162306a36Sopenharmony_ci */
63262306a36Sopenharmony_ci#define INTR_TRIG_RX_PROC1 BIT(17)
63362306a36Sopenharmony_ci
63462306a36Sopenharmony_ci/*
63562306a36Sopenharmony_ci * The host sets this bit to inform the Wlan
63662306a36Sopenharmony_ci * hardware that a TX packet is in the XFER
63762306a36Sopenharmony_ci * Buffer #1.
63862306a36Sopenharmony_ci */
63962306a36Sopenharmony_ci#define INTR_TRIG_TX_PROC1 BIT(18)
64062306a36Sopenharmony_ci
64162306a36Sopenharmony_ci#endif
642