Skip to contentSkip to conversation

imx: imx8mm: Add suppoer for Mettler-Toledo snowflake board.

PATCH Superseded Sebastian Andrzej Siewior 2 participants 2 messages Mar 31, 2023 – Apr 11, 2023

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 imx: imx8mm: Add suppoer for Mettler-Toledo snowflake board.

From: Manuel Traut <[email protected]>

The board is similar to "Kontron SL i.MX8M Mini" SoM. There are two variants. Snowflake_v2 has an external SDCard Interface. LEIG is the same, but without display and without external SDCard Interface. Both variants support only 1GiB of main memory.

[ bigeasy: porting and a bit of cleanup ]

---
v2…v3:
Addressing Frieder's comments:
- Add "kontron,imx8mm-sl" to the compatible string.
- Remove pca9450 node and pinctrl_i2c1. The included imx8mm-kontron-sl.dtsi already provides this.
- Merge the overwritten values in dram_timing.ddrc_cfg/fsp_msg directly into lpddr4_timing.c.
- Simplify the init in spl_dram_init() and panic() if the init failed.
- Replace a reference to SMARC with the current product name of the SoM.

v1…v2:
- Clarify details about the board and whether or not there is an external SD-card interface.

 arch/arm/dts/Makefile                         |    1 +
 .../dts/imx8mm-mt-snowflake-v2-u-boot.dtsi    |  116 ++
 arch/arm/dts/imx8mm-mt-snowflake-v2.dts       |   76 +
 arch/arm/mach-imx/imx8m/Kconfig               |    8 +
 board/mt/snowflake_v2/Kconfig                 |   18 +
 board/mt/snowflake_v2/MAINTAINERS             |    7 +
 board/mt/snowflake_v2/Makefile                |    9 +
 board/mt/snowflake_v2/imximage.cfg            |    8 +
 board/mt/snowflake_v2/lpddr4_timing.c         | 1844 +++++++++++++++++
 board/mt/snowflake_v2/snowflake_v2.c          |   32 +
 board/mt/snowflake_v2/snowflake_v2.env        |   33 +
 board/mt/snowflake_v2/spl.c                   |  147 ++
 configs/snowflake_v2_emmcboot_defconfig       |  134 ++
 include/configs/snowflake_v2.h                |   55 +
 14 files changed, 2488 insertions(+)
 create mode 100644 arch/arm/dts/imx8mm-mt-snowflake-v2-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mm-mt-snowflake-v2.dts
 create mode 100644 board/mt/snowflake_v2/Kconfig
 create mode 100644 board/mt/snowflake_v2/MAINTAINERS
 create mode 100644 board/mt/snowflake_v2/Makefile
 create mode 100644 board/mt/snowflake_v2/imximage.cfg
 create mode 100644 board/mt/snowflake_v2/lpddr4_timing.c
 create mode 100644 board/mt/snowflake_v2/snowflake_v2.c
 create mode 100644 board/mt/snowflake_v2/snowflake_v2.env
 create mode 100644 board/mt/snowflake_v2/spl.c
 create mode 100644 configs/snowflake_v2_emmcboot_defconfig
 create mode 100644 include/configs/snowflake_v2.h
arch/arm/dts/Makefile +1 -0
index 7a577deb5023d..ba0786064847e 100644
@@ -964,6 +964,7 @@ dtb-$(CONFIG_ARCH_IMX8M) += \
 	imx8mm-icore-mx8mm-edimm2.2.dtb \
 	imx8mm-kontron-bl.dtb \
 	imx8mm-kontron-bl-osm-s.dtb \
+	imx8mm-mt-snowflake-v2.dtb \
 	imx8mm-mx8menlo.dtb \
 	imx8mm-phg.dtb \
 	imx8mm-venice.dtb \
arch/arm/dts/imx8mm-mt-snowflake-v2-u-boot.dtsi new file +116 -0

116 lines not on this page · raw message

arch/arm/dts/imx8mm-mt-snowflake-v2.dts new file +76 -0

76 lines not on this page · raw message

