[PATCH 0/8] ARM: imx: Fix reset in SPL

This series is a merge of "ARM: Fix reset in SPL if SYSRESET is not used" [1] and "ARM: imx: Do not define do_reset() if sysreset is enabled" [2] as the two solve the same problem.
The first of the two was sent to originally to fix a problem not related to imx8m (see the last patch of this new series, "ARM: reset: use do_reset in SPL/TPL if SYSRESET was not enabled for them"). However, this broke imx8m boards as they define do_reset() in board code which was the reason for adding the imx8m patches.
Now, Marek sent the latter series which solves the specific issues of the imx8m boards properly by converting them to use DM_SYSRESET in SPL.
This approach is better than what Claudius and I did originally so I've dropped our (non-DM) fixes for the imx8m boards and added Marek's patches instead. I have, however, kept the fixes for the generic code so if anyone would go back to using the non-DM version, it would also work (and not be part of the tree while silently being broken).
[1]: https://patchwork.ozlabs.org/project/uboot/list/?series=162379 [2]: https://patchwork.ozlabs.org/project/uboot/list/?series=173249
Claudius Heine (2): ARM: imx8m: Don't use the addr parameter of reset_cpu() ARM: reset: use do_reset in SPL/TPL if SYSRESET was not enabled for them
Harald Seiler (1): ARM: imx8m: Fix indentation of reset_cpu() function
Marek Vasut (5): ARM: imx8m: Do not define do_reset() if sysreset is enabled ARM: imx8m: Fix reset in SPL on NXP iMX8MM EVK ARM: imx8m: Fix reset in SPL on NXP iMX8MN EVK ARM: imx8m: Fix reset in SPL on NXP iMX8MP EVK ARM: imx8m: Fix reset in SPL on Toradex iMX8MM Verdin
arch/arm/dts/imx8mm-evk-u-boot.dtsi | 12 ++++++++++++ arch/arm/dts/imx8mm-verdin-u-boot.dtsi | 12 ++++++++++++ arch/arm/dts/imx8mn-ddr4-evk-u-boot.dtsi | 12 ++++++++++++ arch/arm/dts/imx8mp-evk-u-boot.dtsi | 12 ++++++++++++ arch/arm/lib/Makefile | 2 +- arch/arm/mach-imx/imx8m/soc.c | 21 +++++++++------------ board/freescale/imx8mm_evk/spl.c | 9 --------- board/freescale/imx8mn_evk/spl.c | 9 --------- board/freescale/imx8mp_evk/spl.c | 9 --------- board/toradex/verdin-imx8mm/spl.c | 9 --------- configs/imx8mm_evk_defconfig | 5 +++++ configs/imx8mn_ddr4_evk_defconfig | 5 +++++ configs/imx8mp_evk_defconfig | 4 ++++ configs/verdin-imx8mm_defconfig | 5 +++++ 14 files changed, 77 insertions(+), 49 deletions(-)

From: Marek Vasut marex@denx.de
The SPL can also be compiled with sysreset drivers just fine, so update the condition to cater for that option.
Signed-off-by: Marek Vasut marex@denx.de Cc: Fabio Estevam festevam@gmail.com Cc: Flavio Suligoi f.suligoi@asem.it Cc: Harald Seiler hws@denx.de Cc: Igor Opaniuk igor.opaniuk@toradex.com Cc: Marcel Ziswiler marcel.ziswiler@toradex.com Cc: Oleksandr Suvorov oleksandr.suvorov@toradex.com Cc: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de --- arch/arm/mach-imx/imx8m/soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c index 7fcbd53f3020..0f17252e80b7 100644 --- a/arch/arm/mach-imx/imx8m/soc.c +++ b/arch/arm/mach-imx/imx8m/soc.c @@ -382,7 +382,7 @@ int ft_system_setup(void *blob, bd_t *bd) } #endif
-#if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SYSRESET) +#if !CONFIG_IS_ENABLED(SYSRESET) void reset_cpu(ulong addr) { struct watchdog_regs *wdog = (struct watchdog_regs *)addr;

From: Marek Vasut marex@denx.de The SPL can also be compiled with sysreset drivers just fine, so update the condition to cater for that option. Signed-off-by: Marek Vasut marex@denx.de Cc: Fabio Estevam festevam@gmail.com Cc: Flavio Suligoi f.suligoi@asem.it Cc: Harald Seiler hws@denx.de Cc: Igor Opaniuk igor.opaniuk@toradex.com Cc: Marcel Ziswiler marcel.ziswiler@toradex.com Cc: Oleksandr Suvorov oleksandr.suvorov@toradex.com Cc: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

Use proper code-style, tabs instead of spaces for indentation.
Signed-off-by: Harald Seiler hws@denx.de --- arch/arm/mach-imx/imx8m/soc.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c index 0f17252e80b7..5b3fbe712c6b 100644 --- a/arch/arm/mach-imx/imx8m/soc.c +++ b/arch/arm/mach-imx/imx8m/soc.c @@ -385,18 +385,18 @@ int ft_system_setup(void *blob, bd_t *bd) #if !CONFIG_IS_ENABLED(SYSRESET) void reset_cpu(ulong addr) { - struct watchdog_regs *wdog = (struct watchdog_regs *)addr; + struct watchdog_regs *wdog = (struct watchdog_regs *)addr;
- if (!addr) - wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR; + if (!addr) + wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR;
- /* Clear WDA to trigger WDOG_B immediately */ - writew((WCR_WDE | WCR_SRS), &wdog->wcr); + /* Clear WDA to trigger WDOG_B immediately */ + writew((WCR_WDE | WCR_SRS), &wdog->wcr);
- while (1) { - /* - * spin for .5 seconds before reset - */ - } + while (1) { + /* + * spin for .5 seconds before reset + */ + } } #endif

Use proper code-style, tabs instead of spaces for indentation. Signed-off-by: Harald Seiler hws@denx.de
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

