18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * This file is part of wlcore 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2011 Texas Instruments Inc. 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef __REG_H__ 98c2ecf20Sopenharmony_ci#define __REG_H__ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#define WL18XX_REGISTERS_BASE 0x00800000 128c2ecf20Sopenharmony_ci#define WL18XX_CODE_BASE 0x00000000 138c2ecf20Sopenharmony_ci#define WL18XX_DATA_BASE 0x00400000 148c2ecf20Sopenharmony_ci#define WL18XX_DOUBLE_BUFFER_BASE 0x00600000 158c2ecf20Sopenharmony_ci#define WL18XX_MCU_KEY_SEARCH_BASE 0x00700000 168c2ecf20Sopenharmony_ci#define WL18XX_PHY_BASE 0x00900000 178c2ecf20Sopenharmony_ci#define WL18XX_TOP_OCP_BASE 0x00A00000 188c2ecf20Sopenharmony_ci#define WL18XX_PACKET_RAM_BASE 0x00B00000 198c2ecf20Sopenharmony_ci#define WL18XX_HOST_BASE 0x00C00000 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#define WL18XX_REGISTERS_DOWN_SIZE 0x0000B000 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci#define WL18XX_REG_BOOT_PART_START 0x00802000 248c2ecf20Sopenharmony_ci#define WL18XX_REG_BOOT_PART_SIZE 0x00014578 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci#define WL18XX_PHY_INIT_MEM_ADDR 0x80926000 278c2ecf20Sopenharmony_ci#define WL18XX_PHY_END_MEM_ADDR 0x8093CA44 288c2ecf20Sopenharmony_ci#define WL18XX_PHY_INIT_MEM_SIZE \ 298c2ecf20Sopenharmony_ci (WL18XX_PHY_END_MEM_ADDR - WL18XX_PHY_INIT_MEM_ADDR) 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#define WL18XX_SDIO_WSPI_BASE (WL18XX_REGISTERS_BASE) 328c2ecf20Sopenharmony_ci#define WL18XX_REG_CONFIG_BASE (WL18XX_REGISTERS_BASE + 0x02000) 338c2ecf20Sopenharmony_ci#define WL18XX_WGCM_REGS_BASE (WL18XX_REGISTERS_BASE + 0x03000) 348c2ecf20Sopenharmony_ci#define WL18XX_ENC_BASE (WL18XX_REGISTERS_BASE + 0x04000) 358c2ecf20Sopenharmony_ci#define WL18XX_INTERRUPT_BASE (WL18XX_REGISTERS_BASE + 0x05000) 368c2ecf20Sopenharmony_ci#define WL18XX_UART_BASE (WL18XX_REGISTERS_BASE + 0x06000) 378c2ecf20Sopenharmony_ci#define WL18XX_WELP_BASE (WL18XX_REGISTERS_BASE + 0x07000) 388c2ecf20Sopenharmony_ci#define WL18XX_TCP_CKSM_BASE (WL18XX_REGISTERS_BASE + 0x08000) 398c2ecf20Sopenharmony_ci#define WL18XX_FIFO_BASE (WL18XX_REGISTERS_BASE + 0x09000) 408c2ecf20Sopenharmony_ci#define WL18XX_OCP_BRIDGE_BASE (WL18XX_REGISTERS_BASE + 0x0A000) 418c2ecf20Sopenharmony_ci#define WL18XX_PMAC_RX_BASE (WL18XX_REGISTERS_BASE + 0x14800) 428c2ecf20Sopenharmony_ci#define WL18XX_PMAC_ACM_BASE (WL18XX_REGISTERS_BASE + 0x14C00) 438c2ecf20Sopenharmony_ci#define WL18XX_PMAC_TX_BASE (WL18XX_REGISTERS_BASE + 0x15000) 448c2ecf20Sopenharmony_ci#define WL18XX_PMAC_CSR_BASE (WL18XX_REGISTERS_BASE + 0x15400) 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci#define WL18XX_REG_ECPU_CONTROL (WL18XX_REGISTERS_BASE + 0x02004) 478c2ecf20Sopenharmony_ci#define WL18XX_REG_INTERRUPT_NO_CLEAR (WL18XX_REGISTERS_BASE + 0x050E8) 488c2ecf20Sopenharmony_ci#define WL18XX_REG_INTERRUPT_ACK (WL18XX_REGISTERS_BASE + 0x050F0) 498c2ecf20Sopenharmony_ci#define WL18XX_REG_INTERRUPT_TRIG (WL18XX_REGISTERS_BASE + 0x5074) 508c2ecf20Sopenharmony_ci#define WL18XX_REG_INTERRUPT_TRIG_H (WL18XX_REGISTERS_BASE + 0x5078) 518c2ecf20Sopenharmony_ci#define WL18XX_REG_INTERRUPT_MASK (WL18XX_REGISTERS_BASE + 0x0050DC) 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci#define WL18XX_REG_CHIP_ID_B (WL18XX_REGISTERS_BASE + 0x01542C) 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci#define WL18XX_SLV_MEM_DATA (WL18XX_HOST_BASE + 0x0018) 568c2ecf20Sopenharmony_ci#define WL18XX_SLV_REG_DATA (WL18XX_HOST_BASE + 0x0008) 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci/* Scratch Pad registers*/ 598c2ecf20Sopenharmony_ci#define WL18XX_SCR_PAD0 (WL18XX_REGISTERS_BASE + 0x0154EC) 608c2ecf20Sopenharmony_ci#define WL18XX_SCR_PAD1 (WL18XX_REGISTERS_BASE + 0x0154F0) 618c2ecf20Sopenharmony_ci#define WL18XX_SCR_PAD2 (WL18XX_REGISTERS_BASE + 0x0154F4) 628c2ecf20Sopenharmony_ci#define WL18XX_SCR_PAD3 (WL18XX_REGISTERS_BASE + 0x0154F8) 638c2ecf20Sopenharmony_ci#define WL18XX_SCR_PAD4 (WL18XX_REGISTERS_BASE + 0x0154FC) 648c2ecf20Sopenharmony_ci#define WL18XX_SCR_PAD4_SET (WL18XX_REGISTERS_BASE + 0x015504) 658c2ecf20Sopenharmony_ci#define WL18XX_SCR_PAD4_CLR (WL18XX_REGISTERS_BASE + 0x015500) 668c2ecf20Sopenharmony_ci#define WL18XX_SCR_PAD5 (WL18XX_REGISTERS_BASE + 0x015508) 678c2ecf20Sopenharmony_ci#define WL18XX_SCR_PAD5_SET (WL18XX_REGISTERS_BASE + 0x015510) 688c2ecf20Sopenharmony_ci#define WL18XX_SCR_PAD5_CLR (WL18XX_REGISTERS_BASE + 0x01550C) 698c2ecf20Sopenharmony_ci#define WL18XX_SCR_PAD6 (WL18XX_REGISTERS_BASE + 0x015514) 708c2ecf20Sopenharmony_ci#define WL18XX_SCR_PAD7 (WL18XX_REGISTERS_BASE + 0x015518) 718c2ecf20Sopenharmony_ci#define WL18XX_SCR_PAD8 (WL18XX_REGISTERS_BASE + 0x01551C) 728c2ecf20Sopenharmony_ci#define WL18XX_SCR_PAD9 (WL18XX_REGISTERS_BASE + 0x015520) 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci/* Spare registers*/ 758c2ecf20Sopenharmony_ci#define WL18XX_SPARE_A1 (WL18XX_REGISTERS_BASE + 0x002194) 768c2ecf20Sopenharmony_ci#define WL18XX_SPARE_A2 (WL18XX_REGISTERS_BASE + 0x002198) 778c2ecf20Sopenharmony_ci#define WL18XX_SPARE_A3 (WL18XX_REGISTERS_BASE + 0x00219C) 788c2ecf20Sopenharmony_ci#define WL18XX_SPARE_A4 (WL18XX_REGISTERS_BASE + 0x0021A0) 798c2ecf20Sopenharmony_ci#define WL18XX_SPARE_A5 (WL18XX_REGISTERS_BASE + 0x0021A4) 808c2ecf20Sopenharmony_ci#define WL18XX_SPARE_A6 (WL18XX_REGISTERS_BASE + 0x0021A8) 818c2ecf20Sopenharmony_ci#define WL18XX_SPARE_A7 (WL18XX_REGISTERS_BASE + 0x0021AC) 828c2ecf20Sopenharmony_ci#define WL18XX_SPARE_A8 (WL18XX_REGISTERS_BASE + 0x0021B0) 838c2ecf20Sopenharmony_ci#define WL18XX_SPARE_B1 (WL18XX_REGISTERS_BASE + 0x015524) 848c2ecf20Sopenharmony_ci#define WL18XX_SPARE_B2 (WL18XX_REGISTERS_BASE + 0x015528) 858c2ecf20Sopenharmony_ci#define WL18XX_SPARE_B3 (WL18XX_REGISTERS_BASE + 0x01552C) 868c2ecf20Sopenharmony_ci#define WL18XX_SPARE_B4 (WL18XX_REGISTERS_BASE + 0x015530) 878c2ecf20Sopenharmony_ci#define WL18XX_SPARE_B5 (WL18XX_REGISTERS_BASE + 0x015534) 888c2ecf20Sopenharmony_ci#define WL18XX_SPARE_B6 (WL18XX_REGISTERS_BASE + 0x015538) 898c2ecf20Sopenharmony_ci#define WL18XX_SPARE_B7 (WL18XX_REGISTERS_BASE + 0x01553C) 908c2ecf20Sopenharmony_ci#define WL18XX_SPARE_B8 (WL18XX_REGISTERS_BASE + 0x015540) 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci#define WL18XX_REG_COMMAND_MAILBOX_PTR (WL18XX_SCR_PAD0) 938c2ecf20Sopenharmony_ci#define WL18XX_REG_EVENT_MAILBOX_PTR (WL18XX_SCR_PAD1) 948c2ecf20Sopenharmony_ci#define WL18XX_EEPROMLESS_IND (WL18XX_SCR_PAD4) 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci#define WL18XX_WELP_ARM_COMMAND (WL18XX_REGISTERS_BASE + 0x7100) 978c2ecf20Sopenharmony_ci#define WL18XX_ENABLE (WL18XX_REGISTERS_BASE + 0x01543C) 988c2ecf20Sopenharmony_ci#define TOP_FN0_CCCR_REG_32 (WL18XX_TOP_OCP_BASE + 0x64) 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci/* PRCM registers */ 1018c2ecf20Sopenharmony_ci#define PLATFORM_DETECTION 0xA0E3E0 1028c2ecf20Sopenharmony_ci#define OCS_EN 0xA02080 1038c2ecf20Sopenharmony_ci#define PRIMARY_CLK_DETECT 0xA020A6 1048c2ecf20Sopenharmony_ci#define PLLSH_COEX_PLL_N 0xA02384 1058c2ecf20Sopenharmony_ci#define PLLSH_COEX_PLL_M 0xA02382 1068c2ecf20Sopenharmony_ci#define PLLSH_COEX_PLL_SWALLOW_EN 0xA0238E 1078c2ecf20Sopenharmony_ci#define PLLSH_WL_PLL_SEL 0xA02398 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ci#define PLLSH_WCS_PLL_N 0xA02362 1108c2ecf20Sopenharmony_ci#define PLLSH_WCS_PLL_M 0xA02360 1118c2ecf20Sopenharmony_ci#define PLLSH_WCS_PLL_Q_FACTOR_CFG_1 0xA02364 1128c2ecf20Sopenharmony_ci#define PLLSH_WCS_PLL_Q_FACTOR_CFG_2 0xA02366 1138c2ecf20Sopenharmony_ci#define PLLSH_WCS_PLL_P_FACTOR_CFG_1 0xA02368 1148c2ecf20Sopenharmony_ci#define PLLSH_WCS_PLL_P_FACTOR_CFG_2 0xA0236A 1158c2ecf20Sopenharmony_ci#define PLLSH_WCS_PLL_SWALLOW_EN 0xA0236C 1168c2ecf20Sopenharmony_ci#define PLLSH_WL_PLL_EN 0xA02392 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ci#define PLLSH_WCS_PLL_Q_FACTOR_CFG_1_MASK 0xFFFF 1198c2ecf20Sopenharmony_ci#define PLLSH_WCS_PLL_Q_FACTOR_CFG_2_MASK 0x007F 1208c2ecf20Sopenharmony_ci#define PLLSH_WCS_PLL_P_FACTOR_CFG_1_MASK 0xFFFF 1218c2ecf20Sopenharmony_ci#define PLLSH_WCS_PLL_P_FACTOR_CFG_2_MASK 0x000F 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci#define PLLSH_WL_PLL_EN_VAL1 0x7 1248c2ecf20Sopenharmony_ci#define PLLSH_WL_PLL_EN_VAL2 0x2 1258c2ecf20Sopenharmony_ci#define PLLSH_COEX_PLL_SWALLOW_EN_VAL1 0x2 1268c2ecf20Sopenharmony_ci#define PLLSH_COEX_PLL_SWALLOW_EN_VAL2 0x11 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_ci#define PLLSH_WCS_PLL_SWALLOW_EN_VAL1 0x1 1298c2ecf20Sopenharmony_ci#define PLLSH_WCS_PLL_SWALLOW_EN_VAL2 0x12 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci#define PLLSH_WL_PLL_SEL_WCS_PLL 0x0 1328c2ecf20Sopenharmony_ci#define PLLSH_WL_PLL_SEL_COEX_PLL 0x1 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_ci#define WL18XX_REG_FUSE_DATA_1_3 0xA0260C 1358c2ecf20Sopenharmony_ci#define WL18XX_PG_VER_MASK 0x70 1368c2ecf20Sopenharmony_ci#define WL18XX_PG_VER_OFFSET 4 1378c2ecf20Sopenharmony_ci#define WL18XX_ROM_VER_MASK 0x3e00 1388c2ecf20Sopenharmony_ci#define WL18XX_ROM_VER_OFFSET 9 1398c2ecf20Sopenharmony_ci#define WL18XX_METAL_VER_MASK 0xC 1408c2ecf20Sopenharmony_ci#define WL18XX_METAL_VER_OFFSET 2 1418c2ecf20Sopenharmony_ci#define WL18XX_NEW_METAL_VER_MASK 0x180 1428c2ecf20Sopenharmony_ci#define WL18XX_NEW_METAL_VER_OFFSET 7 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci#define WL18XX_PACKAGE_TYPE_OFFSET 13 1458c2ecf20Sopenharmony_ci#define WL18XX_PACKAGE_TYPE_WSP 0 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ci#define WL18XX_REG_FUSE_DATA_2_3 0xA02614 1488c2ecf20Sopenharmony_ci#define WL18XX_RDL_VER_MASK 0x1f00 1498c2ecf20Sopenharmony_ci#define WL18XX_RDL_VER_OFFSET 8 1508c2ecf20Sopenharmony_ci 1518c2ecf20Sopenharmony_ci#define WL18XX_REG_FUSE_BD_ADDR_1 0xA02602 1528c2ecf20Sopenharmony_ci#define WL18XX_REG_FUSE_BD_ADDR_2 0xA02606 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci#define WL18XX_CMD_MBOX_ADDRESS 0xB007B4 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_ci#define WL18XX_FW_STATUS_ADDR 0x50F8 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_ci#define CHIP_ID_185x_PG10 (0x06030101) 1598c2ecf20Sopenharmony_ci#define CHIP_ID_185x_PG20 (0x06030111) 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_ci/* 1628c2ecf20Sopenharmony_ci * Host Command Interrupt. Setting this bit masks 1638c2ecf20Sopenharmony_ci * the interrupt that the host issues to inform 1648c2ecf20Sopenharmony_ci * the FW that it has sent a command 1658c2ecf20Sopenharmony_ci * to the Wlan hardware Command Mailbox. 1668c2ecf20Sopenharmony_ci */ 1678c2ecf20Sopenharmony_ci#define WL18XX_INTR_TRIG_CMD BIT(28) 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ci/* 1708c2ecf20Sopenharmony_ci * Host Event Acknowlegde Interrupt. The host 1718c2ecf20Sopenharmony_ci * sets this bit to acknowledge that it received 1728c2ecf20Sopenharmony_ci * the unsolicited information from the event 1738c2ecf20Sopenharmony_ci * mailbox. 1748c2ecf20Sopenharmony_ci */ 1758c2ecf20Sopenharmony_ci#define WL18XX_INTR_TRIG_EVENT_ACK BIT(29) 1768c2ecf20Sopenharmony_ci 1778c2ecf20Sopenharmony_ci/* 1788c2ecf20Sopenharmony_ci * To boot the firmware in PLT mode we need to write this value in 1798c2ecf20Sopenharmony_ci * SCR_PAD8 before starting. 1808c2ecf20Sopenharmony_ci */ 1818c2ecf20Sopenharmony_ci#define WL18XX_SCR_PAD8_PLT 0xBABABEBE 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_cienum { 1848c2ecf20Sopenharmony_ci COMPONENT_NO_SWITCH = 0x0, 1858c2ecf20Sopenharmony_ci COMPONENT_2_WAY_SWITCH = 0x1, 1868c2ecf20Sopenharmony_ci COMPONENT_3_WAY_SWITCH = 0x2, 1878c2ecf20Sopenharmony_ci COMPONENT_MATCHING = 0x3, 1888c2ecf20Sopenharmony_ci}; 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_cienum { 1918c2ecf20Sopenharmony_ci FEM_NONE = 0x0, 1928c2ecf20Sopenharmony_ci FEM_VENDOR_1 = 0x1, 1938c2ecf20Sopenharmony_ci FEM_VENDOR_2 = 0x2, 1948c2ecf20Sopenharmony_ci FEM_VENDOR_3 = 0x3, 1958c2ecf20Sopenharmony_ci}; 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_cienum { 1988c2ecf20Sopenharmony_ci BOARD_TYPE_EVB_18XX = 0, 1998c2ecf20Sopenharmony_ci BOARD_TYPE_DVP_18XX = 1, 2008c2ecf20Sopenharmony_ci BOARD_TYPE_HDK_18XX = 2, 2018c2ecf20Sopenharmony_ci BOARD_TYPE_FPGA_18XX = 3, 2028c2ecf20Sopenharmony_ci BOARD_TYPE_COM8_18XX = 4, 2038c2ecf20Sopenharmony_ci 2048c2ecf20Sopenharmony_ci NUM_BOARD_TYPES, 2058c2ecf20Sopenharmony_ci}; 2068c2ecf20Sopenharmony_ci 2078c2ecf20Sopenharmony_cienum wl18xx_rdl_num { 2088c2ecf20Sopenharmony_ci RDL_NONE = 0, 2098c2ecf20Sopenharmony_ci RDL_1_HP = 1, 2108c2ecf20Sopenharmony_ci RDL_2_SP = 2, 2118c2ecf20Sopenharmony_ci RDL_3_HP = 3, 2128c2ecf20Sopenharmony_ci RDL_4_SP = 4, 2138c2ecf20Sopenharmony_ci RDL_5_SP = 0x11, 2148c2ecf20Sopenharmony_ci RDL_6_SP = 0x12, 2158c2ecf20Sopenharmony_ci RDL_7_SP = 0x13, 2168c2ecf20Sopenharmony_ci RDL_8_SP = 0x14, 2178c2ecf20Sopenharmony_ci 2188c2ecf20Sopenharmony_ci _RDL_LAST, 2198c2ecf20Sopenharmony_ci RDL_MAX = _RDL_LAST - 1, 2208c2ecf20Sopenharmony_ci}; 2218c2ecf20Sopenharmony_ci 2228c2ecf20Sopenharmony_ci 2238c2ecf20Sopenharmony_ci/* FPGA_SPARE_1 register - used to change the PHY ATPG clock at boot time */ 2248c2ecf20Sopenharmony_ci#define WL18XX_PHY_FPGA_SPARE_1 0x8093CA40 2258c2ecf20Sopenharmony_ci 2268c2ecf20Sopenharmony_ci/* command to disable FDSP clock */ 2278c2ecf20Sopenharmony_ci#define MEM_FDSP_CLK_120_DISABLE 0x80000000 2288c2ecf20Sopenharmony_ci 2298c2ecf20Sopenharmony_ci/* command to set ATPG clock toward FDSP Code RAM rather than its own clock */ 2308c2ecf20Sopenharmony_ci#define MEM_FDSP_CODERAM_FUNC_CLK_SEL 0xC0000000 2318c2ecf20Sopenharmony_ci 2328c2ecf20Sopenharmony_ci/* command to re-enable FDSP clock */ 2338c2ecf20Sopenharmony_ci#define MEM_FDSP_CLK_120_ENABLE 0x40000000 2348c2ecf20Sopenharmony_ci 2358c2ecf20Sopenharmony_ci#endif /* __REG_H__ */ 236