arch/arm/mach-imx/imx8m/Kconfig +8 -0
index 5e4836b02feb5..a2bb07c8f54c9 100644
@@ -161,6 +161,13 @@ config TARGET_IMX8MN_DDR4_EVK
 	select FSL_CAAM
 	select SPL_CRYPTO if SPL
 
+config TARGET_MT_SNOWFLAKE_V2
+	bool "MT Snowflake v2"
+	select BINMAN
+	select IMX8MM
+	select SUPPORT_SPL
+	select IMX8M_LPDDR4
+
 config TARGET_IMX8MN_VENICE
 	bool "Support Gateworks Venice iMX8M Nano module"
 	select BINMAN
@@ -343,6 +350,7 @@ source "board/kontron/pitx_imx8m/Kconfig"
 source "board/kontron/sl-mx8mm/Kconfig"
 source "board/menlo/mx8menlo/Kconfig"
 source "board/msc/sm2s_imx8mp/Kconfig"
+source "board/mt/snowflake_v2/Kconfig"
 source "board/phytec/phycore_imx8mm/Kconfig"
 source "board/phytec/phycore_imx8mp/Kconfig"
 source "board/purism/librem5/Kconfig"
board/mt/snowflake_v2/Kconfig new file +18 -0
new file mode 100644
index 0000000000000..f7c02ba1fbf61
@@ -0,0 +1,18 @@
+if TARGET_MT_SNOWFLAKE_V2
+
+config SYS_BOARD
+	string
+	default "snowflake_v2"
+
+config SYS_VENDOR
+	string
+	default "mt"
+
+config SYS_CONFIG_NAME
+	string
+	default "snowflake_v2"
+
+config IMX_CONFIG
+	default "board/mt/snowflake_v2/imximage.cfg"
+
+endif
board/mt/snowflake_v2/MAINTAINERS new file +7 -0
new file mode 100644
index 0000000000000..e60d24e32f57e
@@ -0,0 +1,7 @@
+Mettler-Toledo Snowflake boards
+M:	Manuel Traut <[email protected]>
+S:	Maintained
+F:	arch/arm/dts/imx8mm-mt-snowflake*
+F:	board/mt/snowflake_v2
+F:	configs/snowflake_v2_emmcboot_defconfig
+F:	include/configs/snowflake_v2.h
board/mt/snowflake_v2/Makefile new file +9 -0
new file mode 100644
index 0000000000000..6ced8f5b3e5ca
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2020 Mettler Toledo GmbH
+
+obj-y := snowflake_v2.o
+
+ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
+obj-$(CONFIG_IMX8M_LPDDR4) += lpddr4_timing.o
+endif
board/mt/snowflake_v2/imximage.cfg new file +8 -0
new file mode 100644
index 0000000000000..20061521f227e
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2021 NXP
+ */
+
+
+BOOT_FROM	sd
+LOADER		u-boot-spl-ddr.bin	0x7E1000
board/mt/snowflake_v2/lpddr4_timing.c new file +1844 -0

1,844 lines not on this page · raw message

