Skip to contentSkip to conversation

m68k: add ColdFire watchdog driver

PATCH In review Angelo Dureghello 2 participants 11 messages Jul 24, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover m68k: add ColdFire watchdog driver

This patch allows to reach 0 warning for the m68k family. Watchdog driver was the last one producing the "conversion to DM" warning,

Angelo Dureghello (5):
drivers: watchdog: add mcf watchdog support
m68k: move watchdog functions in mcf_wdt driver
m68k: dts: add watchdog node
configs: m68k: add watchdog driver
MAINTAINERS: add myself as mcf_wdt.c maintainer

 MAINTAINERS                           |   1 +
 arch/m68k/cpu/mcf523x/cpu.c           |  42 --------
 arch/m68k/cpu/mcf52x2/cpu.c           |  47 +--------
 arch/m68k/cpu/mcf532x/cpu.c           |  44 ---------
 arch/m68k/dts/M5208EVBE.dts           |   5 +
 arch/m68k/dts/mcf5208.dtsi            |   6 ++
 arch/m68k/dts/mcf523x.dtsi            |   6 ++
 arch/m68k/dts/mcf5271.dtsi            |   6 ++
 arch/m68k/dts/mcf5275.dtsi            |   6 ++
 arch/m68k/dts/mcf5282.dtsi            |   6 ++
 arch/m68k/dts/mcf5329.dtsi            |   6 ++
 arch/m68k/dts/mcf537x.dtsi            |   6 ++
 configs/M5208EVBE_defconfig           |   2 +
 configs/astro_mcf5373l_defconfig      |   4 +-
 configs/eb_cpu5282_defconfig          |   1 +
 configs/eb_cpu5282_internal_defconfig |   1 +
 drivers/watchdog/Kconfig              |   7 ++
 drivers/watchdog/Makefile             |   1 +
 drivers/watchdog/mcf_wdt.c            | 135 ++++++++++++++++++++++++++
 19 files changed, 198 insertions(+), 134 deletions(-)
 create mode 100644 drivers/watchdog/mcf_wdt.c
Signature · 1 line
2.41.0
#1 lore raw

PATCH v3 1/5 drivers: watchdog: add mcf watchdog support

This watchdog driver applies to the following
mcf families:

- mcf52x2 (5271 5275 5282)
- mcf532x (5329 5373)
- mcf523x (5235)

Cpu's not listed for each family does not have WDT module.

Note, after some attempts testing by qemu on 5208 i finally abandoned, watchdog seems not implemented properly.

The driver has been tested in a real M5282EVM.

---
Changes for v2:
- remove unnecessary hardcoded timeouts
- remove unnecessary hw_watchdog_xxx stuff
- rewrite wdog module reg calculation
- using IS_ENABLED() where possible
Changes for v3:
- remove hardcoded 4s test

---
 drivers/watchdog/Kconfig   |   7 ++
 drivers/watchdog/Makefile  |   1 +
 drivers/watchdog/mcf_wdt.c | 135 +++++++++++++++++++++++++++++++++++++
 3 files changed, 143 insertions(+)
 create mode 100644 drivers/watchdog/mcf_wdt.c
drivers/watchdog/Kconfig +7 -0
index 646663528a..07fc4940e9 100644
@@ -178,6 +178,13 @@ config WDT_MAX6370
 	help
 	  Select this to enable max6370 watchdog timer.
 
+config WDT_MCF
+	bool "ColdFire family watchdog timer support"
+	depends on WDT
+	help
+	  Select this to enable ColdFire watchdog timer,
+	  which supports mcf52x2 mcf532x mcf523x families.
+
 config WDT_MESON_GXBB
 	bool "Amlogic watchdog timer support"
 	depends on WDT
drivers/watchdog/Makefile +1 -0
index fd5d9c7376..eef786f5e7 100644
@@ -31,6 +31,7 @@ obj-$(CONFIG_WDT_CDNS) += cdns_wdt.o
 obj-$(CONFIG_WDT_FTWDT010) += ftwdt010_wdt.o
 obj-$(CONFIG_WDT_GPIO) += gpio_wdt.o
 obj-$(CONFIG_WDT_MAX6370) += max6370_wdt.o
+obj-$(CONFIG_WDT_MCF) += mcf_wdt.o
 obj-$(CONFIG_WDT_MESON_GXBB) += meson_gxbb_wdt.o
 obj-$(CONFIG_WDT_MPC8xxx) += mpc8xxx_wdt.o
 obj-$(CONFIG_WDT_MT7620) += mt7620_wdt.o
