Skip to contentSkip to conversation

imx: Add support for i.MX8MM Beacon EmbeddedWorks devkit.

PATCH New Adam Ford 2 participants 8 messages Apr 26, 2020 – Apr 28, 2020

Subsystems (3)
lore
Share & tools
lore

Adam Ford

author
#0 lore raw

PATCH 1/1 imx: Add support for i.MX8MM Beacon EmbeddedWorks devkit.

Beacon EmbeddedWorks, formerly known as Logic PD, is releasing a devkit based on the i.MX8M Mini SoC consisting of baseboard + SOM.

It supports eMMC on the SOM, microSD on the baseboard, various GPIO, the PINCTRL, and UART.

---
The device tree files are pulled from Shawn Guo's imx branch destined for Linux 5.8 and have already been removed, but the ddrc node was deleted.

arch/arm/dts/Makefile +2 -1
index 59a2713cb2..249d446f69 100644
@@ -730,7 +730,8 @@ dtb-$(CONFIG_ARCH_IMX8M) += \
 	imx8mm-verdin.dtb \
 	imx8mn-ddr4-evk.dtb \
 	imx8mq-evk.dtb \
-	imx8mp-evk.dtb
+	imx8mp-evk.dtb \
+	imx8mm-beacon-kit.dtb
 
 dtb-$(CONFIG_ARCH_IMXRT) += imxrt1050-evk.dtb \
 	imxrt1020-evk.dtb
arch/arm/dts/imx8mm-beacon-baseboard.dtsi new file +285 -0

285 lines not on this page · raw message

arch/arm/dts/imx8mm-beacon-kit-u-boot.dtsi new file +119 -0

119 lines not on this page · raw message

arch/arm/dts/imx8mm-beacon-kit.dts new file +19 -0
new file mode 100644
index 0000000000..74a7b0cc10
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright 2020 Compass Electronics Group, LLC
+ */
+
+/dts-v1/;
+
+#include "imx8mm.dtsi"
+#include "imx8mm-beacon-som.dtsi"
+#include "imx8mm-beacon-baseboard.dtsi"
+
+/ {
+	model = "Beacon EmbeddedWorks i.MX8M Mini Development Kit";
+	compatible = "beacon,imx8mm-beacon-kit", "fsl,imx8mm";
+
+	chosen {
+		stdout-path = &uart2;
+	};
+};
arch/arm/dts/imx8mm-beacon-som.dtsi new file +390 -0

390 lines not on this page · raw message

arch/arm/mach-imx/imx8m/Kconfig +7 -0
index 58f1758ab6..6f6e63472f 100644
@@ -56,6 +56,12 @@ config TARGET_VERDIN_IMX8MM
        select SUPPORT_SPL
        select IMX8M_LPDDR4
 
+config TARGET_IMX8MM_BEACON
+	bool "imx8mm Beacon Embedded devkit"
+	select IMX8MM
+	select SUPPORT_SPL
+	select IMX8M_LPDDR4
+
 endchoice
 
 source "board/freescale/imx8mq_evk/Kconfig"
@@ -63,5 +69,6 @@ source "board/freescale/imx8mm_evk/Kconfig"
 source "board/freescale/imx8mn_evk/Kconfig"
 source "board/freescale/imx8mp_evk/Kconfig"
 source "board/toradex/verdin-imx8mm/Kconfig"
+source "board/beacon/imx8mm/Kconfig"
 
 endif
board/beacon/imx8mm/Kconfig new file +14 -0
new file mode 100644
index 0000000000..df3125eae9
@@ -0,0 +1,14 @@
+if TARGET_IMX8MM_BEACON
+
+config SYS_BOARD
+	default "imx8mm"
+
+config SYS_VENDOR
+	default "beacon"
+
+config SYS_CONFIG_NAME
+	default "imx8mm_beacon"
+
+source "board/freescale/common/Kconfig"
+
+endif
board/beacon/imx8mm/Makefile new file +19 -0
new file mode 100644
index 0000000000..7d83895de8
@@ -0,0 +1,19 @@
+#
+# Copyright 2020 Compass Electronics Group, LLC
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#
+
+obj-y += imx8mm_beacon.o
+obj-y += ../../freescale/common/
+
+ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
+ifdef CONFIG_IMX8M_4G_LPDDR4
+obj-y += lpddr4_timing_4g.o
+else
+obj-$(CONFIG_IMX8M_LPDDR4) += lpddr4_timing.o
+obj-$(CONFIG_IMX8M_DDR4) += ddr4_timing.o
+endif
+
+endif
board/beacon/imx8mm/README new file +37 -0
new file mode 100644
index 0000000000..6dc916fc10
@@ -0,0 +1,37 @@
+U-Boot for the Beacon EmbeddedWorks Devkit
+
+Quick Start
+===========
+- Build the ARM Trusted firmware binary
+- Get ddr fimware
+- Build U-Boot
+- Boot
+
+Get and Build the ARM Trusted firmware
+======================================
+Note: srctree is U-Boot source directory
+
+$ git clone https://source.codeaurora.org/external/imx/imx-atf
+$ git checkout imx_4.19.35_1.0.0
+$ make PLAT=imx8mm bl31 ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-
+$ cp build/imx8mm/release/bl31.bin $(srctree)
+
+Get the DDR firmware
+====================
+$ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.5.bin
+$ chmod +x firmware-imx-8.5.bin
+$ ./firmware-imx-8.5
+$ cp firmware-imx-8.5/firmware/ddr/synopsys/lpddr4*.bin $(srctree)
+
+Build U-Boot
+============
+$ make imx8mm_beacon_defconfig
+$ make flash.bin ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- ATF_LOAD_ADDR=0x920000
+
+Burn U-Boot to microSD Card
+===========================
+$ sudo dd if=flash.bin of=/dev/sd[x] bs=1024 seek=33
+
+Boot
+====
+Set Boot switch to SD boot
board/beacon/imx8mm/imx8mm_beacon.c new file +67 -0

