linux/drivers/misc/cardreader/rts5261.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:
 *   Rui FENG <[email protected]>
 *   Wei WANG <[email protected]>
 */
#ifndef RTS5261_H
#define RTS5261_H

/*New add*/
#define rts5261_vendor_setting_valid(reg)
#define rts5261_reg_to_aspm(reg)
#define rts5261_reg_check_reverse_socket(reg)
#define rts5261_reg_to_sd30_drive_sel_1v8(reg)
#define rts5261_reg_to_sd30_drive_sel_3v3(reg)
#define rts5261_reg_to_rtd3(reg)
#define rts5261_reg_check_mmc_support(reg)

#define RTS5261_AUTOLOAD_CFG0
#define RTS5261_AUTOLOAD_CFG1
#define RTS5261_AUTOLOAD_CFG2
#define RTS5261_AUTOLOAD_CFG3
#define RTS5261_AUTOLOAD_CFG4
#define RTS5261_FORCE_PRSNT_LOW
#define RTS5261_AUX_CLK_16M_EN

#define RTS5261_REG_VREF
#define RTS5261_PWD_SUSPND_EN

#define RTS5261_PAD_H3L1
#define PAD_GPIO_H3L1

/* SSC_CTL2 0xFC12 */
#define RTS5261_SSC_DEPTH_MASK
#define RTS5261_SSC_DEPTH_DISALBE
#define RTS5261_SSC_DEPTH_8M
#define RTS5261_SSC_DEPTH_4M
#define RTS5261_SSC_DEPTH_2M
#define RTS5261_SSC_DEPTH_1M
#define RTS5261_SSC_DEPTH_512K
#define RTS5261_SSC_DEPTH_256K
#define RTS5261_SSC_DEPTH_128K

/* efuse control register*/
#define RTS5261_EFUSE_CTL
#define RTS5261_EFUSE_ENABLE
/* EFUSE_MODE: 0=READ 1=PROGRAM */
#define RTS5261_EFUSE_MODE_MASK
#define RTS5261_EFUSE_PROGRAM

#define RTS5261_EFUSE_ADDR
#define RTS5261_EFUSE_ADDR_MASK

#define RTS5261_EFUSE_WRITE_DATA
#define RTS5261_EFUSE_READ_DATA

/* DMACTL 0xFE2C */
#define RTS5261_DMA_PACK_SIZE_MASK

/* FW status register */
#define RTS5261_FW_STATUS
#define RTS5261_EXPRESS_LINK_FAIL_MASK

/* FW control register */
#define RTS5261_FW_CTL
#define RTS5261_INFORM_RTD3_COLD

#define RTS5261_REG_FPDCTL

#define RTS5261_REG_LDO12_CFG
#define RTS5261_LDO12_VO_TUNE_MASK
#define RTS5261_LDO12_115
#define RTS5261_LDO12_120
#define RTS5261_LDO12_125
#define RTS5261_LDO12_130
#define RTS5261_LDO12_135

/* LDO control register */
#define RTS5261_CARD_PWR_CTL
#define RTS5261_SD_CLK_ISO
#define RTS5261_PAD_SD_DAT_FW_CTRL
#define RTS5261_PUPDC
#define RTS5261_SD_CMD_ISO
#define RTS5261_SD_DAT_ISO_MASK

#define RTS5261_LDO1233318_POW_CTL
#define RTS5261_LDO3318_POWERON
#define RTS5261_LDO3_POWERON
#define RTS5261_LDO2_POWERON
#define RTS5261_LDO1_POWERON
#define RTS5261_LDO_POWERON_MASK

#define RTS5261_DV3318_CFG
#define RTS5261_DV3318_TUNE_MASK
#define RTS5261_DV3318_18
#define RTS5261_DV3318_19
#define RTS5261_DV3318_33

/* CRD6603-433 190319 request changed */
#define RTS5261_LDO1_OCP_THD_740
#define RTS5261_LDO1_OCP_THD_800
#define RTS5261_LDO1_OCP_THD_860
#define RTS5261_LDO1_OCP_THD_920
#define RTS5261_LDO1_OCP_THD_980
#define RTS5261_LDO1_OCP_THD_1040
#define RTS5261_LDO1_OCP_THD_1100
#define RTS5261_LDO1_OCP_THD_1160

#define RTS5261_LDO1_LMT_THD_450
#define RTS5261_LDO1_LMT_THD_1000
#define RTS5261_LDO1_LMT_THD_1500
#define RTS5261_LDO1_LMT_THD_2000

#define RTS5261_LDO1_CFG1
#define RTS5261_LDO1_TUNE_MASK
#define RTS5261_LDO1_18
#define RTS5261_LDO1_33
#define RTS5261_LDO1_PWD_MASK

#define RTS5261_LDO2_CFG0
#define RTS5261_LDO2_OCP_THD_MASK
#define RTS5261_LDO2_OCP_EN
#define RTS5261_LDO2_OCP_LMT_THD_MASK
#define RTS5261_LDO2_OCP_LMT_EN

#define RTS5261_LDO2_OCP_THD_620
#define RTS5261_LDO2_OCP_THD_650
#define RTS5261_LDO2_OCP_THD_680
#define RTS5261_LDO2_OCP_THD_720
#define RTS5261_LDO2_OCP_THD_750
#define RTS5261_LDO2_OCP_THD_780
#define RTS5261_LDO2_OCP_THD_810
#define RTS5261_LDO2_OCP_THD_840

#define RTS5261_LDO2_CFG1
#define RTS5261_LDO2_TUNE_MASK
#define RTS5261_LDO2_18
#define RTS5261_LDO2_33
#define RTS5261_LDO2_PWD_MASK

#define RTS5261_LDO3_CFG0
#define RTS5261_LDO3_OCP_THD_MASK
#define RTS5261_LDO3_OCP_EN
#define RTS5261_LDO3_OCP_LMT_THD_MASK
#define RTS5261_LDO3_OCP_LMT_EN

#define RTS5261_LDO3_OCP_THD_620
#define RTS5261_LDO3_OCP_THD_650
#define RTS5261_LDO3_OCP_THD_680
#define RTS5261_LDO3_OCP_THD_720
#define RTS5261_LDO3_OCP_THD_750
#define RTS5261_LDO3_OCP_THD_780
#define RTS5261_LDO3_OCP_THD_810
#define RTS5261_LDO3_OCP_THD_840

#define RTS5261_LDO3_CFG1
#define RTS5261_LDO3_TUNE_MASK
#define RTS5261_LDO3_18
#define RTS5261_LDO3_33
#define RTS5261_LDO3_PWD_MASK

#define RTS5261_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


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

/* For Change_FPGA_SSCClock Function */
#define MULTIPLY_BY_1
#define MULTIPLY_BY_2
#define MULTIPLY_BY_3
#define MULTIPLY_BY_4
#define MULTIPLY_BY_5
#define MULTIPLY_BY_6
#define MULTIPLY_BY_7
#define MULTIPLY_BY_8
#define MULTIPLY_BY_9
#define MULTIPLY_BY_10

#define DIVIDE_BY_2
#define DIVIDE_BY_3
#define DIVIDE_BY_4
#define DIVIDE_BY_5
#define DIVIDE_BY_6
#define DIVIDE_BY_7
#define DIVIDE_BY_8
#define DIVIDE_BY_9
#define DIVIDE_BY_10

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

#endif /* RTS5261_H */