[U-Boot,v4,16/16] powerpc: mpc8xx: move watchdog into drivers/watchdog
diff mbox series

Message ID c45745b04237909b283503f5064457af1b071865.1521215903.git.christophe.leroy@c-s.fr
State Accepted
Delegated to: Tom Rini
Headers show
Series
  • Powerpc: mpc8xx: cleanup before migration to DM model
Related show

Commit Message

Christophe Leroy March 16, 2018, 4:21 p.m. UTC
In preparation of DM watchdog, move basic actions into drivers/watchdog

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 arch/powerpc/Kconfig            |  2 +-
 arch/powerpc/cpu/mpc8xx/Kconfig |  4 ++++
 arch/powerpc/cpu/mpc8xx/cpu.c   | 12 ------------
 drivers/watchdog/Makefile       |  1 +
 drivers/watchdog/mpc8xx_wdt.c   | 21 +++++++++++++++++++++
 5 files changed, 27 insertions(+), 13 deletions(-)
 create mode 100644 drivers/watchdog/mpc8xx_wdt.c

Comments

Tom Rini April 6, 2018, 9:03 p.m. UTC | #1
On Fri, Mar 16, 2018 at 05:21:01PM +0100, Christophe Leroy wrote:

> In preparation of DM watchdog, move basic actions into drivers/watchdog
> 
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>

Applied to u-boot/master, thanks!

Patch
diff mbox series

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index af45cfe8498..13a79560b24 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -34,7 +34,7 @@  config MPC8xx
 	bool "MPC8xx"
 	select BOARD_EARLY_INIT_F
 	imply CMD_REGINFO
-	imply HW_WATCHDOG
+	imply MPC8xx_WATCHDOG
 
 endchoice
 
diff --git a/arch/powerpc/cpu/mpc8xx/Kconfig b/arch/powerpc/cpu/mpc8xx/Kconfig
index f1123173765..b0e90a0f203 100644
--- a/arch/powerpc/cpu/mpc8xx/Kconfig
+++ b/arch/powerpc/cpu/mpc8xx/Kconfig
@@ -25,6 +25,10 @@  config MPC885
 
 endchoice
 
+config MPC8xx_WATCHDOG
+	bool "Watchdog"
+	select HW_WATCHDOG
+
 config 8xx_GCLK_FREQ
 	int "CPU GCLK Frequency"
 
diff --git a/arch/powerpc/cpu/mpc8xx/cpu.c b/arch/powerpc/cpu/mpc8xx/cpu.c
index 7608970e3b1..d17ad846949 100644
--- a/arch/powerpc/cpu/mpc8xx/cpu.c
+++ b/arch/powerpc/cpu/mpc8xx/cpu.c
@@ -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()
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index ab6a6b79e1d..6c605e87e85 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -22,3 +22,4 @@  obj-$(CONFIG_WDT_ASPEED) += ast_wdt.o
 obj-$(CONFIG_WDT_BCM6345) += bcm6345_wdt.o
 obj-$(CONFIG_BCM2835_WDT)       += bcm2835_wdt.o
 obj-$(CONFIG_WDT_ORION) += orion_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
index 00000000000..ded80c4d6a9
--- /dev/null
+++ b/drivers/watchdog/mpc8xx_wdt.c
@@ -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 */
+}
+