board/mt/snowflake_v2/snowflake_v2.c new file +32 -0
new file mode 100644
index 0000000000000..6510225321a06
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Kontron Electronics GmbH
+ * Copyright (C) 2020 Mettler Toledo GmbH
+ */
+
+#include <asm/arch/imx-regs.h>
+#include <asm/global_data.h>
+#include <asm/io.h>
+#include <fdt_support.h>
+#include <linux/arm-smccc.h>
+#include <linux/errno.h>
+#include <net.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int board_phys_sdram_size(phys_size_t *size)
+{
+	/* always 1GB RAM */
+	*size = 0x40000000;
+	return 0;
+}
+
+int ft_board_setup(void *blob, struct bd_info *bd)
+{
+	return fdt_fixup_memory(blob, PHYS_SDRAM, gd->ram_size);
+}
+
+int board_init(void)
+{
+	return 0;
+}
board/mt/snowflake_v2/snowflake_v2.env new file +33 -0
new file mode 100644
index 0000000000000..1ad9a2b2e17e7
@@ -0,0 +1,33 @@
+bootargs_base=console=ttymxc2,115200 vt.global_cursor_default=0 fbcon=font:VGA8x8
+script=boot.scr
+bootdir=
+bootdelay=1
+bootpart=1
+bootchooser=run bootchooser_1; run bootchooser_2; run bootchooser_3
+bootchooser_1=test -n ${BOOT_ORDER} || setenv BOOT_ORDER "system0 system1";
+                 test -n ${BOOT_system0_LEFT} || setenv BOOT_system0_LEFT 3;
+                 test -n ${BOOT_system1_LEFT} || setenv BOOT_system1_LEFT 3;
+                 setenv rauc_slot;
+bootchooser_2=for BOOT_SLOT in ${BOOT_ORDER}; do if test x${rauc_slot} != x; then;
+                 elif test x${BOOT_SLOT} = xsystem0; then
+                 if test ${BOOT_system0_LEFT} -gt 0; then
+                 echo Found valid slot system0, ${BOOT_system0_LEFT} attempts remaining;
+                 setexpr BOOT_system0_LEFT ${BOOT_system0_LEFT} - 1;
+                 setenv bootpart 1; setenv rauc_slot rauc.slot=system0; fi;
+                 elif test x${BOOT_SLOT} = xsystem1; then
+                 if test ${BOOT_system1_LEFT} -gt 0; then
+                 echo Found valid slot system1, ${BOOT_system1_LEFT} attempts remaining;
+                 setexpr BOOT_system1_LEFT ${BOOT_system1_LEFT} - 1;
+                 setenv bootpart 2; setenv rauc_slot rauc.slot=system1; fi; fi; done
+bootchooser_3=if test -n ${rauc_slot}; then saveenv; else
+                 echo No valid slot found, resetting tries to 3;
+                 setenv BOOT_system0_LEFT 3; setenv BOOT_system1_LEFT 3;
+                 saveenv; reset; fi; echo Booting from ${rauc_slot}...;
+emmcboot=run bootchooser; setenv bootargs ${bootargs_base}
+                 root=/dev/mmcblk0p${bootpart} ro rootfstype=ext4 rootwait ${rauc_slot};
+                 echo Booting from eMMC;
+                 ext4load mmc 0:${bootpart} ${scriptaddr} /boot/fitImage && bootm ${scriptaddr}
+sdboot=run bootchooser; setenv bootargs ${bootargs_base}
+                 root=/dev/mmcblk1p${bootpart} ro rootfstype=ext4 rootwait ${rauc_slot};
+                 echo Booting from SD card;
+                 ext4load mmc 1:${bootpart} ${scriptaddr} /boot/fitImage && bootm ${scriptaddr}
board/mt/snowflake_v2/spl.c new file +147 -0

147 lines not on this page · raw message

configs/snowflake_v2_emmcboot_defconfig new file +134 -0

134 lines not on this page · raw message

include/configs/snowflake_v2.h new file +55 -0

55 lines not on this page · raw message

Signature · 1 line
2.40.0
Reviewed-by on v3 1/1
#1 lore raw
Quoted 23 lines · Sebastian Andrzej Siewior

From: Manuel Traut <[email protected]>

The board is similar to "Kontron SL i.MX8M Mini" SoM. There are two variants. Snowflake_v2 has an external SDCard Interface. LEIG is the same, but without display and without external SDCard Interface. Both variants support only 1GiB of main memory.

[ bigeasy: porting and a bit of cleanup ]

---
v2…v3:
Addressing Frieder's comments:
- Add "kontron,imx8mm-sl" to the compatible string.
- Remove pca9450 node and pinctrl_i2c1. The included imx8mm-kontron-sl.dtsi already provides this.
- Merge the overwritten values in dram_timing.ddrc_cfg/fsp_msg directly into lpddr4_timing.c.
- Simplify the init in spl_dram_init() and panic() if the init failed.
- Replace a reference to SMARC with the current product name of the SoM.

Quoted 3 lines

v1…v2:
- Clarify details about the board and whether or not there is an external SD-card interface.

LGTM!