From: Claudius Heine ch@denx.de
imx8m has the only implementation of reset_cpu() which does not ignore the addr parameter and instead gives it some meaning as the base address of watchdog registers. This breaks convention with the rest of U-Boot where the parameter is ignored and callers are passing in 0.
Fixes: d2041725e84b ("imx8m: restrict reset_cpu") Co-developed-by: Harald Seiler hws@denx.de Signed-off-by: Harald Seiler hws@denx.de Signed-off-by: Claudius Heine ch@denx.de --- arch/arm/mach-imx/imx8m/soc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c index 5b3fbe712c6b..2fe1fa75fb05 100644 --- a/arch/arm/mach-imx/imx8m/soc.c +++ b/arch/arm/mach-imx/imx8m/soc.c @@ -385,10 +385,7 @@ int ft_system_setup(void *blob, bd_t *bd) #if !CONFIG_IS_ENABLED(SYSRESET) void reset_cpu(ulong addr) { - struct watchdog_regs *wdog = (struct watchdog_regs *)addr; - - if (!addr) - wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR; + struct watchdog_regs *wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR;
/* Clear WDA to trigger WDOG_B immediately */ writew((WCR_WDE | WCR_SRS), &wdog->wcr);

Hi Harald,
On Wed, Apr 29, 2020 at 10:04 AM Harald Seiler hws@denx.de wrote:
From: Claudius Heine ch@denx.de
imx8m has the only implementation of reset_cpu() which does not ignore the addr parameter and instead gives it some meaning as the base address
Unrelated to this patch, but maybe the reset_cpu() function should change its parameter from addr to void instead?

Hello Fabio,
On Wed, 2020-04-29 at 10:14 -0300, Fabio Estevam wrote:
Hi Harald,
On Wed, Apr 29, 2020 at 10:04 AM Harald Seiler hws@denx.de wrote:
From: Claudius Heine ch@denx.de
imx8m has the only implementation of reset_cpu() which does not ignore the addr parameter and instead gives it some meaning as the base address
Unrelated to this patch, but maybe the reset_cpu() function should change its parameter from addr to void instead?
Yes! I have already prepared a patchset for that but as the parameter is still used here I could not send that yet.
The parameter was introduces back in the days because some weird architecture needed the reset-vector address to perform a soft reset. This is a long-gone platform and this parameter is thus no longer necessary.
Regards,

From: Claudius Heine ch@denx.de imx8m has the only implementation of reset_cpu() which does not ignore the addr parameter and instead gives it some meaning as the base address of watchdog registers. This breaks convention with the rest of U-Boot where the parameter is ignored and callers are passing in 0. Fixes: d2041725e84b ("imx8m: restrict reset_cpu") Co-developed-by: Harald Seiler hws@denx.de Signed-off-by: Harald Seiler hws@denx.de Signed-off-by: Claudius Heine ch@denx.de
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

From: Marek Vasut marex@denx.de
Board files should not re-implement do_reset() to work around this function not being defined in for specific configurations. Rather, the fix is to compile in drivers which implement this properly. This patch enables sysreset and watchdog drivers in SPL and ties them together to implement the same as the do_reset() hack in the board file, except correctly in the DM/DT framework.
Signed-off-by: Marek Vasut marex@denx.de Cc: Fabio Estevam festevam@gmail.com Cc: Flavio Suligoi f.suligoi@asem.it Cc: Harald Seiler hws@denx.de Cc: Igor Opaniuk igor.opaniuk@toradex.com Cc: Marcel Ziswiler marcel.ziswiler@toradex.com Cc: Oleksandr Suvorov oleksandr.suvorov@toradex.com Cc: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de --- arch/arm/dts/imx8mm-evk-u-boot.dtsi | 12 ++++++++++++ board/freescale/imx8mm_evk/spl.c | 9 --------- configs/imx8mm_evk_defconfig | 5 +++++ 3 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/arch/arm/dts/imx8mm-evk-u-boot.dtsi b/arch/arm/dts/imx8mm-evk-u-boot.dtsi index 3502602fbb86..b5c12105a9d1 100644 --- a/arch/arm/dts/imx8mm-evk-u-boot.dtsi +++ b/arch/arm/dts/imx8mm-evk-u-boot.dtsi @@ -3,6 +3,14 @@ * Copyright 2019 NXP */
+/ { + wdt-reboot { + compatible = "wdt-reboot"; + wdt = <&wdog1>; + u-boot,dm-spl; + }; +}; + &{/soc@0} { u-boot,dm-pre-reloc; u-boot,dm-spl; @@ -117,3 +125,7 @@ &fec1 { phy-reset-gpios = <&gpio4 22 GPIO_ACTIVE_LOW>; }; + +&wdog1 { + u-boot,dm-spl; +}; diff --git a/board/freescale/imx8mm_evk/spl.c b/board/freescale/imx8mm_evk/spl.c index 5d17f397cb68..4d34622465b3 100644 --- a/board/freescale/imx8mm_evk/spl.c +++ b/board/freescale/imx8mm_evk/spl.c @@ -161,12 +161,3 @@ void board_init_f(ulong dummy)
board_init_r(NULL, 0); } - -int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) -{ - puts ("resetting ...\n"); - - reset_cpu(WDOG1_BASE_ADDR); - - return 0; -} diff --git a/configs/imx8mm_evk_defconfig b/configs/imx8mm_evk_defconfig index d988507bc330..120c76633066 100644 --- a/configs/imx8mm_evk_defconfig +++ b/configs/imx8mm_evk_defconfig @@ -30,6 +30,7 @@ CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_SEPARATE_BSS=y CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_POWER_SUPPORT=y +CONFIG_SPL_WATCHDOG_SUPPORT=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="u-boot=> " # CONFIG_CMD_EXPORTENV is not set @@ -82,5 +83,9 @@ CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y CONFIG_MXC_UART=y CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_PSCI=y +CONFIG_SYSRESET_WATCHDOG=y CONFIG_DM_THERMAL=y +# CONFIG_WATCHDOG is not set +CONFIG_IMX_WATCHDOG=y

From: Marek Vasut marex@denx.de Board files should not re-implement do_reset() to work around this function not being defined in for specific configurations. Rather, the fix is to compile in drivers which implement this properly. This patch enables sysreset and watchdog drivers in SPL and ties them together to implement the same as the do_reset() hack in the board file, except correctly in the DM/DT framework. Signed-off-by: Marek Vasut marex@denx.de Cc: Fabio Estevam festevam@gmail.com Cc: Flavio Suligoi f.suligoi@asem.it Cc: Harald Seiler hws@denx.de Cc: Igor Opaniuk igor.opaniuk@toradex.com Cc: Marcel Ziswiler marcel.ziswiler@toradex.com Cc: Oleksandr Suvorov oleksandr.suvorov@toradex.com Cc: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

