Skip to contentSkip to conversation

ARM: imx: Fix reset in SPL

PATCH New Harald Seiler 6 participants 30 messages Apr 29, 2020 – May 5, 2020

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

cover 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(-)
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/8 ARM: imx8m: Do not define do_reset() if sysreset is enabled

From: Marek Vasut <[email protected]>

The SPL can also be compiled with sysreset drivers just fine, so update the condition to cater for that option.

Cc Fabio Estevam <[email protected]>
Cc Flavio Suligoi <[email protected]>
Cc Harald Seiler <[email protected]>
Cc Igor Opaniuk <[email protected]>
Cc Marcel Ziswiler <[email protected]>
Cc Oleksandr Suvorov <[email protected]>
Cc Peng Fan <[email protected]>
Cc Stefano Babic <[email protected]>
---
 arch/arm/mach-imx/imx8m/soc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-imx/imx8m/soc.c +1 -1
index 7fcbd53f3020..0f17252e80b7 100644
@@ -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;
Signature · 1 line
2.26.2
#2 lore raw

PATCH 1/8 ARM: imx8m: Do not define do_reset() if sysreset is enabled

Quoted 12 lines

From: Marek Vasut <[email protected]>
The SPL can also be compiled with sysreset drivers just fine, so update the condition to cater for that option.

Cc Fabio Estevam <[email protected]>
Cc Flavio Suligoi <[email protected]>
Cc Harald Seiler <[email protected]>
Cc Igor Opaniuk <[email protected]>
Cc Marcel Ziswiler <[email protected]>
Cc Oleksandr Suvorov <[email protected]>
Cc Peng Fan <[email protected]>
Cc Stefano Babic <[email protected]>

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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

PATCH 2/8 ARM: imx8m: Fix indentation of reset_cpu() function

In reply to Harald Seiler

Use proper code-style, tabs instead of spaces for indentation.

---
 arch/arm/mach-imx/imx8m/soc.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
arch/arm/mach-imx/imx8m/soc.c +10 -10
index 0f17252e80b7..5b3fbe712c6b 100644
@@ -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
Signature · 1 line
2.26.2
#4 lore raw

PATCH 2/8 ARM: imx8m: Fix indentation of reset_cpu() function

Quoted 2 lines

Use proper code-style, tabs instead of spaces for indentation.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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

PATCH 3/8 ARM: imx8m: Don't use the addr parameter of reset_cpu()

In reply to Harald Seiler

From: Claudius Heine <[email protected]>

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")
---
 arch/arm/mach-imx/imx8m/soc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
arch/arm/mach-imx/imx8m/soc.c +1 -4
index 5b3fbe712c6b..2fe1fa75fb05 100644
@@ -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);
Signature · 1 line
2.26.2
reviewer
#6 lore raw

PATCH 3/8 ARM: imx8m: Don't use the addr parameter of reset_cpu()

Hi Harald,

Quoted 5 lines · Harald Seiler

From: Claudius Heine <[email protected]>

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?

#7 lore raw

PATCH 3/8 ARM: imx8m: Don't use the addr parameter of reset_cpu()

Hello Fabio,

Quoted 10 lines · Fabio Estevam

Hi Harald,

Quoted 4 lines · Harald Seiler

From: Claudius Heine <[email protected]>

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,

Signature · 1 line
Harald
#8 lore raw

PATCH 3/8 ARM: imx8m: Don't use the addr parameter of reset_cpu()

In reply to Harald Seiler
Quoted 9 lines

From: Claudius Heine <[email protected]>
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")

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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

PATCH 4/8 ARM: imx8m: Fix reset in SPL on NXP iMX8MM EVK

In reply to Harald Seiler

From: Marek Vasut <[email protected]>

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.

Cc Fabio Estevam <[email protected]>
Cc Flavio Suligoi <[email protected]>
Cc Harald Seiler <[email protected]>
Cc Igor Opaniuk <[email protected]>
Cc Marcel Ziswiler <[email protected]>
Cc Oleksandr Suvorov <[email protected]>
Cc Peng Fan <[email protected]>
Cc Stefano Babic <[email protected]>
---
 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(-)
arch/arm/dts/imx8mm-evk-u-boot.dtsi +12 -0
index 3502602fbb86..b5c12105a9d1 100644
@@ -3,6 +3,14 @@
  * Copyright 2019 NXP
  */
 
