From d4f81bc21d9ffa7d0ef489e8a33ab5155c3b3be1 Mon Sep 17 00:00:00 2001 From: Moritz Fischer Date: Wed, 17 Feb 2021 21:42:41 -0800 Subject: soc/rockchip/rk3399/sdram: Use rank_mask in WDQL training Add rank_mask based on the rank number and iterate based on that rather than iterating all values. Note: LPDDR4 uses a different rank mask. Ported from u-boot. Signed-off-by: Moritz Fischer Change-Id: I1bff9d20d3d66984c49073aa21212708039d578f Signed-off-by: Moritz Fischer Reviewed-on: https://review.coreboot.org/c/coreboot/+/50888 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons --- src/soc/rockchip/rk3399/sdram.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/soc') diff --git a/src/soc/rockchip/rk3399/sdram.c b/src/soc/rockchip/rk3399/sdram.c index ecee11b62b..07c149de84 100644 --- a/src/soc/rockchip/rk3399/sdram.c +++ b/src/soc/rockchip/rk3399/sdram.c @@ -864,13 +864,16 @@ static int data_training_rl(u32 channel, const struct rk3399_sdram_params *param static int data_training_wdql(u32 channel, const struct rk3399_sdram_params *params) { u32 *denali_pi = rk3399_ddr_pi[channel]->denali_pi; - u32 rank = params->ch[channel].rank; + const u32 rank_mask = get_rank_mask(channel, params); u32 i, tmp; /* clear interrupt,PI_175 PI_INT_ACK:WR:0:17 */ write32(&denali_pi[175], 0x00003f7c); - for (i = 0; i < rank; i++) { + for (i = 0; i < MAX_RANKS_PER_CHANNEL; i++) { + if (!(rank_mask & (1 << i))) + continue; + select_per_cs_training_index(channel, i); /* * disable PI_WDQLVL_VREF_EN before wdq leveling? -- cgit v1.2.3