From: Marek Vasut marex@denx.de
Board files should not re-implement do_reset() to work around this function not being defined in for specific configurations. Rather, the fix is to compile in drivers which implement this properly. This patch enables sysreset and watchdog drivers in SPL and ties them together to implement the same as the do_reset() hack in the board file, except correctly in the DM/DT framework.
Signed-off-by: Marek Vasut marex@denx.de Cc: Fabio Estevam festevam@gmail.com Cc: Flavio Suligoi f.suligoi@asem.it Cc: Harald Seiler hws@denx.de Cc: Igor Opaniuk igor.opaniuk@toradex.com Cc: Marcel Ziswiler marcel.ziswiler@toradex.com Cc: Oleksandr Suvorov oleksandr.suvorov@toradex.com Cc: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de --- arch/arm/dts/imx8mn-ddr4-evk-u-boot.dtsi | 12 ++++++++++++ board/freescale/imx8mn_evk/spl.c | 9 --------- configs/imx8mn_ddr4_evk_defconfig | 5 +++++ 3 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/arch/arm/dts/imx8mn-ddr4-evk-u-boot.dtsi b/arch/arm/dts/imx8mn-ddr4-evk-u-boot.dtsi index 8d61597e0ce0..4419679d4c66 100644 --- a/arch/arm/dts/imx8mn-ddr4-evk-u-boot.dtsi +++ b/arch/arm/dts/imx8mn-ddr4-evk-u-boot.dtsi @@ -3,6 +3,14 @@ * Copyright 2019 NXP */
+/ { + wdt-reboot { + compatible = "wdt-reboot"; + wdt = <&wdog1>; + u-boot,dm-spl; + }; +}; + &{/soc@0} { u-boot,dm-pre-reloc; u-boot,dm-spl; @@ -90,3 +98,7 @@ &usdhc3 { u-boot,dm-spl; }; + +&wdog1 { + u-boot,dm-spl; +}; diff --git a/board/freescale/imx8mn_evk/spl.c b/board/freescale/imx8mn_evk/spl.c index 7aed14c52b68..45417b24464d 100644 --- a/board/freescale/imx8mn_evk/spl.c +++ b/board/freescale/imx8mn_evk/spl.c @@ -114,12 +114,3 @@ void board_init_f(ulong dummy)
board_init_r(NULL, 0); } - -int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) -{ - puts("resetting ...\n"); - - reset_cpu(WDOG1_BASE_ADDR); - - return 0; -} diff --git a/configs/imx8mn_ddr4_evk_defconfig b/configs/imx8mn_ddr4_evk_defconfig index f7485ab27270..224aeb6f0dfa 100644 --- a/configs/imx8mn_ddr4_evk_defconfig +++ b/configs/imx8mn_ddr4_evk_defconfig @@ -32,6 +32,7 @@ CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_BOOTROM_SUPPORT=y CONFIG_SPL_SEPARATE_BSS=y CONFIG_SPL_I2C_SUPPORT=y +CONFIG_SPL_WATCHDOG_SUPPORT=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="u-boot=> " # CONFIG_CMD_EXPORTENV is not set @@ -76,5 +77,9 @@ CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y CONFIG_MXC_UART=y CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_PSCI=y +CONFIG_SYSRESET_WATCHDOG=y CONFIG_DM_THERMAL=y +# CONFIG_WATCHDOG is not set +CONFIG_IMX_WATCHDOG=y

From: Marek Vasut marex@denx.de Board files should not re-implement do_reset() to work around this function not being defined in for specific configurations. Rather, the fix is to compile in drivers which implement this properly. This patch enables sysreset and watchdog drivers in SPL and ties them together to implement the same as the do_reset() hack in the board file, except correctly in the DM/DT framework. Signed-off-by: Marek Vasut marex@denx.de Cc: Fabio Estevam festevam@gmail.com Cc: Flavio Suligoi f.suligoi@asem.it Cc: Harald Seiler hws@denx.de Cc: Igor Opaniuk igor.opaniuk@toradex.com Cc: Marcel Ziswiler marcel.ziswiler@toradex.com Cc: Oleksandr Suvorov oleksandr.suvorov@toradex.com Cc: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

From: Marek Vasut marex@denx.de
Board files should not re-implement do_reset() to work around this function not being defined in for specific configurations. Rather, the fix is to compile in drivers which implement this properly. This patch enables sysreset and watchdog drivers in SPL and ties them together to implement the same as the do_reset() hack in the board file, except correctly in the DM/DT framework.
Signed-off-by: Marek Vasut marex@denx.de Cc: Fabio Estevam festevam@gmail.com Cc: Flavio Suligoi f.suligoi@asem.it Cc: Harald Seiler hws@denx.de Cc: Igor Opaniuk igor.opaniuk@toradex.com Cc: Marcel Ziswiler marcel.ziswiler@toradex.com Cc: Oleksandr Suvorov oleksandr.suvorov@toradex.com Cc: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de --- arch/arm/dts/imx8mp-evk-u-boot.dtsi | 12 ++++++++++++ board/freescale/imx8mp_evk/spl.c | 9 --------- configs/imx8mp_evk_defconfig | 4 ++++ 3 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/arch/arm/dts/imx8mp-evk-u-boot.dtsi b/arch/arm/dts/imx8mp-evk-u-boot.dtsi index 4675ada0a0a9..24a93ac2d690 100644 --- a/arch/arm/dts/imx8mp-evk-u-boot.dtsi +++ b/arch/arm/dts/imx8mp-evk-u-boot.dtsi @@ -3,6 +3,14 @@ * Copyright 2019 NXP */
+/ { + wdt-reboot { + compatible = "wdt-reboot"; + wdt = <&wdog1>; + u-boot,dm-spl; + }; +}; + &{/soc@0} { u-boot,dm-pre-reloc; u-boot,dm-spl; @@ -119,3 +127,7 @@ &usdhc3 { u-boot,dm-spl; }; + +&wdog1 { + u-boot,dm-spl; +}; diff --git a/board/freescale/imx8mp_evk/spl.c b/board/freescale/imx8mp_evk/spl.c index 0b20668e2b30..39c1dae684ac 100644 --- a/board/freescale/imx8mp_evk/spl.c +++ b/board/freescale/imx8mp_evk/spl.c @@ -149,12 +149,3 @@ void board_init_f(ulong dummy)
board_init_r(NULL, 0); } - -int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) -{ - puts("resetting ...\n"); - - reset_cpu(WDOG1_BASE_ADDR); - - return 0; -} diff --git a/configs/imx8mp_evk_defconfig b/configs/imx8mp_evk_defconfig index ce6b342c3672..09ed7a89c9aa 100644 --- a/configs/imx8mp_evk_defconfig +++ b/configs/imx8mp_evk_defconfig @@ -81,4 +81,8 @@ CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y CONFIG_MXC_UART=y CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_PSCI=y +CONFIG_SYSRESET_WATCHDOG=y +# CONFIG_WATCHDOG is not set +CONFIG_IMX_WATCHDOG=y

