powerpc: mpc8xx: move watchdog into drivers/watchdog
authorChristophe Leroy <christophe.leroy@c-s.fr>
Fri, 16 Mar 2018 16:21:01 +0000 (17:21 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 6 Apr 2018 20:31:11 +0000 (16:31 -0400)
In preparation of DM watchdog, move basic actions into drivers/watchdog

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
arch/powerpc/Kconfig
arch/powerpc/cpu/mpc8xx/Kconfig
arch/powerpc/cpu/mpc8xx/cpu.c
drivers/watchdog/Makefile
drivers/watchdog/mpc8xx_wdt.c [new file with mode: 0644]

index af45cfe84986e0e2af006f10ef40402246c2db8d..13a79560b24be7e4bfb143e6115313c36fd14f0f 100644 (file)
@@ -34,7 +34,7 @@ config MPC8xx
        bool "MPC8xx"
        select BOARD_EARLY_INIT_F
        imply CMD_REGINFO
-       imply HW_WATCHDOG
+       imply MPC8xx_WATCHDOG
 
 endchoice
 
index f112317376567b6fbc24c4783b4b6a019a338fc5..b0e90a0f2036f857c93aa7443913abbac7ebcc37 100644 (file)
@@ -25,6 +25,10 @@ config MPC885
 
 endchoice
 
+config MPC8xx_WATCHDOG
+       bool "Watchdog"
+       select HW_WATCHDOG
+
 config 8xx_GCLK_FREQ
        int "CPU GCLK Frequency"
 
index 7608970e3b190ffbed559d2cd0a50d506e5f2343..d17ad846949222a6fffaec351906da06794cf743 100644 (file)
@@ -270,18 +270,6 @@ unsigned long get_tbclk(void)
        return oscclk / 16;
 }
 
-/* ------------------------------------------------------------------------- */
-
-#if defined(CONFIG_HW_WATCHDOG)
-void hw_watchdog_reset(void)
-{
-       immap_t __iomem *immr = (immap_t __iomem *)CONFIG_SYS_IMMR;
-
-       out_be16(&immr->im_siu_conf.sc_swsr, 0x556c);   /* write magic1 */
-       out_be16(&immr->im_siu_conf.sc_swsr, 0xaa39);   /* write magic2 */
-}
-#endif /* CONFIG_WATCHDOG */
-
 /*
  * Initializes on-chip ethernet controllers.
  * to override, implement board_eth_init()
index 4b97df3ab67b88afecc4c5a1162832542e7bf61a..4fee6dbd1f43e7c31868dbe4649ba258eb9cf221 100644 (file)
@@ -23,3 +23,4 @@ obj-$(CONFIG_WDT_BCM6345) += bcm6345_wdt.o
 obj-$(CONFIG_BCM2835_WDT)       += bcm2835_wdt.o
 obj-$(CONFIG_WDT_ORION) += orion_wdt.o
 obj-$(CONFIG_WDT_CDNS) += cdns_wdt.o
+obj-$(CONFIG_MPC8xx_WATCHDOG) += mpc8xx_wdt.o
diff --git a/drivers/watchdog/mpc8xx_wdt.c b/drivers/watchdog/mpc8xx_wdt.c
new file mode 100644 (file)
index 0000000..ded80c4
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2017 CS Systemes d'Information
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <mpc8xx.h>
+#include <asm/cpm_8xx.h>
+#include <asm/io.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void hw_watchdog_reset(void)
+{
+       immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
+
+       out_be16(&immap->im_siu_conf.sc_swsr, 0x556c);  /* write magic1 */
+       out_be16(&immap->im_siu_conf.sc_swsr, 0xaa39);  /* write magic2 */
+}
+