]> git.sur5r.net Git - u-boot/commitdiff
powerpc: mpc8xx: cleaning up watchdog
authorChristophe Leroy <christophe.leroy@c-s.fr>
Fri, 16 Mar 2018 16:20:59 +0000 (17:20 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 6 Apr 2018 20:30:37 +0000 (16:30 -0400)
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>
arch/powerpc/Kconfig
arch/powerpc/cpu/mpc8xx/cpu.c
arch/powerpc/cpu/mpc8xx/cpu_init.c
include/configs/MCR3000.h
include/watchdog.h

index 77c0333030393ff933bbaa0e71105bb78b0cd84d..af45cfe84986e0e2af006f10ef40402246c2db8d 100644 (file)
@@ -34,6 +34,7 @@ config MPC8xx
        bool "MPC8xx"
        select BOARD_EARLY_INIT_F
        imply CMD_REGINFO
+       imply HW_WATCHDOG
 
 endchoice
 
index 6a1bd8dce4b3cef8fed1fb98e410bac4f6d1320c..7608970e3b190ffbed559d2cd0a50d506e5f2343 100644 (file)
@@ -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 */
 }
index 6127c9f77139299a83bdf0dd6c6021bff1c2191a..99e8c85e7a37c4fc23fc3ce6a5c4bc0022b2d2e4 100644 (file)
@@ -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);
index cb28d6522abdedf2ebbe2e9771793e3d2af802ab..aeda4742aabef10bc7600bf0682500a1dcde7edc 100644 (file)
@@ -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
index d420ab127b3b50e3e1848a340ffabe42944f4411..52f4c506b0404886a7e2a91fd40e0b96a0bf3b77 100644 (file)
@@ -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