From: Marek Vasut marex@denx.de Board files should not re-implement do_reset() to work around this function not being defined in for specific configurations. Rather, the fix is to compile in drivers which implement this properly. This patch enables sysreset and watchdog drivers in SPL and ties them together to implement the same as the do_reset() hack in the board file, except correctly in the DM/DT framework. Signed-off-by: Marek Vasut marex@denx.de Cc: Fabio Estevam festevam@gmail.com Cc: Flavio Suligoi f.suligoi@asem.it Cc: Harald Seiler hws@denx.de Cc: Igor Opaniuk igor.opaniuk@toradex.com Cc: Marcel Ziswiler marcel.ziswiler@toradex.com Cc: Oleksandr Suvorov oleksandr.suvorov@toradex.com Cc: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

Hi,
On Wed, Apr 29, 2020 at 10:05 AM Harald Seiler hws@denx.de wrote:
From: Marek Vasut marex@denx.de
Board files should not re-implement do_reset() to work around this function not being defined in for specific configurations. Rather, the fix is to compile in drivers which implement this properly. This patch enables sysreset and watchdog drivers in SPL and ties them together to implement the same as the do_reset() hack in the board file, except correctly in the DM/DT framework.
Signed-off-by: Marek Vasut marex@denx.de Cc: Fabio Estevam festevam@gmail.com Cc: Flavio Suligoi f.suligoi@asem.it Cc: Harald Seiler hws@denx.de Cc: Igor Opaniuk igor.opaniuk@toradex.com Cc: Marcel Ziswiler marcel.ziswiler@toradex.com Cc: Oleksandr Suvorov oleksandr.suvorov@toradex.com Cc: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de
I noticed that this patch breaks the boot on i.MX8MP EVK. Only the following line is printed on boot:
U-Boot SPL 2020.07-rc1-00014-g8142a97d54 (May 04 2020 - 11:15:50 -0300)
If I revert this patch I can boot it again:
U-Boot SPL 2020.07-rc1-00015-g02cd8db94f (May 04 2020 - 11:17:25 -0300) Normal Boot Failed to find clock node. Check device tree WDT: Not found! Trying to boot from BOOTROM image offset 0x8000, pagesize 0x200, ivt offset 0x0
U-Boot 2020.07-rc1-00015-g02cd8db94f (May 04 2020 - 11:17:25 -0300)
CPU: Freescale i.MX8MP rev1.0 at 1000 MHz Reset cause: POR Model: NXP i.MX8MPlus EVK board DRAM: 6 GiB MMC: FSL_SDHC: 1, FSL_SDHC: 2 Loading Environment from MMC... OK In: serial Out: serial Err: serial Net: No ethernet found. Hit any key to stop autoboot: 0 u-boot=>
The "Failed to find clock node. Check device tree" looks suspicious.
Any ideas?

On 5/4/20 4:27 PM, Fabio Estevam wrote:
Hi,
On Wed, Apr 29, 2020 at 10:05 AM Harald Seiler hws@denx.de wrote:
From: Marek Vasut marex@denx.de
Board files should not re-implement do_reset() to work around this function not being defined in for specific configurations. Rather, the fix is to compile in drivers which implement this properly. This patch enables sysreset and watchdog drivers in SPL and ties them together to implement the same as the do_reset() hack in the board file, except correctly in the DM/DT framework.
Signed-off-by: Marek Vasut marex@denx.de Cc: Fabio Estevam festevam@gmail.com Cc: Flavio Suligoi f.suligoi@asem.it Cc: Harald Seiler hws@denx.de Cc: Igor Opaniuk igor.opaniuk@toradex.com Cc: Marcel Ziswiler marcel.ziswiler@toradex.com Cc: Oleksandr Suvorov oleksandr.suvorov@toradex.com Cc: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de
I noticed that this patch breaks the boot on i.MX8MP EVK. Only the following line is printed on boot:
U-Boot SPL 2020.07-rc1-00014-g8142a97d54 (May 04 2020 - 11:15:50 -0300)
If I revert this patch I can boot it again:
U-Boot SPL 2020.07-rc1-00015-g02cd8db94f (May 04 2020 - 11:17:25 -0300) Normal Boot Failed to find clock node. Check device tree WDT: Not found! Trying to boot from BOOTROM image offset 0x8000, pagesize 0x200, ivt offset 0x0
U-Boot 2020.07-rc1-00015-g02cd8db94f (May 04 2020 - 11:17:25 -0300)
CPU: Freescale i.MX8MP rev1.0 at 1000 MHz Reset cause: POR Model: NXP i.MX8MPlus EVK board DRAM: 6 GiB MMC: FSL_SDHC: 1, FSL_SDHC: 2 Loading Environment from MMC... OK In: serial Out: serial Err: serial Net: No ethernet found. Hit any key to stop autoboot: 0 u-boot=>
The "Failed to find clock node. Check device tree" looks suspicious.
The "WDT: not found!" is probably the root cause of your problem. Maybe the WDT driver fails to probe because it can't resolve it's clock phandle ("Failed to find clock node")? So maybe you need to fix your clock in SPL.

