[PATCH 49/92] ram: rk3399: Compute stride for 1 channel a

Jagan Teki
2019-06-11T14:50:52Z

Add stride computation for the sdram which support
single channel a

This configuration available in NanoPi NEO4 and the
same can work with existing rk3399-sdram-ddr3-1866.dtsi

Signed-off-by: Jagan Teki <jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
Signed-off-by: YouMin Chen <cym-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
---
drivers/ram/rockchip/sdram_rk3399.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c
index 5985c37f08..033b2730a6 100644
--- a/drivers/ram/rockchip/sdram_rk3399.c
+++ b/drivers/ram/rockchip/sdram_rk3399.c
@@ -1214,6 +1214,10 @@ static unsigned char calculate_stride(struct rk3399_sdram_params *sdram_params)
chinfo |= 1 << channel;
}

+ /* stride calculation for 1 channel */
+ if (sdram_params->base.num_channels == 1 && chinfo & 1)
+ return 0x17; /* channel a */
+
/* stride calculation for 2 channels, default gstride type is 256B */
if (ch_cap[0] == ch_cap[1]) {
cap = ch_cap[0] + ch_cap[1];
--
2.18.0.321.gffc6fa0e3