+/ {
+	wdt-reboot {
+		compatible = "wdt-reboot";
+		wdt = <&wdog1>;
+		u-boot,dm-spl;
+	};
+};
+
 &{/soc at 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;
+};
board/freescale/imx8mm_evk/spl.c +0 -9
index 5d17f397cb68..4d34622465b3 100644
@@ -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;
-}
configs/imx8mm_evk_defconfig +5 -0
index d988507bc330..120c76633066 100644
@@ -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
Signature · 1 line
2.26.2
#10 lore raw

PATCH 4/8 ARM: imx8m: Fix reset in SPL on NXP iMX8MM EVK

Quoted 7 lines

From: Marek Vasut <[email protected]>
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.

Quoted 9 lines
Cc Fabio Estevam <[email protected]>
Cc Flavio Suligoi <[email protected]>
Cc Harald Seiler <[email protected]>
Cc Igor Opaniuk <[email protected]>
Cc Marcel Ziswiler <[email protected]>
Cc Oleksandr Suvorov <[email protected]>
Cc Peng Fan <[email protected]>
Cc Stefano Babic <[email protected]>

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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

PATCH 5/8 ARM: imx8m: Fix reset in SPL on NXP iMX8MN EVK

In reply to Harald Seiler

From: Marek Vasut <[email protected]>

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.

Cc Fabio Estevam <[email protected]>
Cc Flavio Suligoi <[email protected]>
Cc Harald Seiler <[email protected]>
Cc Igor Opaniuk <[email protected]>
Cc Marcel Ziswiler <[email protected]>
Cc Oleksandr Suvorov <[email protected]>
Cc Peng Fan <[email protected]>
Cc Stefano Babic <[email protected]>
---
 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(-)
arch/arm/dts/imx8mn-ddr4-evk-u-boot.dtsi +12 -0
index 8d61597e0ce0..4419679d4c66 100644
@@ -3,6 +3,14 @@
  * Copyright 2019 NXP
  */
 
+/ {
+	wdt-reboot {
+		compatible = "wdt-reboot";
+		wdt = <&wdog1>;
+		u-boot,dm-spl;
+	};
+};
+
 &{/soc at 0} {
 	u-boot,dm-pre-reloc;
 	u-boot,dm-spl;
@@ -90,3 +98,7 @@
 &usdhc3 {
 	u-boot,dm-spl;
 };
+
+&wdog1 {
+	u-boot,dm-spl;
+};
board/freescale/imx8mn_evk/spl.c +0 -9
index 7aed14c52b68..45417b24464d 100644
@@ -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;
-}
configs/imx8mn_ddr4_evk_defconfig +5 -0
index f7485ab27270..224aeb6f0dfa 100644
@@ -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
Signature · 1 line
2.26.2
#12 lore raw

PATCH 5/8 ARM: imx8m: Fix reset in SPL on NXP iMX8MN EVK

Quoted 7 lines

From: Marek Vasut <[email protected]>
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.

Quoted 9 lines
Cc Fabio Estevam <[email protected]>
Cc Flavio Suligoi <[email protected]>
Cc Harald Seiler <[email protected]>
Cc Igor Opaniuk <[email protected]>
Cc Marcel Ziswiler <[email protected]>
Cc Oleksandr Suvorov <[email protected]>
Cc Peng Fan <[email protected]>
Cc Stefano Babic <[email protected]>

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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

PATCH 6/8 ARM: imx8m: Fix reset in SPL on NXP iMX8MP EVK

In reply to Harald Seiler

From: Marek Vasut <[email protected]>

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.

Cc Fabio Estevam <[email protected]>
Cc Flavio Suligoi <[email protected]>
Cc Harald Seiler <[email protected]>
Cc Igor Opaniuk <[email protected]>
Cc Marcel Ziswiler <[email protected]>
Cc Oleksandr Suvorov <[email protected]>
Cc Peng Fan <[email protected]>
Cc Stefano Babic <[email protected]>
---
 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(-)
arch/arm/dts/imx8mp-evk-u-boot.dtsi +12 -0
index 4675ada0a0a9..24a93ac2d690 100644
@@ -3,6 +3,14 @@
  * Copyright 2019 NXP
  */
 
