18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* Copyright(c) 2009-2012 Realtek Corporation.*/ 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci#ifndef __RTL8723E_PWRSEQCMD_H__ 58c2ecf20Sopenharmony_ci#define __RTL8723E_PWRSEQCMD_H__ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#include "wifi.h" 88c2ecf20Sopenharmony_ci/*--------------------------------------------- 98c2ecf20Sopenharmony_ci * 3 The value of cmd: 4 bits 108c2ecf20Sopenharmony_ci *--------------------------------------------- 118c2ecf20Sopenharmony_ci */ 128c2ecf20Sopenharmony_ci#define PWR_CMD_READ 0x00 138c2ecf20Sopenharmony_ci#define PWR_CMD_WRITE 0x01 148c2ecf20Sopenharmony_ci#define PWR_CMD_POLLING 0x02 158c2ecf20Sopenharmony_ci#define PWR_CMD_DELAY 0x03 168c2ecf20Sopenharmony_ci#define PWR_CMD_END 0x04 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci/* define the base address of each block */ 198c2ecf20Sopenharmony_ci#define PWR_BASEADDR_MAC 0x00 208c2ecf20Sopenharmony_ci#define PWR_BASEADDR_USB 0x01 218c2ecf20Sopenharmony_ci#define PWR_BASEADDR_PCIE 0x02 228c2ecf20Sopenharmony_ci#define PWR_BASEADDR_SDIO 0x03 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#define PWR_INTF_SDIO_MSK BIT(0) 258c2ecf20Sopenharmony_ci#define PWR_INTF_USB_MSK BIT(1) 268c2ecf20Sopenharmony_ci#define PWR_INTF_PCI_MSK BIT(2) 278c2ecf20Sopenharmony_ci#define PWR_INTF_ALL_MSK (BIT(0)|BIT(1)|BIT(2)|BIT(3)) 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#define PWR_FAB_TSMC_MSK BIT(0) 308c2ecf20Sopenharmony_ci#define PWR_FAB_UMC_MSK BIT(1) 318c2ecf20Sopenharmony_ci#define PWR_FAB_ALL_MSK (BIT(0)|BIT(1)|BIT(2)|BIT(3)) 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci#define PWR_CUT_TESTCHIP_MSK BIT(0) 348c2ecf20Sopenharmony_ci#define PWR_CUT_A_MSK BIT(1) 358c2ecf20Sopenharmony_ci#define PWR_CUT_B_MSK BIT(2) 368c2ecf20Sopenharmony_ci#define PWR_CUT_C_MSK BIT(3) 378c2ecf20Sopenharmony_ci#define PWR_CUT_D_MSK BIT(4) 388c2ecf20Sopenharmony_ci#define PWR_CUT_E_MSK BIT(5) 398c2ecf20Sopenharmony_ci#define PWR_CUT_F_MSK BIT(6) 408c2ecf20Sopenharmony_ci#define PWR_CUT_G_MSK BIT(7) 418c2ecf20Sopenharmony_ci#define PWR_CUT_ALL_MSK 0xFF 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_cienum pwrseq_delay_unit { 448c2ecf20Sopenharmony_ci PWRSEQ_DELAY_US, 458c2ecf20Sopenharmony_ci PWRSEQ_DELAY_MS, 468c2ecf20Sopenharmony_ci}; 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_cistruct wlan_pwr_cfg { 498c2ecf20Sopenharmony_ci u16 offset; 508c2ecf20Sopenharmony_ci u8 cut_msk; 518c2ecf20Sopenharmony_ci u8 fab_msk:4; 528c2ecf20Sopenharmony_ci u8 interface_msk:4; 538c2ecf20Sopenharmony_ci u8 base:4; 548c2ecf20Sopenharmony_ci u8 cmd:4; 558c2ecf20Sopenharmony_ci u8 msk; 568c2ecf20Sopenharmony_ci u8 value; 578c2ecf20Sopenharmony_ci}; 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci#define GET_PWR_CFG_OFFSET(__PWR_CMD) (__PWR_CMD.offset) 608c2ecf20Sopenharmony_ci#define GET_PWR_CFG_CUT_MASK(__PWR_CMD) (__PWR_CMD.cut_msk) 618c2ecf20Sopenharmony_ci#define GET_PWR_CFG_FAB_MASK(__PWR_CMD) (__PWR_CMD.fab_msk) 628c2ecf20Sopenharmony_ci#define GET_PWR_CFG_INTF_MASK(__PWR_CMD) (__PWR_CMD.interface_msk) 638c2ecf20Sopenharmony_ci#define GET_PWR_CFG_BASE(__PWR_CMD) (__PWR_CMD.base) 648c2ecf20Sopenharmony_ci#define GET_PWR_CFG_CMD(__PWR_CMD) (__PWR_CMD.cmd) 658c2ecf20Sopenharmony_ci#define GET_PWR_CFG_MASK(__PWR_CMD) (__PWR_CMD.msk) 668c2ecf20Sopenharmony_ci#define GET_PWR_CFG_VALUE(__PWR_CMD) (__PWR_CMD.value) 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_cibool rtl_hal_pwrseqcmdparsing(struct rtl_priv *rtlpriv, u8 cut_version, 698c2ecf20Sopenharmony_ci u8 fab_version, u8 interface_type, 708c2ecf20Sopenharmony_ci struct wlan_pwr_cfg pwrcfgcmd[]); 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci#endif 73