Skip to contentSkip to conversation

board: emcraft: Add support for Emcraft Systems NavQ+

PATCH Superseded Gilles Talis 2 participants 3 messages Oct 20, 2024 – Oct 21, 2024

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 board: emcraft: Add support for Emcraft Systems NavQ+

The Emcraft Systems NavQ+ kit is a mobile robotics platform based on NXP i.MX8 MPlus SoC.

The following interfaces and devices are enabled:
- eMMC
- Gigabit Ethernet (through eQOS interface)
- SD-Card
- UART console

The device tree file is taken from upstream Linux Kernel through OF_UPSTREAM

---
 arch/arm/dts/imx8mp-navqp-u-boot.dtsi         |  113 +
 arch/arm/mach-imx/imx8m/Kconfig               |    8 +
 board/emcraft/imx8mp_navqp/Kconfig            |   15 +
 board/emcraft/imx8mp_navqp/MAINTAINERS        |    8 +
 board/emcraft/imx8mp_navqp/Makefile           |   13 +
 board/emcraft/imx8mp_navqp/imx8mp_navqp.c     |   37 +
 .../imx8mp_navqp/imximage-8mp-lpddr4.cfg      |    9 +
 board/emcraft/imx8mp_navqp/lpddr4_timing.c    | 1842 +++++++++++++++++
 board/emcraft/imx8mp_navqp/spl.c              |  132 ++
 configs/imx8mp_navqp_defconfig                |  105 +
 doc/board/emcraft/imx8mp_navqp.rst            |   65 +
 doc/board/emcraft/index.rst                   |    9 +
 include/configs/imx8mp_navqp.h                |   54 +
 13 files changed, 2410 insertions(+)
 create mode 100644 arch/arm/dts/imx8mp-navqp-u-boot.dtsi
 create mode 100644 board/emcraft/imx8mp_navqp/Kconfig
 create mode 100644 board/emcraft/imx8mp_navqp/MAINTAINERS
 create mode 100644 board/emcraft/imx8mp_navqp/Makefile
 create mode 100644 board/emcraft/imx8mp_navqp/imx8mp_navqp.c
 create mode 100644 board/emcraft/imx8mp_navqp/imximage-8mp-lpddr4.cfg
 create mode 100644 board/emcraft/imx8mp_navqp/lpddr4_timing.c
 create mode 100644 board/emcraft/imx8mp_navqp/spl.c
 create mode 100644 configs/imx8mp_navqp_defconfig
 create mode 100644 doc/board/emcraft/imx8mp_navqp.rst
 create mode 100644 doc/board/emcraft/index.rst
 create mode 100644 include/configs/imx8mp_navqp.h
arch/arm/dts/imx8mp-navqp-u-boot.dtsi new file +113 -0
new file mode 100644
index 0000000000..3f8d6f9779
@@ -0,0 +1,113 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2019, 2021 NXP
+ * Copyright 2024 Gilles Talis <[email protected]>
+ */
+
+#include "imx8mp-u-boot.dtsi"
+
+/ {
+	wdt-reboot {
+		compatible = "wdt-reboot";
+		wdt = <&wdog1>;
+		bootph-pre-ram;
+	};
+	firmware {
+		optee {
+			compatible = "linaro,optee-tz";
+			method = "smc";
+		};
+	};
+};
+
+&{/soc@0/bus@30800000/i2c@30a20000/pmic@25} {
+	bootph-all;
+};
+
+&{/soc@0/bus@30800000/i2c@30a20000/pmic@25/regulators} {
+	bootph-all;
+};
+
+&gpio1 {
+	bootph-pre-ram;
+};
+
+&gpio2 {
+	bootph-pre-ram;
+};
+
+&gpio3 {
+	bootph-pre-ram;
+};
+
+&gpio4 {
+	bootph-pre-ram;
+};
+
+&gpio5 {
+	bootph-pre-ram;
+};
+
+&i2c1 {
+	bootph-all;
+};
+
+&pinctrl_i2c1 {
+	bootph-pre-ram;
+};
+
+&pinctrl_pmic {
+	bootph-pre-ram;
+};
+
+&pinctrl_uart2 {
+	bootph-pre-ram;
+};
+
+&pinctrl_usdhc2_gpio {
+	bootph-pre-ram;
+};
+
+&pinctrl_usdhc2 {
+	bootph-pre-ram;
+};
+
+&pinctrl_usdhc3 {
+	bootph-pre-ram;
+};
+
+&pinctrl_wdog {
+	bootph-pre-ram;
+};
+
+&reg_usdhc2_vmmc {
+	u-boot,off-on-delay-us = <20000>;
+};
+
+&reg_usdhc2_vmmc {
+	bootph-pre-ram;
+};
+
+&uart2 {
+	bootph-pre-ram;
+};
+
+&usdhc1 {
+	bootph-pre-ram;
+};
+
+&usdhc2 {
+	bootph-pre-ram;
+	sd-uhs-sdr104;
+	sd-uhs-ddr50;
+};
+
+&usdhc3 {
+	bootph-pre-ram;
+	mmc-hs400-1_8v;
+	mmc-hs400-enhanced-strobe;
+};
+
+&wdog1 {
+	bootph-pre-ram;
+};
arch/arm/mach-imx/imx8m/Kconfig +8 -0
index 9d1fabe91c..b254a50b09 100644
@@ -228,6 +228,13 @@ config TARGET_IMX8MP_EVK
 	select SPL_CRYPTO if SPL
 	imply OF_UPSTREAM
 