Hello,
On Mon, 2020-05-04 at 16:32 +0200, Marek Vasut wrote:
On 5/4/20 4:27 PM, Fabio Estevam wrote:
Hi,
On Wed, Apr 29, 2020 at 10:05 AM Harald Seiler hws@denx.de wrote:
From: Marek Vasut marex@denx.de
Board files should not re-implement do_reset() to work around this function not being defined in for specific configurations. Rather, the fix is to compile in drivers which implement this properly. This patch enables sysreset and watchdog drivers in SPL and ties them together to implement the same as the do_reset() hack in the board file, except correctly in the DM/DT framework.
Signed-off-by: Marek Vasut marex@denx.de Cc: Fabio Estevam festevam@gmail.com Cc: Flavio Suligoi f.suligoi@asem.it Cc: Harald Seiler hws@denx.de Cc: Igor Opaniuk igor.opaniuk@toradex.com Cc: Marcel Ziswiler marcel.ziswiler@toradex.com Cc: Oleksandr Suvorov oleksandr.suvorov@toradex.com Cc: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de
I noticed that this patch breaks the boot on i.MX8MP EVK. Only the following line is printed on boot:
U-Boot SPL 2020.07-rc1-00014-g8142a97d54 (May 04 2020 - 11:15:50 -0300)
If I revert this patch I can boot it again:
U-Boot SPL 2020.07-rc1-00015-g02cd8db94f (May 04 2020 - 11:17:25 -0300) Normal Boot Failed to find clock node. Check device tree WDT: Not found! Trying to boot from BOOTROM image offset 0x8000, pagesize 0x200, ivt offset 0x0
U-Boot 2020.07-rc1-00015-g02cd8db94f (May 04 2020 - 11:17:25 -0300)
CPU: Freescale i.MX8MP rev1.0 at 1000 MHz Reset cause: POR Model: NXP i.MX8MPlus EVK board DRAM: 6 GiB MMC: FSL_SDHC: 1, FSL_SDHC: 2 Loading Environment from MMC... OK In: serial Out: serial Err: serial Net: No ethernet found. Hit any key to stop autoboot: 0 u-boot=>
The "Failed to find clock node. Check device tree" looks suspicious.
The "WDT: not found!" is probably the root cause of your problem. Maybe the WDT driver fails to probe because it can't resolve it's clock phandle ("Failed to find clock node")? So maybe you need to fix your clock in SPL.
"Failed to find clock node. Check device tree" comes from spl_board_init() in board/freescale/imx8mp_evk/spl.c; line 56:
ret = uclass_get_device_by_name(UCLASS_CLK, "clock-controller@30380000", &dev);
I see that wdog1 references the same clock here:
arch/arm/dts/imx8mp.dtsi; line 222:
wdog1: watchdog@30280000 { compatible = "fsl,imx8mp-wdt", "fsl,imx21-wdt"; reg = <0x30280000 0x10000>; interrupts = <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clk IMX8MP_CLK_WDOG1_ROOT>; status = "disabled"; };
So the two issues are very likely related. The relevant clock's node is also enabled for SPL so I think the driver might be missing here. Maybe you need to add
CONFIG_SPL_CLK_IMX8MP=y
to your defconfig?

On Mon, May 4, 2020 at 12:05 PM Harald Seiler hws@denx.de wrote:
"Failed to find clock node. Check device tree" comes from spl_board_init() in board/freescale/imx8mp_evk/spl.c; line 56:
ret = uclass_get_device_by_name(UCLASS_CLK, "clock-controller@30380000", &dev);
I see that wdog1 references the same clock here:
arch/arm/dts/imx8mp.dtsi; line 222:
wdog1: watchdog@30280000 { compatible = "fsl,imx8mp-wdt", "fsl,imx21-wdt"; reg = <0x30280000 0x10000>; interrupts = <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clk IMX8MP_CLK_WDOG1_ROOT>; status = "disabled"; };
So the two issues are very likely related. The relevant clock's node is also enabled for SPL so I think the driver might be missing here. Maybe you need to add
CONFIG_SPL_CLK_IMX8MP=y
to your defconfig?
I tried like this:
--- a/configs/imx8mp_evk_defconfig +++ b/configs/imx8mp_evk_defconfig @@ -57,7 +57,9 @@ CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_SPL_DM=y +CONFIG_SPL_CLK_COMPOSITE_CCF=y CONFIG_CLK_COMPOSITE_CCF=y +CONFIG_SPL_CLK_IMX8MP=y CONFIG_CLK_IMX8MP=y CONFIG_MXC_GPIO=y CONFIG_DM_PCA953X=y
but still only prints:
U-Boot SPL 2020.07-rc1-00014-g8142a97d54-dirty (May 04 2020 - 12:16:25 -0300)

On Mon, 2020-05-04 at 12:18 -0300, Fabio Estevam wrote:
On Mon, May 4, 2020 at 12:05 PM Harald Seiler hws@denx.de wrote:
"Failed to find clock node. Check device tree" comes from spl_board_init() in board/freescale/imx8mp_evk/spl.c; line 56:
ret = uclass_get_device_by_name(UCLASS_CLK, "clock-controller@30380000", &dev);
I see that wdog1 references the same clock here:
arch/arm/dts/imx8mp.dtsi; line 222:
wdog1: watchdog@30280000 { compatible = "fsl,imx8mp-wdt", "fsl,imx21-wdt"; reg = <0x30280000 0x10000>; interrupts = <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clk IMX8MP_CLK_WDOG1_ROOT>; status = "disabled"; };
So the two issues are very likely related. The relevant clock's node is also enabled for SPL so I think the driver might be missing here. Maybe you need to add
CONFIG_SPL_CLK_IMX8MP=y
to your defconfig?
I tried like this:
--- a/configs/imx8mp_evk_defconfig +++ b/configs/imx8mp_evk_defconfig @@ -57,7 +57,9 @@ CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_SPL_DM=y +CONFIG_SPL_CLK_COMPOSITE_CCF=y CONFIG_CLK_COMPOSITE_CCF=y +CONFIG_SPL_CLK_IMX8MP=y CONFIG_CLK_IMX8MP=y CONFIG_MXC_GPIO=y CONFIG_DM_PCA953X=y
but still only prints:
U-Boot SPL 2020.07-rc1-00014-g8142a97d54-dirty (May 04 2020 - 12:16:25 -0300)
With or without the revert?

On Mon, May 4, 2020 at 12:21 PM Harald Seiler hws@denx.de wrote:
With or without the revert?
When I change the defconfig like:
--- a/configs/imx8mp_evk_defconfig +++ b/configs/imx8mp_evk_defconfig @@ -57,7 +57,9 @@ CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_SPL_DM=y +CONFIG_SPL_CLK_COMPOSITE_CCF=y CONFIG_CLK_COMPOSITE_CCF=y +CONFIG_SPL_CLK_IMX8MP=y CONFIG_CLK_IMX8MP=y CONFIG_MXC_GPIO=y CONFIG_DM_PCA953X=y
It prints a single SPL line with the revert and also without the revert.