67 lines not on this page · raw message

board/beacon/imx8mm/lpddr4_timing.c new file +1980 -0

1,980 lines not on this page · raw message

board/beacon/imx8mm/spl.c new file +169 -0

43 lines not on this page · raw message

configs/imx8mm_beacon_defconfig new file +98 -0

98 lines not on this page · raw message

include/configs/imx8mm_beacon.h new file +152 -0

152 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.25.1

Part of the diff is not shown here. View the raw message.

#1 lore raw

PATCH 1/1 imx: Add support for i.MX8MM Beacon EmbeddedWorks devkit.

Quoted 18 lines · Adam Ford

Beacon EmbeddedWorks, formerly known as Logic PD, is releasing a devkit based on the i.MX8M Mini SoC consisting of baseboard + SOM.

It supports eMMC on the SOM, microSD on the baseboard, various GPIO, the PINCTRL, and UART.

---
The device tree files are pulled from Shawn Guo's imx branch destined for Linux 5.8 and have already been removed, but the ddrc node was deleted.

arch/arm/dts/Makefile +0 -0
index 59a2713cb2..249d446f69 100644

arch/arm/dts/Makefile dtb-$(CONFIG_ARCH_IMX8M) += \ · line 734

Quoted 6 lines
arch/arm/dts/Makefile +2 -1
@@ -730,7 +730,8 @@ dtb-$(CONFIG_ARCH_IMX8M) += \
 	imx8mm-verdin.dtb \
 	imx8mn-ddr4-evk.dtb \
 	imx8mq-evk.dtb \
-	imx8mp-evk.dtb
+	imx8mp-evk.dtb \
+	imx8mm-beacon-kit.dtb

Keep the list sorted.

Quoted 2 lines
arch/arm/dts/Makefile +0 -0
 dtb-$(CONFIG_ARCH_IMXRT) += imxrt1050-evk.dtb \
 	imxrt1020-evk.dtb

[...]

Quoted 18 lines
arch/arm/mach-imx/imx8m/Kconfig +6 -0
index 58f1758ab6..6f6e63472f 100644
@@ -56,6 +56,12 @@ config TARGET_VERDIN_IMX8MM
        select SUPPORT_SPL
        select IMX8M_LPDDR4
 
+config TARGET_IMX8MM_BEACON
+	bool "imx8mm Beacon Embedded devkit"
+	select IMX8MM
+	select SUPPORT_SPL
+	select IMX8M_LPDDR4
+
 endchoice
 
 source "board/freescale/imx8mq_evk/Kconfig"

arch/arm/mach-imx/imx8m/Kconfig source "board/freescale/imx8mm_evk/Kconfig" · line 72

Quoted 4 lines
arch/arm/mach-imx/imx8m/Kconfig +1 -0
@@ -63,5 +69,6 @@ source "board/freescale/imx8mm_evk/Kconfig"
 source "board/freescale/imx8mn_evk/Kconfig"
 source "board/freescale/imx8mp_evk/Kconfig"
 source "board/toradex/verdin-imx8mm/Kconfig"
+source "board/beacon/imx8mm/Kconfig"

Keep the list sorted.

[...]

Quoted 12 lines
board/beacon/imx8mm/Makefile new file +6 -0
new file mode 100644
index 0000000000..7d83895de8
@@ -0,0 +1,19 @@
+#
+# Copyright 2020 Compass Electronics Group, LLC
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#
+

board/beacon/imx8mm/Makefile line 16

Quoted 10 lines
board/beacon/imx8mm/Makefile new file +10 -0
+obj-y += imx8mm_beacon.o
+obj-y += ../../freescale/common/
+
+ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
+ifdef CONFIG_IMX8M_4G_LPDDR4
+obj-y += lpddr4_timing_4g.o
+else
+obj-$(CONFIG_IMX8M_LPDDR4) += lpddr4_timing.o
+obj-$(CONFIG_IMX8M_DDR4) += ddr4_timing.o

Some of these files are missing in this patch .

Quoted 16 lines
board/beacon/imx8mm/Makefile new file +3 -0
+endif
+
+endif
board/beacon/imx8mm/README new file +7 -0
new file mode 100644
index 0000000000..6dc916fc10
@@ -0,0 +1,37 @@
+U-Boot for the Beacon EmbeddedWorks Devkit
+
+Quick Start
+===========
+- Build the ARM Trusted firmware binary
+- Get ddr fimware
+- Build U-Boot

board/beacon/imx8mm/README line 17

Quoted 10 lines
board/beacon/imx8mm/README new file +10 -0
+- Boot
+
+Get and Build the ARM Trusted firmware
+======================================
+Note: srctree is U-Boot source directory
+
+$ git clone https://source.codeaurora.org/external/imx/imx-atf
+$ git checkout imx_4.19.35_1.0.0
+$ make PLAT=imx8mm bl31 ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-
+$ cp build/imx8mm/release/bl31.bin $(srctree)

Why not use mainline TFA instead of this NXP one ?

[...]

Quoted 5 lines
board/beacon/imx8mm/imx8mm_beacon.c new file +0 -0
new file mode 100644
index 0000000000..e82e8b78d8

[...]

