Skip to contentSkip to conversation

arm: imx8m: imx8mm-cl-iot-gate: Add support for detect memory size

PATCH In review Ying-Chun Liu 3 participants 4 messages Aug 24, 2021 – Oct 7, 2021 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

v2 cover arm: imx8m: imx8mm-cl-iot-gate: Add support for detect memory size

From: "Ying-Chun Liu (PaulLiu)" <[email protected]>

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.

This patch was trying to fix the regression on mainline U-boot for imx8mm-cl-iot-gate. However this is not related to the regression. But we should have this implemented anyway.

v2: use hang() instead of while(1)

Ying-Chun Liu (PaulLiu) (1):
arm: imx8m: imx8mm-cl-iot-gate: Add support for detect memory size

 .../imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c   | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)
Signature · 1 line
2.32.0
#1 lore raw

PATCH v2 1/1 arm: imx8m: imx8mm-cl-iot-gate: Add support for detect memory size

From: "Ying-Chun Liu (PaulLiu)" <[email protected]>

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.

Cc Fabio Estevam <[email protected]>
Cc Frieder Schrempf <[email protected]>
Cc uboot-imx <[email protected]>

---
v2: use hang() instead of while(1)

---
 .../imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c   | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)
board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c +25 -0
index eabcc842a4..cd15410978 100644
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <env.h>
+#include <hang.h>
 #include <init.h>
 #include <miiphy.h>
 #include <netdev.h>
@@ -14,8 +15,32 @@
 #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)) {
Signature · 1 line
2.32.0
Reviewed-by on v2 1/1
#2 lore raw

Hi Paul,

Quoted 6 lines · Ying-Chun Liu

From: "Ying-Chun Liu (PaulLiu)" <[email protected]>

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.

Quoted 6 lines
Cc Fabio Estevam <[email protected]>
Cc Frieder Schrempf <[email protected]>
Cc uboot-imx <[email protected]>

---
v2: use hang() instead of while(1)

Thanks for fixing this:

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-60 Fax: (+49)-8142-66989-80 Email: [email protected]
#3 lore raw

PATCH v2 1/1 arm: imx8m: imx8mm-cl-iot-gate: Add support for detect memory size

In reply to Ying-Chun Liu
Quoted 9 lines

From: "Ying-Chun Liu (PaulLiu)" <[email protected]> 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.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================