Skip to contentSkip to conversation

wandboard: add imx6dl rev d1 support

RFC PATCH New Heiko Schocher 2 participants 13 messages Jan 14, 2020 – Jan 17, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover wandboard: add imx6dl rev d1 support

This series is a RFC for adding support for the wandboard revision d1 imx6dl boards. The first patch add the Device tree from linux, the second add the detection for the wandboard d1 imx6dl and imx6q versions. Both patches are from Fabio.

Unfortunately this does not work out of the box, as for the detection of D1 revisions in SPL only the PMIC can be used. But we have no DM support in SPL on wandboard and adding it would explod the size of SPL.

Solution:

- reorder board_fit_config_name_match to work correctly may can be merged with Fabios 2. patch

- enable CONFIG_DTB_RESELECT so we can detect revision in U-Boot before relocation and can reselect the correct devicetree.

- set imx6dl-wandboard-revd1 as default devicetree, so we have a devicetree which contains the PMIC.

- add u-boot specific devicetree, so i2c and pmic can be detected before relocation.

- use in SPL only revision D1 DTB

With this patchset, U-Boot boots on imx6dl revision D1 board after a soft reset. On hardreset, the PMIC does not respond on i2c bus ... and rev d1 gets not detected ... this needs more investigation.

@Fabio (or others): please test, if this patchset does not
break other board revisions!

Hack: If you need working current U-Boot on imx6dl rev d1
board, you can use the first 2 patches from this patchset and change configuration to:

CONFIG_DEFAULT_DEVICE_TREE="imx6dl-wandboard-revd1" CONFIG_OF_LIST="imx6dl-wandboard-revd1"

But this works only on imx6dl revision d1 boards.

Fabio Estevam (2):
wandboard: Import the dts files for the other revd1 variants
wandboard: Handle the imx6dl and imx6q revd1 boards

Heiko Schocher (5):
wandboard: reorder board_fit_config_name_match
wandboard: enable CONFIG_DTB_RESELECT
wandboard: use imx6dl-wandboard-revd1 as default DTB
wandboard: add u-boot specific *wandboard-revd1-u-boot.dtsi
wandboard: in SPL use only D1 DTB

 arch/arm/dts/Makefile                         |  2 +
 .../dts/imx6dl-wandboard-revd1-u-boot.dtsi    | 11 ++++
 arch/arm/dts/imx6dl-wandboard-revd1.dts       | 19 +++++++
 .../arm/dts/imx6q-wandboard-revd1-u-boot.dtsi | 11 ++++
 arch/arm/dts/imx6q-wandboard-revd1.dts        | 23 ++++++++
 board/wandboard/wandboard.c                   | 53 ++++++++++++++++---
 configs/wandboard_defconfig                   |  5 +-
 7 files changed, 115 insertions(+), 9 deletions(-)
 create mode 100644 arch/arm/dts/imx6dl-wandboard-revd1-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx6dl-wandboard-revd1.dts
 create mode 100644 arch/arm/dts/imx6q-wandboard-revd1-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx6q-wandboard-revd1.dts
Signature · 1 line
2.24.1
#1 lore raw

RFC PATCH 1/7 wandboard: Import the dts files for the other revd1 variants

From: Fabio Estevam <[email protected]>

Import the imx6dl-wandboard-revd1.dts and imx6q-wandboard-revd1.dts from kernel 5.4.8 so that these variants can also be supported.

---

 arch/arm/dts/Makefile                   |  2 ++
 arch/arm/dts/imx6dl-wandboard-revd1.dts | 19 +++++++++++++++++++
 arch/arm/dts/imx6q-wandboard-revd1.dts  | 23 +++++++++++++++++++++++
 3 files changed, 44 insertions(+)
 create mode 100644 arch/arm/dts/imx6dl-wandboard-revd1.dts
 create mode 100644 arch/arm/dts/imx6q-wandboard-revd1.dts
