aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoritz Fischer <moritzf@google.com>2021-02-17 21:42:41 -0800
committerron minnich <rminnich@gmail.com>2021-02-20 00:55:00 +0000
commitd4f81bc21d9ffa7d0ef489e8a33ab5155c3b3be1 (patch)
treea58ab4a26c1fdf0073758e09939870d5e6a90434
parent145ecc6761ac540a999d17240d2f3c1f425ff6b5 (diff)
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 <moritzf@google.com> Change-Id: I1bff9d20d3d66984c49073aa21212708039d578f Signed-off-by: Moritz Fischer <moritzf@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/50888 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
-rw-r--r--src/soc/rockchip/rk3399/sdram.c7
1 files changed, 5 insertions, 2 deletions
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?