[PATCH v1 04/14] watchdog: mpc8xxx: Add support for mpc83xx

Christophe Leroy christophe.leroy at csgroup.eu
Thu Apr 6 16:27:08 CEST 2023


Introduce a new compatible "fsl,pq2pro-wdt"
On mpc83xx, the prescaling factor is 0x10000.

Don't write the watchdog configuration register in
start.S as it can be written only once.

Signed-off-by: Christophe Leroy <christophe.leroy at csgroup.eu>
---
 arch/powerpc/cpu/mpc83xx/cpu.c   | 2 +-
 arch/powerpc/cpu/mpc83xx/start.S | 2 ++
 drivers/watchdog/Kconfig         | 2 +-
 drivers/watchdog/mpc8xxx_wdt.c   | 1 +
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/cpu/mpc83xx/cpu.c b/arch/powerpc/cpu/mpc83xx/cpu.c
index a6c063556e..f6ffe295b8 100644
--- a/arch/powerpc/cpu/mpc83xx/cpu.c
+++ b/arch/powerpc/cpu/mpc83xx/cpu.c
@@ -165,7 +165,7 @@ unsigned long get_tbclk(void)
 }
 #endif
 
-#if defined(CONFIG_WATCHDOG)
+#if defined(CONFIG_WATCHDOG) && !defined(CONFIG_WDT)
 void watchdog_reset (void)
 {
 	int re_enable = disable_interrupts();
diff --git a/arch/powerpc/cpu/mpc83xx/start.S b/arch/powerpc/cpu/mpc83xx/start.S
index e3878e431f..4329b173db 100644
--- a/arch/powerpc/cpu/mpc83xx/start.S
+++ b/arch/powerpc/cpu/mpc83xx/start.S
@@ -483,6 +483,7 @@ init_e300_core: /* time t 10 */
 
 
 	lis	r3, CONFIG_SYS_IMMR at h
+#ifndef CONFIG_WDT_MPC8xxx
 #if defined(CONFIG_WATCHDOG)
 	/* Initialise the Watchdog values and reset it (if req) */
 	/*------------------------------------------------------*/
@@ -508,6 +509,7 @@ init_e300_core: /* time t 10 */
 	stw r4, SWCRR(r3)
 1:
 #endif /* CONFIG_WATCHDOG */
+#endif
 
 #if defined(CONFIG_MASK_AER_AO)
 	/* Write the Arbiter Event Enable to mask Address Only traps. */
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index f7fbb28d80..f7767596e1 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -186,7 +186,7 @@ config WDT_MESON_GXBB
 
 config WDT_MPC8xxx
 	bool "MPC8xxx watchdog timer support"
-	depends on WDT && MPC8xx
+	depends on WDT && (MPC8xx || MPC83xx)
 	help
 	  Select this to enable mpc8xxx watchdog timer
 
diff --git a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c
index 9a29938fac..f28636ca90 100644
--- a/drivers/watchdog/mpc8xxx_wdt.c
+++ b/drivers/watchdog/mpc8xxx_wdt.c
@@ -98,6 +98,7 @@ static const struct wdt_ops mpc8xxx_wdt_ops = {
 
 static const struct udevice_id mpc8xxx_wdt_ids[] = {
 	{ .compatible = "fsl,pq1-wdt", .data = 0x800 },
+	{ .compatible = "fsl,pq2pro-wdt", .data = 0x10000 },
 	{}
 };
 
-- 
2.39.2



More information about the U-Boot mailing list