]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ram: rk3399: Use rank mask in ca data training
authorJagan Teki <jagan@amarulasolutions.com>
Mon, 15 Jul 2019 18:28:41 +0000 (23:58 +0530)
committerKever Yang <kever.yang@rock-chips.com>
Fri, 19 Jul 2019 03:11:09 +0000 (11:11 +0800)
Add rank_mask based on the rank number, this would keep
the ca data training loop based on the desired rank mask
value instead of looping for all values.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: YouMin Chen <cym@rock-chips.com>
Reviewed-by: Kever Yang <Kever.yang@rock-chips.com>
drivers/ram/rockchip/sdram_rk3399.c

index fe26144f27dcadcba88a7fc05256b426a8d58f79..b98df20fa53793aa30ff805a7eb9d9eea703d103 100644 (file)
@@ -626,11 +626,17 @@ static int data_training_ca(const struct chan_info *chan, u32 channel,
        u32 i, tmp;
        u32 obs_0, obs_1, obs_2, obs_err = 0;
        u32 rank = params->ch[channel].cap_info.rank;
+       u32 rank_mask;
 
        /* clear interrupt,PI_175 PI_INT_ACK:WR:0:17 */
        writel(0x00003f7c, (&denali_pi[175]));
 
-       for (i = 0; i < rank; i++) {
+       rank_mask = (rank == 1) ? 0x1 : 0x3;
+
+       for (i = 0; i < 4; i++) {
+               if (!(rank_mask & (1 << i)))
+                       continue;
+
                select_per_cs_training_index(chan, i);
 
                /* PI_100 PI_CALVL_EN:RW:8:2 */