Quoted 12 lines
board/beacon/imx8mm/imx8mm_beacon.c new file +12 -0
+#if IS_ENABLED(CONFIG_FEC_MXC)
+static int setup_fec(void)
+{
+	struct iomuxc_gpr_base_regs *gpr =
+		(struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR;
+
+	/* Use 125M anatop REF_CLK1 for ENET1, not from external */
+	clrsetbits_le32(&gpr->gpr[1], 0x2000, 0);
+
+	return 0;
+}
+

board/beacon/imx8mm/imx8mm_beacon.c line 48

Quoted 10 lines
board/beacon/imx8mm/imx8mm_beacon.c new file +10 -0
+int board_phy_config(struct phy_device *phydev)
+{
+	/* enable rgmii rxc skew and phy mode select to RGMII copper */
+	phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x1f);
+	phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x8);
+
+	phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x00);
+	phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x82ee);
+	phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x05);
+	phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x100);

Which kind of ethernet PHY does this board use ?

Quoted 18 lines
board/beacon/imx8mm/imx8mm_beacon.c new file +18 -0
+	if (phydev->drv->config)
+		phydev->drv->config(phydev);
+	return 0;
+}
+#endif
+
+int board_init(void)
+{
+	if (IS_ENABLED(CONFIG_FEC_MXC))
+		setup_fec();
+
+	return 0;
+}
+
+int board_mmc_get_env_dev(int devno)
+{
+	return devno;
+}

[...]

Quoted 2 lines
board/beacon/imx8mm/spl.c new file +0 -0
new file mode 100644

[...]

Quoted 16 lines
board/beacon/imx8mm/spl.c new file +16 -0
+static int power_init_board(void)
+{
+	struct udevice *dev;
+	int ret;
+
+	ret = pmic_get("pmic at 4b", &dev);
+	if (ret == -ENODEV) {
+		puts("No pmic\n");
+		return 0;
+	}
+	if (ret != 0)
+		return ret;
+
+	/* decrease RESET key long push time from the default 10s to 10ms */
+	pmic_reg_write(dev, BD718XX_PWRONCONFIG1, 0x0);
+

board/beacon/imx8mm/spl.c line 109

Quoted 10 lines
board/beacon/imx8mm/spl.c new file +10 -0
+	/* unlock the PMIC regs */
+	pmic_reg_write(dev, BD718XX_REGLOCK, 0x1);
+
+	/* increase VDD_SOC to typical value 0.85v before first DRAM access */
+	pmic_reg_write(dev, BD718XX_BUCK1_VOLT_RUN, 0x0f);
+
+	/* increase VDD_DRAM to 0.975v for 3Ghz DDR */
+	pmic_reg_write(dev, BD718XX_1ST_NODVS_BUCK_VOLT, 0x83);
+
+#ifndef CONFIG_IMX8M_LPDDR4

Is this ever an option? You only have LPDDR4 config files in this patch, so this looks like a remnant from the EVK.

Quoted 9 lines
board/beacon/imx8mm/spl.c new file +9 -0
+	/* increase NVCC_DRAM_1V2 to 1.2v for DDR4 */
+	pmic_reg_write(dev, BD718XX_4TH_NODVS_BUCK_VOLT, 0x28);
+#endif
+
+	/* lock the PMIC regs */
+	pmic_reg_write(dev, BD718XX_REGLOCK, 0x11);
+
+	return 0;
+}

[...]

board/beacon/imx8mm/spl.c line 169

Quoted 8 lines
board/beacon/imx8mm/spl.c new file +8 -0
+int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+	puts("resetting ...\n");
+
+	reset_cpu(WDOG1_BASE_ADDR);
+
+	return 0;
+}

Please do not reimplement reset in SPL, just use some reset driver. This must also be fixed on the NXP devkits, because they are broken and wrong.

author
#2 lore raw

PATCH 1/1 imx: Add support for i.MX8MM Beacon EmbeddedWorks devkit.

Quoted 9 lines · Marek Vasut
Quoted 7 lines · Adam Ford

Beacon EmbeddedWorks, formerly known as Logic PD, is releasing a devkit based on the i.MX8M Mini SoC consisting of baseboard + SOM.

It supports eMMC on the SOM, microSD on the baseboard, various GPIO, the PINCTRL, and UART.

Quoted 6 lines
Quoted 6 lines

---
The device tree files are pulled from Shawn Guo's imx branch destined for Linux 5.8 and have already been removed, but the ddrc node was deleted.

Marek,

Thanks for the review.

Quoted 5 lines
Quoted 5 lines
arch/arm/dts/Makefile +0 -0
index 59a2713cb2..249d446f69 100644
@@ -730,7 +730,8 @@ dtb-$(CONFIG_ARCH_IMX8M) += \
Quoted 8 lines

arch/arm/dts/Makefile dtb-$(CONFIG_ARCH_IMX8M) += \ · line 734

Quoted 6 lines
arch/arm/dts/Makefile +2 -1
      imx8mm-verdin.dtb \
      imx8mn-ddr4-evk.dtb \
      imx8mq-evk.dtb \
-     imx8mp-evk.dtb
+     imx8mp-evk.dtb \
+     imx8mm-beacon-kit.dtb

Keep the list sorted.

Before verdin or before ddr4-evk? It's already out of order.

Quoted 22 lines
Quoted 3 lines
arch/arm/dts/Makefile +0 -0
 dtb-$(CONFIG_ARCH_IMXRT) += imxrt1050-evk.dtb \
      imxrt1020-evk.dtb

[...]

Quoted 16 lines
arch/arm/mach-imx/imx8m/Kconfig +6 -0
index 58f1758ab6..6f6e63472f 100644
@@ -56,6 +56,12 @@ config TARGET_VERDIN_IMX8MM
        select SUPPORT_SPL
        select IMX8M_LPDDR4
 
