Skip to contentSkip to conversation

ARM: imx: Add support for iMX6QDL DHCOM DRC02 and DH picoITX

PATCH Superseded Philip Oberfichtner 4 participants 15 messages May 19, 2022

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover ARM: imx: Add support for iMX6QDL DHCOM DRC02 and DH picoITX

This patch series adds support for the DHCOM DRC02 and DH picoITX baseboards by DH electronics.

The two boards can be equipped with different SoMs. The STM32MP15xx based versions are already mainlined. This patch adds support for the iMX6QDL based variants.

Philip Oberfichtner (8):
ARM: imx6: Fix broken DT path in DH board file
ARM: dts: imx: Migrate iMX6QDL DRC02 DTs from Linux
ARM: dts: imx: Migrate iMX6QDL picoITX DTs from Linux
ARM: imx6: Remove CONFIG_FEC_MXC_PHYADDR from DH header
ARM: dts: imx: Simplify fec node for iMX6QDL DHCOM boards
ARM: dts: imx: Configure FEC for iMX6QDL picoITX
ARM: dts: imx: Configure FEC for iMX6QDL DRC02
ARM: imx6: Adapt device tree selection in DH board file

 arch/arm/dts/Makefile                         |   2 +
 arch/arm/dts/imx6dl-dhcom-picoitx-u-boot.dtsi |  10 ++
 arch/arm/dts/imx6dl-dhcom-picoitx.dts         |  20 +++
 arch/arm/dts/imx6qdl-dhcom-drc02.dtsi         | 143 ++++++++++++++++++
 arch/arm/dts/imx6qdl-dhcom-pdk2-u-boot.dtsi   |  13 --
 arch/arm/dts/imx6qdl-dhcom-picoitx.dtsi       |  69 +++++++++
 arch/arm/dts/imx6qdl-dhcom-u-boot.dtsi        |  18 +++
 arch/arm/dts/imx6s-dhcom-drc02-u-boot.dtsi    |  10 ++
 arch/arm/dts/imx6s-dhcom-drc02.dts            |  30 ++++
 board/dhelectronics/dh_imx6/dh_imx6.c         |  26 ++--
 configs/dh_imx6_defconfig                     |   2 +-
 include/configs/dh_imx6.h                     |   3 -
 12 files changed, 319 insertions(+), 27 deletions(-)
 create mode 100644 arch/arm/dts/imx6dl-dhcom-picoitx-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx6dl-dhcom-picoitx.dts
 create mode 100644 arch/arm/dts/imx6qdl-dhcom-drc02.dtsi
 create mode 100644 arch/arm/dts/imx6qdl-dhcom-picoitx.dtsi
 create mode 100644 arch/arm/dts/imx6s-dhcom-drc02-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx6s-dhcom-drc02.dts
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/8 ARM: imx6: Fix broken DT path in DH board file

In the dhelectronics iMX6 board file fix the outdated eeprom path by using a DT label instead.

The label has been newly created for all iMX6QDL DHCOM boards.

---

 arch/arm/dts/imx6qdl-dhcom-u-boot.dtsi | 11 +++++++++++
 board/dhelectronics/dh_imx6/dh_imx6.c  |  4 ++--
 2 files changed, 13 insertions(+), 2 deletions(-)
arch/arm/dts/imx6qdl-dhcom-u-boot.dtsi +11 -0
index 4c3b5e82d6..91545ab6e9 100644
@@ -3,6 +3,17 @@
  * Copyright (C) 2020 Harald Seiler <[email protected]>
  */
 
+/ {
+	aliases {
+		eeprom0 = &eeprom0;
+	};
+};
+
+&i2c3 {
+	eeprom0: eeprom@50 {
+	};
+};
+
 &reg_usb_otg_vbus {
 	gpio = <&gpio3 31 GPIO_ACTIVE_HIGH>;
 	enable-active-high;
board/dhelectronics/dh_imx6/dh_imx6.c +2 -2
index 2969e90a70..6059f96e80 100644
@@ -100,9 +100,9 @@ static int setup_dhcom_mac_from_fuse(void)
 		return 0;
 	}
 
-	eeprom = ofnode_path("/soc/aips-bus@2100000/i2c@21a8000/eeprom@50");
+	eeprom = ofnode_get_aliases_node("eeprom0");
 	if (!ofnode_valid(eeprom)) {
-		printf("Invalid hardware path to EEPROM!\n");
+		printf("Can't find eeprom0 alias!\n");
 		return -ENODEV;
 	}
 
Signature · 1 line
2.34.1
#3 lore raw

PATCH 2/8 ARM: dts: imx: Migrate iMX6QDL DRC02 DTs from Linux