+/ {
+	wdt-reboot {
+		compatible = "wdt-reboot";
+		wdt = <&wdog1>;
+		u-boot,dm-spl;
+	};
+};
+
 &{/soc at 0} {
 	u-boot,dm-pre-reloc;
 	u-boot,dm-spl;
@@ -119,3 +127,7 @@
 &usdhc3 {
 	u-boot,dm-spl;
 };
+
+&wdog1 {
+	u-boot,dm-spl;
+};
board/freescale/imx8mp_evk/spl.c +0 -9
index 0b20668e2b30..39c1dae684ac 100644
@@ -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;
-}
configs/imx8mp_evk_defconfig +4 -0
index ce6b342c3672..09ed7a89c9aa 100644
@@ -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
Signature · 1 line
2.26.2
#14 lore raw

PATCH 6/8 ARM: imx8m: Fix reset in SPL on NXP iMX8MP EVK

Quoted 7 lines

From: Marek Vasut <[email protected]>
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.

Quoted 9 lines
Cc Fabio Estevam <[email protected]>
Cc Flavio Suligoi <[email protected]>
Cc Harald Seiler <[email protected]>
Cc Igor Opaniuk <[email protected]>
Cc Marcel Ziswiler <[email protected]>
Cc Oleksandr Suvorov <[email protected]>
Cc Peng Fan <[email protected]>
Cc Stefano Babic <[email protected]>

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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

PATCH 6/8 ARM: imx8m: Fix reset in SPL on NXP iMX8MP EVK

In reply to Harald Seiler

Hi,

Quoted 10 lines · Harald Seiler

From: Marek Vasut <[email protected]>

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.

Quoted 9 lines
Cc Fabio Estevam <[email protected]>
Cc Flavio Suligoi <[email protected]>
Cc Harald Seiler <[email protected]>
Cc Igor Opaniuk <[email protected]>
Cc Marcel Ziswiler <[email protected]>
Cc Oleksandr Suvorov <[email protected]>
Cc Peng Fan <[email protected]>
Cc Stefano Babic <[email protected]>

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?

#16 lore raw

PATCH 6/8 ARM: imx8m: Fix reset in SPL on NXP iMX8MP EVK

Quoted 51 lines · Fabio Estevam

Hi,

Quoted 10 lines · Harald Seiler

From: Marek Vasut <[email protected]>

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.

Quoted 9 lines
Cc Fabio Estevam <[email protected]>
Cc Flavio Suligoi <[email protected]>
Cc Harald Seiler <[email protected]>
Cc Igor Opaniuk <[email protected]>
Cc Marcel Ziswiler <[email protected]>
Cc Oleksandr Suvorov <[email protected]>
Cc Peng Fan <[email protected]>
Cc Stefano Babic <[email protected]>

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
Quoted 3 lines

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.

#17 lore raw

PATCH 6/8 ARM: imx8m: Fix reset in SPL on NXP iMX8MP EVK

Hello,

Quoted 53 lines · Marek Vasut
Quoted 52 lines · Fabio Estevam

Hi,

Quoted 9 lines · Harald Seiler

From: Marek Vasut <[email protected]>

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.

Quoted 9 lines
Cc Fabio Estevam <[email protected]>
Cc Flavio Suligoi <[email protected]>
Cc Harald Seiler <[email protected]>
Cc Igor Opaniuk <[email protected]>
Cc Marcel Ziswiler <[email protected]>
Cc Oleksandr Suvorov <[email protected]>
Cc Peng Fan <[email protected]>
Cc Stefano Babic <[email protected]>

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=>

Quoted 6 lines
Quoted 1 line

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 at 30380000",
					&dev);

I see that wdog1 references the same clock here:

arch/arm/dts/imx8mp.dtsi; line 222:

        wdog1: watchdog at 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?

Signature · 1 line
Harald
reviewer
#18 lore raw

PATCH 6/8 ARM: imx8m: Fix reset in SPL on NXP iMX8MP EVK

Quoted 19 lines · Harald Seiler

"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 at 30380000",
                                        &dev);

I see that wdog1 references the same clock here:

arch/arm/dts/imx8mp.dtsi; line 222:

        wdog1: watchdog at 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";
        };
Quoted 7 lines

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:

