diff mbox series

[v1,5/7] apalis-imx8: add implementation for board_mem_get_layout

Message ID 20201022082143.21170-6-igor.opaniuk@gmail.com
State Accepted
Commit 90311be09f653499a1f4bd8198955ae79e00b51c
Delegated to: Stefano Babic
Headers show
Series toradex: add support for Apalis iMX8X WB IT V1.1 module | expand

Commit Message

Igor Opaniuk Oct. 22, 2020, 8:21 a.m. UTC
From: Igor Opaniuk <igor.opaniuk@toradex.com>

Add implementation of board_mem_get_layout for overriding the memory
layout.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
---

 board/toradex/apalis-imx8/apalis-imx8.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

Comments

Oleksandr Suvorov Oct. 30, 2020, 3:19 p.m. UTC | #1
On Thu, Oct 22, 2020 at 11:22 AM Igor Opaniuk <igor.opaniuk@gmail.com> wrote:
>
> From: Igor Opaniuk <igor.opaniuk@toradex.com>
>
> Add implementation of board_mem_get_layout for overriding the memory
> layout.
>
> Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

Acked-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

> ---
>
>  board/toradex/apalis-imx8/apalis-imx8.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
>
> diff --git a/board/toradex/apalis-imx8/apalis-imx8.c b/board/toradex/apalis-imx8/apalis-imx8.c
> index 9263b0f51f..2ed66261d2 100644
> --- a/board/toradex/apalis-imx8/apalis-imx8.c
> +++ b/board/toradex/apalis-imx8/apalis-imx8.c
> @@ -37,6 +37,29 @@ static void setup_iomux_uart(void)
>         imx8_iomux_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
>  }
>
> +void board_mem_get_layout(u64 *phys_sdram_1_start,
> +                         u64 *phys_sdram_1_size,
> +                         u64 *phys_sdram_2_start,
> +                         u64 *phys_sdram_2_size)
> +{
> +       u32 is_quadplus = 0, val = 0;
> +       sc_err_t scierr = sc_misc_otp_fuse_read(-1, 6, &val);
> +
> +       if (scierr == SC_ERR_NONE) {
> +               /* QP has one A72 core disabled */
> +               is_quadplus = ((val >> 4) & 0x3) != 0x0;
> +       }
> +
> +       *phys_sdram_1_start = PHYS_SDRAM_1;
> +       *phys_sdram_1_size = PHYS_SDRAM_1_SIZE;
> +       *phys_sdram_2_start = PHYS_SDRAM_2;
> +       if (is_quadplus)
> +               /* Our QP based SKUs only have 2 GB RAM (PHYS_SDRAM_1_SIZE) */
> +               *phys_sdram_2_size = 0x0UL;
> +       else
> +               *phys_sdram_2_size = PHYS_SDRAM_2_SIZE;
> +}
> +
>  int board_early_init_f(void)
>  {
>         sc_pm_clock_rate_t rate = SC_80MHZ;
> --
> 2.17.1
>
Stefano Babic Dec. 8, 2020, 7:59 a.m. UTC | #2
> From: Igor Opaniuk <igor.opaniuk@toradex.com>
> Add implementation of board_mem_get_layout for overriding the memory
> layout.
> Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
> Acked-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/board/toradex/apalis-imx8/apalis-imx8.c b/board/toradex/apalis-imx8/apalis-imx8.c
index 9263b0f51f..2ed66261d2 100644
--- a/board/toradex/apalis-imx8/apalis-imx8.c
+++ b/board/toradex/apalis-imx8/apalis-imx8.c
@@ -37,6 +37,29 @@  static void setup_iomux_uart(void)
 	imx8_iomux_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
 }
 
+void board_mem_get_layout(u64 *phys_sdram_1_start,
+			  u64 *phys_sdram_1_size,
+			  u64 *phys_sdram_2_start,
+			  u64 *phys_sdram_2_size)
+{
+	u32 is_quadplus = 0, val = 0;
+	sc_err_t scierr = sc_misc_otp_fuse_read(-1, 6, &val);
+
+	if (scierr == SC_ERR_NONE) {
+		/* QP has one A72 core disabled */
+		is_quadplus = ((val >> 4) & 0x3) != 0x0;
+	}
+
+	*phys_sdram_1_start = PHYS_SDRAM_1;
+	*phys_sdram_1_size = PHYS_SDRAM_1_SIZE;
+	*phys_sdram_2_start = PHYS_SDRAM_2;
+	if (is_quadplus)
+		/* Our QP based SKUs only have 2 GB RAM (PHYS_SDRAM_1_SIZE) */
+		*phys_sdram_2_size = 0x0UL;
+	else
+		*phys_sdram_2_size = PHYS_SDRAM_2_SIZE;
+}
+
 int board_early_init_f(void)
 {
 	sc_pm_clock_rate_t rate = SC_80MHZ;