]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm: imx8m: imx8mm-cl-iot-gate: Add support for detect memory size
authorYing-Chun Liu (PaulLiu) <paulliu@debian.org>
Tue, 24 Aug 2021 09:44:19 +0000 (17:44 +0800)
committerStefano Babic <sbabic@denx.de>
Thu, 7 Oct 2021 14:53:50 +0000 (16:53 +0200)
When purchasing imx8mm-cl-iot-gate it is able to customize the
memory size. It could be 1GB, 2GB and 4GB. We implement
board_phys_sdram_size() to detect the memory size for usage.

Signed-off-by: Ying-Chun Liu (PaulLiu) <paulliu@debian.org>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Frieder Schrempf <frieder.schrempf@kontron.de>
Cc: uboot-imx <uboot-imx@nxp.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c

index eabcc842a48cd6875ca89ff4b8b8af4cd257dff7..cd15410978ef9ec055f70d1b24b99bcc5007b2ca 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <env.h>
+#include <hang.h>
 #include <init.h>
 #include <miiphy.h>
 #include <netdev.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/io.h>
 
+#include "ddr/ddr.h"
+
 DECLARE_GLOBAL_DATA_PTR;
 
+int board_phys_sdram_size(phys_size_t *size)
+{
+       struct lpddr4_tcm_desc *lpddr4_tcm_desc =
+               (struct lpddr4_tcm_desc *)TCM_DATA_CFG;
+
+       switch (lpddr4_tcm_desc->size) {
+       case 4096:
+       case 2048:
+       case 1024:
+               *size = (1L << 20) * lpddr4_tcm_desc->size;
+               break;
+       default:
+               printf("%s: DRAM size %uM is not supported\n",
+                      __func__,
+                      lpddr4_tcm_desc->size);
+               hang();
+               break;
+       };
+
+       return 0;
+}
+
 static int setup_fec(void)
 {
        if (IS_ENABLED(CONFIG_FEC_MXC)) {