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

2021-12-18 Thread Vagrant Cascadian
On 2021-12-14, Patrick Wildt wrote:
> 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!

Tested-By: Vagrant Cascadian 

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:

> diff --git a/include/configs/imx8mq_reform2.h 
> b/include/configs/imx8mq_reform2.h
> new file mode 100644
> index 00..8aed1acfcf
> --- /dev/null
> +++ b/include/configs/imx8mq_reform2.h
...
> +#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=0x4300\0"   \

This should have ramdisk_addr_r, maybe:

  "ramdisk_addr_r=0x4400\0"

Maybe 0x440 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.


> + "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


signature.asc
Description: PGP signature


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

2021-12-14 Thread 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.

Signed-off-by: Patrick Wildt 
---
 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

diff --git a/arch/arm/dts/imx8mq-mnt-reform2-u-boot.dtsi 
b/arch/arm/dts/imx8mq-mnt-reform2-u-boot.dtsi
new file mode 100644
index 00..3b7d50635c
--- /dev/null
+++ b/arch/arm/dts/imx8mq-mnt-reform2-u-boot.dtsi
@@ -0,0 +1,143 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+
+/ {
+   binman: binman {
+   multiple-images;
+   };
+};
+
+ {
+   mmc-hs400-1_8v;
+};
+
+ {
+   cd-gpios = < 12 GPIO_ACTIVE_LOW>;
+   sd-uhs-sdr104;
+   sd-uhs-ddr50;
+};
+
+ {
+   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 = ;
+
+   images {
+   uboot {
+   description = "U-Boot (64-bit)";
+   type = "standalone";
+   arch = "arm64";
+   compression = "none";
+   load = ;
+
+   uboot_blob: blob-ext {
+   filename = "u-boot-nodtb.bin";
+   };
+   };
+
+   atf {
+   description = "ARM Trusted Firmware";
+   type = "firmware";
+   arch = "arm64";
+   compression = "none";
+   load = <0x91>;
+   entry = <0x91>;
+
+   atf_blob: blob-ext {
+   filename = "bl31.bin";
+