arch/arm/dts/Makefile +2 -0
index 983e235f442..a60e23242fe 100644
@@ -609,6 +609,7 @@ dtb-y += \
 	imx6dl-sabreauto.dtb \
 	imx6dl-sabresd.dtb \
 	imx6dl-wandboard-revb1.dtb \
+	imx6dl-wandboard-revd1.dtb \
 
 endif
 
@@ -641,6 +642,7 @@ dtb-y += \
 	imx6q-sabresd.dtb \
 	imx6q-tbs2910.dtb \
 	imx6q-wandboard-revb1.dtb \
+	imx6q-wandboard-revd1.dtb \
 	imx6qp-sabreauto.dtb \
 	imx6qp-sabresd.dtb \
 	imx6qp-wandboard-revd1.dtb \
arch/arm/dts/imx6dl-wandboard-revd1.dts new file +19 -0
new file mode 100644
index 00000000000..6d1d863c2e3
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * Author: Fabio Estevam <[email protected]>
+ */
+/dts-v1/;
+#include "imx6dl.dtsi"
+#include "imx6qdl-wandboard-revd1.dtsi"
+
+/ {
+	model = "Wandboard i.MX6 Dual Lite Board revD1";
+	compatible = "wand,imx6dl-wandboard", "fsl,imx6dl";
+
+	memory at 10000000 {
+		device_type = "memory";
+		reg = <0x10000000 0x40000000>;
+	};
+};
arch/arm/dts/imx6q-wandboard-revd1.dts new file +23 -0
new file mode 100644
index 00000000000..55331021d80
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * Author: Fabio Estevam <[email protected]>
+ */
+/dts-v1/;
+#include "imx6q.dtsi"
+#include "imx6qdl-wandboard-revd1.dtsi"
+
+/ {
+	model = "Wandboard i.MX6 Quad Board revD1";
+	compatible = "wand,imx6q-wandboard", "fsl,imx6q";
+
+	memory at 10000000 {
+		device_type = "memory";
+		reg = <0x10000000 0x80000000>;
+	};
+};
+
+&sata {
+	status = "okay";
+};
Signature · 1 line
2.24.1
#2 lore raw

RFC PATCH 2/7 wandboard: Handle the imx6dl and imx6q revd1 boards

In reply to Heiko Schocher

From: Fabio Estevam <[email protected]>

Currently the only supported revd1 variant is imx6qp.

Add logic for supporting imx6dl and imx6q revd1 boards as well.

---

 board/wandboard/wandboard.c | 16 +++++++++++++---
 configs/wandboard_defconfig |  2 +-
 2 files changed, 14 insertions(+), 4 deletions(-)
board/wandboard/wandboard.c +13 -3
index f4534dd3dc6..05f36b7f5d5 100644
@@ -483,12 +483,22 @@ int checkboard(void)
 #ifdef CONFIG_SPL_LOAD_FIT
 int board_fit_config_name_match(const char *name)
 {
+	/* imx6qp wandboard only comes in revd1 flavor */
+	if (is_mx6dqp()) {
+		if (!strcmp(name, "imx6qp-wandboard-revd1"))
+			return 0;
+	}
+
+	if (is_mx6dq() && is_revd1()) {
+		if (!strcmp(name, "imx6q-wandboard-revd1"))
+			return 0;
+	} else if ((is_mx6dl() || is_mx6solo()) && is_revd1()) {
+		if (!strcmp(name, "imx6dl-wandboard-revd1"))
+			return 0;
+	}
 	if (is_mx6dq()) {
 		if (!strcmp(name, "imx6q-wandboard-revb1"))
 			return 0;
-	} else if (is_mx6dqp()) {
-		if (!strcmp(name, "imx6qp-wandboard-revd1"))
-			return 0;
 	} else if (is_mx6dl() || is_mx6solo()) {
 		if (!strcmp(name, "imx6dl-wandboard-revb1"))
 			return 0;
configs/wandboard_defconfig +1 -1
index ca564c59b80..d6bde4bf28b 100644
@@ -43,7 +43,7 @@ CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6dl-wandboard-revb1"
-CONFIG_OF_LIST="imx6q-wandboard-revb1 imx6qp-wandboard-revd1 imx6dl-wandboard-revb1"
+CONFIG_OF_LIST="imx6q-wandboard-revb1 imx6qp-wandboard-revd1 imx6dl-wandboard-revb1 imx6q-wandboard-revd1 imx6dl-wandboard-revd1"
 CONFIG_MULTI_DTB_FIT=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
Signature · 1 line
2.24.1
#3 lore raw

RFC PATCH 3/7 wandboard: reorder board_fit_config_name_match

In reply to Heiko Schocher

handle different board revisions in one if path.

Without this change if "imx6dl-wandboard-revb1" is passed before "imx6dl-wandboard-revd1" to this function, "imx6dl-wandboard-revb1" is detected as the correct version, on revd1 boards, as "imx6dl-wandboard-revb1" is not dependend on is_revd1().

---

 board/wandboard/wandboard.c | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)
board/wandboard/wandboard.c +16 -13
index 05f36b7f5d5..4cb9bf6f8c2 100644
@@ -489,19 +489,22 @@ int board_fit_config_name_match(const char *name)
 			return 0;
 	}
 