drivers/watchdog/mcf_wdt.c new file +135 -0

135 lines not on this page · raw message

Signature · 1 line
2.41.0
Reviewed-by on v3 1/5
#2 lore raw

Re: [PATCH v3 1/5] drivers: watchdog: add mcf watchdog support

Quoted 7 lines · Angelo Dureghello

This watchdog driver applies to the following
mcf families:

- mcf52x2 (5271 5275 5282)
- mcf532x (5329 5373)
- mcf523x (5235)

Quoted 8 lines

Cpu's not listed for each family does not have WDT module.

Note, after some attempts testing by qemu on 5208 i finally abandoned, watchdog seems not implemented properly.

The driver has been tested in a real M5282EVM.

Thanks,
Stefan

Quoted 176 lines

---
Changes for v2:
- remove unnecessary hardcoded timeouts
- remove unnecessary hw_watchdog_xxx stuff
- rewrite wdog module reg calculation
- using IS_ENABLED() where possible
Changes for v3:
- remove hardcoded 4s test

---
  drivers/watchdog/Kconfig   |   7 ++
  drivers/watchdog/Makefile  |   1 +
  drivers/watchdog/mcf_wdt.c | 135 +++++++++++++++++++++++++++++++++++++
  3 files changed, 143 insertions(+)

create mode 100644 drivers/watchdog/mcf_wdt.c

drivers/watchdog/Kconfig +7 -0
index 646663528a..07fc4940e9 100644
@@ -178,6 +178,13 @@ config WDT_MAX6370
  	help
  	  Select this to enable max6370 watchdog timer.
 
+config WDT_MCF
+	bool "ColdFire family watchdog timer support"
+	depends on WDT
+	help
+	  Select this to enable ColdFire watchdog timer,
+	  which supports mcf52x2 mcf532x mcf523x families.
+
  config WDT_MESON_GXBB
  	bool "Amlogic watchdog timer support"
  	depends on WDT
drivers/watchdog/Makefile +1 -0
index fd5d9c7376..eef786f5e7 100644
@@ -31,6 +31,7 @@ obj-$(CONFIG_WDT_CDNS) += cdns_wdt.o
  obj-$(CONFIG_WDT_FTWDT010) += ftwdt010_wdt.o
  obj-$(CONFIG_WDT_GPIO) += gpio_wdt.o
  obj-$(CONFIG_WDT_MAX6370) += max6370_wdt.o
+obj-$(CONFIG_WDT_MCF) += mcf_wdt.o
  obj-$(CONFIG_WDT_MESON_GXBB) += meson_gxbb_wdt.o
  obj-$(CONFIG_WDT_MPC8xxx) += mpc8xxx_wdt.o
  obj-$(CONFIG_WDT_MT7620) += mt7620_wdt.o