+config TARGET_IMX8MM_BEACON
+     bool "imx8mm Beacon Embedded devkit"
+     select IMX8MM
+     select SUPPORT_SPL
+     select IMX8M_LPDDR4
+
 endchoice
 
Quoted 8 lines

arch/arm/mach-imx/imx8m/Kconfig source "board/freescale/imx8mm_evk/Kconfig" · line 72

Quoted 6 lines
arch/arm/mach-imx/imx8m/Kconfig +1 -0
 source "board/freescale/imx8mq_evk/Kconfig"
@@ -63,5 +69,6 @@ source "board/freescale/imx8mm_evk/Kconfig"
 source "board/freescale/imx8mn_evk/Kconfig"
 source "board/freescale/imx8mp_evk/Kconfig"
 source "board/toradex/verdin-imx8mm/Kconfig"
+source "board/beacon/imx8mm/Kconfig"

Keep the list sorted.

I can make this alphabetic.

Quoted 19 lines

[...]

Quoted 16 lines
board/beacon/imx8mm/Makefile new file +10 -0
new file mode 100644
index 0000000000..7d83895de8
@@ -0,0 +1,19 @@
+#
+# Copyright 2020 Compass Electronics Group, LLC
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#
+
+obj-y += imx8mm_beacon.o
+obj-y += ../../freescale/common/
+
+ifdef CONFIG_SPL_BUILD
Quoted 8 lines

board/beacon/imx8mm/Makefile line 16

Quoted 6 lines
board/beacon/imx8mm/Makefile new file +6 -0
+obj-y += spl.o
+ifdef CONFIG_IMX8M_4G_LPDDR4
+obj-y += lpddr4_timing_4g.o
+else
+obj-$(CONFIG_IMX8M_LPDDR4) += lpddr4_timing.o
+obj-$(CONFIG_IMX8M_DDR4) += ddr4_timing.o

Some of these files are missing in this patch .

I will remove it. It's only ever going to be LPDDR4, we won't be supporting DDR4.

Quoted 21 lines
Quoted 21 lines
board/beacon/imx8mm/Makefile new file +3 -0
+endif
+
+endif
board/beacon/imx8mm/README new file +11 -0
new file mode 100644
index 0000000000..6dc916fc10
@@ -0,0 +1,37 @@
+U-Boot for the Beacon EmbeddedWorks Devkit
+
+Quick Start
+===========
+- Build the ARM Trusted firmware binary
+- Get ddr fimware
+- Build U-Boot
+- Boot
+
+Get and Build the ARM Trusted firmware
+======================================
Quoted 8 lines

board/beacon/imx8mm/README line 17

Quoted 6 lines
board/beacon/imx8mm/README new file +6 -0
+Note: srctree is U-Boot source directory
+
+$ git clone https://source.codeaurora.org/external/imx/imx-atf
+$ git checkout imx_4.19.35_1.0.0
+$ make PLAT=imx8mm bl31 ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-
+$ cp build/imx8mm/release/bl31.bin $(srctree)

Why not use mainline TFA instead of this NXP one ?

The testing of upstream kernel code appears to require the NXP ATF instead of upstream ATF. Some of the DDRC stuff doesnt' appear to work with upstream ATF.

Quoted 27 lines

[...]

Quoted 5 lines
board/beacon/imx8mm/imx8mm_beacon.c new file +0 -0
new file mode 100644
index 0000000000..e82e8b78d8

[...]

Quoted 16 lines
board/beacon/imx8mm/imx8mm_beacon.c new file +16 -0
+#if IS_ENABLED(CONFIG_FEC_MXC)
+static int setup_fec(void)
+{
+     struct iomuxc_gpr_base_regs *gpr =
+             (struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR;
+
+     /* Use 125M anatop REF_CLK1 for ENET1, not from external */
+     clrsetbits_le32(&gpr->gpr[1], 0x2000, 0);
+
+     return 0;
+}
+
+int board_phy_config(struct phy_device *phydev)
+{
+     /* enable rgmii rxc skew and phy mode select to RGMII copper */
+     phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x1f);
Quoted 8 lines

board/beacon/imx8mm/imx8mm_beacon.c line 48

Quoted 6 lines
board/beacon/imx8mm/imx8mm_beacon.c new file +6 -0
+     phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x8);
+
+     phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x00);
+     phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x82ee);
+     phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x05);
+     phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x100);

Which kind of ethernet PHY does this board use ?

AR8031

Quoted 48 lines
Quoted 19 lines
board/beacon/imx8mm/imx8mm_beacon.c new file +18 -0
+     if (phydev->drv->config)
+             phydev->drv->config(phydev);
+     return 0;
+}
+#endif
+
+int board_init(void)
+{
+     if (IS_ENABLED(CONFIG_FEC_MXC))
+             setup_fec();
+
+     return 0;
+}
+
+int board_mmc_get_env_dev(int devno)
+{
+     return devno;
+}

[...]

Quoted 2 lines
board/beacon/imx8mm/spl.c new file +0 -0
new file mode 100644

[...]