Hello Fabio,
On Mon, 2020-05-04 at 12:28 -0300, Fabio Estevam wrote:
On Mon, May 4, 2020 at 12:21 PM Harald Seiler hws@denx.de wrote:
With or without the revert?
When I change the defconfig like:
--- a/configs/imx8mp_evk_defconfig +++ b/configs/imx8mp_evk_defconfig @@ -57,7 +57,9 @@ CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_SPL_DM=y +CONFIG_SPL_CLK_COMPOSITE_CCF=y CONFIG_CLK_COMPOSITE_CCF=y +CONFIG_SPL_CLK_IMX8MP=y CONFIG_CLK_IMX8MP=y CONFIG_MXC_GPIO=y CONFIG_DM_PCA953X=y
It prints a single SPL line with the revert and also without the revert.
Ok, I guess this means the imx8mp clock driver in SPL is broken and we can't easily fix the DM_WATCHDOG issue without it. I don't really know much about imx8 nor do I have any hardware which I could use to debug with so I can't help much with this.
Maybe Peng, who wrote the clock driver, can comment?
Otherwise, the series which contains this patch also fixed the non-DM reset in SPL so we could revert back to that if all else fails ...

On 5/5/20 10:54 AM, Harald Seiler wrote:
Hello Fabio,
Hi
On Mon, 2020-05-04 at 12:28 -0300, Fabio Estevam wrote:
On Mon, May 4, 2020 at 12:21 PM Harald Seiler hws@denx.de wrote:
With or without the revert?
When I change the defconfig like:
--- a/configs/imx8mp_evk_defconfig +++ b/configs/imx8mp_evk_defconfig @@ -57,7 +57,9 @@ CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_SPL_DM=y +CONFIG_SPL_CLK_COMPOSITE_CCF=y CONFIG_CLK_COMPOSITE_CCF=y +CONFIG_SPL_CLK_IMX8MP=y CONFIG_CLK_IMX8MP=y CONFIG_MXC_GPIO=y CONFIG_DM_PCA953X=y
It prints a single SPL line with the revert and also without the revert.
Ok, I guess this means the imx8mp clock driver in SPL is broken and we can't easily fix the DM_WATCHDOG issue without it. I don't really know much about imx8 nor do I have any hardware which I could use to debug with so I can't help much with this.
Maybe Peng, who wrote the clock driver, can comment?
Otherwise, the series which contains this patch also fixed the non-DM reset in SPL so we could revert back to that if all else fails ...
Fix the clock driver. Reverting a patch to work around bugs is bad.

From: Marek Vasut marex@denx.de
Board files should not re-implement do_reset() to work around this function not being defined in for specific configurations. Rather, the fix is to compile in drivers which implement this properly. This patch enables sysreset and watchdog drivers in SPL and ties them together to implement the same as the do_reset() hack in the board file, except correctly in the DM/DT framework.
Signed-off-by: Marek Vasut marex@denx.de Cc: Fabio Estevam festevam@gmail.com Cc: Flavio Suligoi f.suligoi@asem.it Cc: Harald Seiler hws@denx.de Cc: Igor Opaniuk igor.opaniuk@toradex.com Cc: Marcel Ziswiler marcel.ziswiler@toradex.com Cc: Oleksandr Suvorov oleksandr.suvorov@toradex.com Cc: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de --- arch/arm/dts/imx8mm-verdin-u-boot.dtsi | 12 ++++++++++++ board/toradex/verdin-imx8mm/spl.c | 9 --------- configs/verdin-imx8mm_defconfig | 5 +++++ 3 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/arch/arm/dts/imx8mm-verdin-u-boot.dtsi b/arch/arm/dts/imx8mm-verdin-u-boot.dtsi index e60b9faee442..fe6bb9bf03cf 100644 --- a/arch/arm/dts/imx8mm-verdin-u-boot.dtsi +++ b/arch/arm/dts/imx8mm-verdin-u-boot.dtsi @@ -3,6 +3,14 @@ * Copyright 2020 Toradex */
+/ { + wdt-reboot { + compatible = "wdt-reboot"; + wdt = <&wdog1>; + u-boot,dm-spl; + }; +}; + &aips1 { u-boot,dm-spl; u-boot,dm-pre-reloc; @@ -105,3 +113,7 @@ &usdhc3 { u-boot,dm-spl; }; + +&wdog1 { + u-boot,dm-spl; +}; diff --git a/board/toradex/verdin-imx8mm/spl.c b/board/toradex/verdin-imx8mm/spl.c index a5dc54082054..dc5bd84f332e 100644 --- a/board/toradex/verdin-imx8mm/spl.c +++ b/board/toradex/verdin-imx8mm/spl.c @@ -169,12 +169,3 @@ void board_init_f(ulong dummy)
board_init_r(NULL, 0); } - -int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) -{ - puts("resetting ...\n"); - - reset_cpu(WDOG1_BASE_ADDR); - - return 0; -} diff --git a/configs/verdin-imx8mm_defconfig b/configs/verdin-imx8mm_defconfig index 590750e9b2d1..21f6aa308208 100644 --- a/configs/verdin-imx8mm_defconfig +++ b/configs/verdin-imx8mm_defconfig @@ -38,6 +38,7 @@ CONFIG_SPL_SEPARATE_BSS=y CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_POWER_SUPPORT=y CONFIG_SPL_USB_HOST_SUPPORT=y +CONFIG_SPL_WATCHDOG_SUPPORT=y CONFIG_SYS_PROMPT="Verdin iMX8MM # " # CONFIG_BOOTM_NETBSD is not set CONFIG_CMD_ASKENV=y @@ -94,5 +95,9 @@ CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y CONFIG_MXC_UART=y CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_PSCI=y +CONFIG_SYSRESET_WATCHDOG=y CONFIG_DM_THERMAL=y +# CONFIG_WATCHDOG is not set +CONFIG_IMX_WATCHDOG=y

