[U-Boot] [PATCH RFCv2 3/6] board: MCR3000: use new DM watchdog

Christophe Leroy christophe.leroy at c-s.fr
Fri Mar 16 16:32:44 UTC 2018


Signed-off-by: Christophe Leroy <christophe.leroy at c-s.fr>
---
 arch/powerpc/dts/mcr3000.dts |  3 +++
 board/cssi/MCR3000/MCR3000.c | 16 ++++++++++++++++
 configs/MCR3000_defconfig    |  2 ++
 include/configs/MCR3000.h    |  1 +
 4 files changed, 22 insertions(+)

diff --git a/arch/powerpc/dts/mcr3000.dts b/arch/powerpc/dts/mcr3000.dts
index e4b222857b5..ef423d73c20 100644
--- a/arch/powerpc/dts/mcr3000.dts
+++ b/arch/powerpc/dts/mcr3000.dts
@@ -9,4 +9,7 @@
 /dts-v1/;
 
 / {
+	WDT: watchdog at 0 {
+		compatible = "fsl,pq1-wdt";
+	};
 };
diff --git a/board/cssi/MCR3000/MCR3000.c b/board/cssi/MCR3000/MCR3000.c
index 6939a2cf617..15713484680 100644
--- a/board/cssi/MCR3000/MCR3000.c
+++ b/board/cssi/MCR3000/MCR3000.c
@@ -13,6 +13,8 @@
 #include <mpc8xx.h>
 #include <fdt_support.h>
 #include <asm/io.h>
+#include <dm/uclass.h>
+#include <wdt.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -144,3 +146,17 @@ int board_early_init_f(void)
 
 	return 0;
 }
+
+int board_early_init_r(void)
+{
+	struct udevice *watchdog_dev = NULL;
+
+	if (uclass_get_device(UCLASS_WDT, 0, &watchdog_dev)) {
+		puts("Cannot find watchdog!\n");
+	} else {
+		puts("Enabling watchdog.\n");
+		wdt_start(watchdog_dev, 0xffff, 0);
+	}
+
+	return 0;
+}
diff --git a/configs/MCR3000_defconfig b/configs/MCR3000_defconfig
index 10667ab0218..f3dc571be22 100644
--- a/configs/MCR3000_defconfig
+++ b/configs/MCR3000_defconfig
@@ -74,3 +74,5 @@ CONFIG_BOOTCOMMAND="run flashboot"
 CONFIG_DM=y
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="mcr3000"
+CONFIG_WDT=y
+CONFIG_WDT_MPC8xx=y
diff --git a/include/configs/MCR3000.h b/include/configs/MCR3000.h
index aeda4742aab..a35caa661db 100644
--- a/include/configs/MCR3000.h
+++ b/include/configs/MCR3000.h
@@ -10,6 +10,7 @@
 
 /* High Level Configuration Options */
 #define CONFIG_MISC_INIT_R		1	/* Call misc_init_r	*/
+#define CONFIG_BOARD_EARLY_INIT_R	1
 
 #define CONFIG_EXTRA_ENV_SETTINGS					\
 	"sdram_type=SDRAM\0"						\
-- 
2.13.3



More information about the U-Boot mailing list