Skip to contentSkip to conversation

Add MNT Reform 2 board support

PATCH Superseded Patrick Wildt 2 participants 4 messages Dec 14, 2021 – Dec 19, 2021

Subsystems (3)

v3 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v3 cover Add MNT Reform 2 board support

The MNT Reform 2 is a modular DIY laptop. In its initial version it is based on the BoundaryDevices i.MX8MQ SoM. Some parts have been lifted from BoundaryDevices official U-Boot downstream project.

This U-Boot patchset supports the serial console, the SD card and eMMC, Gigabit Ethernet and USB.

Changes since v2:
- Switched to Binman.
Changes since v1:
- Synced DTS with files in Linux git repo.
- Added support for USB host ports.

Patrick Wildt (2):
arm: dts: imx8mq: add MNT Reform 2
board: mntre: imx8mq: Add MNT Reform 2 board support

 arch/arm/dts/Makefile                         |    1 +
 arch/arm/dts/imx8mq-mnt-reform2-u-boot.dtsi   |  143 +++
 arch/arm/dts/imx8mq-mnt-reform2.dts           |  214 ++++
 arch/arm/dts/imx8mq-nitrogen-som.dtsi         |  275 +++++
 arch/arm/mach-imx/imx8m/Kconfig               |    7 +
 board/mntre/imx8mq_reform2/Kconfig            |   15 +
 board/mntre/imx8mq_reform2/MAINTAINERS        |    7 +
 board/mntre/imx8mq_reform2/Makefile           |   12 +
 board/mntre/imx8mq_reform2/imx8mq_reform2.c   |  213 ++++
 board/mntre/imx8mq_reform2/imximage.cfg       |   11 +
 board/mntre/imx8mq_reform2/lpddr4_timing.c    | 1014 +++++++++++++++++
 .../mntre/imx8mq_reform2/lpddr4_timing_ch2.h  |   95 ++
 board/mntre/imx8mq_reform2/spl.c              |  260 +++++
 configs/imx8mq_reform2_defconfig              |   82 ++
 include/configs/imx8mq_reform2.h              |  114 ++
 15 files changed, 2463 insertions(+)
 create mode 100644 arch/arm/dts/imx8mq-mnt-reform2-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mq-mnt-reform2.dts
 create mode 100644 arch/arm/dts/imx8mq-nitrogen-som.dtsi
 create mode 100644 board/mntre/imx8mq_reform2/Kconfig
 create mode 100644 board/mntre/imx8mq_reform2/MAINTAINERS
 create mode 100644 board/mntre/imx8mq_reform2/Makefile
 create mode 100644 board/mntre/imx8mq_reform2/imx8mq_reform2.c
 create mode 100644 board/mntre/imx8mq_reform2/imximage.cfg
 create mode 100644 board/mntre/imx8mq_reform2/lpddr4_timing.c
 create mode 100644 board/mntre/imx8mq_reform2/lpddr4_timing_ch2.h
 create mode 100644 board/mntre/imx8mq_reform2/spl.c
 create mode 100644 configs/imx8mq_reform2_defconfig
 create mode 100644 include/configs/imx8mq_reform2.h
Signature · 1 line
2.34.1
#1 lore raw

PATCH v3 1/2 arm: dts: imx8mq: add MNT Reform 2

Device tree taken from Linux v5.16-rc5.

---
 arch/arm/dts/Makefile                 |   1 +
 arch/arm/dts/imx8mq-mnt-reform2.dts   | 214 ++++++++++++++++++++
 arch/arm/dts/imx8mq-nitrogen-som.dtsi | 275 ++++++++++++++++++++++++++
 3 files changed, 490 insertions(+)
 create mode 100644 arch/arm/dts/imx8mq-mnt-reform2.dts
 create mode 100644 arch/arm/dts/imx8mq-nitrogen-som.dtsi
arch/arm/dts/Makefile +1 -0
index 7f622fedbd..1183a8f7c6 100644
@@ -905,6 +905,7 @@ dtb-$(CONFIG_ARCH_IMX8M) += \
 	imx8mq-evk.dtb \
 	imx8mm-beacon-kit.dtb \
 	imx8mn-beacon-kit.dtb \