Quoted 21 lines
board/beacon/imx8mm/spl.c new file +21 -0
+static int power_init_board(void)
+{
+     struct udevice *dev;
+     int ret;
+
+     ret = pmic_get("pmic at 4b", &dev);
+     if (ret == -ENODEV) {
+             puts("No pmic\n");
+             return 0;
+     }
+     if (ret != 0)
+             return ret;
+
+     /* decrease RESET key long push time from the default 10s to 10ms */
+     pmic_reg_write(dev, BD718XX_PWRONCONFIG1, 0x0);
+
+     /* unlock the PMIC regs */
+     pmic_reg_write(dev, BD718XX_REGLOCK, 0x1);
+
+     /* increase VDD_SOC to typical value 0.85v before first DRAM access */
+     pmic_reg_write(dev, BD718XX_BUCK1_VOLT_RUN, 0x0f);
Quoted 8 lines

board/beacon/imx8mm/spl.c line 109

Quoted 5 lines
board/beacon/imx8mm/spl.c new file +5 -0
+
+     /* increase VDD_DRAM to 0.975v for 3Ghz DDR */
+     pmic_reg_write(dev, BD718XX_1ST_NODVS_BUCK_VOLT, 0x83);
+
+#ifndef CONFIG_IMX8M_LPDDR4

Is this ever an option? You only have LPDDR4 config files in this patch, so this looks like a remnant from the EVK.

You're right, I can remove this. It will always be LPDDR4.

Quoted 13 lines
Quoted 10 lines
board/beacon/imx8mm/spl.c new file +9 -0
+     /* increase NVCC_DRAM_1V2 to 1.2v for DDR4 */
+     pmic_reg_write(dev, BD718XX_4TH_NODVS_BUCK_VOLT, 0x28);
+#endif
+
+     /* lock the PMIC regs */
+     pmic_reg_write(dev, BD718XX_REGLOCK, 0x11);
+
+     return 0;
+}

[...]

Quoted 12 lines

board/beacon/imx8mm/spl.c line 169

Quoted 8 lines
board/beacon/imx8mm/spl.c new file +8 -0
+int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+     puts("resetting ...\n");
+
+     reset_cpu(WDOG1_BASE_ADDR);
+
+     return 0;
+}

Please do not reimplement reset in SPL, just use some reset driver. This must also be fixed on the NXP devkits, because they are broken and wrong.

What should they be doing instead? I am just modeling it after the NXP dev kit and it appears to work. Since I don't know what the 'reight' was is, I don't know what I need to do. Ideally, it would be nice if NXP had platform-common code that would do it instead of a series of board files with nearly identical code.

adam

#3 lore raw

PATCH 1/1 imx: Add support for i.MX8MM Beacon EmbeddedWorks devkit.

On 4/27/20 4:26 AM, Adam Ford wrote:

Hi,

[...]

Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
arch/arm/dts/Makefile +0 -0
index 59a2713cb2..249d446f69 100644
@@ -730,7 +730,8 @@ dtb-$(CONFIG_ARCH_IMX8M) += \
Quoted 8 lines

arch/arm/dts/Makefile dtb-$(CONFIG_ARCH_IMX8M) += \ · line 734

Quoted 6 lines
arch/arm/dts/Makefile +2 -1
      imx8mm-verdin.dtb \
      imx8mn-ddr4-evk.dtb \
      imx8mq-evk.dtb \
-     imx8mp-evk.dtb
+     imx8mp-evk.dtb \
+     imx8mm-beacon-kit.dtb

Keep the list sorted.

Quoted 1 line

Before verdin or before ddr4-evk? It's already out of order.

Alphabetical (and if it's not sorted, it should be. can you send a patch to sort it ?)

[...]

Quoted 26 lines
Quoted 17 lines
Quoted 17 lines
board/beacon/imx8mm/README new file +11 -0
new file mode 100644
index 0000000000..6dc916fc10
@@ -0,0 +1,37 @@
+U-Boot for the Beacon EmbeddedWorks Devkit
+
+Quick Start
+===========
+- Build the ARM Trusted firmware binary
+- Get ddr fimware
+- Build U-Boot
+- Boot
+
+Get and Build the ARM Trusted firmware
+======================================
Quoted 8 lines

board/beacon/imx8mm/README line 17

Quoted 6 lines
board/beacon/imx8mm/README new file +6 -0
+Note: srctree is U-Boot source directory
+
+$ git clone https://source.codeaurora.org/external/imx/imx-atf
+$ git checkout imx_4.19.35_1.0.0
+$ make PLAT=imx8mm bl31 ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-
+$ cp build/imx8mm/release/bl31.bin $(srctree)

Why not use mainline TFA instead of this NXP one ?

Quoted 3 lines

The testing of upstream kernel code appears to require the NXP ATF instead of upstream ATF. Some of the DDRC stuff doesnt' appear to work with upstream ATF.

Are there any more details on this ?

[...]

Quoted 14 lines
Quoted 4 lines
Quoted 4 lines
board/beacon/imx8mm/README new file +4 -0
+int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+     puts("resetting ...\n");
+
Quoted 8 lines

board/beacon/imx8mm/README line 25

Quoted 4 lines
board/beacon/imx8mm/README new file +4 -0
+     reset_cpu(WDOG1_BASE_ADDR);
+
+     return 0;
+}

Please do not reimplement reset in SPL, just use some reset driver. This must also be fixed on the NXP devkits, because they are broken and wrong.

Quoted 2 lines

What should they be doing instead? I am just modeling it after the NXP dev kit and it appears to work.

Sure, it "works", but it's not implemented correctly. This NXP devkit is literally the only board which hacks around missing do_reset() in their SPL by implementing it in board files and proliferation of this bug must be stopped.

Either arch/arm/lib/reset.c or drivers/sysreset/sysreset_watchdog.c should be used, in this case it's likely the later.

Quoted 3 lines

Since I don't know what the
'reight' was is, I don't know what I need to do. Ideally, it would be nice if NXP had platform-common code that would do it

Reset implementation is not platform code, it shouldn't be there, see drivers/sysreset/ .

Quoted 2 lines

instead of a
series of board files with nearly identical code.

I agree the amount of duplication in board files should be reduced.

author
#4 lore raw

PATCH 1/1 imx: Add support for i.MX8MM Beacon EmbeddedWorks devkit.

Quoted 54 lines · Marek Vasut

On 4/27/20 4:26 AM, Adam Ford wrote:

Hi,

[...]

Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
arch/arm/dts/Makefile +0 -0
index 59a2713cb2..249d446f69 100644
@@ -730,7 +730,8 @@ dtb-$(CONFIG_ARCH_IMX8M) += \
Quoted 8 lines

arch/arm/dts/Makefile dtb-$(CONFIG_ARCH_IMX8M) += \ · line 734

Quoted 6 lines
arch/arm/dts/Makefile +2 -1
      imx8mm-verdin.dtb \
      imx8mn-ddr4-evk.dtb \
      imx8mq-evk.dtb \
-     imx8mp-evk.dtb
+     imx8mp-evk.dtb \
+     imx8mm-beacon-kit.dtb

Keep the list sorted.

Quoted 1 line

Before verdin or before ddr4-evk? It's already out of order.

Alphabetical (and if it's not sorted, it should be. can you send a patch to sort it ?)

[...]

Quoted 26 lines
Quoted 25 lines
Quoted 13 lines
board/beacon/imx8mm/README new file +7 -0
new file mode 100644
index 0000000000..6dc916fc10
@@ -0,0 +1,37 @@
+U-Boot for the Beacon EmbeddedWorks Devkit
+
+Quick Start
+===========
+- Build the ARM Trusted firmware binary
+- Get ddr fimware
+- Build U-Boot

board/beacon/imx8mm/README line 17

Quoted 10 lines
board/beacon/imx8mm/README new file +10 -0
+- Boot
+
+Get and Build the ARM Trusted firmware
+======================================
+Note: srctree is U-Boot source directory
+
+$ git clone https://source.codeaurora.org/external/imx/imx-atf
+$ git checkout imx_4.19.35_1.0.0
+$ make PLAT=imx8mm bl31 ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-
+$ cp build/imx8mm/release/bl31.bin $(srctree)

Why not use mainline TFA instead of this NXP one ?

Quoted 5 lines
Quoted 3 lines

The testing of upstream kernel code appears to require the NXP ATF instead of upstream ATF. Some of the DDRC stuff doesnt' appear to work with upstream ATF.

Are there any more details on this ?

Yes,

There was some dialog between me and one of the NXP developers adding DDRC support to i.MX8MM.

https://lore.kernel.org/linux-arm-kernel/CAHCN7xJc8yMe683wsB1e1TdE26FX1oMFT_i_hshkEECrJ52oHg at mail.gmail.com/T/

In his message in the above link, he explitly wrote:
You need a recent version of TF-A from nxp ( upstream). Try this:

https://source.codeaurora.org/external/imx/imx-atf/log/?h=imx_4.19.35_1.1.0

Or this:
https://github.com/cdleonard/arm-trusted-firmware/commits/imx_2.0.y_busfreq

Support on upstream ATF is not yet available

Until that is available upstream, I was going to reference the NXP version because that's also what NXP distributes, and it's consistent with their BSP. Once the support is available upstream for ATF, I was planning on pointing there.

Quoted 17 lines

[...]

Quoted 14 lines
Quoted 12 lines

board/beacon/imx8mm/README

Quoted 8 lines
board/beacon/imx8mm/README new file +8 -0
+int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+     puts("resetting ...\n");
+
+     reset_cpu(WDOG1_BASE_ADDR);
+
+     return 0;
+}

Please do not reimplement reset in SPL, just use some reset driver. This must also be fixed on the NXP devkits, because they are broken and wrong.

Quoted 7 lines
Quoted 2 lines

What should they be doing instead? I am just modeling it after the NXP dev kit and it appears to work.

Sure, it "works", but it's not implemented correctly. This NXP devkit is literally the only board which hacks around missing do_reset() in their SPL by implementing it in board files and proliferation of this bug must be stopped.

I think I found a solution which removes the need for this completely based on doc/README.SPL

Quoted 10 lines

Either arch/arm/lib/reset.c or drivers/sysreset/sysreset_watchdog.c should be used, in this case it's likely the later.

Quoted 3 lines

Since I don't know what the
'right' was is, I don't know what I need to do. Ideally, it would be nice if NXP had platform-common code that would do it

Reset implementation is not platform code, it shouldn't be there, see drivers/sysreset/ .

For the benefit of anyone else with an i.MX8M Mini, I found that that if I enable
CONFIG_PANIC_HANG, the need for this function disappears, and it still appears to boot normally from microSD.

Quoted 5 lines
Quoted 3 lines

instead of a
series of board files with nearly identical code.

I agree the amount of duplication in board files should be reduced.

#5 lore raw

PATCH 1/1 imx: Add support for i.MX8MM Beacon EmbeddedWorks devkit.

On 4/27/20 3:31 PM, Adam Ford wrote:

[...]

Quoted 27 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

board/beacon/imx8mm/README line 17

Quoted 8 lines
board/beacon/imx8mm/README new file +8 -0
+Get and Build the ARM Trusted firmware
+======================================
+Note: srctree is U-Boot source directory
+
+$ git clone https://source.codeaurora.org/external/imx/imx-atf
+$ git checkout imx_4.19.35_1.0.0
+$ make PLAT=imx8mm bl31 ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-
+$ cp build/imx8mm/release/bl31.bin $(srctree)

Why not use mainline TFA instead of this NXP one ?