In reply to Philip Oberfichtner

Migrate DH DRC02 device trees from Linux commit 42226c989789 (tag v5.18-rc7). No changes have been made, the DTs are exact copies. Furthermore add the DTB to dh_imx6_defconfig.

---

 arch/arm/dts/Makefile                 |   1 +
 arch/arm/dts/imx6qdl-dhcom-drc02.dtsi | 143 ++++++++++++++++++++++++++
 arch/arm/dts/imx6s-dhcom-drc02.dts    |  30 ++++++
 configs/dh_imx6_defconfig             |   2 +-
 4 files changed, 175 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/imx6qdl-dhcom-drc02.dtsi
 create mode 100644 arch/arm/dts/imx6s-dhcom-drc02.dts
arch/arm/dts/Makefile +1 -0
index 83630af4f6..7bfdfb5313 100644
@@ -771,6 +771,7 @@ dtb-y += \
 	imx6dl-sabreauto.dtb \
 	imx6dl-sabresd.dtb \
 	imx6dl-wandboard-revd1.dtb \
+	imx6s-dhcom-drc02.dtb
 
 endif
 
arch/arm/dts/imx6qdl-dhcom-drc02.dtsi new file +143 -0

143 lines not on this page · raw message

arch/arm/dts/imx6s-dhcom-drc02.dts new file +30 -0
new file mode 100644
index 0000000000..4077b607c2
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2021 DH electronics GmbH
+ *
+ * DHCOM iMX6 variant:
+ * DHCM-iMX6S-C0800-R102-F0409-E-CAN2-RTC-I-01D2
+ * DHCOM PCB number: 493-400 or newer
+ * DRC02 PCB number: 568-100 or newer
+ */
+/dts-v1/;
+
+/*
+ * The kernel only distinguishes between i.MX6 Quad and DualLite,
+ * but the Solo is actually a DualLite with only one CPU. So use
+ * DualLite for the Solo and disable one CPU node.
+ */
+
+#include "imx6dl.dtsi"
+#include "imx6qdl-dhcom-som.dtsi"
+#include "imx6qdl-dhcom-drc02.dtsi"
+
+/ {
+	model = "DH electronics i.MX6S DHCOM on DRC02";
+	compatible = "dh,imx6s-dhcom-drc02", "dh,imx6s-dhcom-som",
+		     "fsl,imx6dl";
+
+	cpus {
+		/delete-node/ cpu@1;
+	};
+};
configs/dh_imx6_defconfig +1 -1
index c45561aa0e..9c78987473 100644
@@ -53,7 +53,7 @@ CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_OF_CONTROL=y
-CONFIG_OF_LIST="imx6q-dhcom-pdk2 imx6dl-dhcom-pdk2"
+CONFIG_OF_LIST="imx6q-dhcom-pdk2 imx6dl-dhcom-pdk2 imx6s-dhcom-drc02"
 CONFIG_MULTI_DTB_FIT=y
 CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
Signature · 1 line
2.34.1
#4 lore raw

PATCH 3/8 ARM: dts: imx: Migrate iMX6QDL picoITX DTs from Linux

In reply to Philip Oberfichtner

Migrate DH picoITX device trees from Linux commit 42226c989789 (tag v5.18-rc7). No changes have been made, the DTs are exact copies. Furthermore add the DTB to dh_imx6_defconfig.

---

 arch/arm/dts/Makefile                   |  1 +
 arch/arm/dts/imx6dl-dhcom-picoitx.dts   | 20 +++++++
 arch/arm/dts/imx6qdl-dhcom-picoitx.dtsi | 69 +++++++++++++++++++++++++
 configs/dh_imx6_defconfig               |  2 +-
 4 files changed, 91 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/imx6dl-dhcom-picoitx.dts
 create mode 100644 arch/arm/dts/imx6qdl-dhcom-picoitx.dtsi
arch/arm/dts/Makefile +1 -0
index 7bfdfb5313..f7601afd9c 100644
@@ -738,6 +738,7 @@ dtb-y += \
 	imx6dl-cubox-i-emmc-som-v15.dtb \
 	imx6dl-cubox-i-som-v15.dtb \
 	imx6dl-dhcom-pdk2.dtb \
+	imx6dl-dhcom-picoitx.dts \
 	imx6dl-gw51xx.dtb \
 	imx6dl-gw52xx.dtb \
 	imx6dl-gw53xx.dtb \