On Wed, Apr 29, 2020 at 4:05 PM Harald Seiler hws@denx.de wrote:
From: Marek Vasut marex@denx.de
Board files should not re-implement do_reset() to work around this function not being defined in for specific configurations. Rather, the fix is to compile in drivers which implement this properly. This patch enables sysreset and watchdog drivers in SPL and ties them together to implement the same as the do_reset() hack in the board file, except correctly in the DM/DT framework.
Signed-off-by: Marek Vasut marex@denx.de Cc: Fabio Estevam festevam@gmail.com Cc: Flavio Suligoi f.suligoi@asem.it Cc: Harald Seiler hws@denx.de Cc: Igor Opaniuk igor.opaniuk@toradex.com Cc: Marcel Ziswiler marcel.ziswiler@toradex.com Cc: Oleksandr Suvorov oleksandr.suvorov@toradex.com Cc: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de
Thanks, Harald!
Reviewed-by: Oleksandr Suvorov oleksandr.suvorov@toradex.com
arch/arm/dts/imx8mm-verdin-u-boot.dtsi | 12 ++++++++++++ board/toradex/verdin-imx8mm/spl.c | 9 --------- configs/verdin-imx8mm_defconfig | 5 +++++ 3 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/arch/arm/dts/imx8mm-verdin-u-boot.dtsi b/arch/arm/dts/imx8mm-verdin-u-boot.dtsi index e60b9faee442..fe6bb9bf03cf 100644 --- a/arch/arm/dts/imx8mm-verdin-u-boot.dtsi +++ b/arch/arm/dts/imx8mm-verdin-u-boot.dtsi @@ -3,6 +3,14 @@
- Copyright 2020 Toradex
*/
+/ {
wdt-reboot {
compatible = "wdt-reboot";
wdt = <&wdog1>;
u-boot,dm-spl;
};
+};
&aips1 { u-boot,dm-spl; u-boot,dm-pre-reloc; @@ -105,3 +113,7 @@ &usdhc3 { u-boot,dm-spl; };
+&wdog1 {
u-boot,dm-spl;
+}; diff --git a/board/toradex/verdin-imx8mm/spl.c b/board/toradex/verdin-imx8mm/spl.c index a5dc54082054..dc5bd84f332e 100644 --- a/board/toradex/verdin-imx8mm/spl.c +++ b/board/toradex/verdin-imx8mm/spl.c @@ -169,12 +169,3 @@ void board_init_f(ulong dummy)
board_init_r(NULL, 0);
}
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) -{
puts("resetting ...\n");
reset_cpu(WDOG1_BASE_ADDR);
return 0;
-} diff --git a/configs/verdin-imx8mm_defconfig b/configs/verdin-imx8mm_defconfig index 590750e9b2d1..21f6aa308208 100644 --- a/configs/verdin-imx8mm_defconfig +++ b/configs/verdin-imx8mm_defconfig @@ -38,6 +38,7 @@ CONFIG_SPL_SEPARATE_BSS=y CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_POWER_SUPPORT=y CONFIG_SPL_USB_HOST_SUPPORT=y +CONFIG_SPL_WATCHDOG_SUPPORT=y CONFIG_SYS_PROMPT="Verdin iMX8MM # " # CONFIG_BOOTM_NETBSD is not set CONFIG_CMD_ASKENV=y @@ -94,5 +95,9 @@ CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y CONFIG_MXC_UART=y CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_PSCI=y +CONFIG_SYSRESET_WATCHDOG=y CONFIG_DM_THERMAL=y +# CONFIG_WATCHDOG is not set
+CONFIG_IMX_WATCHDOG=y
2.26.2

Hello Herald,
On Wed, Apr 29, 2020 at 4:06 PM Harald Seiler hws@denx.de wrote:
From: Marek Vasut marex@denx.de
Board files should not re-implement do_reset() to work around this function not being defined in for specific configurations. Rather, the fix is to compile in drivers which implement this properly. This patch enables sysreset and watchdog drivers in SPL and ties them together to implement the same as the do_reset() hack in the board file, except correctly in the DM/DT framework.
Signed-off-by: Marek Vasut marex@denx.de Cc: Fabio Estevam festevam@gmail.com Cc: Flavio Suligoi f.suligoi@asem.it Cc: Harald Seiler hws@denx.de Cc: Igor Opaniuk igor.opaniuk@toradex.com Cc: Marcel Ziswiler marcel.ziswiler@toradex.com Cc: Oleksandr Suvorov oleksandr.suvorov@toradex.com Cc: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de
arch/arm/dts/imx8mm-verdin-u-boot.dtsi | 12 ++++++++++++ board/toradex/verdin-imx8mm/spl.c | 9 --------- configs/verdin-imx8mm_defconfig | 5 +++++ 3 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/arch/arm/dts/imx8mm-verdin-u-boot.dtsi b/arch/arm/dts/imx8mm-verdin-u-boot.dtsi index e60b9faee442..fe6bb9bf03cf 100644 --- a/arch/arm/dts/imx8mm-verdin-u-boot.dtsi +++ b/arch/arm/dts/imx8mm-verdin-u-boot.dtsi @@ -3,6 +3,14 @@
- Copyright 2020 Toradex
*/
+/ {
wdt-reboot {
compatible = "wdt-reboot";
wdt = <&wdog1>;
u-boot,dm-spl;
};
+};
&aips1 { u-boot,dm-spl; u-boot,dm-pre-reloc; @@ -105,3 +113,7 @@ &usdhc3 { u-boot,dm-spl; };
+&wdog1 {
u-boot,dm-spl;
+}; diff --git a/board/toradex/verdin-imx8mm/spl.c b/board/toradex/verdin-imx8mm/spl.c index a5dc54082054..dc5bd84f332e 100644 --- a/board/toradex/verdin-imx8mm/spl.c +++ b/board/toradex/verdin-imx8mm/spl.c @@ -169,12 +169,3 @@ void board_init_f(ulong dummy)
board_init_r(NULL, 0);
}
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) -{
puts("resetting ...\n");
reset_cpu(WDOG1_BASE_ADDR);
return 0;
-} diff --git a/configs/verdin-imx8mm_defconfig b/configs/verdin-imx8mm_defconfig index 590750e9b2d1..21f6aa308208 100644 --- a/configs/verdin-imx8mm_defconfig +++ b/configs/verdin-imx8mm_defconfig @@ -38,6 +38,7 @@ CONFIG_SPL_SEPARATE_BSS=y CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_POWER_SUPPORT=y CONFIG_SPL_USB_HOST_SUPPORT=y +CONFIG_SPL_WATCHDOG_SUPPORT=y CONFIG_SYS_PROMPT="Verdin iMX8MM # " # CONFIG_BOOTM_NETBSD is not set CONFIG_CMD_ASKENV=y @@ -94,5 +95,9 @@ CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y CONFIG_MXC_UART=y CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_PSCI=y +CONFIG_SYSRESET_WATCHDOG=y CONFIG_DM_THERMAL=y +# CONFIG_WATCHDOG is not set
+CONFIG_IMX_WATCHDOG=y
2.26.2
Acked-by: Igor Opaniuk igor.opaniuk@toradex.com

