* [PATCH 1/2] watchdog: rti_wdt: Fix reset on AM62L
@ 2025-08-14 9:56 Sascha Hauer
2025-08-14 9:56 ` [PATCH 2/2] ARM: dts: AM62L: switch watchdog to SoC specific compatible Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2025-08-14 9:56 UTC (permalink / raw)
To: Barebox List
Due to different watchdog output routing on the AM62L we have to set RTIWWDRXCTRL
register differently in order to properly reset the SoC. Handle this
difference in form of a SoC specific compatible string. Based on the
corresponding Linux patch posted here [1]
[1] https://lore.kernel.org/all/20250721235705.1160972-1-jm@ti.com/
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/watchdog/rti_wdt.c | 31 +++++++++++++++++++++++++++----
1 file changed, 27 insertions(+), 4 deletions(-)
diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c
index ffc4427059..ba943495ff 100644
--- a/drivers/watchdog/rti_wdt.c
+++ b/drivers/watchdog/rti_wdt.c
@@ -26,7 +26,8 @@
#define RTIWWDRXCTRL 0xa4
#define RTIWWDSIZECTRL 0xa8
-#define RTIWWDRX_NMI 0xa
+#define RTIWWDRXN_RST 0x5
+#define RTIWWDRXN_NMI 0xa
#define RTIWWDSIZE_100P 0x5
#define RTIWWDSIZE_50P 0x50
@@ -42,10 +43,15 @@
#define DWDST BIT(1)
+struct rti_wdt_data {
+ bool nmi;
+};
+
struct rti_wdt_priv {
void __iomem *regs;
struct watchdog wdt;
unsigned int clk_hz;
+ struct rti_wdt_data *data;
};
static int rti_wdt_ping(struct watchdog *wdt)
@@ -67,7 +73,7 @@ static int rti_wdt_ping(struct watchdog *wdt)
static int rti_wdt_settimeout(struct watchdog *wdt, unsigned int timeout)
{
struct rti_wdt_priv *priv = container_of(wdt, struct rti_wdt_priv, wdt);
- u32 timer_margin;
+ u32 timer_margin, reaction;
if (!timeout)
return -ENOSYS;
@@ -84,7 +90,13 @@ static int rti_wdt_settimeout(struct watchdog *wdt, unsigned int timeout)
timer_margin = WDT_PRELOAD_MAX;
writel(timer_margin, priv->regs + RTIDWDPRLD);
- writel(RTIWWDRX_NMI, priv->regs + RTIWWDRXCTRL);
+
+ if (priv->data->nmi)
+ reaction = RTIWWDRXN_NMI;
+ else
+ reaction = RTIWWDRXN_RST;
+
+ writel(reaction, priv->regs + RTIWWDRXCTRL);
writel(RTIWWDSIZE_50P, priv->regs + RTIWWDSIZECTRL);
(void)readl(priv->regs + RTIWWDSIZECTRL);
@@ -137,6 +149,8 @@ static int rti_wdt_probe(struct device *dev)
if (priv->clk_hz == 0)
return -EINVAL;
+ priv->data = device_get_match_data(dev);
+
/*
* If watchdog is running at 32k clock, it is not accurate.
* Adjust frequency down in this case so that it does not expire
@@ -172,8 +186,17 @@ static int rti_wdt_probe(struct device *dev)
return watchdog_register(wdt);
}
+static struct rti_wdt_data j7_wdt = {
+ .nmi = true,
+};
+
+static struct rti_wdt_data am62l_wdt = {
+ .nmi = false,
+};
+
static const struct of_device_id rti_wdt_of_match[] = {
- { .compatible = "ti,j7-rti-wdt", },
+ { .compatible = "ti,j7-rti-wdt", .data = &j7_wdt },
+ { .compatible = "ti,am62l-rti-wdt", .data = &am62l_wdt },
{ /* sentinel */ }
};
--
2.39.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 2/2] ARM: dts: AM62L: switch watchdog to SoC specific compatible
2025-08-14 9:56 [PATCH 1/2] watchdog: rti_wdt: Fix reset on AM62L Sascha Hauer
@ 2025-08-14 9:56 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2025-08-14 9:56 UTC (permalink / raw)
To: Barebox List
Due to different watchdog output routing on the AM62L we need a SoC
specific compatible for the AM62L watchdog. It's already handled in
the driver, so change the compatible to make the watchdog work.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/dts/k3-am62l-main.dtsi | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/dts/k3-am62l-main.dtsi b/arch/arm/dts/k3-am62l-main.dtsi
index 95d387afd1..b7b52d6b56 100644
--- a/arch/arm/dts/k3-am62l-main.dtsi
+++ b/arch/arm/dts/k3-am62l-main.dtsi
@@ -212,7 +212,7 @@ epwm_tbclk: clock-controller@1e9100 {
};
rti0: watchdog@e000000 {
- compatible = "ti,j7-rti-wdt";
+ compatible = "ti,am62l-rti-wdt";
reg = <0x00 0x0e000000 0x00 0x100>;
clocks = <&scmi_clk 273>;
power-domains = <&scmi_pds 60>;
@@ -221,7 +221,7 @@ rti0: watchdog@e000000 {
};
rti1: watchdog@e010000 {
- compatible = "ti,j7-rti-wdt";
+ compatible = "ti,am62l-rti-wdt";
reg = <0x00 0x0e010000 0x00 0x100>;
clocks = <&scmi_clk 279>;
power-domains = <&scmi_pds 61>;
--
2.39.5
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-14 13:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-14 9:56 [PATCH 1/2] watchdog: rti_wdt: Fix reset on AM62L Sascha Hauer
2025-08-14 9:56 ` [PATCH 2/2] ARM: dts: AM62L: switch watchdog to SoC specific compatible Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox