colibri-imx8x: add implementation for board_mem_get_layout
authorIgor Opaniuk <igor.opaniuk@toradex.com>
Thu, 22 Oct 2020 08:21:43 +0000 (11:21 +0300)
committerStefano Babic <sbabic@denx.de>
Sun, 6 Dec 2020 14:31:37 +0000 (15:31 +0100)
Add implementation of board_mem_get_layout for overriding the memory
layout.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
board/toradex/colibri-imx8x/colibri-imx8x.c

index f981c11..da081e3 100644 (file)
@@ -39,6 +39,29 @@ static void setup_iomux_uart(void)
        imx8_iomux_setup_multiple_pads(uart3_pads, ARRAY_SIZE(uart3_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_dualx = 0, val = 0;
+       sc_err_t scierr = sc_misc_otp_fuse_read(-1, 6, &val);
+
+       if (scierr == SC_ERR_NONE) {
+               /* DX has two A35 cores disabled */
+               is_dualx = (val & 0xf) != 0x0;
+       }
+
+       *phys_sdram_1_start = PHYS_SDRAM_1;
+       if (is_dualx)
+               /* Our DX based SKUs only have 1 GB RAM */
+               *phys_sdram_1_size = SZ_1G;
+       else
+               *phys_sdram_1_size = PHYS_SDRAM_1_SIZE;
+       *phys_sdram_2_start = PHYS_SDRAM_2;
+       *phys_sdram_2_size = PHYS_SDRAM_2_SIZE;
+}
+
 int board_early_init_f(void)
 {
        sc_pm_clock_rate_t rate;