drivers/watchdog/mcf_wdt.c new file +125 -0
new file mode 100644
index 0000000000..b36488bb5b
@@ -0,0 +1,135 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * mcf_wdt.c - driver for ColdFire on-chip watchdog
+ *
+ * Author: Angelo Dureghello <[email protected]>
+ *
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <hang.h>
+#include <asm/io.h>
+#include <wdt.h>
+#include <linux/bitops.h>
+
+#define DIVIDER_5XXX	4096
+#define DIVIDER_5282	8192
+
+#define WCR_EN          BIT(0)
+#define WCR_HALTED      BIT(1)
+#define WCR_DOZE        BIT(2)
+#define WCR_WAIT        BIT(3)
+
+struct watchdog_regs {
+	u16 wcr;        /* Control */
+	u16 wmr;        /* Service */
+	u16 wcntr;      /* Counter */
+	u16 wsr;        /* Reset Status */
+};
+
+static void mcf_watchdog_reset(struct watchdog_regs *wdog)
+{
+	if (!IS_ENABLED(CONFIG_WATCHDOG_RESET_DISABLE)) {
+		writew(0x5555, &wdog->wsr);
+		writew(0xaaaa, &wdog->wsr);
+	}
+}
+
+static void mcf_watchdog_init(struct watchdog_regs *wdog, u32 fixed_divider,
+			      u64 timeout_msecs)
+{
+	u32 wdog_module, cycles_per_sec;
+
+	cycles_per_sec = CFG_SYS_CLK / fixed_divider;
+
+	wdog_module = cycles_per_sec * ((u32)timeout_msecs / 1000);
+	wdog_module += (cycles_per_sec / 1000) * ((u32)timeout_msecs % 1000);
+
+	/* Limit check, max 16 bits */
+	if (wdog_module > 0xffff)
+		wdog_module = 0xffff;
+
+	/* Set timeout and enable watchdog */
+	writew((u16)wdog_module, &wdog->wmr);
+	writew(WCR_EN, &wdog->wcr);
+
+	mcf_watchdog_reset(wdog);
+}
+
+struct mcf_wdt_priv {
+	void __iomem *base;
+	u32 fixed_divider;
+};
+
+static int mcf_wdt_expire_now(struct udevice *dev, ulong flags)
+{
+	hang();
+
+	return 0;
+}
+
+static int mcf_wdt_reset(struct udevice *dev)
+{
+	struct mcf_wdt_priv *priv = dev_get_priv(dev);
+
+	mcf_watchdog_reset(priv->base);
+
+	return 0;
+}
+
+static int mcf_wdt_start(struct udevice *dev, u64 timeout, ulong flags)
+{
+	struct mcf_wdt_priv *priv = dev_get_priv(dev);
+
+	/* Timeout from fdt (timeout) comes in milliseconds */
+	mcf_watchdog_init(priv->base, priv->fixed_divider, timeout);
+
+	return 0;
+}
+
+static int mcf_wdt_stop(struct udevice *dev)
+{
+	struct mcf_wdt_priv *priv = dev_get_priv(dev);
+	struct watchdog_regs *wdog = (struct watchdog_regs *)priv->base;
+
+	setbits_be16(&wdog->wcr, WCR_HALTED);
+
+	return 0;
+}
+
+static int mcf_wdt_probe(struct udevice *dev)
+{
+	struct mcf_wdt_priv *priv = dev_get_priv(dev);
+
+	priv->base = dev_read_addr_ptr(dev);
+	if (!priv->base)
+		return -ENOENT;
+
+	priv->fixed_divider = (u32)dev_get_driver_data(dev);
+
+	return 0;
+}
+
+static const struct wdt_ops mcf_wdt_ops = {
+	.start		= mcf_wdt_start,
+	.stop		= mcf_wdt_stop,
+	.reset		= mcf_wdt_reset,
+	.expire_now	= mcf_wdt_expire_now,
+};
+
+static const struct udevice_id mcf_wdt_ids[] = {
+	{ .compatible = "fsl,mcf5208-wdt", .data = DIVIDER_5XXX },
+	{ .compatible = "fsl,mcf5282-wdt", .data = DIVIDER_5282 },
+	{}
+};

drivers/watchdog/mcf_wdt.c line 135

Quoted 10 lines
drivers/watchdog/mcf_wdt.c new file +10 -0
+
+U_BOOT_DRIVER(mcf_wdt) = {
+	.name		= "mcf_wdt",
+	.id		= UCLASS_WDT,
+	.of_match	= mcf_wdt_ids,
+	.probe		= mcf_wdt_probe,
+	.ops		= &mcf_wdt_ops,
+	.priv_auto	= sizeof(struct mcf_wdt_priv),
+	.flags		= DM_FLAG_PRE_RELOC,
+};

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#3 lore raw

PATCH v3 2/5 m68k: move watchdog functions in mcf_wdt driver

In reply to Angelo Dureghello

Move watchdog functions inside a separate watchdog driver.

---
Changes for v2:
- none
Changes for v3:
- none

---
 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(-)
arch/m68k/cpu/mcf523x/cpu.c +0 -42
index ba2c228911..bef67767b4 100644
@@ -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:
arch/m68k/cpu/mcf52x2/cpu.c +1 -46

59 lines not on this page · raw message

arch/m68k/cpu/mcf532x/cpu.c +0 -44

56 lines not on this page · raw message

Signature · 1 line
2.41.0
Reviewed-by on v3 2/5
#4 lore raw

Re: [PATCH v3 2/5] m68k: move watchdog functions in mcf_wdt driver

Quoted 3 lines · Angelo Dureghello

Move watchdog functions inside a separate watchdog driver.

Thanks,
Stefan

Quoted 188 lines

---
Changes for v2:
- none
Changes for v3:
- none

---
  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(-)
