Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Copyright(c) 2009-2012  Realtek Corporation.*/
0003 
0004 #ifndef __RTL8723E_PWRSEQCMD_H__
0005 #define __RTL8723E_PWRSEQCMD_H__
0006 
0007 #include "wifi.h"
0008 /*---------------------------------------------
0009  * 3 The value of cmd: 4 bits
0010  *---------------------------------------------
0011  */
0012 #define    PWR_CMD_READ     0x00
0013 #define    PWR_CMD_WRITE    0x01
0014 #define    PWR_CMD_POLLING  0x02
0015 #define    PWR_CMD_DELAY    0x03
0016 #define    PWR_CMD_END      0x04
0017 
0018 /* define the base address of each block */
0019 #define   PWR_BASEADDR_MAC  0x00
0020 #define   PWR_BASEADDR_USB  0x01
0021 #define   PWR_BASEADDR_PCIE 0x02
0022 #define   PWR_BASEADDR_SDIO 0x03
0023 
0024 #define PWR_INTF_SDIO_MSK   BIT(0)
0025 #define PWR_INTF_USB_MSK    BIT(1)
0026 #define PWR_INTF_PCI_MSK    BIT(2)
0027 #define PWR_INTF_ALL_MSK    (BIT(0)|BIT(1)|BIT(2)|BIT(3))
0028 
0029 #define PWR_FAB_TSMC_MSK    BIT(0)
0030 #define PWR_FAB_UMC_MSK     BIT(1)
0031 #define PWR_FAB_ALL_MSK     (BIT(0)|BIT(1)|BIT(2)|BIT(3))
0032 
0033 #define PWR_CUT_TESTCHIP_MSK    BIT(0)
0034 #define PWR_CUT_A_MSK       BIT(1)
0035 #define PWR_CUT_B_MSK       BIT(2)
0036 #define PWR_CUT_C_MSK       BIT(3)
0037 #define PWR_CUT_D_MSK       BIT(4)
0038 #define PWR_CUT_E_MSK       BIT(5)
0039 #define PWR_CUT_F_MSK       BIT(6)
0040 #define PWR_CUT_G_MSK       BIT(7)
0041 #define PWR_CUT_ALL_MSK     0xFF
0042 
0043 enum pwrseq_delay_unit {
0044     PWRSEQ_DELAY_US,
0045     PWRSEQ_DELAY_MS,
0046 };
0047 
0048 struct wlan_pwr_cfg {
0049     u16 offset;
0050     u8 cut_msk;
0051     u8 fab_msk:4;
0052     u8 interface_msk:4;
0053     u8 base:4;
0054     u8 cmd:4;
0055     u8 msk;
0056     u8 value;
0057 };
0058 
0059 #define GET_PWR_CFG_OFFSET(__PWR_CMD)   (__PWR_CMD.offset)
0060 #define GET_PWR_CFG_CUT_MASK(__PWR_CMD) (__PWR_CMD.cut_msk)
0061 #define GET_PWR_CFG_FAB_MASK(__PWR_CMD) (__PWR_CMD.fab_msk)
0062 #define GET_PWR_CFG_INTF_MASK(__PWR_CMD)    (__PWR_CMD.interface_msk)
0063 #define GET_PWR_CFG_BASE(__PWR_CMD) (__PWR_CMD.base)
0064 #define GET_PWR_CFG_CMD(__PWR_CMD)  (__PWR_CMD.cmd)
0065 #define GET_PWR_CFG_MASK(__PWR_CMD) (__PWR_CMD.msk)
0066 #define GET_PWR_CFG_VALUE(__PWR_CMD)    (__PWR_CMD.value)
0067 
0068 bool rtl_hal_pwrseqcmdparsing(struct rtl_priv *rtlpriv, u8 cut_version,
0069                   u8 fab_version, u8 interface_type,
0070                   struct wlan_pwr_cfg pwrcfgcmd[]);
0071 
0072 #endif