[v3,30/57] ram: rk3399: Map chipselect for lpddr4

Message ID 20190716115745.12585-31-jagan@amarulasolutions.com
State New
Headers show
Series
  • ram: rk3399: Add LPDDR4 support
Related show

Commit Message

Jagan Teki July 16, 2019, 11:57 a.m. UTC
Assign desired cs_map values for lpddr4 during set memory map.

Initial cs_map values is based on the sdram parameters, so
the same will adjusted based dramtype as LPDDR4.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: YouMin Chen <cym@rock-chips.com>
---
 drivers/ram/rockchip/sdram_rk3399.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Kever Yang July 16, 2019, 1:13 p.m. UTC | #1
On 2019/7/16 下午7:57, Jagan Teki wrote:
> Assign desired cs_map values for lpddr4 during set memory map.
>
> Initial cs_map values is based on the sdram parameters, so
> the same will adjusted based dramtype as LPDDR4.
>
> 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 | 10 ++++++++++
>   1 file changed, 10 insertions(+)
>
> diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c
> index 2ab10da53f..7689711a99 100644
> --- a/drivers/ram/rockchip/sdram_rk3399.c
> +++ b/drivers/ram/rockchip/sdram_rk3399.c
> @@ -188,6 +188,16 @@ static void set_memory_map(const struct chan_info *chan, u32 channel,
>   	clrsetbits_le32(&denali_pi[155], (0x3 << 16) | (0x7 << 24),
>   			((3 - sdram_ch->cap_info.bk) << 16) |
>   			((16 - row) << 24));
> +
> +	if (IS_ENABLED(CONFIG_RAM_RK3399_LPDDR4)) {
> +		if (cs_map == 1)
> +			cs_map = 0x5;
> +		else if (cs_map == 2)
> +			cs_map = 0xa;
> +		else
> +			cs_map = 0xF;
> +	}
> +
>   	/* PI_41 PI_CS_MAP:RW:24:4 */
>   	clrsetbits_le32(&denali_pi[41], 0xf << 24, cs_map << 24);
>   	if (sdram_ch->cap_info.rank == 1 && params->base.dramtype == DDR3)

Patch

diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c
index 2ab10da53f..7689711a99 100644
--- a/drivers/ram/rockchip/sdram_rk3399.c
+++ b/drivers/ram/rockchip/sdram_rk3399.c
@@ -188,6 +188,16 @@  static void set_memory_map(const struct chan_info *chan, u32 channel,
 	clrsetbits_le32(&denali_pi[155], (0x3 << 16) | (0x7 << 24),
 			((3 - sdram_ch->cap_info.bk) << 16) |
 			((16 - row) << 24));
+
+	if (IS_ENABLED(CONFIG_RAM_RK3399_LPDDR4)) {
+		if (cs_map == 1)
+			cs_map = 0x5;
+		else if (cs_map == 2)
+			cs_map = 0xa;
+		else
+			cs_map = 0xF;
+	}
+
 	/* PI_41 PI_CS_MAP:RW:24:4 */
 	clrsetbits_le32(&denali_pi[41], 0xf << 24, cs_map << 24);
 	if (sdram_ch->cap_info.rank == 1 && params->base.dramtype == DDR3)