arch/arm/dts/imx6dl-dhcom-picoitx.dts new file +20 -0
new file mode 100644
index 0000000000..038bb00255
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2021 DH electronics GmbH
+ *
+ * DHCOM iMX6 variant:
+ * DHCM-iMX6DL-C0800-R102-F0819-E-SD-RTC-T-HS-I-01D2
+ * DHCOM PCB number: 493-300 or newer
+ * PicoITX PCB number: 487-600 or newer
+ */
+/dts-v1/;
+
+#include "imx6dl.dtsi"
+#include "imx6qdl-dhcom-som.dtsi"
+#include "imx6qdl-dhcom-picoitx.dtsi"
+
+/ {
+	model = "DH electronics i.MX6DL DHCOM on PicoITX";
+	compatible = "dh,imx6dl-dhcom-picoitx", "dh,imx6dl-dhcom-som",
+		     "fsl,imx6dl";
+};
arch/arm/dts/imx6qdl-dhcom-picoitx.dtsi new file +69 -0

69 lines not on this page · raw message

configs/dh_imx6_defconfig +1 -1
index 9c78987473..558619fc31 100644
@@ -53,7 +53,7 @@ CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_OF_CONTROL=y
-CONFIG_OF_LIST="imx6q-dhcom-pdk2 imx6dl-dhcom-pdk2 imx6s-dhcom-drc02"
+CONFIG_OF_LIST="imx6q-dhcom-pdk2 imx6dl-dhcom-pdk2 imx6s-dhcom-drc02 imx6dl-dhcom-picoitx"
 CONFIG_MULTI_DTB_FIT=y
 CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
Signature · 1 line
2.34.1
#5 lore raw

PATCH 4/8 ARM: imx6: Remove CONFIG_FEC_MXC_PHYADDR from DH header

In reply to Philip Oberfichtner

Use phy address from device tree instead of CONFIG_FEC_MXC_PHYADDR from board header. This is required, because the DH picoITX and DRC02 boards require different settings than PDK2. The corresponding 'phy-handle' device tree properties are already there.

I tested this change on picoITX and DRC02, but on PDK2 it is untested.

---

 include/configs/dh_imx6.h | 3 ---
 1 file changed, 3 deletions(-)
include/configs/dh_imx6.h +0 -3
index 2b14464dff..178f5a6e7d 100644
@@ -30,9 +30,6 @@
 /* Bootcounter */
 #define CONFIG_SYS_BOOTCOUNT_BE
 
-/* FEC ethernet */
-#define CONFIG_FEC_MXC_PHYADDR		7
-
 /* MMC Configs */
 #define CONFIG_SYS_FSL_ESDHC_ADDR	0
 #define CONFIG_SYS_FSL_USDHC_NUM	3
Signature · 1 line
2.34.1
#6 lore raw

PATCH 5/8 ARM: dts: imx: Simplify fec node for iMX6QDL DHCOM boards

In reply to Philip Oberfichtner

Firstly the fec can now use the regulator reg_eth_vio from imx6qdl-dhcom-som.dtsi instead of defining its own.

Secondly the &fec node is moved to the more generic SoM device tree file, because it can be used by multiple boards.

---

 arch/arm/dts/imx6qdl-dhcom-pdk2-u-boot.dtsi | 13 -------------
 arch/arm/dts/imx6qdl-dhcom-u-boot.dtsi      |  7 +++++++
 2 files changed, 7 insertions(+), 13 deletions(-)
arch/arm/dts/imx6qdl-dhcom-pdk2-u-boot.dtsi +0 -13
index a1ffb1d6fc..0673c21e3c 100644
@@ -5,19 +5,6 @@
 
 #include "imx6qdl-dhcom-u-boot.dtsi"
 
-/ {
-	fec_vio: regulator-fec {
-		compatible = "regulator-fixed";
-
-		regulator-name = "fec-vio";
-		gpio = <&gpio1 7 GPIO_ACTIVE_LOW>;
-	};
-};
-
 &fec {
 	phy-reset-gpios = <&gpio3 29 GPIO_ACTIVE_LOW>;
-	phy-reset-duration = <1>;
-	phy-reset-post-delay = <10>;
-
-	phy-supply = <&fec_vio>;
 };
arch/arm/dts/imx6qdl-dhcom-u-boot.dtsi +7 -0
index 91545ab6e9..190567ab7b 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: (GPL-2.0+)
 /*
  * Copyright (C) 2020 Harald Seiler <[email protected]>
+ * Copyright (C) 2022 Philip Oberfichtner <[email protected]>
  */
 
 / {
@@ -9,6 +10,12 @@
 	};
 };
 
