Skip to contentSkip to conversation

bsh: imx6ulz_smm_m2: Add imx6ulz BSH SMM M2B board

PATCH Superseded Michael Trimarchi 2 participants 2 messages May 27, 2025 – May 30, 2025 Arm i.MX and Layerscape

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 bsh: imx6ulz_smm_m2: Add imx6ulz BSH SMM M2B board

Introduce the BSH SystemMaster (SMM) M2B board. Notably, the M2B is designed to leverage the existing device tree of its predecessor, the M2. The primary distinction arises from memory incompatibilities with the M2. To address this, we've implemented a configuration system that allows for selective inclusion of the desired memory components.

---

Changes in v2:
- Ajust commit message and kconfig
- Add MAINTAINERS entry just for configuration file

 board/bsh/imx6ulz_smm_m2/Kconfig              |  21 +++
 board/bsh/imx6ulz_smm_m2/MAINTAINERS          |   3 +-
 board/bsh/imx6ulz_smm_m2/Makefile             |   4 +-
 board/bsh/imx6ulz_smm_m2/ddr3l_timing_128m.c  |   1 +
 .../imx6ulz_smm_m2/ddr3l_timing_128m_m2b.c    | 152 ++++++++++++++++++
 board/bsh/imx6ulz_smm_m2/ddr3l_timing_256m.c  |   1 +
 .../imx6ulz_smm_m2/ddr3l_timing_256m_m2b.c    | 137 ++++++++++++++++
 board/bsh/imx6ulz_smm_m2/ddr3l_timing_512m.c  |   1 +
 board/bsh/imx6ulz_smm_m2/spl.c                |  37 +++--
 board/bsh/imx6ulz_smm_m2/spl_mtypes.h         |   1 +
 configs/imx6ulz_smm_m2b_defconfig             |  78 +++++++++
 11 files changed, 417 insertions(+), 19 deletions(-)
 create mode 100644 board/bsh/imx6ulz_smm_m2/ddr3l_timing_128m_m2b.c
 create mode 100644 board/bsh/imx6ulz_smm_m2/ddr3l_timing_256m_m2b.c
 create mode 100644 configs/imx6ulz_smm_m2b_defconfig
board/bsh/imx6ulz_smm_m2/Kconfig +21 -0
index e38df7ce5cb..20971aa4fe1 100644
@@ -9,4 +9,25 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
 	default "imx6ulz_smm_m2"
 
+choice
+	prompt "Memory Type (M2/M2B) board"
+	default BSH_M2_MEMORY
+	help
+	  Memory type setup.
+	  Please choose correct memory model here.
+
+config BSH_M2_MEMORY
+	bool "Enable for bsh m2 variant"
+	help
+	  If this option is enabled, U-Boot will be configured to support
+	  imx6ulz bsh m2 revision memories.
+
+config BSH_M2B_MEMORY
+	bool "Enable for bsh m2b variant"
+	help
+	  If this option is enabled, U-Boot will be configured to support
+	  imx6ulz bsh m2b revision memories.
+
+endchoice
+
 endif
board/bsh/imx6ulz_smm_m2/MAINTAINERS +2 -1
index 77a033c6cbb..785b57d05f9 100644
@@ -3,4 +3,5 @@ M:	Michael Trimarchi <[email protected]>
 S:	Maintained
 F:	board/bsh/imx6ulz_smm_m2/
 F:	include/configs/imx6ulz_smm_m2.h
-F:	configs/imx6ulz_smm_m2_defconfig
+F:	configs/configs/imx6ulz_smm_m2_defconfig
+F:	configs/configs/imx6ulz_smm_m2b_defconfig
board/bsh/imx6ulz_smm_m2/Makefile +3 -1
index 4f4d67f659d..233bbff4c16 100644
@@ -2,4 +2,6 @@
 # (C) Copyright 2021 Amarula Solutions B.V.
 
 obj-y  := imx6ulz_smm_m2.o
