Hello Fabio,
Am 08.01.2020 um 21:26 schrieb Fabio Estevam:
Hi Heiko,
On Wed, Jan 8, 2020 at 4:52 PM Fabio Estevam <[email protected]> wrote:
The support for imx6q-wandboard-revd1 and imx6dl-wandboard-revd1 still
needs to be added (it used to work prior to the DM conversion as you
noticed), but unfortunately I don't have access to these variants.
Could you please try the attached two patches?
You were faster than I, thanks!
I don't have access to a imx6dl-wandboard-revd1 board, but hopefully
these two patches would make it to work.
Unfortunately they don;t work.
It applies against the latest u-boot-imx tree.
Tried mainline also as u-boot-imx.
But! Additionally setting:
CONFIG_DEFAULT_DEVICE_TREE="imx6dl-wandboard-revd1"
CONFIG_OF_LIST="imx6dl-wandboard-revd1"
and U-Boot works again, see [1]!
So we are on the correct direction...
Hmm.. I wonder ... if you want to detect the revd1, you must
access the pmic in SPL, so you need a DTS in which it is
configured, also DM PMIC support in SPL ... which introduces a
lot of dependencies starting with enabling CONFIG_SPL_DM and
blows up SPL ... :-(
2 problems I see:
- reorder board_fit_config_name_match
see attached patch: 0001-wandboard-reorder-board_fit_config_name_match.patch
With this patch (based on your patches) and hack [2] U-Boot works also again.
- detect rev D1 board (remaining problem)
board_fit_config_name_match() is called from board_fit_config_name_match,
so from SPL where you have no access (yet?) to pmic_get(), and so
is_revd1() is always 0 -> which leads to wrong DTB selection.
First question: other possibility to detect revision D1 ?
may only probing the chip is enough ?
Should we use instead CONFIG_DTB_RESELECT ?
This is the way to go I think, added patches:
0002-wandboard-enable-CONFIG_DTB_RESELECT.patch
0003-wandboard-use-imx6dl-wandboard-revd1-as-default-DTB.patch
0004-wandboard-add-u-boot-specific-wandboard-revd1-u-boot.patch
0005-wandboard-in-SPL-use-only-D1-DTB.patch
with them, after a soft reset all works fine, see [3] but
on power on I see [4] :-(
Any idea, why after a power on, pmic does not work?
Uff... sorry for the long email ... and may dummy questions.
bye,
Heiko
[1]
U-Boot SPL 2020.01-tbot-00002-g6cd56d3 (Jan 09 2020 - 06:21:00 +0100)
Trying to boot from MMC1
U-Boot 2020.01-tbot-00002-g6cd56d3 (Jan 09 2020 - 06:21:00 +0100)
CPU: Freescale i.MX6DL rev1.3 at 792 MHz
Reset cause: WDOG
DRAM: 1 GiB
PMIC: PFUZE100 ID=0x10
MMC: FSL_SDHC: 2, FSL_SDHC: 1, FSL_SDHC: 0
Loading Environment from MMC... *** Warning - bad CRC, using default environment
No panel detected: default to HDMI
Display: HDMI (1024x768)
In: serial
Out: serial
Err: serial
Model: Wandboard i.MX6 Dual Lite Board revD1
Board: Wandboard rev D1
Net:
Warning: ethernet@2188000 using MAC address from ROM
eth0: ethernet@2188000
Hit any key to stop autoboot: 0
=>
[2] hack for is_revd1()
diff --git a/board/wandboard/wandboard.c b/board/wandboard/wandboard.c
index 4cb9bf6..5c64ab5 100644
--- a/board/wandboard/wandboard.c
+++ b/board/wandboard/wandboard.c
@@ -414,6 +414,7 @@ static bool is_revc1(void)
static bool is_revd1(void)
{
+ with_pmic = 1;
if (with_pmic)
return true;
else
[3] softreset with patches 1-5
U-Boot SPL 2020.01-tbot-00007-g44f7a02 (Jan 09 2020 - 09:00:27 +0100)
Trying to boot from MMC1
U-Boot 2020.01-tbot-00007-g44f7a02 (Jan 09 2020 - 09:00:27 +0100)
CPU: Freescale i.MX6DL rev1.3 at 792 MHz
Reset cause: WDOG
PMIC: PFUZE100 ID=0x10
DRAM: 1 GiB
PMIC: PFUZE100 ID=0x10
MMC: FSL_SDHC: 2, FSL_SDHC: 1, FSL_SDHC: 0
Loading Environment from MMC... *** Warning - bad CRC, using default environment
No panel detected: default to HDMI
Display: HDMI (1024x768)
In: serial
Out: serial
Err: serial
Model: Wandboard i.MX6 Dual Lite Board revD1
Board: Wandboard rev D1
Net:
Warning: ethernet@2188000 using MAC address from ROM
eth0: ethernet@2188000
Hit any key to stop autoboot: 0
=>
[4] hard power on
U-Boot SPL 2020.01-tbot-00007-g44f7a02 (Jan 09 2020 - 09:00:27 +0100)
Trying to boot from MMC1
U-Boot 2020.01-tbot-00007-g44f7a02 (Jan 09 2020 - 09:00:27 +0100)
CPU: Freescale i.MX6DL rev1.3 at 792 MHz
Reset cause: POR
wait_for_sr_state: failed sr=81 cr=a0 state=2020
i2c_init_transfer: failed for chip 0x8 retry=0
wait_for_sr_state: failed sr=81 cr=a0 state=2020
i2c_init_transfer: failed for chip 0x8 retry=1
wait_for_sr_state: failed sr=81 cr=a0 state=2020
i2c_init_transfer: failed for chip 0x8 retry=2
i2c_init_transfer: give up i2c_regs=0x21a8000
read error from device: 0093e358 register: 0x0!
pmic_reg_read() ret -5
DRAM: 1 GiB
PMIC: PFUZE100 ID=0x10
[...]
--
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: [email protected]
>From d05b5fa725b9cc2feef6e15ce84e2891d71e099b Mon Sep 17 00:00:00 2001
From: Heiko Schocher <[email protected]>
Date: Thu, 9 Jan 2020 07:58:57 +0100
Subject: [PATCH 4/5] wandboard: add u-boot specific
*wandboard-revd1-u-boot.dtsi
we want to access PMIC before relocation, so we need
to add u-boot specific "u-boot,dm-pre-reloc" properties.
Signed-off-by: Heiko Schocher <[email protected]>
---
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
diff --git a/arch/arm/dts/imx6dl-wandboard-revd1-u-boot.dtsi b/arch/arm/dts/imx6dl-wandboard-revd1-u-boot.dtsi
new file mode 100644
index 0000000..93e88fa
--- /dev/null
+++ b/arch/arm/dts/imx6dl-wandboard-revd1-u-boot.dtsi
@@ -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;
+};
diff --git a/arch/arm/dts/imx6q-wandboard-revd1-u-boot.dtsi b/arch/arm/dts/imx6q-wandboard-revd1-u-boot.dtsi
new file mode 100644
index 0000000..93e88fa
--- /dev/null
+++ b/arch/arm/dts/imx6q-wandboard-revd1-u-boot.dtsi
@@ -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;
+};
--
2.1.0
>From 9f07f2c3d18c28e7e0bf82dcb472fc4a5d5c19b6 Mon Sep 17 00:00:00 2001
From: Heiko Schocher <[email protected]>
Date: Thu, 9 Jan 2020 07:47:36 +0100
Subject: [PATCH 3/5] wandboard: use imx6dl-wandboard-revd1 as default DTB
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
Signed-off-by: Heiko Schocher <[email protected]>
---
configs/wandboard_defconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configs/wandboard_defconfig b/configs/wandboard_defconfig
index b8ed143..6f3d413 100644
--- a/configs/wandboard_defconfig
+++ b/configs/wandboard_defconfig
@@ -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
--
2.1.0
>From 83f5d95670ed955ee12db800188b47861ceaa116 Mon Sep 17 00:00:00 2001
From: Heiko Schocher <[email protected]>
Date: Thu, 9 Jan 2020 07:45:42 +0100
Subject: [PATCH 2/5] wandboard: enable 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.
Signed-off-by: Heiko Schocher <[email protected]>
---
board/wandboard/wandboard.c | 21 +++++++++++++++++++++
configs/wandboard_defconfig | 1 +
2 files changed, 22 insertions(+)
diff --git a/board/wandboard/wandboard.c b/board/wandboard/wandboard.c
index 4cb9bf6..c343e1b 100644
--- a/board/wandboard/wandboard.c
+++ b/board/wandboard/wandboard.c
@@ -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
diff --git a/configs/wandboard_defconfig b/configs/wandboard_defconfig
index d6bde4b..b8ed143 100644
--- a/configs/wandboard_defconfig
+++ b/configs/wandboard_defconfig
@@ -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
--
2.1.0
>From 963c677df2818c19ddf81c9d90c54151e0f1757f Mon Sep 17 00:00:00 2001
From: Heiko Schocher <[email protected]>
Date: Thu, 9 Jan 2020 07:25:33 +0100
Subject: [PATCH 1/5] wandboard: reorder board_fit_config_name_match
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().
Signed-off-by: Heiko Schocher <[email protected]>
---
board/wandboard/wandboard.c | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/board/wandboard/wandboard.c b/board/wandboard/wandboard.c
index 05f36b7..4cb9bf6 100644
--- a/board/wandboard/wandboard.c
+++ b/board/wandboard/wandboard.c
@@ -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;
--
2.1.0
>From 44f7a0221b99ba40dd73208dc3864bf171fbdaae Mon Sep 17 00:00:00 2001
From: Heiko Schocher <[email protected]>
Date: Thu, 9 Jan 2020 08:08:11 +0100
Subject: [PATCH 5/5] wandboard: in SPL use only D1 DTB
Signed-off-by: Heiko Schocher <[email protected]>
---
board/wandboard/wandboard.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/board/wandboard/wandboard.c b/board/wandboard/wandboard.c
index c343e1b..ca6a579 100644
--- a/board/wandboard/wandboard.c
+++ b/board/wandboard/wandboard.c
@@ -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;
--
2.1.0