+config TARGET_IMX8MP_NAVQP
+	bool "Emcraft Systems i.MX8M Plus NavQ+ board"
+	select IMX8MP
+	select IMX8M_LPDDR4
+	select SUPPORT_SPL
+	imply OF_UPSTREAM
+
 config TARGET_IMX8MP_VENICE
 	bool "Support Gateworks Venice iMX8M Plus module"
 	select IMX8MP
@@ -358,6 +365,7 @@ source "board/compulab/imx8mm-cl-iot-gate/Kconfig"
 source "board/data_modul/imx8mm_edm_sbc/Kconfig"
 source "board/data_modul/imx8mp_edm_sbc/Kconfig"
 source "board/dhelectronics/dh_imx8mp/Kconfig"
+source "board/emcraft/imx8mp_navqp/Kconfig"
 source "board/engicam/imx8mm/Kconfig"
 source "board/engicam/imx8mp/Kconfig"
 source "board/freescale/imx8mq_evk/Kconfig"
board/emcraft/imx8mp_navqp/Kconfig new file +15 -0
new file mode 100644
index 0000000000..20b09b68c7
@@ -0,0 +1,15 @@
+if TARGET_IMX8MP_NAVQP
+
+config SYS_BOARD
+	default "imx8mp_navqp"
+
+config SYS_VENDOR
+	default "emcraft"
+
+config SYS_CONFIG_NAME
+	default "imx8mp_navqp"
+
+config IMX_CONFIG
+	default "board/emcraft/imx8mp_navqp/imximage-8mp-lpddr4.cfg"
+
+endif
board/emcraft/imx8mp_navqp/MAINTAINERS new file +8 -0
new file mode 100644
index 0000000000..d91605e461
@@ -0,0 +1,8 @@
+Emcraft Systems NavQ+ board (i.MX8M Plus)
+M:	Gilles Talis <[email protected]>
+S:	Maintained
+F:	arch/arm/dts/imx8mp-navqp-u-boot.dtsi
+F:	board/emcraft/imx8mp_navqp/
+F:	configs/imx8mp_navqp_defconfig
+F:	doc/board/emcraft/
+F:	include/configs/imx8mp_navqp.h
board/emcraft/imx8mp_navqp/Makefile new file +13 -0
new file mode 100644
index 0000000000..a5890b009e
@@ -0,0 +1,13 @@
+#
+# Copyright 2019 NXP
+# Copyright 2024 Gilles Talis <[email protected]>
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#
+
+obj-y += imx8mp_navqp.o
+
+ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
+obj-$(CONFIG_IMX8M_LPDDR4) += lpddr4_timing.o
+endif
board/emcraft/imx8mp_navqp/imx8mp_navqp.c new file +37 -0
new file mode 100644
index 0000000000..b40978dd3d
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2019 NXP
+ * Copyright 2024 Gilles Talis <[email protected]>
+ */
+
+#include <miiphy.h>
+
+#if CONFIG_IS_ENABLED(NET) || CONFIG_IS_ENABLED(NET_LWIP)
+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);
+
+	if (phydev->drv->config)
+		phydev->drv->config(phydev);
+
+	return 0;
+}
+#endif
+
+int board_init(void)
+{
+	return 0;
+}
+
+int board_late_init(void)
+{
+	return 0;
+}
board/emcraft/imx8mp_navqp/imximage-8mp-lpddr4.cfg new file +9 -0
new file mode 100644
index 0000000000..999cb630fe
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2021, 2024 NXP
+ */
+
+
+ROM_VERSION	v2
+BOOT_FROM	sd
+LOADER		u-boot-spl-ddr.bin	0x920000
board/emcraft/imx8mp_navqp/lpddr4_timing.c new file +1842 -0

1,842 lines not on this page · raw message

board/emcraft/imx8mp_navqp/spl.c new file +132 -0

132 lines not on this page · raw message

configs/imx8mp_navqp_defconfig new file +105 -0

105 lines not on this page · raw message

doc/board/emcraft/imx8mp_navqp.rst new file +65 -0

65 lines not on this page · raw message

doc/board/emcraft/index.rst new file +9 -0
new file mode 100644
index 0000000000..564552cb36
@@ -0,0 +1,9 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Emcraft
+=======
+
+.. toctree::
+   :maxdepth: 2
+
+   imx8mp-navqp
include/configs/imx8mp_navqp.h new file +54 -0

54 lines not on this page · raw message

base-commit: 7036abbd5c3934059b020d5fd5bcb8b3bf3c788c

Signature · 1 line
2.43.0
reviewer
#1 lore raw

Hi Gilles,

arch/arm/dts/imx8mp-navqp-u-boot.dtsi line 14

Quoted 6 lines · Gilles Talis
arch/arm/dts/imx8mp-navqp-u-boot.dtsi new file +6 -0
+/ {
+       wdt-reboot {
+               compatible = "wdt-reboot";
+               wdt = <&wdog1>;
+               bootph-pre-ram;
+       };

Please add a blank line here.

arch/arm/dts/imx8mp-navqp-u-boot.dtsi

Quoted 12 lines
arch/arm/dts/imx8mp-navqp-u-boot.dtsi new file +11 -0
+       firmware {
+               optee {
+                       compatible = "linaro,optee-tz";
+                       method = "smc";
+               };
+       };
+};
 
+&usdhc3 {
+       bootph-pre-ram;
+       mmc-hs400-1_8v;
+       mmc-hs400-enhanced-strobe;

Why are the 2 properties above only present in the U-Boot dtsi and not in the kernel devicetree?

board/emcraft/imx8mp_navqp/imx8mp_navqp.c line 20

Quoted 12 lines
board/emcraft/imx8mp_navqp/imx8mp_navqp.c new file +12 -0
+#if CONFIG_IS_ENABLED(NET) || CONFIG_IS_ENABLED(NET_LWIP)
+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);

Are these board code settings needed? Can't this be derived in the devicetree instead?

board/emcraft/imx8mp_navqp/imx8mp_navqp.c line 37

Quoted 4 lines
board/emcraft/imx8mp_navqp/imx8mp_navqp.c new file +4 -0
+int board_late_init(void)
+{
+       return 0;
+}

This can be removed, along with CONFIG_BOARD_LATE_INIT=y.

board/emcraft/imx8mp_navqp/imximage-8mp-lpddr4.cfg line 6

Quoted 12 lines
board/emcraft/imx8mp_navqp/imximage-8mp-lpddr4.cfg new file +6 -0
new file mode 100644
index 0000000000..999cb630fe
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2021, 2024 NXP
+ */
+
+

Remove the double-blank line.

board/emcraft/imx8mp_navqp/imximage-8mp-lpddr4.cfg

Quoted 8 lines
board/emcraft/imx8mp_navqp/imximage-8mp-lpddr4.cfg new file +8 -0
+Get and Build the ARM Trusted Firmware (Trusted Firmware A)
+-----------------------------------------------------------
+
+.. code-block:: bash
+
+    $ echo "Downloading and building TF-A..."
+    $ git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git
+    $ cd trusted-firmware-a

Please specify a specific branch of the trusted-firmware-a repo.

Quoted 4 lines
board/emcraft/imx8mp_navqp/imximage-8mp-lpddr4.cfg new file +4 -0
+/* Initial environment variables */
+#define CFG_EXTRA_ENV_SETTINGS         \
+       BOOTENV \
+       "scriptaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \

board/emcraft/imx8mp_navqp/imximage-8mp-lpddr4.cfg

Quoted 10 lines
board/emcraft/imx8mp_navqp/imximage-8mp-lpddr4.cfg new file +10 -0
+       "kernel_addr_r=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
+       "image=Image\0" \
+       "console=ttymxc1,115200 earlycon=ec_imx6q,0x30890000,115200\0" \
+       "fdt_addr_r=0x43000000\0"                       \
+       "boot_fdt=try\0" \
+       "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
+       "initrd_addr=0x43800000\0"              \
+       "bootm_size=0x10000000\0" \
+       "mmcpart=1\0" \
+       "mmcroot=/dev/mmcblk1p2 rootwait rw\0" \