+	imx8mq-mnt-reform2.dtb \
 	imx8mq-phanbell.dtb \
 	imx8mp-evk.dtb \
 	imx8mp-phyboard-pollux-rdk.dtb \
arch/arm/dts/imx8mq-mnt-reform2.dts new file +214 -0

214 lines not on this page · raw message

arch/arm/dts/imx8mq-nitrogen-som.dtsi new file +275 -0

275 lines not on this page · raw message

Signature · 1 line
2.34.1
#2 lore raw

PATCH v3 2/2 board: mntre: imx8mq: Add MNT Reform 2 board support

In reply to Patrick Wildt

The MNT Reform 2 is a modular DIY laptop. In its initial version it is based on the BoundaryDevices i.MX8MQ SoM. Some parts have been lifted from BoundaryDevices official U-Boot downstream project.

---
 arch/arm/dts/imx8mq-mnt-reform2-u-boot.dtsi   |  143 +++
 arch/arm/mach-imx/imx8m/Kconfig               |    7 +
 board/mntre/imx8mq_reform2/Kconfig            |   15 +
 board/mntre/imx8mq_reform2/MAINTAINERS        |    7 +
 board/mntre/imx8mq_reform2/Makefile           |   12 +
 board/mntre/imx8mq_reform2/imx8mq_reform2.c   |  213 ++++
 board/mntre/imx8mq_reform2/imximage.cfg       |   11 +
 board/mntre/imx8mq_reform2/lpddr4_timing.c    | 1014 +++++++++++++++++
 .../mntre/imx8mq_reform2/lpddr4_timing_ch2.h  |   95 ++
 board/mntre/imx8mq_reform2/spl.c              |  260 +++++
 configs/imx8mq_reform2_defconfig              |   82 ++
 include/configs/imx8mq_reform2.h              |  114 ++
 12 files changed, 1973 insertions(+)
 create mode 100644 arch/arm/dts/imx8mq-mnt-reform2-u-boot.dtsi
 create mode 100644 board/mntre/imx8mq_reform2/Kconfig
 create mode 100644 board/mntre/imx8mq_reform2/MAINTAINERS
 create mode 100644 board/mntre/imx8mq_reform2/Makefile
 create mode 100644 board/mntre/imx8mq_reform2/imx8mq_reform2.c
 create mode 100644 board/mntre/imx8mq_reform2/imximage.cfg
 create mode 100644 board/mntre/imx8mq_reform2/lpddr4_timing.c
 create mode 100644 board/mntre/imx8mq_reform2/lpddr4_timing_ch2.h
 create mode 100644 board/mntre/imx8mq_reform2/spl.c
 create mode 100644 configs/imx8mq_reform2_defconfig
 create mode 100644 include/configs/imx8mq_reform2.h
