diff mbox series

[U-Boot,v2,4/9] board: MCR3000: use new DM watchdog

Message ID ae2a9f80307c05b3096241f061671fab66641d0b.1542749104.git.christophe.leroy@c-s.fr
State Accepted
Commit 4c4ca6cdd5836a416fcebe0d8dea585ad4a00681
Delegated to: Tom Rini
Headers show
Series [U-Boot,v2,1/9] powerpc, mpc8xx: clear top of stack | expand

Commit Message

Christophe Leroy Nov. 21, 2018, 8:51 a.m. UTC
This patch switches MCR3000 board to the new DM watchdog.

The change in u-boot.lds is because MCR3000.o grows a bit
with this patch and doesn't fit anymore below env_offset on
some versions of GCC.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 v2: fixed build failure for lack of space before env_offset in u-boot.lds

 arch/powerpc/dts/mcr3000.dts  |  3 +++
 board/cssi/MCR3000/MCR3000.c  | 16 ++++++++++++++++
 board/cssi/MCR3000/u-boot.lds |  1 -
 configs/MCR3000_defconfig     |  3 +++
 4 files changed, 22 insertions(+), 1 deletion(-)

Comments

Tom Rini Dec. 3, 2018, 10:50 p.m. UTC | #1
On Wed, Nov 21, 2018 at 08:51:47AM +0000, Christophe Leroy wrote:

> This patch switches MCR3000 board to the new DM watchdog.
> 
> The change in u-boot.lds is because MCR3000.o grows a bit
> with this patch and doesn't fit anymore below env_offset on
> some versions of GCC.
> 
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>

Applied to u-boot/master, thanks!
diff mbox series

Patch

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@0 {
+		compatible = "fsl,pq1-wdt";
+	};
 };
diff --git a/board/cssi/MCR3000/MCR3000.c b/board/cssi/MCR3000/MCR3000.c
index ffbeb14ed0f..d26ac35b440 100644
--- a/board/cssi/MCR3000/MCR3000.c
+++ b/board/cssi/MCR3000/MCR3000.c
@@ -12,6 +12,8 @@ 
 #include <mpc8xx.h>
 #include <fdt_support.h>
 #include <asm/io.h>
+#include <dm/uclass.h>
+#include <wdt.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -143,3 +145,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/board/cssi/MCR3000/u-boot.lds b/board/cssi/MCR3000/u-boot.lds
index 447ffded814..70aef3241c8 100644
--- a/board/cssi/MCR3000/u-boot.lds
+++ b/board/cssi/MCR3000/u-boot.lds
@@ -19,7 +19,6 @@  SECTIONS
 		arch/powerpc/cpu/mpc8xx/start.o	(.text)
 		arch/powerpc/cpu/mpc8xx/traps.o	(.text*)
 		arch/powerpc/lib/built-in.o		(.text*)
-		board/cssi/MCR3000/built-in.o	(.text*)
 		drivers/net/built-in.o		(.text*)
 
 		. = DEFINED(env_offset) ? env_offset : .;
diff --git a/configs/MCR3000_defconfig b/configs/MCR3000_defconfig
index 6d7dda82a21..2e79425bdbc 100644
--- a/configs/MCR3000_defconfig
+++ b/configs/MCR3000_defconfig
@@ -42,6 +42,7 @@  CONFIG_BOOTDELAY=5
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="run flashboot"
 CONFIG_MISC_INIT_R=y
+CONFIG_BOARD_EARLY_INIT_R=y
 CONFIG_HUSH_PARSER=y
 # CONFIG_AUTO_COMPLETE is not set
 CONFIG_SYS_PROMPT="S3K> "
@@ -76,3 +77,5 @@  CONFIG_OF_LIBFDT=y
 CONFIG_DM=y
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="mcr3000"
+CONFIG_WDT=y
+CONFIG_WDT_MPC8xx=y