-	if (is_mx6dq() && is_revd1()) {
-		if (!strcmp(name, "imx6q-wandboard-revd1"))
-			return 0;
-	} else if ((is_mx6dl() || is_mx6solo()) && is_revd1()) {
-		if (!strcmp(name, "imx6dl-wandboard-revd1"))
-			return 0;
-	}
-	if (is_mx6dq()) {
-		if (!strcmp(name, "imx6q-wandboard-revb1"))
-			return 0;
-	} else if (is_mx6dl() || is_mx6solo()) {
-		if (!strcmp(name, "imx6dl-wandboard-revb1"))
-			return 0;
+	if (is_revd1()) {
+		if (is_mx6dq()) {
+			if (!strcmp(name, "imx6q-wandboard-revd1"))
+				return 0;
+		} else if (is_mx6dl() || is_mx6solo()) {
+			if (!strcmp(name, "imx6dl-wandboard-revd1"))
+				return 0;
+		}
+	} else {
+		if (is_mx6dq()) {
+			if (!strcmp(name, "imx6q-wandboard-revb1"))
+				return 0;
+		} else if (is_mx6dl() || is_mx6solo()) {
+			if (!strcmp(name, "imx6dl-wandboard-revb1"))
+				return 0;
+		}
 	}
 
 	return -EINVAL;
Signature · 1 line
2.24.1
#4 lore raw

RFC PATCH 4/7 wandboard: enable CONFIG_DTB_RESELECT

In reply to Heiko Schocher

we have to reselect the DTB, as we need to start with DTB for revision D1 boards, as there is a PMIC which is not on other board revisions. If we do not find the PMIC, we are not on D1 revision board.

---

 board/wandboard/wandboard.c | 21 +++++++++++++++++++++
 configs/wandboard_defconfig |  1 +
 2 files changed, 22 insertions(+)
board/wandboard/wandboard.c +21 -0
index 4cb9bf6f8c2..ae4ad765a83 100644
@@ -510,3 +510,24 @@ int board_fit_config_name_match(const char *name)
 	return -EINVAL;
 }
 #endif
+
+#if !defined(CONFIG_SPL_BUILD)
+#ifdef CONFIG_DTB_RESELECT
+/*
+ * we have to reselect the DTB, as we need to start
+ * with DTB for revision D1 boards, as there is
+ * a PMIC which is not on other board revisions.
+ * If we do not find the PMIC, we are not on D1
+ * revision board.
+ */
+int embedded_dtb_select(void)
+{
+	int rescan;
+
+	power_init_board();
+	fdtdec_resetup(&rescan);
+
+	return 0;
+}
+#endif
+#endif
configs/wandboard_defconfig +1 -0
index d6bde4bf28b..b8ed143ee99 100644
@@ -44,6 +44,7 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6dl-wandboard-revb1"
 CONFIG_OF_LIST="imx6q-wandboard-revb1 imx6qp-wandboard-revd1 imx6dl-wandboard-revb1 imx6q-wandboard-revd1 imx6dl-wandboard-revd1"