Harald,
sorry for the typo in the previous email.
On Wed, Apr 29, 2020 at 4:06 PM Harald Seiler hws@denx.de wrote:
From: Marek Vasut marex@denx.de
Board files should not re-implement do_reset() to work around this function not being defined in for specific configurations. Rather, the fix is to compile in drivers which implement this properly. This patch enables sysreset and watchdog drivers in SPL and ties them together to implement the same as the do_reset() hack in the board file, except correctly in the DM/DT framework.
Signed-off-by: Marek Vasut marex@denx.de Cc: Fabio Estevam festevam@gmail.com Cc: Flavio Suligoi f.suligoi@asem.it Cc: Harald Seiler hws@denx.de Cc: Igor Opaniuk igor.opaniuk@toradex.com Cc: Marcel Ziswiler marcel.ziswiler@toradex.com Cc: Oleksandr Suvorov oleksandr.suvorov@toradex.com Cc: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de
arch/arm/dts/imx8mm-verdin-u-boot.dtsi | 12 ++++++++++++ board/toradex/verdin-imx8mm/spl.c | 9 --------- configs/verdin-imx8mm_defconfig | 5 +++++ 3 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/arch/arm/dts/imx8mm-verdin-u-boot.dtsi b/arch/arm/dts/imx8mm-verdin-u-boot.dtsi index e60b9faee442..fe6bb9bf03cf 100644 --- a/arch/arm/dts/imx8mm-verdin-u-boot.dtsi +++ b/arch/arm/dts/imx8mm-verdin-u-boot.dtsi @@ -3,6 +3,14 @@
- Copyright 2020 Toradex
*/
+/ {
wdt-reboot {
compatible = "wdt-reboot";
wdt = <&wdog1>;
u-boot,dm-spl;
};
+};
&aips1 { u-boot,dm-spl; u-boot,dm-pre-reloc; @@ -105,3 +113,7 @@ &usdhc3 { u-boot,dm-spl; };
+&wdog1 {
u-boot,dm-spl;
+}; diff --git a/board/toradex/verdin-imx8mm/spl.c b/board/toradex/verdin-imx8mm/spl.c index a5dc54082054..dc5bd84f332e 100644 --- a/board/toradex/verdin-imx8mm/spl.c +++ b/board/toradex/verdin-imx8mm/spl.c @@ -169,12 +169,3 @@ void board_init_f(ulong dummy)
board_init_r(NULL, 0);
}
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) -{
puts("resetting ...\n");
reset_cpu(WDOG1_BASE_ADDR);
return 0;
-} diff --git a/configs/verdin-imx8mm_defconfig b/configs/verdin-imx8mm_defconfig index 590750e9b2d1..21f6aa308208 100644 --- a/configs/verdin-imx8mm_defconfig +++ b/configs/verdin-imx8mm_defconfig @@ -38,6 +38,7 @@ CONFIG_SPL_SEPARATE_BSS=y CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_POWER_SUPPORT=y CONFIG_SPL_USB_HOST_SUPPORT=y +CONFIG_SPL_WATCHDOG_SUPPORT=y CONFIG_SYS_PROMPT="Verdin iMX8MM # " # CONFIG_BOOTM_NETBSD is not set CONFIG_CMD_ASKENV=y @@ -94,5 +95,9 @@ CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y CONFIG_MXC_UART=y CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_PSCI=y +CONFIG_SYSRESET_WATCHDOG=y CONFIG_DM_THERMAL=y +# CONFIG_WATCHDOG is not set
+CONFIG_IMX_WATCHDOG=y
2.26.2
Acked-by: Igor Opaniuk igor.opaniuk@toradex.com
Thanks!

From: Marek Vasut marex@denx.de Board files should not re-implement do_reset() to work around this function not being defined in for specific configurations. Rather, the fix is to compile in drivers which implement this properly. This patch enables sysreset and watchdog drivers in SPL and ties them together to implement the same as the do_reset() hack in the board file, except correctly in the DM/DT framework. Signed-off-by: Marek Vasut marex@denx.de Cc: Fabio Estevam festevam@gmail.com Cc: Flavio Suligoi f.suligoi@asem.it Cc: Harald Seiler hws@denx.de Cc: Igor Opaniuk igor.opaniuk@toradex.com Cc: Marcel Ziswiler marcel.ziswiler@toradex.com Cc: Oleksandr Suvorov oleksandr.suvorov@toradex.com Cc: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de Reviewed-by: Oleksandr Suvorov oleksandr.suvorov@toradex.com Acked-by: Igor Opaniuk igor.opaniuk@toradex.com Acked-by: Igor Opaniuk igor.opaniuk@toradex.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

From: Claudius Heine ch@denx.de
In case CONFIG_SYSRESET is set, do_reset() from reset.c will not be available anywere, even if SYSRESET is disabled for SPL/TPL.
do_reset() is called from SPL for instance from the panic handler and PANIC_HANG is not set
Signed-off-by: Claudius Heine ch@denx.de --- arch/arm/lib/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index 8482f5446c5c..b839aa7a5096 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile @@ -57,7 +57,7 @@ obj-y += interrupts_64.o else obj-y += interrupts.o endif -ifndef CONFIG_SYSRESET +ifndef CONFIG_$(SPL_TPL_)SYSRESET obj-y += reset.o endif

Hi folks,
On Wed, Apr 29, 2020 at 10:04 AM Harald Seiler hws@denx.de wrote:
This series is a merge of "ARM: Fix reset in SPL if SYSRESET is not used" [1] and "ARM: imx: Do not define do_reset() if sysreset is enabled" [2] as the two solve the same problem.
The first of the two was sent to originally to fix a problem not related to imx8m (see the last patch of this new series, "ARM: reset: use do_reset in SPL/TPL if SYSRESET was not enabled for them"). However, this broke imx8m boards as they define do_reset() in board code which was the reason for adding the imx8m patches.
Now, Marek sent the latter series which solves the specific issues of the imx8m boards properly by converting them to use DM_SYSRESET in SPL.
This approach is better than what Claudius and I did originally so I've dropped our (non-DM) fixes for the imx8m boards and added Marek's patches instead. I have, however, kept the fixes for the generic code so if anyone would go back to using the non-DM version, it would also work (and not be part of the tree while silently being broken).
Nice work!
For the entire series:
Reviewed-by: Fabio Estevam festevam@gmail.com
participants (6)
-
Fabio Estevam
-
Harald Seiler
-
Igor Opaniuk
-
Marek Vasut
-
Oleksandr Suvorov
-
sbabic@denx.de