[v3,15/18] ram: rk3399: Compute stride for 1 channel a

Message ID 20190715182856.21688-16-jagan@amarulasolutions.com
State New
Headers show
Series
  • ram: rk3399: Add rank detection
Related show

Commit Message

Jagan Teki July 15, 2019, 6:28 p.m. UTC
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@amarulasolutions.com>
Signed-off-by: YouMin Chen <cym@rock-chips.com>
---
 drivers/ram/rockchip/sdram_rk3399.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Kever Yang July 16, 2019, 7:44 a.m. UTC | #1
On 2019/7/16 上午2:28, Jagan Teki wrote:
> 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@amarulasolutions.com>
> Signed-off-by: YouMin Chen <cym@rock-chips.com>

Reviewed-by: Kever Yang <Kever.yang@rock-chips.com>

Thanks,
  - Kever
> ---
>   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 c626ef602c..8bbacb5275 100644
> --- a/drivers/ram/rockchip/sdram_rk3399.c
> +++ b/drivers/ram/rockchip/sdram_rk3399.c
> @@ -1211,6 +1211,10 @@ static unsigned char calculate_stride(struct rk3399_sdram_params *params)
>   		chinfo |= 1 << channel;
>   	}
>   
> +	/* stride calculation for 1 channel */
> +	if (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];

Patch

diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c
index c626ef602c..8bbacb5275 100644
--- a/drivers/ram/rockchip/sdram_rk3399.c
+++ b/drivers/ram/rockchip/sdram_rk3399.c
@@ -1211,6 +1211,10 @@  static unsigned char calculate_stride(struct rk3399_sdram_params *params)
 		chinfo |= 1 << channel;
 	}
 
+	/* stride calculation for 1 channel */
+	if (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];