configs/imx8mp_evk_defconfig +2 -0
@@ -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)

#19 lore raw

PATCH 6/8 ARM: imx8m: Fix reset in SPL on NXP iMX8MP EVK

Quoted 44 lines · Fabio Estevam
Quoted 19 lines · Harald Seiler

"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 at 30380000",
                                        &dev);

I see that wdog1 references the same clock here:

arch/arm/dts/imx8mp.dtsi; line 222:

        wdog1: watchdog at 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";
        };
Quoted 7 lines

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:

configs/imx8mp_evk_defconfig +2 -0
@@ -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
Quoted 3 lines

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?

Signature · 1 line
Harald
reviewer
#20 lore raw

PATCH 6/8 ARM: imx8m: Fix reset in SPL on NXP iMX8MP EVK

Quoted 1 line · Harald Seiler

With or without the revert?

When I change the defconfig like:

configs/imx8mp_evk_defconfig +2 -0
@@ -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.

#21 lore raw

PATCH 6/8 ARM: imx8m: Fix reset in SPL on NXP iMX8MP EVK

Hello Fabio,

Quoted 19 lines · Fabio Estevam
Quoted 1 line · Harald Seiler

With or without the revert?

When I change the defconfig like:

configs/imx8mp_evk_defconfig +2 -0
@@ -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
Quoted 1 line

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 ...

Signature · 1 line
Harald
#22 lore raw

PATCH 6/8 ARM: imx8m: Fix reset in SPL on NXP iMX8MP EVK

Quoted 1 line · Harald Seiler

Hello Fabio,

Hi

Quoted 27 lines · Fabio Estevam
Quoted 19 lines · Harald Seiler
Quoted 2 lines

With or without the revert?

When I change the defconfig like:

configs/imx8mp_evk_defconfig +2 -0
@@ -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
Quoted 1 line

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.

Quoted 4 lines

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.

#23 lore raw

PATCH 7/8 ARM: imx8m: Fix reset in SPL on Toradex iMX8MM Verdin

In reply to Harald Seiler

From: Marek Vasut <[email protected]>

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.

Cc Fabio Estevam <[email protected]>
Cc Flavio Suligoi <[email protected]>
Cc Harald Seiler <[email protected]>
Cc Igor Opaniuk <[email protected]>
Cc Marcel Ziswiler <[email protected]>
Cc Oleksandr Suvorov <[email protected]>
Cc Peng Fan <[email protected]>
Cc Stefano Babic <[email protected]>
---
 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(-)
arch/arm/dts/imx8mm-verdin-u-boot.dtsi +12 -0
index e60b9faee442..fe6bb9bf03cf 100644
@@ -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;
+};
board/toradex/verdin-imx8mm/spl.c +0 -9
index a5dc54082054..dc5bd84f332e 100644
@@ -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;
-}
configs/verdin-imx8mm_defconfig +5 -0
index 590750e9b2d1..21f6aa308208 100644
@@ -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
Signature · 1 line
2.26.2
#24 lore raw

PATCH 7/8 ARM: imx8m: Fix reset in SPL on Toradex iMX8MM Verdin

Quoted 10 lines · Harald Seiler

From: Marek Vasut <[email protected]>

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.

Quoted 9 lines
Cc Fabio Estevam <[email protected]>
Cc Flavio Suligoi <[email protected]>
Cc Harald Seiler <[email protected]>
Cc Igor Opaniuk <[email protected]>
Cc Marcel Ziswiler <[email protected]>
Cc Oleksandr Suvorov <[email protected]>
Cc Peng Fan <[email protected]>
Cc Stefano Babic <[email protected]>

Thanks, Harald!

Quoted 75 lines
---
 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(-)
arch/arm/dts/imx8mm-verdin-u-boot.dtsi +12 -0
index e60b9faee442..fe6bb9bf03cf 100644
@@ -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;
+};
board/toradex/verdin-imx8mm/spl.c +0 -9
index a5dc54082054..dc5bd84f332e 100644
@@ -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;
-}
configs/verdin-imx8mm_defconfig +5 -1
index 590750e9b2d1..21f6aa308208 100644
@@ -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

Signature · 5 lines
Best regards
Oleksandr Suvorov

Toradex AG
Ebenaustrasse 10 | 6048 Horw | Switzerland | T: +41 41 500 48 00
#25 lore raw

