public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Angelo Dureghello <angelo@kernel-space.org>
To: trini@konsulko.com, sr@denx.de
Cc: u-boot@lists.denx.de, Angelo Dureghello <angelo@kernel-space.org>
Subject: [PATCH 2/5] m68k: move watchdog functions in mcf_wdt driver
Date: Sun, 25 Jun 2023 21:35:18 +0200	[thread overview]
Message-ID: <20230625193521.981846-3-angelo@kernel-space.org> (raw)
In-Reply-To: <20230625193521.981846-1-angelo@kernel-space.org>

Move watchdog functions inside a separate watchdog driver.

Signed-off-by: Angelo Dureghello <angelo@kernel-space.org>
---
 arch/m68k/cpu/mcf523x/cpu.c | 42 ---------------------------------
 arch/m68k/cpu/mcf52x2/cpu.c | 47 +------------------------------------
 arch/m68k/cpu/mcf532x/cpu.c | 44 ----------------------------------
 3 files changed, 1 insertion(+), 132 deletions(-)

diff --git a/arch/m68k/cpu/mcf523x/cpu.c b/arch/m68k/cpu/mcf523x/cpu.c
index ba2c228911..bef67767b4 100644
--- a/arch/m68k/cpu/mcf523x/cpu.c
+++ b/arch/m68k/cpu/mcf523x/cpu.c
@@ -12,7 +12,6 @@
 #include <init.h>
 #include <net.h>
 #include <vsprintf.h>
-#include <watchdog.h>
 #include <command.h>
 #include <netdev.h>
 #include <asm/global_data.h>
@@ -62,47 +61,6 @@ int print_cpuinfo(void)
 };
 #endif /* CONFIG_DISPLAY_CPUINFO */
 
-#if defined(CONFIG_WATCHDOG)
-/* Called by macro WATCHDOG_RESET */
-void watchdog_reset(void)
-{
-	wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
-
-	/* Count register */
-	out_be16(&wdp->sr, 0x5555);
-	asm("nop");
-	out_be16(&wdp->sr, 0xaaaa);
-}
-
-int watchdog_disable(void)
-{
-	wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
-
-	/* UserManual, once the wdog is disabled, wdog cannot be re-enabled */
-	/* halted watchdog timer */
-	setbits_be16(&wdp->cr, WTM_WCR_HALTED);
-
-	puts("WATCHDOG:disabled\n");
-	return (0);
-}
-
-int watchdog_init(void)
-{
-	wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
-	u32 wdog_module = 0;
-
-	/* set timeout and enable watchdog */
-	wdog_module = ((CFG_SYS_CLK / CONFIG_SYS_HZ) * CONFIG_WATCHDOG_TIMEOUT_MSECS);
-	wdog_module |= (wdog_module / 8192);
-	out_be16(&wdp->mr, wdog_module);
-
-	out_be16(&wdp->cr, WTM_WCR_EN);
-	puts("WATCHDOG:enabled\n");
-
-	return (0);
-}
-#endif				/* CONFIG_WATCHDOG */
-
 #if defined(CONFIG_MCFFEC)
 /* Default initializations for MCFFEC controllers.  To override,
  * create a board-specific function called:
diff --git a/arch/m68k/cpu/mcf52x2/cpu.c b/arch/m68k/cpu/mcf52x2/cpu.c
index d7cbf11e25..5042a38b3e 100644
--- a/arch/m68k/cpu/mcf52x2/cpu.c
+++ b/arch/m68k/cpu/mcf52x2/cpu.c
@@ -17,7 +17,6 @@
 #include <init.h>
 #include <net.h>
 #include <vsprintf.h>
-#include <watchdog.h>
 #include <command.h>
 #include <asm/global_data.h>
 #include <asm/immap.h>
@@ -53,51 +52,7 @@ int print_cpuinfo(void)
 	return 0;
 };
 #endif /* CONFIG_DISPLAY_CPUINFO */