+&fec {
+	phy-reset-duration = <1>;
+	phy-reset-post-delay = <10>;
+	phy-supply = <&reg_eth_vio>;
+};
+
 &i2c3 {
 	eeprom0: eeprom@50 {
 	};
Signature · 1 line
2.34.1
Reviewed-by on v1 5/8
#7 lore raw

Re: [PATCH 5/8] ARM: dts: imx: Simplify fec node for iMX6QDL DHCOM boards

Quoted 5 lines · Philip Oberfichtner

Firstly the fec can now use the regulator reg_eth_vio from imx6qdl-dhcom-som.dtsi instead of defining its own.

Secondly the &fec node is moved to the more generic SoM device tree file, because it can be used by multiple boards.

#8 lore raw

PATCH 6/8 ARM: dts: imx: Configure FEC for iMX6QDL picoITX

In reply to Philip Oberfichtner

Add a u-boot dtsi for configuring the fec node of the DH picoITX.

---

 arch/arm/dts/imx6dl-dhcom-picoitx-u-boot.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
 create mode 100644 arch/arm/dts/imx6dl-dhcom-picoitx-u-boot.dtsi
arch/arm/dts/imx6dl-dhcom-picoitx-u-boot.dtsi new file +10 -0
new file mode 100644
index 0000000000..16669b2533
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: (GPL-2.0+)
+/*
+ * Copyright (C) 2022 Philip Oberfichtner <[email protected]>
+ */
+
+#include "imx6qdl-dhcom-u-boot.dtsi"
+
+&fec {
+	phy-reset-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>;
+};
Signature · 1 line
2.34.1
Reviewed-by on v1 6/8
#9 lore raw

Re: [PATCH 6/8] ARM: dts: imx: Configure FEC for iMX6QDL picoITX

Quoted 1 line · Philip Oberfichtner

Add a u-boot dtsi for configuring the fec node of the DH picoITX.

#10 lore raw

PATCH 7/8 ARM: dts: imx: Configure FEC for iMX6QDL DRC02

In reply to Philip Oberfichtner

Add a u-boot dtsi for configuring the fec node of the DH DRC02.

---

 arch/arm/dts/imx6s-dhcom-drc02-u-boot.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
 create mode 100644 arch/arm/dts/imx6s-dhcom-drc02-u-boot.dtsi
arch/arm/dts/imx6s-dhcom-drc02-u-boot.dtsi new file +10 -0
new file mode 100644
index 0000000000..16669b2533
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: (GPL-2.0+)
+/*
+ * Copyright (C) 2022 Philip Oberfichtner <[email protected]>
+ */
+
+#include "imx6qdl-dhcom-u-boot.dtsi"
+
+&fec {
+	phy-reset-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>;
+};
Signature · 1 line
2.34.1
Reviewed-by on v1 7/8
#11 lore raw

Re: [PATCH 7/8] ARM: dts: imx: Configure FEC for iMX6QDL DRC02

Quoted 1 line · Philip Oberfichtner

Add a u-boot dtsi for configuring the fec node of the DH DRC02.

nit: FEC (in caps), means Freescale Ethernet Controller or some such.

#12 lore raw

PATCH 8/8 ARM: imx6: Adapt device tree selection in DH board file

In reply to Philip Oberfichtner

Before this commit device tree selection could rely solely on differentiating the iMX6 processor variant Q and DL. After adding two new carrier boards, the DRC02 and the picoITX, the interchangeability of SoMs makes this approach infeasible.

It is now required to specify the carrier board (dhcom-drc02, dhcom-picoitx or dhcom-pdk2) at compile time using CONFIG_DEFAULT_DEVICETREE. The SoM is determined at runtime as before.

---

 board/dhelectronics/dh_imx6/dh_imx6.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
board/dhelectronics/dh_imx6/dh_imx6.c +14 -8
index 6059f96e80..c63fc1dd8a 100644
@@ -227,14 +227,20 @@ int checkboard(void)
 #ifdef CONFIG_MULTI_DTB_FIT
 int board_fit_config_name_match(const char *name)
 {
-	if (is_mx6dq()) {
-		if (!strcmp(name, "imx6q-dhcom-pdk2"))
-			return 0;
-	} else if (is_mx6sdl()) {
-		if (!strcmp(name, "imx6dl-dhcom-pdk2"))
-			return 0;
-	}
+	/* Determine carrier board at compile time and SoM at runtime */
+	const size_t size = 32;
+	char *car, *som, dt[size];
+
+	car = strchr(CONFIG_DEFAULT_DEVICE_TREE, '-'); /* i.e. -dhcom-drc02 */
+
+	som = is_mx6dq()   ? "imx6q"  :
+	      is_mx6dl()   ? "imx6dl" :
+	      is_mx6solo() ? "imx6s"  : NULL;
+
+	if (!(car && som))
+		return -1;
 
-	return -1;
+	snprintf(dt, size, "%s%s", som, car);
+	return strcmp(name, dt);
 }
 #endif
Signature · 1 line
2.34.1
#13 lore raw

Re: [PATCH 8/8] ARM: imx6: Adapt device tree selection in DH board file

On 19/05/2022 08:08, Philip Oberfichtner wrote:

		return 0;
Quoted 7 lines
board/dhelectronics/dh_imx6/dh_imx6.c +5 -1
-	}
+	/* Determine carrier board at compile time and SoM at runtime */
+	const size_t size = 32;
+	char *car, *som, dt[size];
+
+	car = strchr(CONFIG_DEFAULT_DEVICE_TREE, '-'); /* i.e. -dhcom-drc02 

*/

