linux/drivers/misc/cardreader/rts5264.h

/* SPDX-License-Identifier: GPL-2.0-only */
/* Driver for Realtek PCI-Express card reader
 *
 * Copyright(c) 2018-2019 Realtek Semiconductor Corp. All rights reserved.
 *
 * Author:
 *   Ricky Wu <[email protected]>
 */
#ifndef RTS5264_H
#define RTS5264_H

/*New add*/
#define rts5264_vendor_setting_valid(reg)
#define rts5264_reg_to_aspm(reg)
#define rts5264_reg_check_reverse_socket(reg)
#define rts5264_reg_to_sd30_drive_sel_1v8(reg)
#define rts5264_reg_to_sd30_drive_sel_3v3(reg)
#define rts5264_reg_to_rtd3(reg)

#define RTS5264_AUTOLOAD_CFG0
#define RTS5264_AUTOLOAD_CFG1
#define RTS5264_AUTOLOAD_CFG3
#define RTS5264_AUTOLOAD_CFG4
#define RTS5264_FORCE_PRSNT_LOW
#define RTS5264_AUX_CLK_16M_EN
#define RTS5264_F_HIGH_RC_MASK
#define RTS5264_F_HIGH_RC_1_6M
#define RTS5264_F_HIGH_RC_400K

/* SSC_CTL2 0xFC12 */
#define RTS5264_SSC_DEPTH_MASK
#define RTS5264_SSC_DEPTH_DISALBE
#define RTS5264_SSC_DEPTH_8M
#define RTS5264_SSC_DEPTH_4M
#define RTS5264_SSC_DEPTH_2M
#define RTS5264_SSC_DEPTH_1M
#define RTS5264_SSC_DEPTH_512K
#define RTS5264_SSC_DEPTH_256K
#define RTS5264_SSC_DEPTH_128K

#define RTS5264_CARD_CLK_SRC2
#define RTS5264_REG_BIG_KVCO_A

/* efuse control register*/
#define RTS5264_EFUSE_CTL
#define RTS5264_EFUSE_ENABLE
/* EFUSE_MODE: 0=READ 1=PROGRAM */
#define RTS5264_EFUSE_MODE_MASK
#define RTS5264_EFUSE_PROGRAM

#define RTS5264_EFUSE_ADDR
#define RTS5264_EFUSE_ADDR_MASK

#define RTS5264_EFUSE_WRITE_DATA
#define RTS5264_EFUSE_READ_DATA

#define RTS5264_SYS_DUMMY_1
#define RTS5264_REG_BIG_KVCO

/* DMACTL 0xFE2C */
#define RTS5264_DMA_PACK_SIZE_MASK

#define RTS5264_FW_CFG1
#define RTS5264_SYS_CLK_SEL_MCU_CLK
#define RTS5264_CRC_CLK_SEL_MCU_CLK
#define RTS5264_FAKE_MCU_CLOCK_GATING
#define RTS5264_MCU_BUS_SEL_MASK

/* FW status register */
#define RTS5264_FW_STATUS
#define RTS5264_EXPRESS_LINK_FAIL_MASK

/* FW control register */
#define RTS5264_FW_CTL
#define RTS5264_INFORM_RTD3_COLD

#define RTS5264_REG_FPDCTL

#define RTS5264_REG_LDO12_CFG
#define RTS5264_LDO12_SR_MASK
#define RTS5264_LDO12_SR_1_0_MS
#define RTS5264_LDO12_SR_0_5_MS
#define RTS5264_LDO12_SR_0_2_5_MS
#define RTS5264_LDO12_SR_0_0_MS
#define RTS5264_LDO12_VO_TUNE_MASK
#define RTS5264_LDO12_115
#define RTS5264_LDO12_120
#define RTS5264_LDO12_125
#define RTS5264_LDO12_130
#define RTS5264_LDO12_135

/* LDO control register */
#define RTS5264_CARD_PWR_CTL
#define RTS5264_SD_CLK_ISO
#define RTS5264_PAD_SD_DAT_FW_CTRL
#define RTS5264_PUPDC
#define RTS5264_SD_CMD_ISO