-
-#if defined(CONFIG_WATCHDOG)
-/* Called by macro WATCHDOG_RESET */
-void watchdog_reset(void)
-{
-	wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
-
-	out_be16(&wdt->sr, 0x5555);
-	out_be16(&wdt->sr, 0xaaaa);
-}
-
-int watchdog_disable(void)
-{
-	wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
-
-	/* reset watchdog counter */
-	out_be16(&wdt->sr, 0x5555);
-	out_be16(&wdt->sr, 0xaaaa);
-	/* disable watchdog timer */
-	out_be16(&wdt->cr, 0);
-
-	puts("WATCHDOG:disabled\n");
-	return (0);
-}
-
-int watchdog_init(void)
-{
-	wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
-
-	/* disable watchdog */
-	out_be16(&wdt->cr, 0);
-
-	/* set timeout and enable watchdog */
-	out_be16(&wdt->mr,
-		(CONFIG_WATCHDOG_TIMEOUT_MSECS * CONFIG_SYS_HZ) / (32768 * 1000) - 1);
-
-	/* reset watchdog counter */
-	out_be16(&wdt->sr, 0x5555);
-	out_be16(&wdt->sr, 0xaaaa);
-
-	puts("WATCHDOG:enabled\n");
-	return (0);
-}
-#endif				/* #ifdef CONFIG_WATCHDOG */
-#endif				/* #ifdef CONFIG_M5208 */
+#endif /* #ifdef CONFIG_M5208 */
 
 #ifdef  CONFIG_M5271
 #if defined(CONFIG_DISPLAY_CPUINFO)
diff --git a/arch/m68k/cpu/mcf532x/cpu.c b/arch/m68k/cpu/mcf532x/cpu.c
index 548cbca36a..18d20a8926 100644
--- a/arch/m68k/cpu/mcf532x/cpu.c
+++ b/arch/m68k/cpu/mcf532x/cpu.c
@@ -12,7 +12,6 @@
 #include <init.h>
 #include <net.h>
 #include <vsprintf.h>
-#include <watchdog.h>
 #include <command.h>
 #include <netdev.h>
 #include <asm/global_data.h>
@@ -102,49 +101,6 @@ int print_cpuinfo(void)
 };
 #endif /* CONFIG_DISPLAY_CPUINFO */
 
-#if defined(CONFIG_WATCHDOG)
-/* Called by macro WATCHDOG_RESET */
-void watchdog_reset(void)
-{
-	wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
-
-	/* Count register */
-	out_be16(&wdp->sr, 0x5555);
-	out_be16(&wdp->sr, 0xaaaa);
-}
-
-int watchdog_disable(void)
-{
-	wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
-
-	/* UserManual, once the wdog is disabled, wdog cannot be re-enabled */
-	/* halted watchdog timer */
-	setbits_be16(&wdp->cr, WTM_WCR_HALTED);
-
-	puts("WATCHDOG:disabled\n");
-	return (0);
-}
-
-int watchdog_init(void)
-{
-	wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
-	u32 wdog_module = 0;
-
-	/* set timeout and enable watchdog */
-	wdog_module = ((CFG_SYS_CLK / 1000) * CONFIG_WATCHDOG_TIMEOUT_MSECS);
-#ifdef CONFIG_M5329
-	out_be16(&wdp->mr, wdog_module / 8192);
-#else
-	out_be16(&wdp->mr, wdog_module / 4096);
-#endif
-
-	out_be16(&wdp->cr, WTM_WCR_EN);
-	puts("WATCHDOG:enabled\n");
-
-	return (0);
-}
-#endif				/* CONFIG_WATCHDOG */
-
 #if defined(CONFIG_MCFFEC)
 /* Default initializations for MCFFEC controllers.  To override,
  * create a board-specific function called:
-- 
2.41.0


  parent reply	other threads:[~2023-06-25 19:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-25 19:35 [PATCH 0/5] m68k: add ColdFire watchdog driver Angelo Dureghello
2023-06-25 19:35 ` [PATCH 1/5] drivers: watchdog: add mcf watchdog support Angelo Dureghello
2023-07-18 12:23   ` Stefan Roese
2023-07-18 14:06     ` Angelo Dureghello
2023-07-19  9:55       ` Stefan Roese
2023-06-25 19:35 ` Angelo Dureghello [this message]
2023-07-18 12:25   ` [PATCH 2/5] m68k: move watchdog functions in mcf_wdt driver Stefan Roese
2023-06-25 19:35 ` [PATCH 3/5] m68k: dts: add watchdog node Angelo Dureghello
2023-07-18 12:26   ` Stefan Roese
2023-07-18 13:58     ` Angelo Dureghello
2023-07-18 14:27       ` Stefan Roese
2023-07-19  1:07       ` Simon Glass
2023-06-25 19:35 ` [PATCH 4/5] configs: m68k: add watchdog driver Angelo Dureghello
2023-06-25 19:35 ` [PATCH 5/5] MAINTAINERS: add myself as mcf_wdt.c maintainer Angelo Dureghello

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230625193521.981846-3-angelo@kernel-space.org \
    --to=angelo@kernel-space.org \
    --cc=sr@denx.de \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox