diff mbox series

[4/5] ARM: imx: Fix reset in SPL on NXP iMX8MP EVK

Message ID 20200428142225.2041132-4-marex@denx.de
State New
Headers show
Series [1/5] ARM: imx: Do not define do_reset() if sysreset is enabled | expand

Commit Message

Marek Vasut April 28, 2020, 2:22 p.m. UTC
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 at denx.de>
Cc: Fabio Estevam <festevam at gmail.com>
Cc: Flavio Suligoi <f.suligoi at asem.it>
Cc: Harald Seiler <hws at denx.de>
Cc: Igor Opaniuk <igor.opaniuk at toradex.com>
Cc: Marcel Ziswiler <marcel.ziswiler at toradex.com>
Cc: Oleksandr Suvorov <oleksandr.suvorov at toradex.com>
Cc: Peng Fan <peng.fan at nxp.com>
Cc: Stefano Babic <sbabic at 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 mbox series

Patch

diff --git a/arch/arm/dts/imx8mp-evk-u-boot.dtsi b/arch/arm/dts/imx8mp-evk-u-boot.dtsi
index 4675ada0a0..24a93ac2d6 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 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;
+};
diff --git a/board/freescale/imx8mp_evk/spl.c b/board/freescale/imx8mp_evk/spl.c
index 0b20668e2b..39c1dae684 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 b181543df5..e9163ec7ca 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