#define RTS5264_OCP_VDD3_CTL
#define SD_VDD3_DETECT_EN
#define SD_VDD3_OCP_INT_EN
#define SD_VDD3_OCP_INT_CLR
#define SD_VDD3_OC_CLR

#define RTS5264_OCP_VDD3_STS
#define SD_VDD3_OCP_DETECT
#define SD_VDD3_OC_NOW
#define SD_VDD3_OC_EVER

#define RTS5264_OVP_CTL
#define RTS5264_OVP_TIME_MASK
#define RTS5264_OVP_TIME_DFT
#define RTS5264_OVP_DETECT_EN
#define RTS5264_OVP_INT_EN
#define RTS5264_OVP_INT_CLR
#define RTS5264_OVP_CLR

#define RTS5264_OVP_STS
#define RTS5264_OVP_GLTCH_TIME_MASK
#define RTS5264_OVP_GLTCH_TIME_DFT
#define RTS5264_VOVER_DET
#define RTS5264_OVP_NOW
#define RTS5264_OVP_EVER

#define RTS5264_CMD_OE_START_EARLY
#define RTS5264_CMD_OE_EARLY_LEAVE
#define RTS5264_CMD_OE_EARLY_CYCLE_MASK
#define RTS5264_CMD_OE_EARLY_4CYCLE
#define RTS5264_CMD_OE_EARLY_3CYCLE
#define RTS5264_CMD_OE_EARLY_2CYCLE
#define RTS5264_CMD_OE_EARLY_1CYCLE
#define RTS5264_CMD_OE_EARLY_EN

#define RTS5264_DAT_OE_START_EARLY
#define RTS5264_DAT_OE_EARLY_LEAVE
#define RTS5264_DAT_OE_EARLY_CYCLE_MASK
#define RTS5264_DAT_OE_EARLY_4CYCLE
#define RTS5264_DAT_OE_EARLY_3CYCLE
#define RTS5264_DAT_OE_EARLY_2CYCLE
#define RTS5264_DAT_OE_EARLY_1CYCLE
#define RTS5264_DAT_OE_EARLY_EN

#define RTS5264_LDO1233318_POW_CTL
#define RTS5264_TUNE_REF_LDO3318
#define RTS5264_TUNE_REF_LDO3318_DFT
#define RTS5264_LDO3318_POWERON
#define RTS5264_LDO3_POWERON
#define RTS5264_LDO2_POWERON
#define RTS5264_LDO1_POWERON
#define RTS5264_LDO_POWERON_MASK

#define RTS5264_DV3318_CFG
#define RTS5264_DV3318_TUNE_MASK
#define RTS5264_DV3318_18
#define RTS5264_DV3318_19
#define RTS5264_DV3318_33

#define RTS5264_LDO1_CFG0
#define RTS5264_LDO1_OCP_THD_MASK
#define RTS5264_LDO1_OCP_EN
#define RTS5264_LDO1_OCP_LMT_THD_MASK
#define RTS5264_LDO1_OCP_LMT_EN

#define RTS5264_LDO1_OCP_THD_850
#define RTS5264_LDO1_OCP_THD_950
#define RTS5264_LDO1_OCP_THD_1050
#define RTS5264_LDO1_OCP_THD_1100
#define RTS5264_LDO1_OCP_THD_1150
#define RTS5264_LDO1_OCP_THD_1200
#define RTS5264_LDO1_OCP_THD_1300
#define RTS5264_LDO1_OCP_THD_1350

#define RTS5264_LDO1_LMT_THD_1700
#define RTS5264_LDO1_LMT_THD_1800
#define RTS5264_LDO1_LMT_THD_1900
#define RTS5264_LDO1_LMT_THD_2000

#define RTS5264_LDO1_CFG1
#define RTS5264_LDO1_TUNE_MASK
#define RTS5264_LDO1_18
#define RTS5264_LDO1_33
#define RTS5264_LDO1_PWD_MASK

