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-2009 Texas Instruments. All rights reserved.
662306a36Sopenharmony_ci * Copyright (C) 2009 Nokia Corporation
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * Contact: Luciano Coelho <luciano.coelho@nokia.com>
962306a36Sopenharmony_ci */
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#ifndef __REG_H__
1262306a36Sopenharmony_ci#define __REG_H__
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#include <linux/bitops.h>
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#define REGISTERS_BASE 0x00300000
1762306a36Sopenharmony_ci#define DRPW_BASE      0x00310000
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci#define REGISTERS_DOWN_SIZE 0x00008800
2062306a36Sopenharmony_ci#define REGISTERS_WORK_SIZE 0x0000b000
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci#define FW_STATUS_ADDR                      (0x14FC0 + 0xA000)
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci/*===============================================
2562306a36Sopenharmony_ci   Host Software Reset - 32bit RW
2662306a36Sopenharmony_ci ------------------------------------------
2762306a36Sopenharmony_ci    [31:1] Reserved
2862306a36Sopenharmony_ci    0  SOFT_RESET Soft Reset  - When this bit is set,
2962306a36Sopenharmony_ci    it holds the Wlan hardware in a soft reset state.
3062306a36Sopenharmony_ci    This reset disables all MAC and baseband processor
3162306a36Sopenharmony_ci    clocks except the CardBus/PCI interface clock.
3262306a36Sopenharmony_ci    It also initializes all MAC state machines except
3362306a36Sopenharmony_ci    the host interface. It does not reload the
3462306a36Sopenharmony_ci    contents of the EEPROM. When this bit is cleared
3562306a36Sopenharmony_ci    (not self-clearing), the Wlan hardware
3662306a36Sopenharmony_ci    exits the software reset state.
3762306a36Sopenharmony_ci===============================================*/
3862306a36Sopenharmony_ci#define WL12XX_SLV_SOFT_RESET		(REGISTERS_BASE + 0x0000)
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci#define WL1271_SLV_REG_DATA            (REGISTERS_BASE + 0x0008)
4162306a36Sopenharmony_ci#define WL1271_SLV_REG_ADATA           (REGISTERS_BASE + 0x000c)
4262306a36Sopenharmony_ci#define WL1271_SLV_MEM_DATA            (REGISTERS_BASE + 0x0018)
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci#define WL12XX_REG_INTERRUPT_TRIG         (REGISTERS_BASE + 0x0474)
4562306a36Sopenharmony_ci#define WL12XX_REG_INTERRUPT_TRIG_H       (REGISTERS_BASE + 0x0478)
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci/*=============================================
4862306a36Sopenharmony_ci  Host Interrupt Mask Register - 32bit (RW)
4962306a36Sopenharmony_ci  ------------------------------------------
5062306a36Sopenharmony_ci  Setting a bit in this register masks the
5162306a36Sopenharmony_ci  corresponding interrupt to the host.
5262306a36Sopenharmony_ci  0 - RX0		- Rx first dubble buffer Data Interrupt
5362306a36Sopenharmony_ci  1 - TXD		- Tx Data Interrupt
5462306a36Sopenharmony_ci  2 - TXXFR		- Tx Transfer Interrupt
5562306a36Sopenharmony_ci  3 - RX1		- Rx second dubble buffer Data Interrupt
5662306a36Sopenharmony_ci  4 - RXXFR		- Rx Transfer Interrupt
5762306a36Sopenharmony_ci  5 - EVENT_A	- Event Mailbox interrupt
5862306a36Sopenharmony_ci  6 - EVENT_B	- Event Mailbox interrupt
5962306a36Sopenharmony_ci  7 - WNONHST	- Wake On Host Interrupt
6062306a36Sopenharmony_ci  8 - TRACE_A	- Debug Trace interrupt
6162306a36Sopenharmony_ci  9 - TRACE_B	- Debug Trace interrupt
6262306a36Sopenharmony_ci 10 - CDCMP		- Command Complete Interrupt
6362306a36Sopenharmony_ci 11 -
6462306a36Sopenharmony_ci 12 -
6562306a36Sopenharmony_ci 13 -
6662306a36Sopenharmony_ci 14 - ICOMP		- Initialization Complete Interrupt
6762306a36Sopenharmony_ci 16 - SG SE		- Soft Gemini - Sense enable interrupt
6862306a36Sopenharmony_ci 17 - SG SD		- Soft Gemini - Sense disable interrupt
6962306a36Sopenharmony_ci 18 -			-
7062306a36Sopenharmony_ci 19 -			-
7162306a36Sopenharmony_ci 20 -			-
7262306a36Sopenharmony_ci 21-			-
7362306a36Sopenharmony_ci Default: 0x0001
7462306a36Sopenharmony_ci*==============================================*/
7562306a36Sopenharmony_ci#define WL12XX_REG_INTERRUPT_MASK         (REGISTERS_BASE + 0x04DC)
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci/*=============================================
7862306a36Sopenharmony_ci  Host Interrupt Mask Set 16bit, (Write only)
7962306a36Sopenharmony_ci  ------------------------------------------
8062306a36Sopenharmony_ci Setting a bit in this register sets
8162306a36Sopenharmony_ci the corresponding bin in ACX_HINT_MASK register
8262306a36Sopenharmony_ci without effecting the mask
8362306a36Sopenharmony_ci state of other bits (0 = no effect).
8462306a36Sopenharmony_ci==============================================*/
8562306a36Sopenharmony_ci#define ACX_REG_HINT_MASK_SET          (REGISTERS_BASE + 0x04E0)
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci/*=============================================
8862306a36Sopenharmony_ci  Host Interrupt Mask Clear 16bit,(Write only)
8962306a36Sopenharmony_ci  ------------------------------------------
9062306a36Sopenharmony_ci Setting a bit in this register clears
9162306a36Sopenharmony_ci the corresponding bin in ACX_HINT_MASK register
9262306a36Sopenharmony_ci without effecting the mask
9362306a36Sopenharmony_ci state of other bits (0 = no effect).
9462306a36Sopenharmony_ci=============================================*/
9562306a36Sopenharmony_ci#define ACX_REG_HINT_MASK_CLR          (REGISTERS_BASE + 0x04E4)
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci/*=============================================
9862306a36Sopenharmony_ci  Host Interrupt Status Nondestructive Read
9962306a36Sopenharmony_ci  16bit,(Read only)
10062306a36Sopenharmony_ci  ------------------------------------------
10162306a36Sopenharmony_ci The host can read this register to determine
10262306a36Sopenharmony_ci which interrupts are active.
10362306a36Sopenharmony_ci Reading this register doesn't
10462306a36Sopenharmony_ci effect its content.
10562306a36Sopenharmony_ci=============================================*/
10662306a36Sopenharmony_ci#define WL12XX_REG_INTERRUPT_NO_CLEAR     (REGISTERS_BASE + 0x04E8)
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ci/*=============================================
10962306a36Sopenharmony_ci  Host Interrupt Status Clear on Read  Register
11062306a36Sopenharmony_ci  16bit,(Read only)
11162306a36Sopenharmony_ci  ------------------------------------------
11262306a36Sopenharmony_ci The host can read this register to determine
11362306a36Sopenharmony_ci which interrupts are active.
11462306a36Sopenharmony_ci Reading this register clears it,
11562306a36Sopenharmony_ci thus making all interrupts inactive.
11662306a36Sopenharmony_ci==============================================*/
11762306a36Sopenharmony_ci#define ACX_REG_INTERRUPT_CLEAR        (REGISTERS_BASE + 0x04F8)
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_ci/*=============================================
12062306a36Sopenharmony_ci  Host Interrupt Acknowledge Register
12162306a36Sopenharmony_ci  16bit,(Write only)
12262306a36Sopenharmony_ci  ------------------------------------------
12362306a36Sopenharmony_ci The host can set individual bits in this
12462306a36Sopenharmony_ci register to clear (acknowledge) the corresp.
12562306a36Sopenharmony_ci interrupt status bits in the HINT_STS_CLR and
12662306a36Sopenharmony_ci HINT_STS_ND registers, thus making the
12762306a36Sopenharmony_ci assotiated interrupt inactive. (0-no effect)
12862306a36Sopenharmony_ci==============================================*/
12962306a36Sopenharmony_ci#define WL12XX_REG_INTERRUPT_ACK          (REGISTERS_BASE + 0x04F0)
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ci#define WL12XX_REG_RX_DRIVER_COUNTER	(REGISTERS_BASE + 0x0538)
13262306a36Sopenharmony_ci
13362306a36Sopenharmony_ci/* Device Configuration registers*/
13462306a36Sopenharmony_ci#define SOR_CFG                        (REGISTERS_BASE + 0x0800)
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ci/* Embedded ARM CPU Control */
13762306a36Sopenharmony_ci
13862306a36Sopenharmony_ci/*===============================================
13962306a36Sopenharmony_ci Halt eCPU   - 32bit RW
14062306a36Sopenharmony_ci ------------------------------------------
14162306a36Sopenharmony_ci 0 HALT_ECPU Halt Embedded CPU - This bit is the
14262306a36Sopenharmony_ci complement of bit 1 (MDATA2) in the SOR_CFG register.
14362306a36Sopenharmony_ci During a hardware reset, this bit holds
14462306a36Sopenharmony_ci the inverse of MDATA2.
14562306a36Sopenharmony_ci When downloading firmware from the host,
14662306a36Sopenharmony_ci set this bit (pull down MDATA2).
14762306a36Sopenharmony_ci The host clears this bit after downloading the firmware into
14862306a36Sopenharmony_ci zero-wait-state SSRAM.
14962306a36Sopenharmony_ci When loading firmware from Flash, clear this bit (pull up MDATA2)
15062306a36Sopenharmony_ci so that the eCPU can run the bootloader code in Flash
15162306a36Sopenharmony_ci HALT_ECPU eCPU State
15262306a36Sopenharmony_ci --------------------
15362306a36Sopenharmony_ci 1 halt eCPU
15462306a36Sopenharmony_ci 0 enable eCPU
15562306a36Sopenharmony_ci ===============================================*/
15662306a36Sopenharmony_ci#define WL12XX_REG_ECPU_CONTROL           (REGISTERS_BASE + 0x0804)
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_ci#define WL12XX_HI_CFG			(REGISTERS_BASE + 0x0808)
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci/*===============================================
16162306a36Sopenharmony_ci EEPROM Burst Read Start  - 32bit RW
16262306a36Sopenharmony_ci ------------------------------------------
16362306a36Sopenharmony_ci [31:1] Reserved
16462306a36Sopenharmony_ci 0  ACX_EE_START -  EEPROM Burst Read Start 0
16562306a36Sopenharmony_ci Setting this bit starts a burst read from
16662306a36Sopenharmony_ci the external EEPROM.
16762306a36Sopenharmony_ci If this bit is set (after reset) before an EEPROM read/write,
16862306a36Sopenharmony_ci the burst read starts at EEPROM address 0.
16962306a36Sopenharmony_ci Otherwise, it starts at the address
17062306a36Sopenharmony_ci following the address of the previous access.
17162306a36Sopenharmony_ci TheWlan hardware hardware clears this bit automatically.
17262306a36Sopenharmony_ci
17362306a36Sopenharmony_ci Default: 0x00000000
17462306a36Sopenharmony_ci*================================================*/
17562306a36Sopenharmony_ci#define ACX_REG_EE_START               (REGISTERS_BASE + 0x080C)
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ci#define WL12XX_OCP_POR_CTR		(REGISTERS_BASE + 0x09B4)
17862306a36Sopenharmony_ci#define WL12XX_OCP_DATA_WRITE		(REGISTERS_BASE + 0x09B8)
17962306a36Sopenharmony_ci#define WL12XX_OCP_DATA_READ		(REGISTERS_BASE + 0x09BC)
18062306a36Sopenharmony_ci#define WL12XX_OCP_CMD			(REGISTERS_BASE + 0x09C0)
18162306a36Sopenharmony_ci
18262306a36Sopenharmony_ci#define WL12XX_HOST_WR_ACCESS		(REGISTERS_BASE + 0x09F8)
18362306a36Sopenharmony_ci
18462306a36Sopenharmony_ci#define WL12XX_CHIP_ID_B		(REGISTERS_BASE + 0x5674)
18562306a36Sopenharmony_ci
18662306a36Sopenharmony_ci#define WL12XX_ENABLE			(REGISTERS_BASE + 0x5450)
18762306a36Sopenharmony_ci
18862306a36Sopenharmony_ci/* Power Management registers */
18962306a36Sopenharmony_ci#define WL12XX_ELP_CFG_MODE		(REGISTERS_BASE + 0x5804)
19062306a36Sopenharmony_ci#define WL12XX_ELP_CMD			(REGISTERS_BASE + 0x5808)
19162306a36Sopenharmony_ci#define WL12XX_PLL_CAL_TIME		(REGISTERS_BASE + 0x5810)
19262306a36Sopenharmony_ci#define WL12XX_CLK_REQ_TIME		(REGISTERS_BASE + 0x5814)
19362306a36Sopenharmony_ci#define WL12XX_CLK_BUF_TIME		(REGISTERS_BASE + 0x5818)
19462306a36Sopenharmony_ci
19562306a36Sopenharmony_ci#define WL12XX_CFG_PLL_SYNC_CNT		(REGISTERS_BASE + 0x5820)
19662306a36Sopenharmony_ci
19762306a36Sopenharmony_ci/* Scratch Pad registers*/
19862306a36Sopenharmony_ci#define WL12XX_SCR_PAD0			(REGISTERS_BASE + 0x5608)
19962306a36Sopenharmony_ci#define WL12XX_SCR_PAD1			(REGISTERS_BASE + 0x560C)
20062306a36Sopenharmony_ci#define WL12XX_SCR_PAD2			(REGISTERS_BASE + 0x5610)
20162306a36Sopenharmony_ci#define WL12XX_SCR_PAD3			(REGISTERS_BASE + 0x5614)
20262306a36Sopenharmony_ci#define WL12XX_SCR_PAD4			(REGISTERS_BASE + 0x5618)
20362306a36Sopenharmony_ci#define WL12XX_SCR_PAD4_SET		(REGISTERS_BASE + 0x561C)
20462306a36Sopenharmony_ci#define WL12XX_SCR_PAD4_CLR		(REGISTERS_BASE + 0x5620)
20562306a36Sopenharmony_ci#define WL12XX_SCR_PAD5			(REGISTERS_BASE + 0x5624)
20662306a36Sopenharmony_ci#define WL12XX_SCR_PAD5_SET		(REGISTERS_BASE + 0x5628)
20762306a36Sopenharmony_ci#define WL12XX_SCR_PAD5_CLR		(REGISTERS_BASE + 0x562C)
20862306a36Sopenharmony_ci#define WL12XX_SCR_PAD6			(REGISTERS_BASE + 0x5630)
20962306a36Sopenharmony_ci#define WL12XX_SCR_PAD7			(REGISTERS_BASE + 0x5634)
21062306a36Sopenharmony_ci#define WL12XX_SCR_PAD8			(REGISTERS_BASE + 0x5638)
21162306a36Sopenharmony_ci#define WL12XX_SCR_PAD9			(REGISTERS_BASE + 0x563C)
21262306a36Sopenharmony_ci
21362306a36Sopenharmony_ci/* Spare registers*/
21462306a36Sopenharmony_ci#define WL12XX_SPARE_A1			(REGISTERS_BASE + 0x0994)
21562306a36Sopenharmony_ci#define WL12XX_SPARE_A2			(REGISTERS_BASE + 0x0998)
21662306a36Sopenharmony_ci#define WL12XX_SPARE_A3			(REGISTERS_BASE + 0x099C)
21762306a36Sopenharmony_ci#define WL12XX_SPARE_A4			(REGISTERS_BASE + 0x09A0)
21862306a36Sopenharmony_ci#define WL12XX_SPARE_A5			(REGISTERS_BASE + 0x09A4)
21962306a36Sopenharmony_ci#define WL12XX_SPARE_A6			(REGISTERS_BASE + 0x09A8)
22062306a36Sopenharmony_ci#define WL12XX_SPARE_A7			(REGISTERS_BASE + 0x09AC)
22162306a36Sopenharmony_ci#define WL12XX_SPARE_A8			(REGISTERS_BASE + 0x09B0)
22262306a36Sopenharmony_ci#define WL12XX_SPARE_B1			(REGISTERS_BASE + 0x5420)
22362306a36Sopenharmony_ci#define WL12XX_SPARE_B2			(REGISTERS_BASE + 0x5424)
22462306a36Sopenharmony_ci#define WL12XX_SPARE_B3			(REGISTERS_BASE + 0x5428)
22562306a36Sopenharmony_ci#define WL12XX_SPARE_B4			(REGISTERS_BASE + 0x542C)
22662306a36Sopenharmony_ci#define WL12XX_SPARE_B5			(REGISTERS_BASE + 0x5430)
22762306a36Sopenharmony_ci#define WL12XX_SPARE_B6			(REGISTERS_BASE + 0x5434)
22862306a36Sopenharmony_ci#define WL12XX_SPARE_B7			(REGISTERS_BASE + 0x5438)
22962306a36Sopenharmony_ci#define WL12XX_SPARE_B8			(REGISTERS_BASE + 0x543C)
23062306a36Sopenharmony_ci
23162306a36Sopenharmony_ci#define WL12XX_PLL_PARAMETERS		(REGISTERS_BASE + 0x6040)
23262306a36Sopenharmony_ci#define WL12XX_WU_COUNTER_PAUSE		(REGISTERS_BASE + 0x6008)
23362306a36Sopenharmony_ci#define WL12XX_WELP_ARM_COMMAND		(REGISTERS_BASE + 0x6100)
23462306a36Sopenharmony_ci#define WL12XX_DRPW_SCRATCH_START	(DRPW_BASE + 0x002C)
23562306a36Sopenharmony_ci
23662306a36Sopenharmony_ci#define WL12XX_CMD_MBOX_ADDRESS		0x407B4
23762306a36Sopenharmony_ci
23862306a36Sopenharmony_ci#define ACX_REG_EEPROM_START_BIT BIT(1)
23962306a36Sopenharmony_ci
24062306a36Sopenharmony_ci/* Command/Information Mailbox Pointers */
24162306a36Sopenharmony_ci
24262306a36Sopenharmony_ci/*===============================================
24362306a36Sopenharmony_ci  Command Mailbox Pointer - 32bit RW
24462306a36Sopenharmony_ci ------------------------------------------
24562306a36Sopenharmony_ci This register holds the start address of
24662306a36Sopenharmony_ci the command mailbox located in the Wlan hardware memory.
24762306a36Sopenharmony_ci The host must read this pointer after a reset to
24862306a36Sopenharmony_ci find the location of the command mailbox.
24962306a36Sopenharmony_ci The Wlan hardware initializes the command mailbox
25062306a36Sopenharmony_ci pointer with the default address of the command mailbox.
25162306a36Sopenharmony_ci The command mailbox pointer is not valid until after
25262306a36Sopenharmony_ci the host receives the Init Complete interrupt from
25362306a36Sopenharmony_ci the Wlan hardware.
25462306a36Sopenharmony_ci ===============================================*/
25562306a36Sopenharmony_ci#define WL12XX_REG_COMMAND_MAILBOX_PTR		(WL12XX_SCR_PAD0)
25662306a36Sopenharmony_ci
25762306a36Sopenharmony_ci/*===============================================
25862306a36Sopenharmony_ci  Information Mailbox Pointer - 32bit RW
25962306a36Sopenharmony_ci ------------------------------------------
26062306a36Sopenharmony_ci This register holds the start address of
26162306a36Sopenharmony_ci the information mailbox located in the Wlan hardware memory.
26262306a36Sopenharmony_ci The host must read this pointer after a reset to find
26362306a36Sopenharmony_ci the location of the information mailbox.
26462306a36Sopenharmony_ci The Wlan hardware initializes the information mailbox pointer
26562306a36Sopenharmony_ci with the default address of the information mailbox.
26662306a36Sopenharmony_ci The information mailbox pointer is not valid
26762306a36Sopenharmony_ci until after the host receives the Init Complete interrupt from
26862306a36Sopenharmony_ci the Wlan hardware.
26962306a36Sopenharmony_ci ===============================================*/
27062306a36Sopenharmony_ci#define WL12XX_REG_EVENT_MAILBOX_PTR		(WL12XX_SCR_PAD1)
27162306a36Sopenharmony_ci
27262306a36Sopenharmony_ci/*===============================================
27362306a36Sopenharmony_ci EEPROM Read/Write Request 32bit RW
27462306a36Sopenharmony_ci ------------------------------------------
27562306a36Sopenharmony_ci 1 EE_READ - EEPROM Read Request 1 - Setting this bit
27662306a36Sopenharmony_ci loads a single byte of data into the EE_DATA
27762306a36Sopenharmony_ci register from the EEPROM location specified in
27862306a36Sopenharmony_ci the EE_ADDR register.
27962306a36Sopenharmony_ci The Wlan hardware hardware clears this bit automatically.
28062306a36Sopenharmony_ci EE_DATA is valid when this bit is cleared.
28162306a36Sopenharmony_ci
28262306a36Sopenharmony_ci 0 EE_WRITE  - EEPROM Write Request  - Setting this bit
28362306a36Sopenharmony_ci writes a single byte of data from the EE_DATA register into the
28462306a36Sopenharmony_ci EEPROM location specified in the EE_ADDR register.
28562306a36Sopenharmony_ci The Wlan hardware hardware clears this bit automatically.
28662306a36Sopenharmony_ci*===============================================*/
28762306a36Sopenharmony_ci#define ACX_EE_CTL_REG                      EE_CTL
28862306a36Sopenharmony_ci#define EE_WRITE                            0x00000001ul
28962306a36Sopenharmony_ci#define EE_READ                             0x00000002ul
29062306a36Sopenharmony_ci
29162306a36Sopenharmony_ci/*===============================================
29262306a36Sopenharmony_ci  EEPROM Address  - 32bit RW
29362306a36Sopenharmony_ci  ------------------------------------------
29462306a36Sopenharmony_ci  This register specifies the address
29562306a36Sopenharmony_ci  within the EEPROM from/to which to read/write data.
29662306a36Sopenharmony_ci  ===============================================*/
29762306a36Sopenharmony_ci#define ACX_EE_ADDR_REG                     EE_ADDR
29862306a36Sopenharmony_ci
29962306a36Sopenharmony_ci/*===============================================
30062306a36Sopenharmony_ci  EEPROM Data  - 32bit RW
30162306a36Sopenharmony_ci  ------------------------------------------
30262306a36Sopenharmony_ci  This register either holds the read 8 bits of
30362306a36Sopenharmony_ci  data from the EEPROM or the write data
30462306a36Sopenharmony_ci  to be written to the EEPROM.
30562306a36Sopenharmony_ci  ===============================================*/
30662306a36Sopenharmony_ci#define ACX_EE_DATA_REG                     EE_DATA
30762306a36Sopenharmony_ci
30862306a36Sopenharmony_ci/*===============================================
30962306a36Sopenharmony_ci  EEPROM Base Address  - 32bit RW
31062306a36Sopenharmony_ci  ------------------------------------------
31162306a36Sopenharmony_ci  This register holds the upper nine bits
31262306a36Sopenharmony_ci  [23:15] of the 24-bit Wlan hardware memory
31362306a36Sopenharmony_ci  address for burst reads from EEPROM accesses.
31462306a36Sopenharmony_ci  The EEPROM provides the lower 15 bits of this address.
31562306a36Sopenharmony_ci  The MSB of the address from the EEPROM is ignored.
31662306a36Sopenharmony_ci  ===============================================*/
31762306a36Sopenharmony_ci#define ACX_EE_CFG                          EE_CFG
31862306a36Sopenharmony_ci
31962306a36Sopenharmony_ci/*===============================================
32062306a36Sopenharmony_ci  GPIO Output Values  -32bit, RW
32162306a36Sopenharmony_ci  ------------------------------------------
32262306a36Sopenharmony_ci  [31:16]  Reserved
32362306a36Sopenharmony_ci  [15: 0]  Specify the output values (at the output driver inputs) for
32462306a36Sopenharmony_ci  GPIO[15:0], respectively.
32562306a36Sopenharmony_ci  ===============================================*/
32662306a36Sopenharmony_ci#define ACX_GPIO_OUT_REG            GPIO_OUT
32762306a36Sopenharmony_ci#define ACX_MAX_GPIO_LINES          15
32862306a36Sopenharmony_ci
32962306a36Sopenharmony_ci/*===============================================
33062306a36Sopenharmony_ci  Contention window  -32bit, RW
33162306a36Sopenharmony_ci  ------------------------------------------
33262306a36Sopenharmony_ci  [31:26]  Reserved
33362306a36Sopenharmony_ci  [25:16]  Max (0x3ff)
33462306a36Sopenharmony_ci  [15:07]  Reserved
33562306a36Sopenharmony_ci  [06:00]  Current contention window value - default is 0x1F
33662306a36Sopenharmony_ci  ===============================================*/
33762306a36Sopenharmony_ci#define ACX_CONT_WIND_CFG_REG    CONT_WIND_CFG
33862306a36Sopenharmony_ci#define ACX_CONT_WIND_MIN_MASK   0x0000007f
33962306a36Sopenharmony_ci#define ACX_CONT_WIND_MAX        0x03ff0000
34062306a36Sopenharmony_ci
34162306a36Sopenharmony_ci#define REF_FREQ_19_2                       0
34262306a36Sopenharmony_ci#define REF_FREQ_26_0                       1
34362306a36Sopenharmony_ci#define REF_FREQ_38_4                       2
34462306a36Sopenharmony_ci#define REF_FREQ_40_0                       3
34562306a36Sopenharmony_ci#define REF_FREQ_33_6                       4
34662306a36Sopenharmony_ci#define REF_FREQ_NUM                        5
34762306a36Sopenharmony_ci
34862306a36Sopenharmony_ci#define LUT_PARAM_INTEGER_DIVIDER           0
34962306a36Sopenharmony_ci#define LUT_PARAM_FRACTIONAL_DIVIDER        1
35062306a36Sopenharmony_ci#define LUT_PARAM_ATTN_BB                   2
35162306a36Sopenharmony_ci#define LUT_PARAM_ALPHA_BB                  3
35262306a36Sopenharmony_ci#define LUT_PARAM_STOP_TIME_BB              4
35362306a36Sopenharmony_ci#define LUT_PARAM_BB_PLL_LOOP_FILTER        5
35462306a36Sopenharmony_ci#define LUT_PARAM_NUM                       6
35562306a36Sopenharmony_ci
35662306a36Sopenharmony_ci#define WL12XX_EEPROMLESS_IND		(WL12XX_SCR_PAD4)
35762306a36Sopenharmony_ci#define USE_EEPROM                          0
35862306a36Sopenharmony_ci#define NVS_DATA_BUNDARY_ALIGNMENT          4
35962306a36Sopenharmony_ci
36062306a36Sopenharmony_ci/* Firmware image header size */
36162306a36Sopenharmony_ci#define FW_HDR_SIZE 8
36262306a36Sopenharmony_ci
36362306a36Sopenharmony_ci/******************************************************************************
36462306a36Sopenharmony_ci
36562306a36Sopenharmony_ci    CHANNELS, BAND & REG DOMAINS definitions
36662306a36Sopenharmony_ci
36762306a36Sopenharmony_ci******************************************************************************/
36862306a36Sopenharmony_ci
36962306a36Sopenharmony_ci#define SHORT_PREAMBLE_BIT   BIT(0) /* CCK or Barker depending on the rate */
37062306a36Sopenharmony_ci#define OFDM_RATE_BIT        BIT(6)
37162306a36Sopenharmony_ci#define PBCC_RATE_BIT        BIT(7)
37262306a36Sopenharmony_ci
37362306a36Sopenharmony_cienum {
37462306a36Sopenharmony_ci	CCK_LONG = 0,
37562306a36Sopenharmony_ci	CCK_SHORT = SHORT_PREAMBLE_BIT,
37662306a36Sopenharmony_ci	PBCC_LONG = PBCC_RATE_BIT,
37762306a36Sopenharmony_ci	PBCC_SHORT = PBCC_RATE_BIT | SHORT_PREAMBLE_BIT,
37862306a36Sopenharmony_ci	OFDM = OFDM_RATE_BIT
37962306a36Sopenharmony_ci};
38062306a36Sopenharmony_ci
38162306a36Sopenharmony_ci/******************************************************************************
38262306a36Sopenharmony_ci
38362306a36Sopenharmony_ciTransmit-Descriptor RATE-SET field definitions...
38462306a36Sopenharmony_ci
38562306a36Sopenharmony_ciDefine a new "Rate-Set" for TX path that incorporates the
38662306a36Sopenharmony_ciRate & Modulation info into a single 16-bit field.
38762306a36Sopenharmony_ci
38862306a36Sopenharmony_ciTxdRateSet_t:
38962306a36Sopenharmony_cib15   - Indicates Preamble type (1=SHORT, 0=LONG).
39062306a36Sopenharmony_ci	Notes:
39162306a36Sopenharmony_ci	Must be LONG (0) for 1Mbps rate.
39262306a36Sopenharmony_ci	Does not apply (set to 0) for RevG-OFDM rates.
39362306a36Sopenharmony_cib14   - Indicates PBCC encoding (1=PBCC, 0=not).
39462306a36Sopenharmony_ci	Notes:
39562306a36Sopenharmony_ci	Does not apply (set to 0) for rates 1 and 2 Mbps.
39662306a36Sopenharmony_ci	Does not apply (set to 0) for RevG-OFDM rates.
39762306a36Sopenharmony_cib13    - Unused (set to 0).
39862306a36Sopenharmony_cib12-b0 - Supported Rate indicator bits as defined below.
39962306a36Sopenharmony_ci
40062306a36Sopenharmony_ci******************************************************************************/
40162306a36Sopenharmony_ci
40262306a36Sopenharmony_ci#define OCP_CMD_LOOP		32
40362306a36Sopenharmony_ci#define OCP_CMD_WRITE		0x1
40462306a36Sopenharmony_ci#define OCP_CMD_READ		0x2
40562306a36Sopenharmony_ci#define OCP_READY_MASK		BIT(18)
40662306a36Sopenharmony_ci#define OCP_STATUS_MASK		(BIT(16) | BIT(17))
40762306a36Sopenharmony_ci#define OCP_STATUS_NO_RESP	0x00000
40862306a36Sopenharmony_ci#define OCP_STATUS_OK		0x10000
40962306a36Sopenharmony_ci#define OCP_STATUS_REQ_FAILED	0x20000
41062306a36Sopenharmony_ci#define OCP_STATUS_RESP_ERROR	0x30000
41162306a36Sopenharmony_ci
41262306a36Sopenharmony_ci#define OCP_REG_POLARITY     0x0064
41362306a36Sopenharmony_ci#define OCP_REG_CLK_TYPE     0x0448
41462306a36Sopenharmony_ci#define OCP_REG_CLK_POLARITY 0x0cb2
41562306a36Sopenharmony_ci#define OCP_REG_CLK_PULL     0x0cb4
41662306a36Sopenharmony_ci
41762306a36Sopenharmony_ci#define POLARITY_LOW         BIT(1)
41862306a36Sopenharmony_ci#define NO_PULL              (BIT(14) | BIT(15))
41962306a36Sopenharmony_ci
42062306a36Sopenharmony_ci#define FREF_CLK_TYPE_BITS     0xfffffe7f
42162306a36Sopenharmony_ci#define CLK_REQ_PRCM           0x100
42262306a36Sopenharmony_ci#define FREF_CLK_POLARITY_BITS 0xfffff8ff
42362306a36Sopenharmony_ci#define CLK_REQ_OUTN_SEL       0x700
42462306a36Sopenharmony_ci
42562306a36Sopenharmony_ci#define WU_COUNTER_PAUSE_VAL 0x3FF
42662306a36Sopenharmony_ci
42762306a36Sopenharmony_ci/* PLL configuration algorithm for wl128x */
42862306a36Sopenharmony_ci#define SYS_CLK_CFG_REG              0x2200
42962306a36Sopenharmony_ci/* Bit[0]   -  0-TCXO,  1-FREF */
43062306a36Sopenharmony_ci#define MCS_PLL_CLK_SEL_FREF         BIT(0)
43162306a36Sopenharmony_ci/* Bit[3:2] - 01-TCXO, 10-FREF */
43262306a36Sopenharmony_ci#define WL_CLK_REQ_TYPE_FREF         BIT(3)
43362306a36Sopenharmony_ci#define WL_CLK_REQ_TYPE_PG2          (BIT(3) | BIT(2))
43462306a36Sopenharmony_ci/* Bit[4]   -  0-TCXO,  1-FREF */
43562306a36Sopenharmony_ci#define PRCM_CM_EN_MUX_WLAN_FREF     BIT(4)
43662306a36Sopenharmony_ci
43762306a36Sopenharmony_ci#define TCXO_ILOAD_INT_REG           0x2264
43862306a36Sopenharmony_ci#define TCXO_CLK_DETECT_REG          0x2266
43962306a36Sopenharmony_ci
44062306a36Sopenharmony_ci#define TCXO_DET_FAILED              BIT(4)
44162306a36Sopenharmony_ci
44262306a36Sopenharmony_ci#define FREF_ILOAD_INT_REG           0x2084
44362306a36Sopenharmony_ci#define FREF_CLK_DETECT_REG          0x2086
44462306a36Sopenharmony_ci#define FREF_CLK_DETECT_FAIL         BIT(4)
44562306a36Sopenharmony_ci
44662306a36Sopenharmony_ci/* Use this reg for masking during driver access */
44762306a36Sopenharmony_ci#define WL_SPARE_REG                 0x2320
44862306a36Sopenharmony_ci#define WL_SPARE_VAL                 BIT(2)
44962306a36Sopenharmony_ci/* Bit[6:5:3] -  mask wl write SYS_CLK_CFG[8:5:2:4] */
45062306a36Sopenharmony_ci#define WL_SPARE_MASK_8526           (BIT(6) | BIT(5) | BIT(3))
45162306a36Sopenharmony_ci
45262306a36Sopenharmony_ci#define PLL_LOCK_COUNTERS_REG        0xD8C
45362306a36Sopenharmony_ci#define PLL_LOCK_COUNTERS_COEX       0x0F
45462306a36Sopenharmony_ci#define PLL_LOCK_COUNTERS_MCS        0xF0
45562306a36Sopenharmony_ci#define MCS_PLL_OVERRIDE_REG         0xD90
45662306a36Sopenharmony_ci#define MCS_PLL_CONFIG_REG           0xD92
45762306a36Sopenharmony_ci#define MCS_SEL_IN_FREQ_MASK         0x0070
45862306a36Sopenharmony_ci#define MCS_SEL_IN_FREQ_SHIFT        4
45962306a36Sopenharmony_ci#define MCS_PLL_CONFIG_REG_VAL       0x73
46062306a36Sopenharmony_ci#define MCS_PLL_ENABLE_HP            (BIT(0) | BIT(1))
46162306a36Sopenharmony_ci
46262306a36Sopenharmony_ci#define MCS_PLL_M_REG                0xD94
46362306a36Sopenharmony_ci#define MCS_PLL_N_REG                0xD96
46462306a36Sopenharmony_ci#define MCS_PLL_M_REG_VAL            0xC8
46562306a36Sopenharmony_ci#define MCS_PLL_N_REG_VAL            0x07
46662306a36Sopenharmony_ci
46762306a36Sopenharmony_ci#define SDIO_IO_DS                   0xd14
46862306a36Sopenharmony_ci
46962306a36Sopenharmony_ci/* SDIO/wSPI DS configuration values */
47062306a36Sopenharmony_cienum {
47162306a36Sopenharmony_ci	HCI_IO_DS_8MA = 0,
47262306a36Sopenharmony_ci	HCI_IO_DS_4MA = 1, /* default */
47362306a36Sopenharmony_ci	HCI_IO_DS_6MA = 2,
47462306a36Sopenharmony_ci	HCI_IO_DS_2MA = 3,
47562306a36Sopenharmony_ci};
47662306a36Sopenharmony_ci
47762306a36Sopenharmony_ci/* end PLL configuration algorithm for wl128x */
47862306a36Sopenharmony_ci
47962306a36Sopenharmony_ci/*
48062306a36Sopenharmony_ci * Host Command Interrupt. Setting this bit masks
48162306a36Sopenharmony_ci * the interrupt that the host issues to inform
48262306a36Sopenharmony_ci * the FW that it has sent a command
48362306a36Sopenharmony_ci * to the Wlan hardware Command Mailbox.
48462306a36Sopenharmony_ci */
48562306a36Sopenharmony_ci#define WL12XX_INTR_TRIG_CMD		BIT(0)
48662306a36Sopenharmony_ci
48762306a36Sopenharmony_ci/*
48862306a36Sopenharmony_ci * Host Event Acknowlegde Interrupt. The host
48962306a36Sopenharmony_ci * sets this bit to acknowledge that it received
49062306a36Sopenharmony_ci * the unsolicited information from the event
49162306a36Sopenharmony_ci * mailbox.
49262306a36Sopenharmony_ci */
49362306a36Sopenharmony_ci#define WL12XX_INTR_TRIG_EVENT_ACK	BIT(1)
49462306a36Sopenharmony_ci
49562306a36Sopenharmony_ci/*===============================================
49662306a36Sopenharmony_ci  HI_CFG Interface Configuration Register Values
49762306a36Sopenharmony_ci  ------------------------------------------
49862306a36Sopenharmony_ci  ===============================================*/
49962306a36Sopenharmony_ci#define HI_CFG_UART_ENABLE          0x00000004
50062306a36Sopenharmony_ci#define HI_CFG_RST232_ENABLE        0x00000008
50162306a36Sopenharmony_ci#define HI_CFG_CLOCK_REQ_SELECT     0x00000010
50262306a36Sopenharmony_ci#define HI_CFG_HOST_INT_ENABLE      0x00000020
50362306a36Sopenharmony_ci#define HI_CFG_VLYNQ_OUTPUT_ENABLE  0x00000040
50462306a36Sopenharmony_ci#define HI_CFG_HOST_INT_ACTIVE_LOW  0x00000080
50562306a36Sopenharmony_ci#define HI_CFG_UART_TX_OUT_GPIO_15  0x00000100
50662306a36Sopenharmony_ci#define HI_CFG_UART_TX_OUT_GPIO_14  0x00000200
50762306a36Sopenharmony_ci#define HI_CFG_UART_TX_OUT_GPIO_7   0x00000400
50862306a36Sopenharmony_ci
50962306a36Sopenharmony_ci#define HI_CFG_DEF_VAL              \
51062306a36Sopenharmony_ci	(HI_CFG_UART_ENABLE |        \
51162306a36Sopenharmony_ci	HI_CFG_RST232_ENABLE |      \
51262306a36Sopenharmony_ci	HI_CFG_CLOCK_REQ_SELECT |   \
51362306a36Sopenharmony_ci	HI_CFG_HOST_INT_ENABLE)
51462306a36Sopenharmony_ci
51562306a36Sopenharmony_ci#define WL127X_REG_FUSE_DATA_2_1	0x050a
51662306a36Sopenharmony_ci#define WL128X_REG_FUSE_DATA_2_1	0x2152
51762306a36Sopenharmony_ci#define PG_VER_MASK			0x3c
51862306a36Sopenharmony_ci#define PG_VER_OFFSET			2
51962306a36Sopenharmony_ci
52062306a36Sopenharmony_ci#define WL127X_PG_MAJOR_VER_MASK	0x3
52162306a36Sopenharmony_ci#define WL127X_PG_MAJOR_VER_OFFSET	0x0
52262306a36Sopenharmony_ci#define WL127X_PG_MINOR_VER_MASK	0xc
52362306a36Sopenharmony_ci#define WL127X_PG_MINOR_VER_OFFSET	0x2
52462306a36Sopenharmony_ci
52562306a36Sopenharmony_ci#define WL128X_PG_MAJOR_VER_MASK	0xc
52662306a36Sopenharmony_ci#define WL128X_PG_MAJOR_VER_OFFSET	0x2
52762306a36Sopenharmony_ci#define WL128X_PG_MINOR_VER_MASK	0x3
52862306a36Sopenharmony_ci#define WL128X_PG_MINOR_VER_OFFSET	0x0
52962306a36Sopenharmony_ci
53062306a36Sopenharmony_ci#define WL127X_PG_GET_MAJOR(pg_ver) ((pg_ver & WL127X_PG_MAJOR_VER_MASK) >> \
53162306a36Sopenharmony_ci				     WL127X_PG_MAJOR_VER_OFFSET)
53262306a36Sopenharmony_ci#define WL127X_PG_GET_MINOR(pg_ver) ((pg_ver & WL127X_PG_MINOR_VER_MASK) >> \
53362306a36Sopenharmony_ci				     WL127X_PG_MINOR_VER_OFFSET)
53462306a36Sopenharmony_ci#define WL128X_PG_GET_MAJOR(pg_ver) ((pg_ver & WL128X_PG_MAJOR_VER_MASK) >> \
53562306a36Sopenharmony_ci				     WL128X_PG_MAJOR_VER_OFFSET)
53662306a36Sopenharmony_ci#define WL128X_PG_GET_MINOR(pg_ver) ((pg_ver & WL128X_PG_MINOR_VER_MASK) >> \
53762306a36Sopenharmony_ci				     WL128X_PG_MINOR_VER_OFFSET)
53862306a36Sopenharmony_ci
53962306a36Sopenharmony_ci#define WL12XX_REG_FUSE_BD_ADDR_1	0x00310eb4
54062306a36Sopenharmony_ci#define WL12XX_REG_FUSE_BD_ADDR_2	0x00310eb8
54162306a36Sopenharmony_ci
54262306a36Sopenharmony_ci#endif
543