+CONFIG_DTB_RESELECT=y
 CONFIG_MULTI_DTB_FIT=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
Signature · 1 line
2.24.1
#5 lore raw

RFC PATCH 5/7 wandboard: use imx6dl-wandboard-revd1 as default DTB

In reply to Heiko Schocher

we detect revision D1 board by searching for pmic, as revision D1 only has a pmic on board. For this we need to have pmic in DTB, so use

imx6dl-wandboard-revd1

as default device tree, not imx6dl-wandboard-revb1

---

 configs/wandboard_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configs/wandboard_defconfig +1 -1
index b8ed143ee99..6f3d413f66a 100644
@@ -42,7 +42,7 @@ CONFIG_CMD_BMP=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_OF_CONTROL=y
-CONFIG_DEFAULT_DEVICE_TREE="imx6dl-wandboard-revb1"
+CONFIG_DEFAULT_DEVICE_TREE="imx6dl-wandboard-revd1"
 CONFIG_OF_LIST="imx6q-wandboard-revb1 imx6qp-wandboard-revd1 imx6dl-wandboard-revb1 imx6q-wandboard-revd1 imx6dl-wandboard-revd1"
 CONFIG_DTB_RESELECT=y
 CONFIG_MULTI_DTB_FIT=y
Signature · 1 line
2.24.1
#6 lore raw

RFC PATCH 6/7 wandboard: add u-boot specific *wandboard-revd1-u-boot.dtsi

In reply to Heiko Schocher

we want to access PMIC before relocation, so we need to add u-boot specific "u-boot,dm-pre-reloc" properties.

---

 arch/arm/dts/imx6dl-wandboard-revd1-u-boot.dtsi | 11 +++++++++++
 arch/arm/dts/imx6q-wandboard-revd1-u-boot.dtsi  | 11 +++++++++++
 2 files changed, 22 insertions(+)
 create mode 100644 arch/arm/dts/imx6dl-wandboard-revd1-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx6q-wandboard-revd1-u-boot.dtsi
arch/arm/dts/imx6dl-wandboard-revd1-u-boot.dtsi new file +11 -0
new file mode 100644
index 00000000000..93e88fa1148
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (C) 2020 Heiko Schocher <[email protected]>
+
+&i2c3 {
+	u-boot,dm-pre-reloc;
+};
+
+&pmic {
+	u-boot,dm-pre-reloc;
+};
arch/arm/dts/imx6q-wandboard-revd1-u-boot.dtsi new file +11 -0
new file mode 100644
index 00000000000..93e88fa1148
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (C) 2020 Heiko Schocher <[email protected]>
+
+&i2c3 {
+	u-boot,dm-pre-reloc;
+};
+
+&pmic {
+	u-boot,dm-pre-reloc;
+};
Signature · 1 line
2.24.1
reviewer
#7 lore raw

RFC PATCH 6/7 wandboard: add u-boot specific *wandboard-revd1-u-boot.dtsi

Hi Heiko,

Quoted 4 lines · Heiko Schocher

we want to access PMIC before relocation, so we need to add u-boot specific "u-boot,dm-pre-reloc" properties.

Quoted 8 lines

---

 arch/arm/dts/imx6dl-wandboard-revd1-u-boot.dtsi | 11 +++++++++++
 arch/arm/dts/imx6q-wandboard-revd1-u-boot.dtsi  | 11 +++++++++++
 2 files changed, 22 insertions(+)
 create mode 100644 arch/arm/dts/imx6dl-wandboard-revd1-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx6q-wandboard-revd1-u-boot.dtsi

The imx6q-wandboard-revd1-u-boot.dtsi is missing.

Thanks

#8 lore raw

RFC PATCH 6/7 wandboard: add u-boot specific *wandboard-revd1-u-boot.dtsi

Hello Fabio,

Am 15.01.2020 um 20:52 schrieb Fabio Estevam:

Quoted 10 lines

Hi Heiko,

Quoted 7 lines · Heiko Schocher

we want to access PMIC before relocation, so we need to add u-boot specific "u-boot,dm-pre-reloc" properties.

---

Quoted 7 lines
Quoted 5 lines
  arch/arm/dts/imx6dl-wandboard-revd1-u-boot.dtsi | 11 +++++++++++
  arch/arm/dts/imx6q-wandboard-revd1-u-boot.dtsi  | 11 +++++++++++
  2 files changed, 22 insertions(+)

create mode 100644 arch/arm/dts/imx6dl-wandboard-revd1-u-boot.dtsi create mode 100644 arch/arm/dts/imx6q-wandboard-revd1-u-boot.dtsi

The imx6q-wandboard-revd1-u-boot.dtsi is missing.

Ah, ok, I can add it ... wait for your testing results.

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de
reviewer
#9 lore raw

RFC PATCH 6/7 wandboard: add u-boot specific *wandboard-revd1-u-boot.dtsi

Hi Heiko,

Quoted 1 line · Heiko Schocher

Ah, ok, I can add it ... wait for your testing results.

I haven't had a chance to test this series, sorry, but after thinking more about it I would prefer to test an improved version of this series because:

1. is_revd1() needs to be done in SPL (if we manage to fix this, it seems we would not need some of the patches of this current series)

2. This series still causes issues on your board: "On hardreset, the PMIC does not respond
on i2c bus"

Thanks

#10 lore raw

RFC PATCH 7/7 wandboard: in SPL use only D1 DTB

In reply to Heiko Schocher

---

 board/wandboard/wandboard.c | 5 +++++
 1 file changed, 5 insertions(+)
board/wandboard/wandboard.c +5 -0
index ae4ad765a83..6b7210c0992 100644
@@ -489,7 +489,12 @@ int board_fit_config_name_match(const char *name)
 			return 0;
 	}
 
+#if defined(CONFIG_SPL_BUILD)
+	/* in SPL we use only revision D1 DTB */
+	if (1) {
+#else
 	if (is_revd1()) {
+#endif
 		if (is_mx6dq()) {
 			if (!strcmp(name, "imx6q-wandboard-revd1"))
 				return 0;
Signature · 1 line
2.24.1
reviewer
#11 lore raw

RFC PATCH 7/7 wandboard: in SPL use only D1 DTB

Hi Heiko,

board/wandboard/wandboard.c int board_fit_config_name_match(const char *name) · line 497

Quoted 6 lines · Heiko Schocher
board/wandboard/wandboard.c +5 -0
+#if defined(CONFIG_SPL_BUILD)
+       /* in SPL we use only revision D1 DTB */
+       if (1) {
+#else
        if (is_revd1()) {
+#endif

Is there a way to improve is_revd1() so that it can call i2c_probe() and detect whether the PMIC is present or not?

Thanks

#12 lore raw

RFC PATCH 7/7 wandboard: in SPL use only D1 DTB

Hello Fabio,

Am 15.01.2020 um 20:54 schrieb Fabio Estevam:

Quoted 4 lines

Hi Heiko,

On Tue, Jan 14, 2020 at 3:14 AM Heiko Schocher <[email protected]> wrote:

Quoted 9 lines

board/wandboard/wandboard.c int board_fit_config_name_match(const char *name) · line 497

Quoted 6 lines
board/wandboard/wandboard.c +5 -0
+#if defined(CONFIG_SPL_BUILD)
+       /* in SPL we use only revision D1 DTB */
+       if (1) {
+#else
         if (is_revd1()) {
+#endif

Is there a way to improve is_revd1() so that it can call i2c_probe() and detect whether the PMIC is present or not?

It is WIP so maybe yes ;-)

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de