ram: rk3399: Add lpddr4 rank mask for ca training
authorJagan Teki <jagan@amarulasolutions.com>
Tue, 16 Jul 2019 11:57:09 +0000 (17:27 +0530)
committerKever Yang <kever.yang@rock-chips.com>
Sat, 20 Jul 2019 15:59:44 +0000 (23:59 +0800)
Add rank_mask based on the rank number for lpddr4.

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 cca809a7e3a2abaa3e87c6b4c695c5a2a6354e76..b7cad9274b8bb47deb763dedf5c5d8efaf3c82c1 100644 (file)
@@ -687,7 +687,10 @@ static int data_training_ca(const struct chan_info *chan, u32 channel,
        /* clear interrupt,PI_175 PI_INT_ACK:WR:0:17 */
        writel(0x00003f7c, (&denali_pi[175]));
 
-       rank_mask = (rank == 1) ? 0x1 : 0x3;
+       if (params->base.dramtype == LPDDR4)
+               rank_mask = (rank == 1) ? 0x5 : 0xf;
+       else
+               rank_mask = (rank == 1) ? 0x1 : 0x3;
 
        for (i = 0; i < 4; i++) {
                if (!(rank_mask & (1 << i)))