PATCH 7/8 ARM: imx8m: Fix reset in SPL on Toradex iMX8MM Verdin

In reply to Harald Seiler

Hello Herald,

Quoted 92 lines · Harald Seiler

From: Marek Vasut <[email protected]>

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.

Cc Fabio Estevam <[email protected]>
Cc Flavio Suligoi <[email protected]>
Cc Harald Seiler <[email protected]>
Cc Igor Opaniuk <[email protected]>
Cc Marcel Ziswiler <[email protected]>
Cc Oleksandr Suvorov <[email protected]>
Cc Peng Fan <[email protected]>
Cc Stefano Babic <[email protected]>
---
 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(-)
arch/arm/dts/imx8mm-verdin-u-boot.dtsi +12 -0
index e60b9faee442..fe6bb9bf03cf 100644
@@ -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;
+};
board/toradex/verdin-imx8mm/spl.c +0 -9
index a5dc54082054..dc5bd84f332e 100644
@@ -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;
-}
configs/verdin-imx8mm_defconfig +5 -1
index 590750e9b2d1..21f6aa308208 100644
@@ -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
--
Quoted 2 lines

2.26.2

Signature · 8 lines
Best regards - Freundliche Gr?sse - Meilleures salutations

Igor Opaniuk

mailto: igor.opaniuk at gmail.com
skype: igor.opanyuk
+380 (93) 836 40 67
http://ua.linkedin.com/in/iopaniuk
#26 lore raw

PATCH 7/8 ARM: imx8m: Fix reset in SPL on Toradex iMX8MM Verdin

In reply to Harald Seiler

Harald,

sorry for the typo in the previous email.

Quoted 92 lines · Harald Seiler

From: Marek Vasut <[email protected]>

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.

Cc Fabio Estevam <[email protected]>
Cc Flavio Suligoi <[email protected]>
Cc Harald Seiler <[email protected]>
Cc Igor Opaniuk <[email protected]>
Cc Marcel Ziswiler <[email protected]>
Cc Oleksandr Suvorov <[email protected]>
Cc Peng Fan <[email protected]>
Cc Stefano Babic <[email protected]>
---
 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(-)
arch/arm/dts/imx8mm-verdin-u-boot.dtsi +12 -0
index e60b9faee442..fe6bb9bf03cf 100644
@@ -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;
+};
board/toradex/verdin-imx8mm/spl.c +0 -9
index a5dc54082054..dc5bd84f332e 100644
@@ -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;
-}
configs/verdin-imx8mm_defconfig +5 -1
index 590750e9b2d1..21f6aa308208 100644
@@ -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
--
Quoted 2 lines

2.26.2

Thanks!

Signature · 8 lines
Best regards - Freundliche Gr?sse - Meilleures salutations

Igor Opaniuk

mailto: igor.opaniuk at gmail.com
skype: igor.opanyuk
+380 (93) 836 40 67
http://ua.linkedin.com/in/iopaniuk
#27 lore raw

PATCH 7/8 ARM: imx8m: Fix reset in SPL on Toradex iMX8MM Verdin

In reply to Harald Seiler
Quoted 7 lines

From: Marek Vasut <[email protected]>
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.

Quoted 12 lines
Cc Fabio Estevam <[email protected]>
Cc Flavio Suligoi <[email protected]>
Cc Harald Seiler <[email protected]>
Cc Igor Opaniuk <[email protected]>
Cc Marcel Ziswiler <[email protected]>
Cc Oleksandr Suvorov <[email protected]>
Cc Peng Fan <[email protected]>
Cc Stefano Babic <[email protected]>

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

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

PATCH 8/8 ARM: reset: use do_reset in SPL/TPL if SYSRESET was not enabled for them

In reply to Harald Seiler

From: Claudius Heine <[email protected]>

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

---
 arch/arm/lib/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/lib/Makefile +1 -1
index 8482f5446c5c..b839aa7a5096 100644
@@ -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
 
Signature · 1 line
2.26.2
reviewer
#29 lore raw

cover ARM: imx: Fix reset in SPL

In reply to Harald Seiler

Hi folks,

Quoted 14 lines · Harald Seiler

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.

Quoted 8 lines

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

Nice work!

For the entire series: