board: MCR3000: use new DM watchdog
authorChristophe Leroy <christophe.leroy@c-s.fr>
Wed, 21 Nov 2018 08:51:47 +0000 (08:51 +0000)
committerTom Rini <trini@konsulko.com>
Mon, 3 Dec 2018 15:44:10 +0000 (10:44 -0500)
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>
arch/powerpc/dts/mcr3000.dts
board/cssi/MCR3000/MCR3000.c
board/cssi/MCR3000/u-boot.lds
configs/MCR3000_defconfig

index e4b222857b5495512946db27d587de7c8fb00d71..ef423d73c207879b08b1ce53dd6b24a7b166343a 100644 (file)
@@ -9,4 +9,7 @@
 /dts-v1/;
 
 / {
+       WDT: watchdog@0 {
+               compatible = "fsl,pq1-wdt";
+       };
 };
index ffbeb14ed0ff5f973177d940b800b3e41a4eb99e..d26ac35b4406fc9408bca6f558689cb1aa749e36 100644 (file)
@@ -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;
+}
index 447ffded814f27b36dd0796a9320491f9012618b..70aef3241c8e448f0f379e29943f8563a8772be3 100644 (file)
@@ -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 : .;
index 6d7dda82a21a763505f83bdd36de2b653d9c4c50..2e79425bdbc5913fc0a2006478a5235eccbe1dcb 100644 (file)
@@ -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