summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@c-s.fr>2018-03-16 17:20:59 +0100
committerTom Rini <trini@konsulko.com>2018-04-06 16:30:37 -0400
commit5c5da4318b18b7144975c9d93cbde1b981ed4e56 (patch)
tree184ae67e60554ab1ae3b2e5885c088f6084de9c8
parentab0d8192583a725f992279fe895653a146509bdc (diff)
downloadu-boot-5c5da4318b18b7144975c9d93cbde1b981ed4e56.tar.gz
powerpc: mpc8xx: cleaning up watchdog
In preparation of migration to DM watchdog, clean up a bit. The 8xx watchdog really is a HW watchdog, so declare it as is then it goes through Kconfig And the watchdog reset doesn't mind getting interrupted, so no need to disable interrupts Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
-rw-r--r--arch/powerpc/Kconfig1
-rw-r--r--arch/powerpc/cpu/mpc8xx/cpu.c19
-rw-r--r--arch/powerpc/cpu/mpc8xx/cpu_init.c9
-rw-r--r--include/configs/MCR3000.h2
-rw-r--r--include/watchdog.h5
5 files changed, 9 insertions, 27 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 77c0333030..af45cfe849 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -34,6 +34,7 @@ config MPC8xx
bool "MPC8xx"
select BOARD_EARLY_INIT_F
imply CMD_REGINFO
+ imply HW_WATCHDOG
endchoice
diff --git a/arch/powerpc/cpu/mpc8xx/cpu.c b/arch/powerpc/cpu/mpc8xx/cpu.c
index 6a1bd8dce4..7608970e3b 100644
--- a/arch/powerpc/cpu/mpc8xx/cpu.c
+++ b/arch/powerpc/cpu/mpc8xx/cpu.c
@@ -272,24 +272,11 @@ unsigned long get_tbclk(void)
/* ------------------------------------------------------------------------- */
-#if defined(CONFIG_WATCHDOG)
-void watchdog_reset(void)
+#if defined(CONFIG_HW_WATCHDOG)
+void hw_watchdog_reset(void)
{
- int re_enable = disable_interrupts();
+ immap_t __iomem *immr = (immap_t __iomem *)CONFIG_SYS_IMMR;
- reset_8xx_watchdog((immap_t __iomem *)CONFIG_SYS_IMMR);
- if (re_enable)
- enable_interrupts();
-}
-#endif /* CONFIG_WATCHDOG */
-
-#if defined(CONFIG_WATCHDOG)
-
-void reset_8xx_watchdog(immap_t __iomem *immr)
-{
- /*
- * All other boards use the MPC8xx Internal Watchdog
- */
out_be16(&immr->im_siu_conf.sc_swsr, 0x556c); /* write magic1 */
out_be16(&immr->im_siu_conf.sc_swsr, 0xaa39); /* write magic2 */
}
diff --git a/arch/powerpc/cpu/mpc8xx/cpu_init.c b/arch/powerpc/cpu/mpc8xx/cpu_init.c
index 6127c9f771..99e8c85e7a 100644
--- a/arch/powerpc/cpu/mpc8xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc8xx/cpu_init.c
@@ -26,11 +26,12 @@ void cpu_init_f(immap_t __iomem *immr)
/* SYPCR - contains watchdog control (11-9) */
- out_be32(&immr->im_siu_conf.sc_sypcr, CONFIG_SYS_SYPCR);
+#ifndef CONFIG_HW_WATCHDOG
+ /* deactivate watchdog if not enabled in config */
+ out_be32(&immr->im_siu_conf.sc_sypcr, CONFIG_SYS_SYPCR & ~SYPCR_SWE);
+#endif
-#if defined(CONFIG_WATCHDOG)
- reset_8xx_watchdog(immr);
-#endif /* CONFIG_WATCHDOG */
+ WATCHDOG_RESET();
/* SIUMCR - contains debug pin configuration (11-6) */
setbits_be32(&immr->im_siu_conf.sc_siumcr, CONFIG_SYS_SIUMCR);
diff --git a/include/configs/MCR3000.h b/include/configs/MCR3000.h
index cb28d6522a..aeda4742aa 100644
--- a/include/configs/MCR3000.h
+++ b/include/configs/MCR3000.h
@@ -60,8 +60,6 @@
#define CONFIG_LOADS_ECHO 1 /* echo on for serial download */
-#define CONFIG_WATCHDOG 1 /* watchdog enabled */
-
/* Miscellaneous configurable options */
#define CONFIG_SYS_MEMTEST_START 0x00002000
diff --git a/include/watchdog.h b/include/watchdog.h
index d420ab127b..52f4c506b0 100644
--- a/include/watchdog.h
+++ b/include/watchdog.h
@@ -72,11 +72,6 @@ int init_func_watchdog_reset(void);
* Prototypes from $(CPU)/cpu.c.
*/
-/* MPC 8xx */
-#if defined(CONFIG_MPC8xx) && !defined(__ASSEMBLY__)
- void reset_8xx_watchdog(immap_t __iomem *immr);
-#endif
-
#if defined(CONFIG_HW_WATCHDOG) && !defined(__ASSEMBLY__)
void hw_watchdog_init(void);
#endif