arch/m68k/cpu/mcf523x/cpu.c +0 -42
index ba2c228911..bef67767b4 100644
@@ -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:
arch/m68k/cpu/mcf52x2/cpu.c +1 -46
index d7cbf11e25..5042a38b3e 100644
@@ -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)
arch/m68k/cpu/mcf532x/cpu.c +0 -37
index 548cbca36a..18d20a8926 100644
@@ -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
-

arch/m68k/cpu/mcf532x/cpu.c int print_cpuinfo(void) · line 106

Quoted 10 lines
arch/m68k/cpu/mcf532x/cpu.c +0 -7
-	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:

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#5 lore raw

PATCH v3 3/5 m68k: dts: add watchdog node

In reply to Angelo Dureghello

Add watchdog node for the implemented mcf_wdt driver.

---
Changes for v2:
- remove unnecessary big-endian property
Changes for v3:
- none

---
 arch/m68k/dts/M5208EVBE.dts | 5 +++++
 arch/m68k/dts/mcf5208.dtsi  | 6 ++++++
 arch/m68k/dts/mcf523x.dtsi  | 6 ++++++
 arch/m68k/dts/mcf5271.dtsi  | 6 ++++++
 arch/m68k/dts/mcf5275.dtsi  | 6 ++++++
 arch/m68k/dts/mcf5282.dtsi  | 6 ++++++
 arch/m68k/dts/mcf5329.dtsi  | 6 ++++++
 arch/m68k/dts/mcf537x.dtsi  | 6 ++++++
 8 files changed, 47 insertions(+)
arch/m68k/dts/M5208EVBE.dts +5 -0
index 1c32718af4..ec203e8b69 100644
@@ -15,6 +15,11 @@
 	};
 };
 
