Commit 68dcbdd594d4 ("ARM: imx: Add weak default reset_cpu()") caused
the 'reset' command in U-Boot to not cause a board reset.
    
Fix it by switching to the watchdog driver model via sysreset, which
is the preferred method for implementing the watchdog reset.

With the watchdog driver model in place, it is no longer needed
to have board code to initialize the watchdog, so remove
its related board code.

Signed-off-by: Fabio Estevam <feste...@gmail.com>
---
Changes since v1:
- Remove board wdog board code.

 arch/arm/dts/imx6sx-udoo-neo-basic-u-boot.dtsi | 12 ++++++++++++
 board/udoo/neo/neo.c                           | 16 ----------------
 configs/udoo_neo_defconfig                     |  3 +++
 3 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/arch/arm/dts/imx6sx-udoo-neo-basic-u-boot.dtsi 
b/arch/arm/dts/imx6sx-udoo-neo-basic-u-boot.dtsi
index b5e1f2b9a16f..7f5a6424bac8 100644
--- a/arch/arm/dts/imx6sx-udoo-neo-basic-u-boot.dtsi
+++ b/arch/arm/dts/imx6sx-udoo-neo-basic-u-boot.dtsi
@@ -1,5 +1,13 @@
 // SPDX-License-Identifier: GPL-2.0+
 
+/ {
+       wdt-reboot {
+               compatible = "wdt-reboot";
+               wdt = <&wdog1>;
+               bootph-pre-ram;
+       };
+};
+
 &soc {
        bootph-all;
 };
@@ -15,3 +23,7 @@
 &uart1 {
        bootph-all;
 };
+
+&wdog1 {
+       bootph-pre-ram;
+};
diff --git a/board/udoo/neo/neo.c b/board/udoo/neo/neo.c
index b435b721e53c..1a0aaecc3328 100644
--- a/board/udoo/neo/neo.c
+++ b/board/udoo/neo/neo.c
@@ -57,9 +57,6 @@ enum {
 #define ENET_RX_PAD_CTRL  (PAD_CTL_PKE | PAD_CTL_PUE |          \
        PAD_CTL_SPEED_MED   | PAD_CTL_SRE_FAST)
 
-#define WDOG_PAD_CTRL (PAD_CTL_PUE | PAD_CTL_PKE | PAD_CTL_SPEED_MED | \
-       PAD_CTL_DSE_40ohm)
-
 #define BOARD_DETECT_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE |             \
        PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED |               \
        PAD_CTL_DSE_34ohm | PAD_CTL_HYS | PAD_CTL_SRE_FAST)
@@ -113,10 +110,6 @@ static iomux_v3_cfg_t const phy_control_pads[] = {
        MUX_PAD_CTRL(ENET_CLK_PAD_CTRL),
 };
 
-static iomux_v3_cfg_t const wdog_b_pad = {
-       MX6_PAD_GPIO1_IO13__GPIO1_IO_13 | MUX_PAD_CTRL(WDOG_PAD_CTRL),
-};
-
 static iomux_v3_cfg_t const peri_3v3_pads[] = {
        MX6_PAD_QSPI1A_DATA0__GPIO4_IO_16 | MUX_PAD_CTRL(NO_PAD_CTRL),
 };
@@ -148,15 +141,6 @@ int board_init(void)
        /* Address of boot parameters */
        gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
 
-       /*
-        * Because kernel set WDOG_B mux before pad with the commone pinctrl
-        * framwork now and wdog reset will be triggered once set WDOG_B mux
-        * with default pad setting, we set pad setting here to workaround this.
-        * Since imx_iomux_v3_setup_pad also set mux before pad setting, we set
-        * as GPIO mux firstly here to workaround it.
-        */
-       imx_iomux_v3_setup_pad(wdog_b_pad);
-
        /* Enable PERI_3V3, which is used by SD2, ENET, LVDS, BT */
        imx_iomux_v3_setup_multiple_pads(peri_3v3_pads,
                                         ARRAY_SIZE(peri_3v3_pads));
diff --git a/configs/udoo_neo_defconfig b/configs/udoo_neo_defconfig
index 4986b4c26260..9f9ad0ad5ec7 100644
--- a/configs/udoo_neo_defconfig
+++ b/configs/udoo_neo_defconfig
@@ -61,5 +61,8 @@ CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_ANATOP=y
 CONFIG_DM_SERIAL=y
 CONFIG_MXC_UART=y
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_IMX_THERMAL=y
 CONFIG_USB=y
+CONFIG_IMX_WATCHDOG=y
-- 
2.34.1

Reply via email to