[RFC WIP PATCH v1 0/7] 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

From: Fabio Estevam festevam@gmail.com
Import the imx6dl-wandboard-revd1.dts and imx6q-wandboard-revd1.dts from kernel 5.4.8 so that these variants can also be supported.
Signed-off-by: Fabio Estevam festevam@gmail.com
Signed-off-by: Heiko Schocher hs@denx.de ---
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
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 983e235f442..a60e23242fe 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -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 \ diff --git a/arch/arm/dts/imx6dl-wandboard-revd1.dts b/arch/arm/dts/imx6dl-wandboard-revd1.dts new file mode 100644 index 00000000000..6d1d863c2e3 --- /dev/null +++ b/arch/arm/dts/imx6dl-wandboard-revd1.dts @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2013 Freescale Semiconductor, Inc. + * + * Author: Fabio Estevam fabio.estevam@freescale.com + */ +/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@10000000 { + device_type = "memory"; + reg = <0x10000000 0x40000000>; + }; +}; diff --git a/arch/arm/dts/imx6q-wandboard-revd1.dts b/arch/arm/dts/imx6q-wandboard-revd1.dts new file mode 100644 index 00000000000..55331021d80 --- /dev/null +++ b/arch/arm/dts/imx6q-wandboard-revd1.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2013 Freescale Semiconductor, Inc. + * + * Author: Fabio Estevam fabio.estevam@freescale.com + */ +/dts-v1/; +#include "imx6q.dtsi" +#include "imx6qdl-wandboard-revd1.dtsi" + +/ { + model = "Wandboard i.MX6 Quad Board revD1"; + compatible = "wand,imx6q-wandboard", "fsl,imx6q"; + + memory@10000000 { + device_type = "memory"; + reg = <0x10000000 0x80000000>; + }; +}; + +&sata { + status = "okay"; +};

From: Fabio Estevam festevam@gmail.com
Currently the only supported revd1 variant is imx6qp.
Add logic for supporting imx6dl and imx6q revd1 boards as well.
Reported-by: Heiko Schocher hs@denx.de Signed-off-by: Fabio Estevam festevam@gmail.com Signed-off-by: Heiko Schocher hs@denx.de ---
board/wandboard/wandboard.c | 16 +++++++++++++--- configs/wandboard_defconfig | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/board/wandboard/wandboard.c b/board/wandboard/wandboard.c index f4534dd3dc6..05f36b7f5d5 100644 --- a/board/wandboard/wandboard.c +++ b/board/wandboard/wandboard.c @@ -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; diff --git a/configs/wandboard_defconfig b/configs/wandboard_defconfig index ca564c59b80..d6bde4bf28b 100644 --- a/configs/wandboard_defconfig +++ b/configs/wandboard_defconfig @@ -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

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 hs@denx.de ---
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 05f36b7f5d5..4cb9bf6f8c2 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;

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 hs@denx.de ---
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 4cb9bf6f8c2..ae4ad765a83 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 d6bde4bf28b..b8ed143ee99 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

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 hs@denx.de ---
configs/wandboard_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configs/wandboard_defconfig b/configs/wandboard_defconfig index b8ed143ee99..6f3d413f66a 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

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 hs@denx.de ---
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 00000000000..93e88fa1148 --- /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 hs@denx.de + +&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 00000000000..93e88fa1148 --- /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 hs@denx.de + +&i2c3 { + u-boot,dm-pre-reloc; +}; + +&pmic { + u-boot,dm-pre-reloc; +};

Hi Heiko,
On Tue, Jan 14, 2020 at 3:14 AM Heiko Schocher hs@denx.de wrote:
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 hs@denx.de
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

Hello Fabio,
Am 15.01.2020 um 20:52 schrieb Fabio Estevam:
Hi Heiko,
On Tue, Jan 14, 2020 at 3:14 AM Heiko Schocher hs@denx.de wrote:
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 hs@denx.de
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

Hi Heiko,
On Thu, Jan 16, 2020 at 3:18 AM Heiko Schocher hs@denx.de wrote:
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

Signed-off-by: Heiko Schocher hs@denx.de ---
board/wandboard/wandboard.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/board/wandboard/wandboard.c b/board/wandboard/wandboard.c index ae4ad765a83..6b7210c0992 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;

Hi Heiko,
On Tue, Jan 14, 2020 at 3:14 AM Heiko Schocher hs@denx.de wrote:
+#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

Hello Fabio,
Am 15.01.2020 um 20:54 schrieb Fabio Estevam:
Hi Heiko,
On Tue, Jan 14, 2020 at 3:14 AM Heiko Schocher hs@denx.de wrote:
+#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
participants (2)
-
Fabio Estevam
-
Heiko Schocher