[v3,13/18] ram: rk3399: debug: Add sdram_print_stride

Message ID 20190715182856.21688-14-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 code to print the channel stride, this would help to
print the stride of associated channel.

Here is sample print on LPDDR4, 50MHz.
256B stride

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: YouMin Chen <cym@rock-chips.com>
---
 .../include/asm/arch-rockchip/sdram_common.h  |  5 ++++
 drivers/ram/rockchip/sdram_debug.c            | 29 +++++++++++++++++++
 2 files changed, 34 insertions(+)

Comments

Kever Yang July 16, 2019, 7:43 a.m. UTC | #1
On 2019/7/16 上午2:28, Jagan Teki wrote:
> Add code to print the channel stride, this would help to
> print the stride of associated channel.
>
> Here is sample print on LPDDR4, 50MHz.
> 256B stride
>
> 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
> ---
>   .../include/asm/arch-rockchip/sdram_common.h  |  5 ++++
>   drivers/ram/rockchip/sdram_debug.c            | 29 +++++++++++++++++++
>   2 files changed, 34 insertions(+)
>
> diff --git a/arch/arm/include/asm/arch-rockchip/sdram_common.h b/arch/arm/include/asm/arch-rockchip/sdram_common.h
> index cfbb511843..b7549f5d8a 100644
> --- a/arch/arm/include/asm/arch-rockchip/sdram_common.h
> +++ b/arch/arm/include/asm/arch-rockchip/sdram_common.h
> @@ -102,10 +102,15 @@ inline void sdram_print_ddr_info(struct sdram_cap_info *cap_info,
>   				 struct sdram_base_params *base)
>   {
>   }
> +
> +inline void sdram_print_stride(unsigned int stride)
> +{
> +}
>   #else
>   void sdram_print_dram_type(unsigned char dramtype);
>   void sdram_print_ddr_info(struct sdram_cap_info *cap_info,
>   			  struct sdram_base_params *base);
> +void sdram_print_stride(unsigned int stride);
>   #endif /* CONFIG_RAM_ROCKCHIP_DEBUG */
>   
>   #endif
> diff --git a/drivers/ram/rockchip/sdram_debug.c b/drivers/ram/rockchip/sdram_debug.c
> index 19e9225c12..9cf662675b 100644
> --- a/drivers/ram/rockchip/sdram_debug.c
> +++ b/drivers/ram/rockchip/sdram_debug.c
> @@ -116,3 +116,32 @@ void sdram_print_ddr_info(struct sdram_cap_info *cap_info,
>   	printdec(cap >> 20);
>   	printascii("MB\n");
>   }
> +
> +void sdram_print_stride(unsigned int stride)
> +{
> +	switch (stride) {
> +	case 0xc:
> +		printf("128B stride\n");
> +		break;
> +	case 5:
> +	case 9:
> +	case 0xd:
> +	case 0x11:
> +	case 0x19:
> +		printf("256B stride\n");
> +		break;
> +	case 0xa:
> +	case 0xe:
> +	case 0x12:
> +		printf("512B stride\n");
> +		break;
> +	case 0xf:
> +		printf("4K stride\n");
> +		break;
> +	case 0x1f:
> +		printf("32MB + 256B stride\n");
> +		break;
> +	default:
> +		printf("no stride\n");
> +	}
> +}

Patch

diff --git a/arch/arm/include/asm/arch-rockchip/sdram_common.h b/arch/arm/include/asm/arch-rockchip/sdram_common.h
index cfbb511843..b7549f5d8a 100644
--- a/arch/arm/include/asm/arch-rockchip/sdram_common.h
+++ b/arch/arm/include/asm/arch-rockchip/sdram_common.h
@@ -102,10 +102,15 @@  inline void sdram_print_ddr_info(struct sdram_cap_info *cap_info,
 				 struct sdram_base_params *base)
 {
 }
+
+inline void sdram_print_stride(unsigned int stride)
+{
+}
 #else
 void sdram_print_dram_type(unsigned char dramtype);
 void sdram_print_ddr_info(struct sdram_cap_info *cap_info,
 			  struct sdram_base_params *base);
+void sdram_print_stride(unsigned int stride);
 #endif /* CONFIG_RAM_ROCKCHIP_DEBUG */
 
 #endif
diff --git a/drivers/ram/rockchip/sdram_debug.c b/drivers/ram/rockchip/sdram_debug.c
index 19e9225c12..9cf662675b 100644
--- a/drivers/ram/rockchip/sdram_debug.c
+++ b/drivers/ram/rockchip/sdram_debug.c
@@ -116,3 +116,32 @@  void sdram_print_ddr_info(struct sdram_cap_info *cap_info,
 	printdec(cap >> 20);
 	printascii("MB\n");
 }
+
+void sdram_print_stride(unsigned int stride)
+{
+	switch (stride) {
+	case 0xc:
+		printf("128B stride\n");
+		break;
+	case 5:
+	case 9:
+	case 0xd:
+	case 0x11:
+	case 0x19:
+		printf("256B stride\n");
+		break;
+	case 0xa:
+	case 0xe:
+	case 0x12:
+		printf("512B stride\n");
+		break;
+	case 0xf:
+		printf("4K stride\n");
+		break;
+	case 0x1f:
+		printf("32MB + 256B stride\n");
+		break;
+	default:
+		printf("no stride\n");
+	}
+}