-obj-$(CONFIG_XPL_BUILD) += spl.o ddr3l_timing_512m.o ddr3l_timing_256m.o ddr3l_timing_128m.o
+obj-$(CONFIG_XPL_BUILD) += spl.o
+obj-$(CONFIG_BSH_M2_MEMORY) += ddr3l_timing_512m.o ddr3l_timing_256m.o ddr3l_timing_128m.o
+obj-$(CONFIG_BSH_M2B_MEMORY) += ddr3l_timing_256m_m2b.o ddr3l_timing_128m_m2b.o
board/bsh/imx6ulz_smm_m2/ddr3l_timing_128m.c +1 -0
index 66c3483adbf..f11654a8ceb 100644
@@ -166,4 +166,5 @@ static const struct dram_cfg_param ddr_ddrc_cfg_128mb[] = {
 struct dram_timing_info bsh_dram_timing_128mb = {
 	.ddrc_cfg = ddr_ddrc_cfg_128mb,
 	.ddrc_cfg_num = ARRAY_SIZE(ddr_ddrc_cfg_128mb),
+	.dram_size = SZ_128M,
 };
board/bsh/imx6ulz_smm_m2/ddr3l_timing_128m_m2b.c new file +152 -0

152 lines not on this page · raw message

board/bsh/imx6ulz_smm_m2/ddr3l_timing_256m.c +1 -0
index 0fe5b90a673..5dfc9f5c70d 100644
@@ -165,4 +165,5 @@ static const struct dram_cfg_param ddr_ddrc_cfg_256mb[] = {
 struct dram_timing_info bsh_dram_timing_256mb = {
 	.ddrc_cfg = ddr_ddrc_cfg_256mb,
 	.ddrc_cfg_num = ARRAY_SIZE(ddr_ddrc_cfg_256mb),
+	.dram_size = SZ_256M,
 };
board/bsh/imx6ulz_smm_m2/ddr3l_timing_256m_m2b.c new file +137 -0

137 lines not on this page · raw message

board/bsh/imx6ulz_smm_m2/ddr3l_timing_512m.c +1 -0
index f5989382f5a..4c2ffcd429d 100644
@@ -165,4 +165,5 @@ static const struct dram_cfg_param ddr_ddrc_cfg_512mb[] = {
 struct dram_timing_info bsh_dram_timing_512mb = {
 	.ddrc_cfg = ddr_ddrc_cfg_512mb,
 	.ddrc_cfg_num = ARRAY_SIZE(ddr_ddrc_cfg_512mb),
+	.dram_size = SZ_512M,
 };
board/bsh/imx6ulz_smm_m2/spl.c +20 -17
index c330e4d6d39..7aea73f0f5d 100644
@@ -52,28 +52,31 @@ static void ddr_cfg_write(const struct dram_timing_info *dram_timing_info)
 	}
 }
 
+static const struct dram_timing_info *board_dram_timing[] = {
+#if defined(CONFIG_M2_MEMORY)
+	&bsh_dram_timing_512mb,
+#endif
+	&bsh_dram_timing_256mb,
+	&bsh_dram_timing_128mb,
+};
+
 static void spl_dram_init(void)
 {
 	/* Configure memory to maximum supported size for detection */
-	ddr_cfg_write(&bsh_dram_timing_512mb);
+	ddr_cfg_write(board_dram_timing[0]);
 
 	/* Detect memory physically present */
-	gd->ram_size = get_ram_size((void *)CFG_SYS_SDRAM_BASE, SZ_512M);
-
-	/* Reconfigure memory for actual detected size */
-	switch (gd->ram_size) {
-	case SZ_512M:
-		/* Already configured, nothing to do */
-		break;
-	case SZ_256M:
-		udelay(1);
-		ddr_cfg_write(&bsh_dram_timing_256mb);
-		break;
-	case SZ_128M:
-	default:
-		udelay(1);
-		ddr_cfg_write(&bsh_dram_timing_128mb);
-		break;
+	gd->ram_size = get_ram_size((void *)CFG_SYS_SDRAM_BASE, board_dram_timing[0]->dram_size);
+
+	if (board_dram_timing[0]->dram_size == gd->ram_size)
+		return;
+
+	for (size_t index = 1; index < ARRAY_SIZE(board_dram_timing); index++) {
+		if (board_dram_timing[index]->dram_size == gd->ram_size) {
+			udelay(1);
+			ddr_cfg_write(board_dram_timing[index]);
+			break;
+		}
 	}
 }
 
board/bsh/imx6ulz_smm_m2/spl_mtypes.h +1 -0
index 8da59881c83..06d6f2d76d8 100644
@@ -18,6 +18,7 @@ struct dram_cfg_param {
 struct dram_timing_info {
 	const struct dram_cfg_param *ddrc_cfg;
 	unsigned int ddrc_cfg_num;
+	size_t dram_size;
 };
 
 extern struct dram_timing_info bsh_dram_timing_128mb;
configs/imx6ulz_smm_m2b_defconfig new file +78 -0

78 lines not on this page · raw message

Signature · 3 lines
2.43.0

base-commit: ac093d938648074e11e9ea2829d051f37fd29f81
reviewer
#1 lore raw

board/bsh/imx6ulz_smm_m2/MAINTAINERS M: Michael Trimarchi <[email protected]> · line 7

Quoted 9 lines · Michael Trimarchi
board/bsh/imx6ulz_smm_m2/MAINTAINERS +2 -1
@@ -3,4 +3,5 @@ M:      Michael Trimarchi <[email protected]>
 S:     Maintained
 F:     board/bsh/imx6ulz_smm_m2/
 F:     include/configs/imx6ulz_smm_m2.h
-F:     configs/imx6ulz_smm_m2_defconfig
+F:     configs/configs/imx6ulz_smm_m2_defconfig
+F:     configs/configs/imx6ulz_smm_m2b_defconfig

This still causes CI to fail:

$ ./tools/buildman/buildman --maintainer-check
fatal: detected dubious ownership in repository at
'/builds/u-boot/custodians/u-boot-imx'
To add an exception for this directory, call:
 git config --global --add safe.directory /builds/u-boot/custodians/u-boot-imx
WARNING: no maintainers for 'imx6ulz_smm_m2'
WARNING: no maintainers for 'imx6ulz_smm_m2b'

These 'configs/configs' entries are incorrect.

Please trigger a CI job to catch these errors before submitting a v3.