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


#define RTS5228_AUTOLOAD_CFG0
#define RTS5228_AUTOLOAD_CFG1
#define RTS5228_AUTOLOAD_CFG2
#define RTS5228_AUTOLOAD_CFG3
#define RTS5228_AUTOLOAD_CFG4

#define RTS5228_REG_VREF
#define RTS5228_PWD_SUSPND_EN

#define RTS5228_PAD_H3L1
#define PAD_GPIO_H3L1

/* SSC_CTL2 0xFC12 */
#define RTS5228_SSC_DEPTH_MASK
#define RTS5228_SSC_DEPTH_DISALBE
#define RTS5228_SSC_DEPTH_8M
#define RTS5228_SSC_DEPTH_4M
#define RTS5228_SSC_DEPTH_2M
#define RTS5228_SSC_DEPTH_1M
#define RTS5228_SSC_DEPTH_512K
#define RTS5228_SSC_DEPTH_256K
#define RTS5228_SSC_DEPTH_128K

/* DMACTL 0xFE2C */
#define RTS5228_DMA_PACK_SIZE_MASK

#define RTS5228_REG_LDO12_CFG
#define RTS5228_LDO12_VO_TUNE_MASK
#define RTS5228_LDO12_100
#define RTS5228_LDO12_105
#define RTS5228_LDO12_110
#define RTS5228_LDO12_115
#define RTS5228_LDO12_120
#define RTS5228_LDO12_125
#define RTS5228_LDO12_130
#define RTS5228_LDO12_135
#define RTS5228_REG_PWD_LDO12

#define RTS5228_REG_LDO12_L12
#define RTS5228_LDO12_L12_MASK
#define RTS5228_LDO12_L12_120

/* LDO control register */
#define RTS5228_CARD_PWR_CTL
#define RTS5228_PUPDC

#define RTS5228_LDO1233318_POW_CTL
#define RTS5228_LDO3318_POWERON
#define RTS5228_LDO1_POWEROFF
#define RTS5228_LDO1_SOFTSTART
#define RTS5228_LDO1_FULLON
#define RTS5228_LDO1_POWERON_MASK
#define RTS5228_LDO_POWERON_MASK

#define RTS5228_DV3318_CFG
#define RTS5228_DV3318_TUNE_MASK
#define RTS5228_DV3318_17
#define RTS5228_DV3318_1V75
#define RTS5228_DV3318_18
#define RTS5228_DV3318_1V85
#define RTS5228_DV3318_19
#define RTS5228_DV3318_33
#define RTS5228_DV3318_SR_MASK
#define RTS5228_DV3318_SR_0
#define RTS5228_DV3318_SR_250
#define RTS5228_DV3318_SR_500
#define RTS5228_DV3318_SR_1000

#define RTS5228_LDO1_CFG0
#define RTS5228_LDO1_OCP_THD_MASK
#define RTS5228_LDO1_OCP_EN
#define RTS5228_LDO1_OCP_LMT_THD_MASK
#define RTS5228_LDO1_OCP_LMT_EN

#define RTS5228_LDO1_OCP_THD_730
#define RTS5228_LDO1_OCP_THD_780
#define RTS5228_LDO1_OCP_THD_860
#define RTS5228_LDO1_OCP_THD_930
#define RTS5228_LDO1_OCP_THD_1000
#define RTS5228_LDO1_OCP_THD_1070
#define RTS5228_LDO1_OCP_THD_1140
#define RTS5228_LDO1_OCP_THD_1220

#define RTS5228_LDO1_LMT_THD_450
#define RTS5228_LDO1_LMT_THD_1000
#define RTS5228_LDO1_LMT_THD_1500
#define RTS5228_LDO1_LMT_THD_2000

#define RTS5228_LDO1_CFG1
#define RTS5228_LDO1_SR_TIME_MASK
#define RTS5228_LDO1_SR_0_0
#define RTS5228_LDO1_SR_0_25
#define RTS5228_LDO1_SR_0_5
#define RTS5228_LDO1_SR_1_0
#define RTS5228_LDO1_TUNE_MASK
#define RTS5228_LDO1_18
#define RTS5228_LDO1_33
#define RTS5228_LDO1_PWD_MASK

#define RTS5228_AUXCLK_GAT_CTL

#define RTS5228_REG_RREF_CTL_0
#define RTS5228_FORCE_RREF_EXTL
#define RTS5228_REG_BG33_MASK
#define RTS5228_RREF_12_1V
#define RTS5228_RREF_12_3V

#define RTS5228_REG_RREF_CTL_1

#define RTS5228_REG_RREF_CTL_2
#define RTS5228_TEST_INTL_RREF
#define RTS5228_DGLCH_TIME_MASK
#define RTS5228_DGLCH_TIME_50
#define RTS5228_DGLCH_TIME_75
#define RTS5228_DGLCH_TIME_100
#define RTS5228_DGLCH_TIME_125
#define RTS5228_REG_REXT_TUNE_MASK

#define RTS5228_REG_PME_FORCE_CTL
#define FORCE_PM_CONTROL
#define FORCE_PM_VALUE


/* Single LUN, support SD */
#define DEFAULT_SINGLE
#define SD_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 rts5228_pci_switch_clock(struct rtsx_pcr *pcr, unsigned int card_clock,
		u8 ssc_depth, bool initial_mode, bool double_clk, bool vpclk);

#endif /* RTS5228_H */