board/dhelectronics/dh_imx6/dh_imx6.c int checkboard(void) · line 241

Quoted 7 lines
board/dhelectronics/dh_imx6/dh_imx6.c +7 -0
+
+	som = is_mx6dq()   ? "imx6q"  :
+	      is_mx6dl()   ? "imx6dl" :
+	      is_mx6solo() ? "imx6s"  : NULL;
+
+	if (!(car && som))
+		return -1;

Nit: can you return -EINVAL instead of -1?

#14 lore raw

Re: [PATCH 8/8] ARM: imx6: Adapt device tree selection in DH board file

In reply to Philip Oberfichtner
Quoted 20 lines · Philip Oberfichtner

Before this commit device tree selection could rely solely on differentiating the iMX6 processor variant Q and DL. After adding two new carrier boards, the DRC02 and the picoITX, the interchangeability of SoMs makes this approach infeasible.

It is now required to specify the carrier board (dhcom-drc02, dhcom-picoitx or dhcom-pdk2) at compile time using CONFIG_DEFAULT_DEVICETREE. The SoM is determined at runtime as before.

---

  board/dhelectronics/dh_imx6/dh_imx6.c | 22 ++++++++++++++--------
  1 file changed, 14 insertions(+), 8 deletions(-)
board/dhelectronics/dh_imx6/dh_imx6.c +0 -0
index 6059f96e80..c63fc1dd8a 100644

board/dhelectronics/dh_imx6/dh_imx6.c int checkboard(void) · line 233

Quoted 7 lines
board/dhelectronics/dh_imx6/dh_imx6.c +0 -4
@@ -227,14 +227,20 @@ int checkboard(void)
  #ifdef CONFIG_MULTI_DTB_FIT
  int board_fit_config_name_match(const char *name)
  {
-	if (is_mx6dq()) {
-		if (!strcmp(name, "imx6q-dhcom-pdk2"))
-			return 0;
-	} else if (is_mx6sdl()) {

Careful here ^ is_mx6sdl() matches on Solo and DualLite.

Quoted 9 lines
board/dhelectronics/dh_imx6/dh_imx6.c +6 -3
-		if (!strcmp(name, "imx6dl-dhcom-pdk2"))
-			return 0;
-	}
+	/* Determine carrier board at compile time and SoM at runtime */
+	const size_t size = 32;
+	char *car, *som, dt[size];
+
+	car = strchr(CONFIG_DEFAULT_DEVICE_TREE, '-'); /* i.e. -dhcom-drc02 */
+

board/dhelectronics/dh_imx6/dh_imx6.c int checkboard(void) · line 244

Quoted 10 lines
board/dhelectronics/dh_imx6/dh_imx6.c +8 -1
+	som = is_mx6dq()   ? "imx6q"  :
+	      is_mx6dl()   ? "imx6dl" :
+	      is_mx6solo() ? "imx6s"  : NULL;
+
+	if (!(car && som))
+		return -1;
 
-	return -1;
+	snprintf(dt, size, "%s%s", som, car);
+	return strcmp(name, dt);

This will break imx6s-dhcom-pdk2 , which used the imx6dl-dhcom-pdk2 DT which was fine, because U-Boot is single core anyway.

Try something like this:

/* Test SoC prefix */

if (is_mx6dq()) {
	if (strncmp(name, "imx6q-"))
		return -1;
} else if (is_mx6sdl()) {
	if (strncmp(name, "imx6s-") && strncmp(name, "imx6dl-"))
		return -1;
}

/* Test board suffix */
a = strchr(CONFIG_DEFAULT_DEVICE_TREE, '-'); /* i.e. -dhcom-drc02 */ b = strchr(name, '-'); /* i.e. -dhcom-drc02 */

return strcmp(a, b) ? -1 : 0;

I _think_ that should work and cover all combinations. (and of course, pick better variable names than a,b)