struct sdram_rk3399_ops {
int (*data_training)(struct dram_info *dram, u32 channel, u8 rank,
struct rk3399_sdram_params *sdram);
+ int (*set_rate)(struct dram_info *dram,
+ const struct rk3399_sdram_params *params);
};
#if defined(CONFIG_TPL_BUILD) || \
return 0;
}
+#if !defined(CONFIG_RAM_RK3399_LPDDR4)
static void select_per_cs_training_index(const struct chan_info *chan,
u32 rank)
{
return 0;
}
+#endif
static void set_ddrconfig(const struct chan_info *chan,
const struct rk3399_sdram_params *params,
return data_training(dram, channel, params, training_flag);
}
-#endif
static int switch_to_phy_index1(struct dram_info *dram,
const struct rk3399_sdram_params *params)
return 0;
}
-#if defined(CONFIG_RAM_RK3399_LPDDR4)
+#else
+
static u32 get_ddr_stride(struct rk3399_pmusgrf_regs *pmusgrf)
{
return ((readl(&pmusgrf->soc_con4) >> 10) & 0x1F);
params->base.stride = calculate_stride(params);
dram_all_config(dram, params);
- switch_to_phy_index1(dram, params);
+ dram->ops->set_rate(dram, params);
debug("Finish SDRAM initialization...\n");
return 0;
static const struct sdram_rk3399_ops rk3399_ops = {
#if !defined(CONFIG_RAM_RK3399_LPDDR4)
.data_training = default_data_training,
+ .set_rate = switch_to_phy_index1,
#else
.data_training = lpddr4_mr_detect,
#endif