+&wdog0 {
+	timeout-sec = <32>;
+	status = "okay";
+};
+
 &uart0 {
 	bootph-all;
 	status = "okay";
arch/m68k/dts/mcf5208.dtsi +6 -0
index 9392facfa8..c61dbf3557 100644
@@ -16,6 +16,12 @@
 		#address-cells = <1>;
 		#size-cells = <1>;
 
+		wdog0: watchdog@fc08c000 {
+			compatible = "fsl,mcf5208-wdt";
+			reg = <0xfc08c000 0x10>;
+			status = "disabled";
+		};
+
 		uart0: uart@fc060000 {
 			compatible = "fsl,mcf-uart";
 			reg = <0xfc060000 0x40>;
arch/m68k/dts/mcf523x.dtsi +6 -0
index 41c7b9b2d1..cae7b4f861 100644
@@ -23,6 +23,12 @@
 			ranges = <0x00000000 0x40000000 0x40000000>;
 			reg = <0x40000000 0x40000000>;
 
+			wdog0: watchdog@140000 {
+				compatible = "fsl,mcf5208-wdt";
+				reg = <0x140000 0x10>;
+				status = "disabled";
+			};
+
 			uart0: uart@200 {
 				compatible = "fsl,mcf-uart";
 				reg = <0x200 0x40>;
arch/m68k/dts/mcf5271.dtsi +6 -0
index fc82bd3c24..5acf6994af 100644
@@ -23,6 +23,12 @@
 			ranges = <0x00000000 0x40000000 0x40000000>;
 			reg = <0x40000000 0x40000000>;
 
+			wdog0: watchdog@140000 {
+				compatible = "fsl,mcf5208-wdt";
+				reg = <0x140000 0x10>;
+				status = "disabled";
+			};
+
 			uart0: uart@200 {
 				compatible = "fsl,mcf-uart";
 				reg = <0x200 0x40>;
arch/m68k/dts/mcf5275.dtsi +6 -0
index 402517cdec..3df17b445c 100644
@@ -24,6 +24,12 @@
 			ranges = <0x00000000 0x40000000 0x40000000>;
 			reg = <0x40000000 0x40000000>;
 
+			wdog0: watchdog@140000 {
+				compatible = "fsl,mcf5208-wdt";
+				reg = <0x140000 0x10>;
+				status = "disabled";
+			};
+
 			uart0: uart@200 {
 				compatible = "fsl,mcf-uart";
 				reg = <0x200 0x40>;
arch/m68k/dts/mcf5282.dtsi +6 -0
index 883c0d0324..640c1a32e4 100644
@@ -23,6 +23,12 @@
 			ranges = <0x00000000 0x40000000 0x40000000>;
 			reg = <0x40000000 0x40000000>;
 
+			wdog0: watchdog@140000 {
+				compatible = "fsl,mcf5282-wdt";
+				reg = <0x140000 0x10>;
+				status = "disabled";
+			};
+
 			uart0: uart@200 {
 				compatible = "fsl,mcf-uart";
 				reg = <0x200 0x40>;
arch/m68k/dts/mcf5329.dtsi +6 -0
index 7501cc4b01..991985e48c 100644
@@ -16,6 +16,12 @@
 		#address-cells = <1>;
 		#size-cells = <1>;
 
+		wdog0: watchdog@fc098000 {
+			compatible = "fsl,mcf5208-wdt";
+			reg = <0xfc08c000 0x10>;
+			status = "disabled";
+		};
+
 		uart0: uart@fc060000 {
 			compatible = "fsl,mcf-uart";
 			reg = <0xfc060000 0x40>;
arch/m68k/dts/mcf537x.dtsi +6 -0
index 338b8b4583..4fa0f4bc3d 100644
@@ -16,6 +16,12 @@
 		#address-cells = <1>;
 		#size-cells = <1>;
 
+		wdog0: watchdog@fc098000 {
+			compatible = "fsl,mcf5208-wdt";
+			reg = <0xfc08c000 0x10>;
+			status = "disabled";
+		};
+
 		uart0: uart@fc060000 {
 			compatible = "fsl,mcf-uart";
 			reg = <0xfc060000 0x40>;
Signature · 1 line
2.41.0
Reviewed-by on v3 3/5
#6 lore raw

Re: [PATCH v3 3/5] m68k: dts: add watchdog node

Quoted 3 lines · Angelo Dureghello

Add watchdog node for the implemented mcf_wdt driver.

Thanks,
Stefan

Quoted 141 lines

---
Changes for v2:
- remove unnecessary big-endian property
Changes for v3:
- none

---
  arch/m68k/dts/M5208EVBE.dts | 5 +++++
  arch/m68k/dts/mcf5208.dtsi  | 6 ++++++
  arch/m68k/dts/mcf523x.dtsi  | 6 ++++++
  arch/m68k/dts/mcf5271.dtsi  | 6 ++++++
  arch/m68k/dts/mcf5275.dtsi  | 6 ++++++
  arch/m68k/dts/mcf5282.dtsi  | 6 ++++++
  arch/m68k/dts/mcf5329.dtsi  | 6 ++++++
  arch/m68k/dts/mcf537x.dtsi  | 6 ++++++
  8 files changed, 47 insertions(+)
arch/m68k/dts/M5208EVBE.dts +5 -0
index 1c32718af4..ec203e8b69 100644
@@ -15,6 +15,11 @@
  	};
  };
 
+&wdog0 {
+	timeout-sec = <32>;
+	status = "okay";
+};
+
  &uart0 {
  	bootph-all;
  	status = "okay";
arch/m68k/dts/mcf5208.dtsi +6 -0
index 9392facfa8..c61dbf3557 100644
@@ -16,6 +16,12 @@
  		#address-cells = <1>;
  		#size-cells = <1>;
 
+		wdog0: watchdog@fc08c000 {
+			compatible = "fsl,mcf5208-wdt";
+			reg = <0xfc08c000 0x10>;
+			status = "disabled";
+		};
+
  		uart0: uart@fc060000 {
  			compatible = "fsl,mcf-uart";
  			reg = <0xfc060000 0x40>;
arch/m68k/dts/mcf523x.dtsi +6 -0
index 41c7b9b2d1..cae7b4f861 100644
@@ -23,6 +23,12 @@
  			ranges = <0x00000000 0x40000000 0x40000000>;
  			reg = <0x40000000 0x40000000>;
 
+			wdog0: watchdog@140000 {
+				compatible = "fsl,mcf5208-wdt";
+				reg = <0x140000 0x10>;
+				status = "disabled";
+			};
+
  			uart0: uart@200 {
  				compatible = "fsl,mcf-uart";
  				reg = <0x200 0x40>;
arch/m68k/dts/mcf5271.dtsi +6 -0
index fc82bd3c24..5acf6994af 100644
@@ -23,6 +23,12 @@
  			ranges = <0x00000000 0x40000000 0x40000000>;
  			reg = <0x40000000 0x40000000>;
 
+			wdog0: watchdog@140000 {
+				compatible = "fsl,mcf5208-wdt";
+				reg = <0x140000 0x10>;
+				status = "disabled";
+			};
+
  			uart0: uart@200 {
  				compatible = "fsl,mcf-uart";
  				reg = <0x200 0x40>;
arch/m68k/dts/mcf5275.dtsi +6 -0
index 402517cdec..3df17b445c 100644
@@ -24,6 +24,12 @@
  			ranges = <0x00000000 0x40000000 0x40000000>;
  			reg = <0x40000000 0x40000000>;
 
+			wdog0: watchdog@140000 {
+				compatible = "fsl,mcf5208-wdt";
+				reg = <0x140000 0x10>;
+				status = "disabled";
+			};
+
  			uart0: uart@200 {
  				compatible = "fsl,mcf-uart";
  				reg = <0x200 0x40>;
arch/m68k/dts/mcf5282.dtsi +6 -0
index 883c0d0324..640c1a32e4 100644
@@ -23,6 +23,12 @@
  			ranges = <0x00000000 0x40000000 0x40000000>;
  			reg = <0x40000000 0x40000000>;
 
+			wdog0: watchdog@140000 {
+				compatible = "fsl,mcf5282-wdt";
+				reg = <0x140000 0x10>;
+				status = "disabled";
+			};
+
  			uart0: uart@200 {
  				compatible = "fsl,mcf-uart";
  				reg = <0x200 0x40>;
arch/m68k/dts/mcf5329.dtsi +6 -0
index 7501cc4b01..991985e48c 100644
@@ -16,6 +16,12 @@
  		#address-cells = <1>;
  		#size-cells = <1>;
 
+		wdog0: watchdog@fc098000 {
+			compatible = "fsl,mcf5208-wdt";
+			reg = <0xfc08c000 0x10>;
+			status = "disabled";
+		};
+
  		uart0: uart@fc060000 {
  			compatible = "fsl,mcf-uart";
  			reg = <0xfc060000 0x40>;
arch/m68k/dts/mcf537x.dtsi +0 -0
index 338b8b4583..4fa0f4bc3d 100644
@@ -16,6 +16,12 @@
  		#address-cells = <1>;
  		#size-cells = <1>;

arch/m68k/dts/mcf537x.dtsi line 27

Quoted 10 lines
arch/m68k/dts/mcf537x.dtsi +6 -0
 
+		wdog0: watchdog@fc098000 {
+			compatible = "fsl,mcf5208-wdt";
+			reg = <0xfc08c000 0x10>;
+			status = "disabled";
+		};
+
  		uart0: uart@fc060000 {
  			compatible = "fsl,mcf-uart";
  			reg = <0xfc060000 0x40>;

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#7 lore raw

PATCH v3 4/5 configs: m68k: add watchdog driver

In reply to Angelo Dureghello

Add config options for mcf_wdt driver.

---
Changes for v2:
- none
Changes for v3:
- none

---
 configs/M5208EVBE_defconfig           | 2 ++
 configs/astro_mcf5373l_defconfig      | 4 ++--
 configs/eb_cpu5282_defconfig          | 1 +
 configs/eb_cpu5282_internal_defconfig | 1 +
 4 files changed, 6 insertions(+), 2 deletions(-)
configs/M5208EVBE_defconfig +2 -0
index 0c5afe869b..aa054f753f 100644
@@ -50,3 +50,5 @@ CONFIG_MCFFEC=y
 CONFIG_MII=y
 CONFIG_MCFUART=y
 CONFIG_WATCHDOG_TIMEOUT_MSECS=5000
+CONFIG_WDT=y
+CONFIG_WDT_MCF=y
configs/astro_mcf5373l_defconfig +2 -2
index aade1f98be..f4dad3bcc8 100644
@@ -46,5 +46,5 @@ CONFIG_DM_RTC=y
 CONFIG_MCFRTC=y
 CONFIG_SYS_MCFRTC_BASE=0xFC0A8000
 CONFIG_MCFUART=y
-CONFIG_WATCHDOG=y
-CONFIG_WATCHDOG_TIMEOUT_MSECS=3355
+CONFIG_WDT=y
+CONFIG_WDT_MCF=y
configs/eb_cpu5282_defconfig +1 -0
index 24edecb510..2873322598 100644
@@ -52,3 +52,4 @@ CONFIG_MII=y
 CONFIG_DM_RTC=y
 CONFIG_RTC_DS1338=y
 CONFIG_MCFUART=y
+CONFIG_WDT=y
configs/eb_cpu5282_internal_defconfig +1 -0
index 44e22eb01d..bd780034ba 100644
@@ -50,3 +50,4 @@ CONFIG_MII=y
 CONFIG_DM_RTC=y
 CONFIG_RTC_DS1338=y
 CONFIG_MCFUART=y
+CONFIG_WDT=y
Signature · 1 line
2.41.0
Reviewed-by on v3 4/5
#8 lore raw

Re: [PATCH v3 4/5] configs: m68k: add watchdog driver

Quoted 3 lines · Angelo Dureghello

Add config options for mcf_wdt driver.

Thanks,
Stefan

Quoted 48 lines

---
Changes for v2:
- none
Changes for v3:
- none

---
  configs/M5208EVBE_defconfig           | 2 ++
  configs/astro_mcf5373l_defconfig      | 4 ++--
  configs/eb_cpu5282_defconfig          | 1 +
  configs/eb_cpu5282_internal_defconfig | 1 +
  4 files changed, 6 insertions(+), 2 deletions(-)
configs/M5208EVBE_defconfig +2 -0
index 0c5afe869b..aa054f753f 100644
@@ -50,3 +50,5 @@ CONFIG_MCFFEC=y
  CONFIG_MII=y
  CONFIG_MCFUART=y
  CONFIG_WATCHDOG_TIMEOUT_MSECS=5000
+CONFIG_WDT=y
+CONFIG_WDT_MCF=y
configs/astro_mcf5373l_defconfig +2 -2
index aade1f98be..f4dad3bcc8 100644
@@ -46,5 +46,5 @@ CONFIG_DM_RTC=y
  CONFIG_MCFRTC=y
  CONFIG_SYS_MCFRTC_BASE=0xFC0A8000
  CONFIG_MCFUART=y
-CONFIG_WATCHDOG=y
-CONFIG_WATCHDOG_TIMEOUT_MSECS=3355
+CONFIG_WDT=y
+CONFIG_WDT_MCF=y
configs/eb_cpu5282_defconfig +1 -0
index 24edecb510..2873322598 100644
@@ -52,3 +52,4 @@ CONFIG_MII=y
  CONFIG_DM_RTC=y
  CONFIG_RTC_DS1338=y
  CONFIG_MCFUART=y
+CONFIG_WDT=y
configs/eb_cpu5282_internal_defconfig +0 -0
index 44e22eb01d..bd780034ba 100644

configs/eb_cpu5282_internal_defconfig CONFIG_MII=y · line 53

Quoted 4 lines
configs/eb_cpu5282_internal_defconfig +1 -0
@@ -50,3 +50,4 @@ CONFIG_MII=y
  CONFIG_DM_RTC=y
  CONFIG_RTC_DS1338=y
  CONFIG_MCFUART=y
+CONFIG_WDT=y

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#9 lore raw

PATCH v3 5/5 MAINTAINERS: add myself as mcf_wdt.c maintainer

In reply to Angelo Dureghello

---
Changes for v2:
- none
Changes for v3:
- none

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index 87991cccdd..2b157214cb 100644
@@ -867,6 +867,7 @@ S:	Maintained
 T:	git https://source.denx.de/u-boot/custodians/u-boot-coldfire.git
 F:	arch/m68k/
 F:	doc/arch/m68k.rst
+F:	drivers/watchdog/mcf_wdt.c
 
 CYCLIC
 M:	Stefan Roese <[email protected]>
Signature · 1 line
2.41.0
Reviewed-by on v3 5/5
#10 lore raw

Re: [PATCH v3 5/5] MAINTAINERS: add myself as mcf_wdt.c maintainer

Quoted 1 line · Angelo Dureghello

Thanks,
Stefan

Quoted 14 lines

---
Changes for v2:
- none
Changes for v3:
- none

---
  MAINTAINERS | 1 +
  1 file changed, 1 insertion(+)
MAINTAINERS +0 -0
index 87991cccdd..2b157214cb 100644

MAINTAINERS S: Maintained · line 873

Quoted 7 lines
MAINTAINERS +1 -0
@@ -867,6 +867,7 @@ S:	Maintained
  T:	git https://source.denx.de/u-boot/custodians/u-boot-coldfire.git
  F:	arch/m68k/
  F:	doc/arch/m68k.rst
+F:	drivers/watchdog/mcf_wdt.c
 
  CYCLIC
  M:	Stefan Roese <[email protected]>

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]