Please move the above variables to board/emcraft/imx8mp_navqp/imx8mp_navqp.env instead.

#2 lore raw

Hi Fabio,
thanks for the review.

Quoted 5 lines · Fabio Estevam

Hi Gilles,

On Sun, Oct 20, 2024 at 5:10 PM Gilles Talis <[email protected]> wrote:

Quoted 8 lines

arch/arm/dts/imx8mp-navqp-u-boot.dtsi line 14

Quoted 6 lines
arch/arm/dts/imx8mp-navqp-u-boot.dtsi new file +6 -0
+/ {
+       wdt-reboot {
+               compatible = "wdt-reboot";
+               wdt = <&wdog1>;
+               bootph-pre-ram;
+       };

Please add a blank line here.

Noted.

Quoted 9 lines
Quoted 8 lines
arch/arm/dts/imx8mp-navqp-u-boot.dtsi new file +7 -0
+       firmware {
+               optee {
+                       compatible = "linaro,optee-tz";
+                       method = "smc";
+               };
+       };
+};
Quoted 7 lines

arch/arm/dts/imx8mp-navqp-u-boot.dtsi line 108

Quoted 4 lines

+&usdhc3 {

arch/arm/dts/imx8mp-navqp-u-boot.dtsi new file +3 -0
+       bootph-pre-ram;
+       mmc-hs400-1_8v;
+       mmc-hs400-enhanced-strobe;

Why are the 2 properties above only present in the U-Boot dtsi and not in the kernel devicetree?

I think it is copy/paste without further verification :-)

Quoted 16 lines

board/emcraft/imx8mp_navqp/imx8mp_navqp.c line 20

Quoted 13 lines
board/emcraft/imx8mp_navqp/imx8mp_navqp.c new file +12 -0
+#if CONFIG_IS_ENABLED(NET) || CONFIG_IS_ENABLED(NET_LWIP)
+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);

Are these board code settings needed? Can't this be derived in the devicetree instead?

Yes, they are needed. I don't know how they can be derived in the devicetree, but I will check.

Quoted 7 lines

board/emcraft/imx8mp_navqp/imx8mp_navqp.c line 37

Quoted 5 lines
board/emcraft/imx8mp_navqp/imx8mp_navqp.c new file +4 -0
+int board_late_init(void)
+{
+       return 0;
+}

This can be removed, along with CONFIG_BOARD_LATE_INIT=y.

OK. Will do.

Quoted 15 lines

board/emcraft/imx8mp_navqp/imximage-8mp-lpddr4.cfg line 6

Quoted 13 lines
board/emcraft/imx8mp_navqp/imximage-8mp-lpddr4.cfg new file +6 -0
new file mode 100644
index 0000000000..999cb630fe
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2021, 2024 NXP
+ */
+
+

Remove the double-blank line.

OK.

Quoted 11 lines

board/emcraft/imx8mp_navqp/imximage-8mp-lpddr4.cfg

Quoted 9 lines
board/emcraft/imx8mp_navqp/imximage-8mp-lpddr4.cfg new file +8 -0
+Get and Build the ARM Trusted Firmware (Trusted Firmware A)
+-----------------------------------------------------------
+
+.. code-block:: bash
+
+    $ echo "Downloading and building TF-A..."
+    $ git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git
+    $ cd trusted-firmware-a

Please specify a specific branch of the trusted-firmware-a repo.

OK.

Quoted 10 lines
Quoted 10 lines
board/emcraft/imx8mp_navqp/imximage-8mp-lpddr4.cfg new file +9 -0
+/* Initial environment variables */
+#define CFG_EXTRA_ENV_SETTINGS         \
+       BOOTENV \
+       "scriptaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
+       "kernel_addr_r=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
+       "image=Image\0" \
+       "console=ttymxc1,115200 earlycon=ec_imx6q,0x30890000,115200\0" \
+       "fdt_addr_r=0x43000000\0"                       \
+       "boot_fdt=try\0" \
Quoted 8 lines

board/emcraft/imx8mp_navqp/imximage-8mp-lpddr4.cfg

Quoted 5 lines
board/emcraft/imx8mp_navqp/imximage-8mp-lpddr4.cfg new file +5 -0
+       "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
+       "initrd_addr=0x43800000\0"              \
+       "bootm_size=0x10000000\0" \
+       "mmcpart=1\0" \
+       "mmcroot=/dev/mmcblk1p2 rootwait rw\0" \

Please move the above variables to board/emcraft/imx8mp_navqp/imx8mp_navqp.env instead.

OK. Will do.

thanks
Gilles.