162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * This file is part of wlcore
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2011 Texas Instruments Inc.
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifndef __REG_H__
962306a36Sopenharmony_ci#define __REG_H__
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#define WL18XX_REGISTERS_BASE      0x00800000
1262306a36Sopenharmony_ci#define WL18XX_CODE_BASE           0x00000000
1362306a36Sopenharmony_ci#define WL18XX_DATA_BASE           0x00400000
1462306a36Sopenharmony_ci#define WL18XX_DOUBLE_BUFFER_BASE  0x00600000
1562306a36Sopenharmony_ci#define WL18XX_MCU_KEY_SEARCH_BASE 0x00700000
1662306a36Sopenharmony_ci#define WL18XX_PHY_BASE            0x00900000
1762306a36Sopenharmony_ci#define WL18XX_TOP_OCP_BASE        0x00A00000
1862306a36Sopenharmony_ci#define WL18XX_PACKET_RAM_BASE     0x00B00000
1962306a36Sopenharmony_ci#define WL18XX_HOST_BASE           0x00C00000
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci#define WL18XX_REGISTERS_DOWN_SIZE 0x0000B000
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci#define WL18XX_REG_BOOT_PART_START 0x00802000
2462306a36Sopenharmony_ci#define WL18XX_REG_BOOT_PART_SIZE  0x00014578
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci#define WL18XX_PHY_INIT_MEM_ADDR   0x80926000
2762306a36Sopenharmony_ci#define WL18XX_PHY_END_MEM_ADDR	   0x8093CA44
2862306a36Sopenharmony_ci#define WL18XX_PHY_INIT_MEM_SIZE \
2962306a36Sopenharmony_ci	(WL18XX_PHY_END_MEM_ADDR - WL18XX_PHY_INIT_MEM_ADDR)
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci#define WL18XX_SDIO_WSPI_BASE		(WL18XX_REGISTERS_BASE)
3262306a36Sopenharmony_ci#define WL18XX_REG_CONFIG_BASE		(WL18XX_REGISTERS_BASE + 0x02000)
3362306a36Sopenharmony_ci#define WL18XX_WGCM_REGS_BASE		(WL18XX_REGISTERS_BASE + 0x03000)
3462306a36Sopenharmony_ci#define WL18XX_ENC_BASE			(WL18XX_REGISTERS_BASE + 0x04000)
3562306a36Sopenharmony_ci#define WL18XX_INTERRUPT_BASE		(WL18XX_REGISTERS_BASE + 0x05000)
3662306a36Sopenharmony_ci#define WL18XX_UART_BASE		(WL18XX_REGISTERS_BASE + 0x06000)
3762306a36Sopenharmony_ci#define WL18XX_WELP_BASE		(WL18XX_REGISTERS_BASE + 0x07000)
3862306a36Sopenharmony_ci#define WL18XX_TCP_CKSM_BASE		(WL18XX_REGISTERS_BASE + 0x08000)
3962306a36Sopenharmony_ci#define WL18XX_FIFO_BASE		(WL18XX_REGISTERS_BASE + 0x09000)
4062306a36Sopenharmony_ci#define WL18XX_OCP_BRIDGE_BASE		(WL18XX_REGISTERS_BASE + 0x0A000)
4162306a36Sopenharmony_ci#define WL18XX_PMAC_RX_BASE		(WL18XX_REGISTERS_BASE + 0x14800)
4262306a36Sopenharmony_ci#define WL18XX_PMAC_ACM_BASE		(WL18XX_REGISTERS_BASE + 0x14C00)
4362306a36Sopenharmony_ci#define WL18XX_PMAC_TX_BASE		(WL18XX_REGISTERS_BASE + 0x15000)
4462306a36Sopenharmony_ci#define WL18XX_PMAC_CSR_BASE		(WL18XX_REGISTERS_BASE + 0x15400)
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci#define WL18XX_REG_ECPU_CONTROL		(WL18XX_REGISTERS_BASE + 0x02004)
4762306a36Sopenharmony_ci#define WL18XX_REG_INTERRUPT_NO_CLEAR	(WL18XX_REGISTERS_BASE + 0x050E8)
4862306a36Sopenharmony_ci#define WL18XX_REG_INTERRUPT_ACK	(WL18XX_REGISTERS_BASE + 0x050F0)
4962306a36Sopenharmony_ci#define WL18XX_REG_INTERRUPT_TRIG	(WL18XX_REGISTERS_BASE + 0x5074)
5062306a36Sopenharmony_ci#define WL18XX_REG_INTERRUPT_TRIG_H	(WL18XX_REGISTERS_BASE + 0x5078)
5162306a36Sopenharmony_ci#define WL18XX_REG_INTERRUPT_MASK	(WL18XX_REGISTERS_BASE + 0x0050DC)
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci#define WL18XX_REG_CHIP_ID_B		(WL18XX_REGISTERS_BASE + 0x01542C)
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci#define WL18XX_SLV_MEM_DATA		(WL18XX_HOST_BASE + 0x0018)
5662306a36Sopenharmony_ci#define WL18XX_SLV_REG_DATA		(WL18XX_HOST_BASE + 0x0008)
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci/* Scratch Pad registers*/
5962306a36Sopenharmony_ci#define WL18XX_SCR_PAD0			(WL18XX_REGISTERS_BASE + 0x0154EC)
6062306a36Sopenharmony_ci#define WL18XX_SCR_PAD1			(WL18XX_REGISTERS_BASE + 0x0154F0)
6162306a36Sopenharmony_ci#define WL18XX_SCR_PAD2			(WL18XX_REGISTERS_BASE + 0x0154F4)
6262306a36Sopenharmony_ci#define WL18XX_SCR_PAD3			(WL18XX_REGISTERS_BASE + 0x0154F8)
6362306a36Sopenharmony_ci#define WL18XX_SCR_PAD4			(WL18XX_REGISTERS_BASE + 0x0154FC)
6462306a36Sopenharmony_ci#define WL18XX_SCR_PAD4_SET		(WL18XX_REGISTERS_BASE + 0x015504)
6562306a36Sopenharmony_ci#define WL18XX_SCR_PAD4_CLR		(WL18XX_REGISTERS_BASE + 0x015500)
6662306a36Sopenharmony_ci#define WL18XX_SCR_PAD5			(WL18XX_REGISTERS_BASE + 0x015508)
6762306a36Sopenharmony_ci#define WL18XX_SCR_PAD5_SET		(WL18XX_REGISTERS_BASE + 0x015510)
6862306a36Sopenharmony_ci#define WL18XX_SCR_PAD5_CLR		(WL18XX_REGISTERS_BASE + 0x01550C)
6962306a36Sopenharmony_ci#define WL18XX_SCR_PAD6			(WL18XX_REGISTERS_BASE + 0x015514)
7062306a36Sopenharmony_ci#define WL18XX_SCR_PAD7			(WL18XX_REGISTERS_BASE + 0x015518)
7162306a36Sopenharmony_ci#define WL18XX_SCR_PAD8			(WL18XX_REGISTERS_BASE + 0x01551C)
7262306a36Sopenharmony_ci#define WL18XX_SCR_PAD9			(WL18XX_REGISTERS_BASE + 0x015520)
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci/* Spare registers*/
7562306a36Sopenharmony_ci#define WL18XX_SPARE_A1			(WL18XX_REGISTERS_BASE + 0x002194)
7662306a36Sopenharmony_ci#define WL18XX_SPARE_A2			(WL18XX_REGISTERS_BASE + 0x002198)
7762306a36Sopenharmony_ci#define WL18XX_SPARE_A3			(WL18XX_REGISTERS_BASE + 0x00219C)
7862306a36Sopenharmony_ci#define WL18XX_SPARE_A4			(WL18XX_REGISTERS_BASE + 0x0021A0)
7962306a36Sopenharmony_ci#define WL18XX_SPARE_A5			(WL18XX_REGISTERS_BASE + 0x0021A4)
8062306a36Sopenharmony_ci#define WL18XX_SPARE_A6			(WL18XX_REGISTERS_BASE + 0x0021A8)
8162306a36Sopenharmony_ci#define WL18XX_SPARE_A7			(WL18XX_REGISTERS_BASE + 0x0021AC)
8262306a36Sopenharmony_ci#define WL18XX_SPARE_A8			(WL18XX_REGISTERS_BASE + 0x0021B0)
8362306a36Sopenharmony_ci#define WL18XX_SPARE_B1			(WL18XX_REGISTERS_BASE + 0x015524)
8462306a36Sopenharmony_ci#define WL18XX_SPARE_B2			(WL18XX_REGISTERS_BASE + 0x015528)
8562306a36Sopenharmony_ci#define WL18XX_SPARE_B3			(WL18XX_REGISTERS_BASE + 0x01552C)
8662306a36Sopenharmony_ci#define WL18XX_SPARE_B4			(WL18XX_REGISTERS_BASE + 0x015530)
8762306a36Sopenharmony_ci#define WL18XX_SPARE_B5			(WL18XX_REGISTERS_BASE + 0x015534)
8862306a36Sopenharmony_ci#define WL18XX_SPARE_B6			(WL18XX_REGISTERS_BASE + 0x015538)
8962306a36Sopenharmony_ci#define WL18XX_SPARE_B7			(WL18XX_REGISTERS_BASE + 0x01553C)
9062306a36Sopenharmony_ci#define WL18XX_SPARE_B8			(WL18XX_REGISTERS_BASE + 0x015540)
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci#define WL18XX_REG_COMMAND_MAILBOX_PTR	(WL18XX_SCR_PAD0)
9362306a36Sopenharmony_ci#define WL18XX_REG_EVENT_MAILBOX_PTR	(WL18XX_SCR_PAD1)
9462306a36Sopenharmony_ci#define WL18XX_EEPROMLESS_IND		(WL18XX_SCR_PAD4)
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci#define WL18XX_WELP_ARM_COMMAND		(WL18XX_REGISTERS_BASE + 0x7100)
9762306a36Sopenharmony_ci#define WL18XX_ENABLE			(WL18XX_REGISTERS_BASE + 0x01543C)
9862306a36Sopenharmony_ci#define TOP_FN0_CCCR_REG_32		(WL18XX_TOP_OCP_BASE + 0x64)
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ci/* PRCM registers */
10162306a36Sopenharmony_ci#define PLATFORM_DETECTION		0xA0E3E0
10262306a36Sopenharmony_ci#define OCS_EN				0xA02080
10362306a36Sopenharmony_ci#define PRIMARY_CLK_DETECT		0xA020A6
10462306a36Sopenharmony_ci#define PLLSH_COEX_PLL_N		0xA02384
10562306a36Sopenharmony_ci#define PLLSH_COEX_PLL_M		0xA02382
10662306a36Sopenharmony_ci#define PLLSH_COEX_PLL_SWALLOW_EN	0xA0238E
10762306a36Sopenharmony_ci#define PLLSH_WL_PLL_SEL		0xA02398
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ci#define PLLSH_WCS_PLL_N			0xA02362
11062306a36Sopenharmony_ci#define PLLSH_WCS_PLL_M			0xA02360
11162306a36Sopenharmony_ci#define PLLSH_WCS_PLL_Q_FACTOR_CFG_1	0xA02364
11262306a36Sopenharmony_ci#define PLLSH_WCS_PLL_Q_FACTOR_CFG_2	0xA02366
11362306a36Sopenharmony_ci#define PLLSH_WCS_PLL_P_FACTOR_CFG_1	0xA02368
11462306a36Sopenharmony_ci#define PLLSH_WCS_PLL_P_FACTOR_CFG_2	0xA0236A
11562306a36Sopenharmony_ci#define PLLSH_WCS_PLL_SWALLOW_EN	0xA0236C
11662306a36Sopenharmony_ci#define PLLSH_WL_PLL_EN			0xA02392
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ci#define PLLSH_WCS_PLL_Q_FACTOR_CFG_1_MASK	0xFFFF
11962306a36Sopenharmony_ci#define PLLSH_WCS_PLL_Q_FACTOR_CFG_2_MASK	0x007F
12062306a36Sopenharmony_ci#define PLLSH_WCS_PLL_P_FACTOR_CFG_1_MASK	0xFFFF
12162306a36Sopenharmony_ci#define PLLSH_WCS_PLL_P_FACTOR_CFG_2_MASK	0x000F
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci#define PLLSH_WL_PLL_EN_VAL1		0x7
12462306a36Sopenharmony_ci#define PLLSH_WL_PLL_EN_VAL2		0x2
12562306a36Sopenharmony_ci#define PLLSH_COEX_PLL_SWALLOW_EN_VAL1	0x2
12662306a36Sopenharmony_ci#define PLLSH_COEX_PLL_SWALLOW_EN_VAL2	0x11
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_ci#define PLLSH_WCS_PLL_SWALLOW_EN_VAL1	0x1
12962306a36Sopenharmony_ci#define PLLSH_WCS_PLL_SWALLOW_EN_VAL2	0x12
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ci#define PLLSH_WL_PLL_SEL_WCS_PLL	0x0
13262306a36Sopenharmony_ci#define PLLSH_WL_PLL_SEL_COEX_PLL	0x1
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ci#define WL18XX_REG_FUSE_DATA_1_3	0xA0260C
13562306a36Sopenharmony_ci#define WL18XX_PG_VER_MASK		0x70
13662306a36Sopenharmony_ci#define WL18XX_PG_VER_OFFSET		4
13762306a36Sopenharmony_ci#define WL18XX_ROM_VER_MASK		0x3e00
13862306a36Sopenharmony_ci#define WL18XX_ROM_VER_OFFSET		9
13962306a36Sopenharmony_ci#define WL18XX_METAL_VER_MASK		0xC
14062306a36Sopenharmony_ci#define WL18XX_METAL_VER_OFFSET		2
14162306a36Sopenharmony_ci#define WL18XX_NEW_METAL_VER_MASK	0x180
14262306a36Sopenharmony_ci#define WL18XX_NEW_METAL_VER_OFFSET	7
14362306a36Sopenharmony_ci
14462306a36Sopenharmony_ci#define WL18XX_PACKAGE_TYPE_OFFSET	13
14562306a36Sopenharmony_ci#define WL18XX_PACKAGE_TYPE_WSP		0
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_ci#define WL18XX_REG_FUSE_DATA_2_3	0xA02614
14862306a36Sopenharmony_ci#define WL18XX_RDL_VER_MASK		0x1f00
14962306a36Sopenharmony_ci#define WL18XX_RDL_VER_OFFSET		8
15062306a36Sopenharmony_ci
15162306a36Sopenharmony_ci#define WL18XX_REG_FUSE_BD_ADDR_1	0xA02602
15262306a36Sopenharmony_ci#define WL18XX_REG_FUSE_BD_ADDR_2	0xA02606
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_ci#define WL18XX_CMD_MBOX_ADDRESS		0xB007B4
15562306a36Sopenharmony_ci
15662306a36Sopenharmony_ci#define WL18XX_FW_STATUS_ADDR		0x50F8
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_ci#define CHIP_ID_185x_PG10              (0x06030101)
15962306a36Sopenharmony_ci#define CHIP_ID_185x_PG20              (0x06030111)
16062306a36Sopenharmony_ci
16162306a36Sopenharmony_ci/*
16262306a36Sopenharmony_ci * Host Command Interrupt. Setting this bit masks
16362306a36Sopenharmony_ci * the interrupt that the host issues to inform
16462306a36Sopenharmony_ci * the FW that it has sent a command
16562306a36Sopenharmony_ci * to the Wlan hardware Command Mailbox.
16662306a36Sopenharmony_ci */
16762306a36Sopenharmony_ci#define WL18XX_INTR_TRIG_CMD       BIT(28)
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_ci/*
17062306a36Sopenharmony_ci * Host Event Acknowlegde Interrupt. The host
17162306a36Sopenharmony_ci * sets this bit to acknowledge that it received
17262306a36Sopenharmony_ci * the unsolicited information from the event
17362306a36Sopenharmony_ci * mailbox.
17462306a36Sopenharmony_ci */
17562306a36Sopenharmony_ci#define WL18XX_INTR_TRIG_EVENT_ACK BIT(29)
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ci/*
17862306a36Sopenharmony_ci * To boot the firmware in PLT mode we need to write this value in
17962306a36Sopenharmony_ci * SCR_PAD8 before starting.
18062306a36Sopenharmony_ci */
18162306a36Sopenharmony_ci#define WL18XX_SCR_PAD8_PLT	0xBABABEBE
18262306a36Sopenharmony_ci
18362306a36Sopenharmony_cienum {
18462306a36Sopenharmony_ci	COMPONENT_NO_SWITCH	= 0x0,
18562306a36Sopenharmony_ci	COMPONENT_2_WAY_SWITCH	= 0x1,
18662306a36Sopenharmony_ci	COMPONENT_3_WAY_SWITCH	= 0x2,
18762306a36Sopenharmony_ci	COMPONENT_MATCHING	= 0x3,
18862306a36Sopenharmony_ci};
18962306a36Sopenharmony_ci
19062306a36Sopenharmony_cienum {
19162306a36Sopenharmony_ci	FEM_NONE	= 0x0,
19262306a36Sopenharmony_ci	FEM_VENDOR_1	= 0x1,
19362306a36Sopenharmony_ci	FEM_VENDOR_2	= 0x2,
19462306a36Sopenharmony_ci	FEM_VENDOR_3	= 0x3,
19562306a36Sopenharmony_ci};
19662306a36Sopenharmony_ci
19762306a36Sopenharmony_cienum {
19862306a36Sopenharmony_ci	BOARD_TYPE_EVB_18XX     = 0,
19962306a36Sopenharmony_ci	BOARD_TYPE_DVP_18XX     = 1,
20062306a36Sopenharmony_ci	BOARD_TYPE_HDK_18XX     = 2,
20162306a36Sopenharmony_ci	BOARD_TYPE_FPGA_18XX    = 3,
20262306a36Sopenharmony_ci	BOARD_TYPE_COM8_18XX    = 4,
20362306a36Sopenharmony_ci
20462306a36Sopenharmony_ci	NUM_BOARD_TYPES,
20562306a36Sopenharmony_ci};
20662306a36Sopenharmony_ci
20762306a36Sopenharmony_cienum wl18xx_rdl_num {
20862306a36Sopenharmony_ci	RDL_NONE	= 0,
20962306a36Sopenharmony_ci	RDL_1_HP	= 1,
21062306a36Sopenharmony_ci	RDL_2_SP	= 2,
21162306a36Sopenharmony_ci	RDL_3_HP	= 3,
21262306a36Sopenharmony_ci	RDL_4_SP	= 4,
21362306a36Sopenharmony_ci	RDL_5_SP	= 0x11,
21462306a36Sopenharmony_ci	RDL_6_SP	= 0x12,
21562306a36Sopenharmony_ci	RDL_7_SP	= 0x13,
21662306a36Sopenharmony_ci	RDL_8_SP	= 0x14,
21762306a36Sopenharmony_ci
21862306a36Sopenharmony_ci	_RDL_LAST,
21962306a36Sopenharmony_ci	RDL_MAX = _RDL_LAST - 1,
22062306a36Sopenharmony_ci};
22162306a36Sopenharmony_ci
22262306a36Sopenharmony_ci
22362306a36Sopenharmony_ci/* FPGA_SPARE_1 register - used to change the PHY ATPG clock at boot time */
22462306a36Sopenharmony_ci#define WL18XX_PHY_FPGA_SPARE_1		0x8093CA40
22562306a36Sopenharmony_ci
22662306a36Sopenharmony_ci/* command to disable FDSP clock */
22762306a36Sopenharmony_ci#define MEM_FDSP_CLK_120_DISABLE        0x80000000
22862306a36Sopenharmony_ci
22962306a36Sopenharmony_ci/* command to set ATPG clock toward FDSP Code RAM rather than its own clock */
23062306a36Sopenharmony_ci#define MEM_FDSP_CODERAM_FUNC_CLK_SEL	0xC0000000
23162306a36Sopenharmony_ci
23262306a36Sopenharmony_ci/* command to re-enable FDSP clock */
23362306a36Sopenharmony_ci#define MEM_FDSP_CLK_120_ENABLE		0x40000000
23462306a36Sopenharmony_ci
23562306a36Sopenharmony_ci#endif /* __REG_H__ */
236