mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-15 09:34:17 +00:00
mfd: rtsx: Add set pull control macro and simplify rtl8411
Add set pull control macro to reduce code for setting pull control, and use a common init function to reduce code for rtl8411.c. So this patch is used to just simplify code. Signed-off-by: Micky Ching <micky_ching@realsil.com.cn> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
This commit is contained in:
parent
c1ec8fc308
commit
0da14eeba2
@ -441,12 +441,10 @@ static const u32 rtl8411b_qfn48_ms_pull_ctl_disable_tbl[] = {
|
|||||||
0,
|
0,
|
||||||
};
|
};
|
||||||
|
|
||||||
void rtl8411_init_params(struct rtsx_pcr *pcr)
|
void rtl8411_init_common_params(struct rtsx_pcr *pcr)
|
||||||
{
|
{
|
||||||
pcr->extra_caps = EXTRA_CAPS_SD_SDR50 | EXTRA_CAPS_SD_SDR104;
|
pcr->extra_caps = EXTRA_CAPS_SD_SDR50 | EXTRA_CAPS_SD_SDR104;
|
||||||
pcr->num_slots = 2;
|
pcr->num_slots = 2;
|
||||||
pcr->ops = &rtl8411_pcr_ops;
|
|
||||||
|
|
||||||
pcr->flags = 0;
|
pcr->flags = 0;
|
||||||
pcr->card_drive_sel = RTL8411_CARD_DRIVE_DEFAULT;
|
pcr->card_drive_sel = RTL8411_CARD_DRIVE_DEFAULT;
|
||||||
pcr->sd30_drive_sel_1v8 = DRIVER_TYPE_B;
|
pcr->sd30_drive_sel_1v8 = DRIVER_TYPE_B;
|
||||||
@ -454,47 +452,22 @@ void rtl8411_init_params(struct rtsx_pcr *pcr)
|
|||||||
pcr->aspm_en = ASPM_L1_EN;
|
pcr->aspm_en = ASPM_L1_EN;
|
||||||
pcr->tx_initial_phase = SET_CLOCK_PHASE(23, 7, 14);
|
pcr->tx_initial_phase = SET_CLOCK_PHASE(23, 7, 14);
|
||||||
pcr->rx_initial_phase = SET_CLOCK_PHASE(4, 3, 10);
|
pcr->rx_initial_phase = SET_CLOCK_PHASE(4, 3, 10);
|
||||||
|
|
||||||
pcr->ic_version = rtl8411_get_ic_version(pcr);
|
pcr->ic_version = rtl8411_get_ic_version(pcr);
|
||||||
pcr->sd_pull_ctl_enable_tbl = rtl8411_sd_pull_ctl_enable_tbl;
|
}
|
||||||
pcr->sd_pull_ctl_disable_tbl = rtl8411_sd_pull_ctl_disable_tbl;
|
|
||||||
pcr->ms_pull_ctl_enable_tbl = rtl8411_ms_pull_ctl_enable_tbl;
|
void rtl8411_init_params(struct rtsx_pcr *pcr)
|
||||||
pcr->ms_pull_ctl_disable_tbl = rtl8411_ms_pull_ctl_disable_tbl;
|
{
|
||||||
|
rtl8411_init_common_params(pcr);
|
||||||
|
pcr->ops = &rtl8411_pcr_ops;
|
||||||
|
set_pull_ctrl_tables(pcr, rtl8411);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rtl8411b_init_params(struct rtsx_pcr *pcr)
|
void rtl8411b_init_params(struct rtsx_pcr *pcr)
|
||||||
{
|
{
|
||||||
pcr->extra_caps = EXTRA_CAPS_SD_SDR50 | EXTRA_CAPS_SD_SDR104;
|
rtl8411_init_common_params(pcr);
|
||||||
pcr->num_slots = 2;
|
|
||||||
pcr->ops = &rtl8411b_pcr_ops;
|
pcr->ops = &rtl8411b_pcr_ops;
|
||||||
|
if (rtl8411b_is_qfn48(pcr))
|
||||||
pcr->flags = 0;
|
set_pull_ctrl_tables(pcr, rtl8411b_qfn48);
|
||||||
pcr->card_drive_sel = RTL8411_CARD_DRIVE_DEFAULT;
|
else
|
||||||
pcr->sd30_drive_sel_1v8 = DRIVER_TYPE_B;
|
set_pull_ctrl_tables(pcr, rtl8411b_qfn64);
|
||||||
pcr->sd30_drive_sel_3v3 = DRIVER_TYPE_D;
|
|
||||||
pcr->aspm_en = ASPM_L1_EN;
|
|
||||||
pcr->tx_initial_phase = SET_CLOCK_PHASE(23, 7, 14);
|
|
||||||
pcr->rx_initial_phase = SET_CLOCK_PHASE(4, 3, 10);
|
|
||||||
|
|
||||||
pcr->ic_version = rtl8411_get_ic_version(pcr);
|
|
||||||
|
|
||||||
if (rtl8411b_is_qfn48(pcr)) {
|
|
||||||
pcr->sd_pull_ctl_enable_tbl =
|
|
||||||
rtl8411b_qfn48_sd_pull_ctl_enable_tbl;
|
|
||||||
pcr->sd_pull_ctl_disable_tbl =
|
|
||||||
rtl8411b_qfn48_sd_pull_ctl_disable_tbl;
|
|
||||||
pcr->ms_pull_ctl_enable_tbl =
|
|
||||||
rtl8411b_qfn48_ms_pull_ctl_enable_tbl;
|
|
||||||
pcr->ms_pull_ctl_disable_tbl =
|
|
||||||
rtl8411b_qfn48_ms_pull_ctl_disable_tbl;
|
|
||||||
} else {
|
|
||||||
pcr->sd_pull_ctl_enable_tbl =
|
|
||||||
rtl8411b_qfn64_sd_pull_ctl_enable_tbl;
|
|
||||||
pcr->sd_pull_ctl_disable_tbl =
|
|
||||||
rtl8411b_qfn64_sd_pull_ctl_disable_tbl;
|
|
||||||
pcr->ms_pull_ctl_enable_tbl =
|
|
||||||
rtl8411b_qfn64_ms_pull_ctl_enable_tbl;
|
|
||||||
pcr->ms_pull_ctl_disable_tbl =
|
|
||||||
rtl8411b_qfn64_ms_pull_ctl_disable_tbl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -63,4 +63,12 @@ static inline u8 map_sd_drive(int idx)
|
|||||||
#define rtl8411_reg_to_sd30_drive_sel_3v3(reg) (((reg) >> 5) & 0x07)
|
#define rtl8411_reg_to_sd30_drive_sel_3v3(reg) (((reg) >> 5) & 0x07)
|
||||||
#define rtl8411b_reg_to_sd30_drive_sel_3v3(reg) ((reg) & 0x03)
|
#define rtl8411b_reg_to_sd30_drive_sel_3v3(reg) ((reg) & 0x03)
|
||||||
|
|
||||||
|
#define set_pull_ctrl_tables(pcr, __device) \
|
||||||
|
do { \
|
||||||
|
pcr->sd_pull_ctl_enable_tbl = __device##_sd_pull_ctl_enable_tbl; \
|
||||||
|
pcr->sd_pull_ctl_disable_tbl = __device##_sd_pull_ctl_disable_tbl; \
|
||||||
|
pcr->ms_pull_ctl_enable_tbl = __device##_ms_pull_ctl_enable_tbl; \
|
||||||
|
pcr->ms_pull_ctl_disable_tbl = __device##_ms_pull_ctl_disable_tbl; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user