arch/arm/dts/imx8mq-mnt-reform2-u-boot.dtsi new file +143 -0
new file mode 100644
index 0000000000..3b7d50635c
@@ -0,0 +1,143 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+
+/ {
+	binman: binman {
+		multiple-images;
+	};
+};
+
+&usdhc1 {
+	mmc-hs400-1_8v;
+};
+
+&usdhc2 {
+	cd-gpios = <&gpio2 12 GPIO_ACTIVE_LOW>;
+	sd-uhs-sdr104;
+	sd-uhs-ddr50;
+};
+
+&binman {
+	u-boot-spl-ddr {
+		filename = "u-boot-spl-ddr.bin";
+		pad-byte = <0xff>;
+		align-size = <4>;
+		align = <4>;
+
+		u-boot-spl {
+			align-end = <4>;
+		};
+
+		blob_1: blob-ext@1 {
+			filename = "lpddr4_pmu_train_1d_imem.bin";
+			size = <0x8000>;
+		};
+
+		blob_2: blob-ext@2 {
+			filename = "lpddr4_pmu_train_1d_dmem.bin";
+			size = <0x4000>;
+		};
+
+		blob_3: blob-ext@3 {
+			filename = "lpddr4_pmu_train_2d_imem.bin";
+			size = <0x8000>;
+		};
+
+		blob_4: blob-ext@4 {
+			filename = "lpddr4_pmu_train_2d_dmem.bin";
+			size = <0x4000>;
+		};
+	};
+
+	signed_hdmi {
+		filename = "signed_hdmi.bin";
+
+		blob_5: blob-ext@5 {
+			filename = "signed_hdmi_imx8m.bin";
+		};
+	};
+
+	spl {
+		filename = "spl.bin";
+
+		mkimage {
+			args = "-n spl/u-boot-spl.cfgout -T imx8mimage -e 0x7e1000";
+
+			blob {
+				filename = "u-boot-spl-ddr.bin";
+			};
+		};
+	};
+
+	itb {
+		filename = "u-boot.itb";
+
+		fit {
+			description = "Configuration to load ATF before U-Boot";
+			#address-cells = <1>;
+			fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>;
+
+			images {
+				uboot {
+					description = "U-Boot (64-bit)";
+					type = "standalone";
+					arch = "arm64";
+					compression = "none";
+					load = <CONFIG_SYS_TEXT_BASE>;
+
+					uboot_blob: blob-ext {
+						filename = "u-boot-nodtb.bin";
+					};
+				};
+
+				atf {
+					description = "ARM Trusted Firmware";
+					type = "firmware";
+					arch = "arm64";
+					compression = "none";
+					load = <0x910000>;
+					entry = <0x910000>;
+
+					atf_blob: blob-ext {
+						filename = "bl31.bin";
+					};
+				};
+
+				fdt {
+					description = "NAME";
+					type = "flat_dt";
+					compression = "none";
+
+					uboot_fdt_blob: blob-ext {
+						filename = "u-boot.dtb";
+					};
+				};
+			};
+
+			configurations {
+				default = "conf";
+
+				conf {
+					description = "NAME";
+					firmware = "uboot";
+					loadables = "atf";
+					fdt = "fdt";
+				};
+			};
+		};
+	};
+
+	imx-boot {
+		filename = "flash.bin";
+		pad-byte = <0x00>;
+
+		spl: blob-ext@1 {
+			offset = <0x0>;
+			filename = "spl.bin";
+		};
+
+		uboot: blob-ext@2 {
+			offset = <0x57c00>;
+			filename = "u-boot.itb";
+		};
+	};
+};
arch/arm/mach-imx/imx8m/Kconfig +7 -0
index 276b8bd974..c719da4c8b 100644
@@ -44,6 +44,12 @@ config TARGET_IMX8MQ_PHANBELL
         select IMX8MQ
         select IMX8M_LPDDR4
 
+config TARGET_IMX8MQ_REFORM2
+	bool "imx8mq_reform2"
+	select BINMAN
+	select IMX8MQ
+	select IMX8M_LPDDR4
+
 config TARGET_IMX8MM_EVK
 	bool "imx8mm LPDDR4 EVK board"
 	select BINMAN
@@ -167,6 +173,7 @@ source "board/freescale/imx8mp_evk/Kconfig"
 source "board/gateworks/venice/Kconfig"
 source "board/google/imx8mq_phanbell/Kconfig"
 source "board/kontron/sl-mx8mm/Kconfig"
+source "board/mntre/imx8mq_reform2/Kconfig"
 source "board/phytec/phycore_imx8mm/Kconfig"
 source "board/phytec/phycore_imx8mp/Kconfig"
 source "board/ronetix/imx8mq-cm/Kconfig"
board/mntre/imx8mq_reform2/Kconfig new file +15 -0
new file mode 100644
index 0000000000..7edd7cf21e
@@ -0,0 +1,15 @@
+if TARGET_IMX8MQ_REFORM2
+
+config SYS_BOARD
+	default "imx8mq_reform2"
+
+config SYS_VENDOR
+	default "mntre"
+
+config SYS_CONFIG_NAME
+	default "imx8mq_reform2"
+
+config IMX_CONFIG
+	default "board/mntre/imx8mq_reform2/imximage.cfg"
+
+endif
board/mntre/imx8mq_reform2/MAINTAINERS new file +7 -0
new file mode 100644
index 0000000000..946f287ecf
@@ -0,0 +1,7 @@
+REFORM2 IMX8MQ BOARD
+M:	Lukas F. Hartmann <[email protected]>
+M:	Patrick Wildt <[email protected]>
+S:	Maintained
+F:	board/mntre/imx8mq_reform2/
+F:	include/configs/imx8mq_reform2.h
+F:	configs/imx8mq_reform2_defconfig
board/mntre/imx8mq_reform2/Makefile new file +12 -0
new file mode 100644
index 0000000000..2efd56bb4a
@@ -0,0 +1,12 @@
+#
+# Copyright 2017 NXP
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#
+
+obj-y += imx8mq_reform2.o
+
+ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
+obj-$(CONFIG_IMX8M_LPDDR4) += lpddr4_timing.o
+endif
board/mntre/imx8mq_reform2/imx8mq_reform2.c new file +213 -0