Quoted 5 lines
Quoted 3 lines

The testing of upstream kernel code appears to require the NXP ATF instead of upstream ATF. Some of the DDRC stuff doesnt' appear to work with upstream ATF.

Are there any more details on this ?

Yes,

There was some dialog between me and one of the NXP developers adding DDRC support to i.MX8MM.

https://lore.kernel.org/linux-arm-kernel/CAHCN7xJc8yMe683wsB1e1TdE26FX1oMFT_i_hshkEECrJ52oHg at mail.gmail.com/T/

In his message in the above link, he explitly wrote:
You need a recent version of TF-A from nxp ( upstream). Try this:

Quoted 6 lines

https://source.codeaurora.org/external/imx/imx-atf/log/?h=imx_4.19.35_1.1.0

Or this:
https://github.com/cdleonard/arm-trusted-firmware/commits/imx_2.0.y_busfreq

Support on upstream ATF is not yet available

And yet, upstream ATF documents support for imx8mm as a PLAT= build target, but I ran into the same problem with Variscite iMX8MM board, that ATF is completely broken :-(

Quoted 4 lines

Until that is available upstream, I was going to reference the NXP version because that's also what NXP distributes, and it's consistent with their BSP. Once the support is available upstream for ATF, I was planning on pointing there.

That's OK, thanks for clarifying.

(I also saw you ran into problems with iMX8MM clock and power domains, which are basically identical to MX8MQ, but it seems like there is a push for implementing this through PSCI, which makes the MX8MM far less appealing)

Quoted 19 lines
Quoted 19 lines

[...]

Quoted 16 lines
Quoted 4 lines
Quoted 4 lines
board/beacon/imx8mm/spl.c new file +4 -0
+int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+     puts("resetting ...\n");
+
Quoted 8 lines

board/beacon/imx8mm/spl.c line 169

Quoted 4 lines
board/beacon/imx8mm/spl.c new file +4 -0
+     reset_cpu(WDOG1_BASE_ADDR);
+
+     return 0;
+}

Please do not reimplement reset in SPL, just use some reset driver. This must also be fixed on the NXP devkits, because they are broken and wrong.

What should they be doing instead? I am just modeling it after the NXP dev kit and it appears to work.

Quoted 7 lines
Quoted 4 lines

Sure, it "works", but it's not implemented correctly. This NXP devkit is literally the only board which hacks around missing do_reset() in their SPL by implementing it in board files and proliferation of this bug must be stopped.

I think I found a solution which removes the need for this completely based on doc/README.SPL

Do you think you can fix the other sites which implement the do_reset() too ? That would be fantastic.

Quoted 7 lines
Quoted 7 lines

Either arch/arm/lib/reset.c or drivers/sysreset/sysreset_watchdog.c should be used, in this case it's likely the later.

Quoted 3 lines

Since I don't know what the
'right' was is, I don't know what I need to do. Ideally, it would be nice if NXP had platform-common code that would do it

Quoted 7 lines
Quoted 2 lines

Reset implementation is not platform code, it shouldn't be there, see drivers/sysreset/ .

For the benefit of anyone else with an i.MX8M Mini, I found that that if I enable
CONFIG_PANIC_HANG, the need for this function disappears, and it still appears to boot normally from microSD.

Except if something calls hang(), the board is stuck instead of rebooting and trying again. I think you might want to look at the sysreset_watchdog.c, it implements basically the same thing, except via DM and without hacks in board files.

author
#6 lore raw

PATCH 1/1 imx: Add support for i.MX8MM Beacon EmbeddedWorks devkit.

Quoted 100 lines · Marek Vasut

On 4/27/20 3:31 PM, Adam Ford wrote:

[...]

Quoted 27 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

board/beacon/imx8mm/README line 17

Quoted 8 lines
board/beacon/imx8mm/README new file +8 -0
+Get and Build the ARM Trusted firmware
+======================================
+Note: srctree is U-Boot source directory
+
+$ git clone https://source.codeaurora.org/external/imx/imx-atf
+$ git checkout imx_4.19.35_1.0.0
+$ make PLAT=imx8mm bl31 ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-
+$ cp build/imx8mm/release/bl31.bin $(srctree)

Why not use mainline TFA instead of this NXP one ?

Quoted 5 lines
Quoted 3 lines

The testing of upstream kernel code appears to require the NXP ATF instead of upstream ATF. Some of the DDRC stuff doesnt' appear to work with upstream ATF.

Are there any more details on this ?

Yes,

There was some dialog between me and one of the NXP developers adding DDRC support to i.MX8MM.

https://lore.kernel.org/linux-arm-kernel/CAHCN7xJc8yMe683wsB1e1TdE26FX1oMFT_i_hshkEECrJ52oHg at mail.gmail.com/T/

In his message in the above link, he explitly wrote:
You need a recent version of TF-A from nxp ( upstream). Try this:

Quoted 6 lines

https://source.codeaurora.org/external/imx/imx-atf/log/?h=imx_4.19.35_1.1.0

Or this:
https://github.com/cdleonard/arm-trusted-firmware/commits/imx_2.0.y_busfreq

Support on upstream ATF is not yet available

