From: Andrew Davis <afd@ti.com>
To: Guenter Roeck <linux@roeck-us.net>, Judith Mendez <jm@ti.com>
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Vignesh Raghavendra <vigneshr@ti.com>,
Tero Kristo <kristo@kernel.org>, <linux-watchdog@vger.kernel.org>,
<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 2/2] watchdog: rti_wdt: Add reaction control
Date: Mon, 7 Jul 2025 16:49:31 -0500 [thread overview]
Message-ID: <d96541bc-644d-4c90-b9f7-1e4afd16aeb6@ti.com> (raw)
In-Reply-To: <cc37e797-d3e5-444d-8016-c437a0534001@roeck-us.net>
On 7/7/25 3:58 PM, Guenter Roeck wrote:
> On Mon, Jul 07, 2025 at 01:00:02PM -0500, Judith Mendez wrote:
>> This allows to configure reaction between NMI and reset for WWD.
>>
>> On K3 SoC's other than AM62L SoC [0], watchdog reset output is routed
>> to the ESM module which can subsequently route the signal to safety
>> master or SoC reset. On AM62L, the watchdog reset output is routed
>> to the SoC HW reset block. So, add a new compatible for AM62l to add
>> SoC data and configure reaction to reset instead of NMI.
>>
>> [0] https://www.ti.com/product/AM62L
>> Signed-off-by: Judith Mendez <jm@ti.com>
>> ---
>> drivers/watchdog/rti_wdt.c | 32 ++++++++++++++++++++++++++++----
>> 1 file changed, 28 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c
>> index d1f9ce4100a8..c9ee443c70af 100644
>> --- a/drivers/watchdog/rti_wdt.c
>> +++ b/drivers/watchdog/rti_wdt.c
>> @@ -35,7 +35,8 @@
>> #define RTIWWDRXCTRL 0xa4
>> #define RTIWWDSIZECTRL 0xa8
>>
>> -#define RTIWWDRX_NMI 0xa
>> +#define RTIWWDRXN_RST 0x5
>> +#define RTIWWDRXN_NMI 0xa
>>
>> #define RTIWWDSIZE_50P 0x50
>> #define RTIWWDSIZE_25P 0x500
>> @@ -63,22 +64,29 @@
>>
>> static int heartbeat;
>>
>> +struct rti_wdt_data {
>> + bool reset;
>> +};
>> +
>> /*
>> * struct to hold data for each WDT device
>> * @base - base io address of WD device
>> * @freq - source clock frequency of WDT
>> * @wdd - hold watchdog device as is in WDT core
>> + * @data - hold configuration data
>> */
>> struct rti_wdt_device {
>> void __iomem *base;
>> unsigned long freq;
>> struct watchdog_device wdd;
>> + const struct rti_wdt_data *data;
>> };
>>
>> static int rti_wdt_start(struct watchdog_device *wdd)
>> {
>> u32 timer_margin;
>> struct rti_wdt_device *wdt = watchdog_get_drvdata(wdd);
>> + u8 reaction;
>> int ret;
>>
>> ret = pm_runtime_resume_and_get(wdd->parent);
>> @@ -101,8 +109,13 @@ static int rti_wdt_start(struct watchdog_device *wdd)
>> */
>> wdd->min_hw_heartbeat_ms = 520 * wdd->timeout + MAX_HW_ERROR;
>>
>> - /* Generate NMI when wdt expires */
>> - writel_relaxed(RTIWWDRX_NMI, wdt->base + RTIWWDRXCTRL);
>> + /* Reset device if wdt serviced outside of window or generate NMI if available */
>
> Shouldn't that be "or generate NMI if _not_ available" ?
>
For almost all the K3 devices, the WDT has two selectable outputs, one resets
the device directly, the other is this "NMI" which is wired to an ESM module
which can take other actions (but usually it just also resets the device).
For AM62L that second NMI output is not wired (no ESM module), so our only
choice is to set the WDT to direct reset mode.
The wording is a little strange, but the "or generate NMI if available" meaning
if NMI is available, then do that. Reset being the fallback when _not_ available.
Maybe this would work better:
/* If WDT is serviced outside of window, generate NMI if available, or reset device */
Andrew
> Guenter
>
>> + if (wdt->data->reset)
>> + reaction = RTIWWDRXN_RST;
>> + else
>> + reaction = RTIWWDRXN_NMI;
>> +
>> + writel_relaxed(reaction, wdt->base + RTIWWDRXCTRL);
>>
>> /* Open window size 50%; this is the largest window size available */
>> writel_relaxed(RTIWWDSIZE_50P, wdt->base + RTIWWDSIZECTRL);
>> @@ -255,6 +268,8 @@ static int rti_wdt_probe(struct platform_device *pdev)
>> wdd->timeout = DEFAULT_HEARTBEAT;
>> wdd->parent = dev;
>>
>> + wdt->data = device_get_match_data(dev);
>> +
>> watchdog_set_drvdata(wdd, wdt);
>> watchdog_set_nowayout(wdd, 1);
>> watchdog_set_restart_priority(wdd, 128);
>> @@ -369,8 +384,17 @@ static void rti_wdt_remove(struct platform_device *pdev)
>> pm_runtime_disable(&pdev->dev);
>> }
>>
>> +static struct rti_wdt_data j7_wdt = {
>> + .reset = false,
>> +};
>> +
>> +static struct rti_wdt_data am62l_wdt = {
>> + .reset = true,
>> +};
>> +
>> 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 },
>> {},
>> };
>> MODULE_DEVICE_TABLE(of, rti_wdt_of_match);
>> --
>> 2.49.0
>>
next prev parent reply other threads:[~2025-07-07 21:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-07 18:00 [PATCH v3 0/2] Add reaction control in rti Judith Mendez
2025-07-07 18:00 ` [PATCH v3 1/2] dt-bindings: watchdog: ti,rti-wdt: Add ti,am62l-rti-wdt compatible Judith Mendez
2025-07-07 18:00 ` [PATCH v3 2/2] watchdog: rti_wdt: Add reaction control Judith Mendez
2025-07-07 20:58 ` Guenter Roeck
2025-07-07 21:49 ` Andrew Davis [this message]
2025-07-07 22:55 ` Guenter Roeck
2025-07-10 14:08 ` Judith Mendez
2025-07-16 18:47 ` Judith Mendez
2025-07-16 18:50 ` Guenter Roeck
2025-07-17 15:24 ` Judith Mendez
2025-07-17 16:44 ` Andrew Davis
2025-07-17 17:51 ` Judith Mendez
2025-07-17 20:10 ` Andrew Davis
2025-07-18 14:01 ` Judith Mendez
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=d96541bc-644d-4c90-b9f7-1e4afd16aeb6@ti.com \
--to=afd@ti.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jm@ti.com \
--cc=kristo@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=robh@kernel.org \
--cc=vigneshr@ti.com \
--cc=wim@linux-watchdog.org \
/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
all inboxes | Powered by JetHome®