213 lines not on this page · raw message

board/mntre/imx8mq_reform2/imximage.cfg new file +11 -0
new file mode 100644
index 0000000000..2a3f959183
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2018-2021 NXP
+ */
+
+#define __ASSEMBLY__
+
+FIT
+BOOT_FROM	sd
+SIGNED_HDMI	signed_hdmi.bin
+LOADER		u-boot-spl-ddr.bin	0x7e1000
board/mntre/imx8mq_reform2/lpddr4_timing.c new file +1014 -0

1,014 lines not on this page · raw message

board/mntre/imx8mq_reform2/lpddr4_timing_ch2.h new file +95 -0

95 lines not on this page · raw message

board/mntre/imx8mq_reform2/spl.c new file +260 -0

260 lines not on this page · raw message

configs/imx8mq_reform2_defconfig new file +82 -0

82 lines not on this page · raw message

include/configs/imx8mq_reform2.h new file +114 -0

114 lines not on this page · raw message

Signature · 1 line
2.34.1
Tested-by on v3 2/2
#3 lore raw

Re: [PATCH v3 2/2] board: mntre: imx8mq: Add MNT Reform 2 board support

Quoted 3 lines · Patrick Wildt

The MNT Reform 2 is a modular DIY laptop. In its initial version it is based on the BoundaryDevices i.MX8MQ SoM. Some parts have been lifted from BoundaryDevices official U-Boot downstream project.

Successfully loaded u-boot, loaded a kernel and .dtb, thanks!

This may not be specific to this patch series, but one problem I had during build is that it doesn't appear to respect the BL31 environment variable that many other platforms support to specify the path to the ATF firmware; is there a way to add that with binman?

Similarly, it would be ideal to have environment variables for the other various firmware (lpddr*.bin, signed-hdmi*.bin) needed to build. The Debian u-boot packages build all boards from a single source, and copying *.bin into the top-level directory for each one at the right time seems trickier than telling each build target where the firmware is via environment variables.

A couple relatively small things in the patch itself:

Quoted 5 lines
include/configs/imx8mq_reform2.h new file +0 -0
new file mode 100644
index 0000000000..8aed1acfcf

...

include/configs/imx8mq_reform2.h line 68

Quoted 7 lines
include/configs/imx8mq_reform2.h new file +7 -0
+#define CONFIG_EXTRA_ENV_SETTINGS		\
+	BOOTENV \
+	"scriptaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
+	"kernel_addr_r=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
+	"image=Image\0" \
+	"console=ttymxc0,115200\0" \
+	"fdt_addr_r=0x43000000\0"			\

This should have ramdisk_addr_r, maybe:

"ramdisk_addr_r=0x44000000\0"

Maybe 0x4400000 is a bit overkill, but anything that that starts sufficiently after fdt_addr_r to leave room for the .dtb file.

This is needed to support distro_bootcmd functionality (boot scripts, extlinux.conf support, etc.) where an initrd/initramfs should be an available option.

include/configs/imx8mq_reform2.h line 70

Quoted 2 lines
include/configs/imx8mq_reform2.h new file +2 -0
+	"boot_fdt=try\0" \
+	"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \

This should be something like:

  "fdtfile=freescale/" CONFIG_DEFAULT_FDT_FILE "\0" \

Or maybe CONFIG_DEFAULT_FDT_FILE should have the vendor directory prepended in configs/imx8mq_reform2_defconfig? Not sure which is more correct, but the boot environment should have the vendor directory included in fdtfile one way or another.

Thanks again, it is very nice to be able to build my own bootloader. :)

live well,
vagrant