#define RTS5264_LDO2_CFG0
#define RTS5264_LDO2_OCP_THD_MASK
#define RTS5264_LDO2_OCP_EN
#define RTS5264_LDO2_OCP_LMT_THD_MASK
#define RTS5264_LDO2_OCP_LMT_EN

#define RTS5264_LDO2_OCP_THD_750
#define RTS5264_LDO2_OCP_THD_850
#define RTS5264_LDO2_OCP_THD_900
#define RTS5264_LDO2_OCP_THD_950
#define RTS5264_LDO2_OCP_THD_1050
#define RTS5264_LDO2_OCP_THD_1100
#define RTS5264_LDO2_OCP_THD_1150
#define RTS5264_LDO2_OCP_THD_1200

#define RTS5264_LDO2_LMT_THD_1700
#define RTS5264_LDO2_LMT_THD_1800
#define RTS5264_LDO2_LMT_THD_1900
#define RTS5264_LDO2_LMT_THD_2000

#define RTS5264_LDO2_CFG1
#define RTS5264_LDO2_TUNE_MASK
#define RTS5264_LDO2_18
#define RTS5264_LDO2_185
#define RTS5264_LDO2_19
#define RTS5264_LDO2_195
#define RTS5264_LDO2_33
#define RTS5264_LDO2_PWD_MASK

#define RTS5264_LDO3_CFG0
#define RTS5264_LDO3_OCP_THD_MASK
#define RTS5264_LDO3_OCP_EN
#define RTS5264_LDO3_OCP_LMT_THD_MASK
#define RTS5264_LDO3_OCP_LMT_EN

#define RTS5264_LDO3_OCP_THD_610
#define RTS5264_LDO3_OCP_THD_630
#define RTS5264_LDO3_OCP_THD_670
#define RTS5264_LDO3_OCP_THD_710
#define RTS5264_LDO3_OCP_THD_750
#define RTS5264_LDO3_OCP_THD_770
#define RTS5264_LDO3_OCP_THD_810
#define RTS5264_LDO3_OCP_THD_850

#define RTS5264_LDO3_LMT_THD_1200
#define RTS5264_LDO3_LMT_THD_1300
#define RTS5264_LDO3_LMT_THD_1400
#define RTS5264_LDO3_LMT_THD_1500

#define RTS5264_LDO3_CFG1
#define RTS5264_LDO3_TUNE_MASK
#define RTS5264_LDO3_12
#define RTS5264_LDO3_125
#define RTS5264_LDO3_13
#define RTS5264_LDO3_135
#define RTS5264_LDO3_33
#define RTS5264_LDO3_PWD_MASK

#define RTS5264_REG_PME_FORCE_CTL
#define FORCE_PM_CONTROL
#define FORCE_PM_VALUE
#define REG_EFUSE_BYPASS
#define REG_EFUSE_POR
#define REG_EFUSE_POWER_MASK
#define REG_EFUSE_POWERON
#define REG_EFUSE_POWEROFF

#define RTS5264_PWR_CUT
#define RTS5264_CFG_MEM_PD

#define RTS5264_OVP_DET
#define RTS5264_POW_VDET
#define RTS5264_TUNE_VROV_MASK
#define RTS5264_TUNE_VROV_2V
#define RTS5264_TUNE_VROV_1V8
#define RTS5264_TUNE_VROV_1V6
#define RTS5264_TUNE_VROV_1V4

#define RTS5264_CKMUX_MBIAS_PWR
#define RTS5264_NON_XTAL_SEL
#define RTS5264_POW_CKMUX
#define RTS5264_LVD_MASK
#define RTS5264_POW_PSW_MASK
#define RTS5264_POW_PSW_DFT

/* Single LUN, support SD/SD EXPRESS */
#define DEFAULT_SINGLE
#define SD_LUN
#define SD_EXPRESS_LUN

int rts5264_pci_switch_clock(struct rtsx_pcr *pcr, unsigned int card_clock,
		u8 ssc_depth, bool initial_mode, bool double_clk, bool vpclk);

#endif /* RTS5264_H */