And yet, upstream ATF documents support for imx8mm as a PLAT= build target, but I ran into the same problem with Variscite iMX8MM board, that ATF is completely broken :-(

Quoted 4 lines

Until that is available upstream, I was going to reference the NXP version because that's also what NXP distributes, and it's consistent with their BSP. Once the support is available upstream for ATF, I was planning on pointing there.

That's OK, thanks for clarifying.

(I also saw you ran into problems with iMX8MM clock and power domains, which are basically identical to MX8MQ, but it seems like there is a push for implementing this through PSCI, which makes the MX8MM far less appealing)

Quoted 19 lines
Quoted 19 lines

[...]

Quoted 16 lines
Quoted 4 lines
Quoted 4 lines
board/beacon/imx8mm/spl.c new file +4 -0
+int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+     puts("resetting ...\n");
+
Quoted 8 lines

board/beacon/imx8mm/spl.c line 169

Quoted 4 lines
board/beacon/imx8mm/spl.c new file +4 -0
+     reset_cpu(WDOG1_BASE_ADDR);
+
+     return 0;
+}

Please do not reimplement reset in SPL, just use some reset driver. This must also be fixed on the NXP devkits, because they are broken and wrong.

What should they be doing instead? I am just modeling it after the NXP dev kit and it appears to work.

Quoted 7 lines
Quoted 4 lines

Sure, it "works", but it's not implemented correctly. This NXP devkit is literally the only board which hacks around missing do_reset() in their SPL by implementing it in board files and proliferation of this bug must be stopped.

I think I found a solution which removes the need for this completely based on doc/README.SPL

Do you think you can fix the other sites which implement the do_reset() too ? That would be fantastic.

Quoted 7 lines
Quoted 7 lines

Either arch/arm/lib/reset.c or drivers/sysreset/sysreset_watchdog.c should be used, in this case it's likely the later.

Quoted 3 lines

Since I don't know what the
'right' was is, I don't know what I need to do. Ideally, it would be nice if NXP had platform-common code that would do it

Quoted 7 lines
Quoted 2 lines

Reset implementation is not platform code, it shouldn't be there, see drivers/sysreset/ .

For the benefit of anyone else with an i.MX8M Mini, I found that that if I enable
CONFIG_PANIC_HANG, the need for this function disappears, and it still appears to boot normally from microSD.

Quoted 4 lines

Except if something calls hang(), the board is stuck instead of rebooting and trying again. I think you might want to look at the sysreset_watchdog.c, it implements basically the same thing, except via DM and without hacks in board files.

My understanding is that SPL isn't required to support DM and not all drivers have their DM equivalents enabled in SPL. For my boards, I'm not seeing hang, nor am I seeing any issues by removing the do_reset function in spl with the CONFIG_PANIC_HANG. I can't speak for others, but I'm fine with that work around for my board. If there is a hang() call in SPL, it seems like I need to fix that issue rather than whether or not it reboots.

adam

#7 lore raw

PATCH 1/1 imx: Add support for i.MX8MM Beacon EmbeddedWorks devkit.

On 4/28/20 3:30 PM, Adam Ford wrote:
[...]

Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 9 lines

Either arch/arm/lib/reset.c or drivers/sysreset/sysreset_watchdog.c should be used, in this case it's likely the later.

Quoted 3 lines

Since I don't know what the
'right' was is, I don't know what I need to do. Ideally, it would be nice if NXP had platform-common code that would do it

Reset implementation is not platform code, it shouldn't be there, see drivers/sysreset/ .

For the benefit of anyone else with an i.MX8M Mini, I found that that if I enable
CONFIG_PANIC_HANG, the need for this function disappears, and it still appears to boot normally from microSD.

Quoted 7 lines
Quoted 4 lines

Except if something calls hang(), the board is stuck instead of rebooting and trying again. I think you might want to look at the sysreset_watchdog.c, it implements basically the same thing, except via DM and without hacks in board files.

My understanding is that SPL isn't required to support DM and not all drivers have their DM equivalents enabled in SPL.

The MX8MM already has DM enabled in SPL, and the above drivers I pointed you to already have DM support.

Quoted 6 lines

For my boards, I'm
not seeing hang, nor am I seeing any issues by removing the do_reset function in spl with the CONFIG_PANIC_HANG. I can't speak for others, but I'm fine with that work around for my board. If there is a hang() call in SPL, it seems like I need to fix that issue rather than whether or not it reboots.

It could be a transient failure.

So instead of spending more time trying to convince you to fix your patch, this is what you have to add. See? It's less work than to keep this discussion going...

(quoted diff) +0 -0

b/arch/arm/dts/imx8mm-board-u-boot.dtsi
index da841e94a9..dccd26663f 100644

arch/arm/dts/imx8mm-board-u-boot.dtsi +9 -0
@@ -9,3 +9,8 @@
 / {
+       wdt-reboot {
+               compatible = "wdt-reboot";
+               wdt = <&wdog1>;
+               u-boot,dm-spl;
+       };
 };
 
@@ -121 +126,5 @@
 };
+
+&wdog1 {
+       u-boot,dm-spl;
+};
arch/arm/mach-imx/imx8m/soc.c +1 -1
index bbfc9c5576..09be0153fd 100644
@@ -384,7 +384,7 @@ int ft_system_setup(void *blob, bd_t *bd)
 }
 #endif
 
-#if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SYSRESET)
+#if !CONFIG_IS_ENABLED(SYSRESET)
 void reset_cpu(ulong addr)
 {
        struct watchdog_regs *wdog = (struct watchdog_regs *)addr;
configs/imx8mm_board_defconfig +5 -1
index d6d30015e1..049c687910 100644
@@ -30 +30,5 @@ CONFIG_SPL_BOARD_INIT=y
-CONFIG_PANIC_HANG=y
+CONFIG_SPL_WATCHDOG_SUPPORT=y
+CONFIG_SPL_SYSRESET=y
+CONFIG_SYSRESET_WATCHDOG=y
+# CONFIG_WATCHDOG is not set
+CONFIG_IMX_WATCHDOG=y