From nobody Mon Feb 9 08:15:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2D0AEB64DC for ; Tue, 11 Jul 2023 09:24:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230197AbjGKJYA (ORCPT ); Tue, 11 Jul 2023 05:24:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232415AbjGKJXM (ORCPT ); Tue, 11 Jul 2023 05:23:12 -0400 X-Greylist: delayed 81 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 11 Jul 2023 02:19:03 PDT Received: from mta-65-226.siemens.flowmailer.net (mta-65-226.siemens.flowmailer.net [185.136.65.226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E5AC44B8 for ; Tue, 11 Jul 2023 02:19:03 -0700 (PDT) Received: by mta-65-226.siemens.flowmailer.net with ESMTPSA id 202307110917390949818ac86cb28ad0 for ; Tue, 11 Jul 2023 11:17:40 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=huaqian.li@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=wE+SEueNbEbwnhCHFDEWPtQJzySe4EclgZMfWR8En/4=; b=gt8hEd6JCG6zwuqr5chB1NtzWxJ910wZPCDgmK9GLi8dwDMo+u+xPW84URA2v2SRvoXxx1 mhwOAdnPpAmEsIYY3ppntPYh6S9DJSqF+lAkkQn6NznpdinLn6Js9cLWAJCe3KmzsGmWKDpo 6WbeQKTgGX2EFv9tgbyv4OmWsHg/A=; From: huaqian.li@siemens.com To: wim@linux-watchdog.org, linux@roeck-us.net, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Cc: huaqianlee@gmail.com, nm@ti.com, vigneshr@ti.com, kristo@kernel.org, linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, jan.kiszka@siemens.com, baocheng.su@siemens.com, Li Hua Qian Subject: [PATCH v2 1/3] dt-bindings: watchdog: ti,rti-wdt: Add support for WDIOF_CARDRESET Date: Tue, 11 Jul 2023 17:17:11 +0800 Message-Id: <20230711091713.1113010-2-huaqian.li@siemens.com> In-Reply-To: <20230711091713.1113010-1-huaqian.li@siemens.com> References: <20230711091713.1113010-1-huaqian.li@siemens.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-959203:519-21489:flowmailer Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Li Hua Qian TI RTI (Real Time Interrupt) Watchdog doesn't support to record the watchdog cause. Add a reserved memory to know the last reboot was caused by the watchdog card. In the reserved memory, some specific info will be saved to indicate whether the watchdog reset was triggered in last boot. Signed-off-by: Li Hua Qian --- .../devicetree/bindings/watchdog/ti,rti-wdt.yaml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/watchdog/ti,rti-wdt.yaml b/D= ocumentation/devicetree/bindings/watchdog/ti,rti-wdt.yaml index fc553211e42d..f227db08dc70 100644 --- a/Documentation/devicetree/bindings/watchdog/ti,rti-wdt.yaml +++ b/Documentation/devicetree/bindings/watchdog/ti,rti-wdt.yaml @@ -26,7 +26,18 @@ properties: - ti,j7-rti-wdt =20 reg: - maxItems: 1 + maxItems: 2 + description: + - Contains the address and the size of MCU RTI register. + - Contains the address and the size of reserved memory, which + has the pre-stored watchdog reset cause as power-on reason. The + second item is optional. + In the reserved memory, the following values are needed at the + first 12 bytes to tell that last boot was caused by watchdog + reset. + - PON_REASON_SOF_NUM: 0xBBBBCCCC + - PON_REASON_MAGIC_NUM: 0xDDDDDDDD + - PON_REASON_EOF_NUM: 0xCCCCBBBB =20 clocks: maxItems: 1 --=20 2.34.1 From nobody Mon Feb 9 08:15:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90727EB64DD for ; Tue, 11 Jul 2023 09:21:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232148AbjGKJV2 (ORCPT ); Tue, 11 Jul 2023 05:21:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231932AbjGKJVC (ORCPT ); Tue, 11 Jul 2023 05:21:02 -0400 Received: from mta-65-227.siemens.flowmailer.net (mta-65-227.siemens.flowmailer.net [185.136.65.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 441A02D72 for ; Tue, 11 Jul 2023 02:17:47 -0700 (PDT) Received: by mta-65-227.siemens.flowmailer.net with ESMTPSA id 2023071109174573b7a51eeab6294c8e for ; Tue, 11 Jul 2023 11:17:45 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=huaqian.li@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=e9SD9YBZjnTBpPz3kT2lbToZg8m/zbYJHLT15YixKKw=; b=BtDkFxlARX0a6UDCjugj9rpamX49f2zA/RG8VgvWTDYdY2UphcXMTBO6pmBRskf0NvBDV5 4ZYKAp+GSkW1T7xNEbGeCWL2lNVRcGTovE2p9aRO86d7gPYn1mArlmQaOnSSiFfINVc+KUSF UHbCsLCoMacmCp5lQEXmtkFz20Meo=; From: huaqian.li@siemens.com To: wim@linux-watchdog.org, linux@roeck-us.net, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Cc: huaqianlee@gmail.com, nm@ti.com, vigneshr@ti.com, kristo@kernel.org, linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, jan.kiszka@siemens.com, baocheng.su@siemens.com, Li Hua Qian Subject: [PATCH v2 2/3] arm64: dts: ti: Add reserved memory for watchdog Date: Tue, 11 Jul 2023 17:17:12 +0800 Message-Id: <20230711091713.1113010-3-huaqian.li@siemens.com> In-Reply-To: <20230711091713.1113010-1-huaqian.li@siemens.com> References: <20230711091713.1113010-1-huaqian.li@siemens.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-959203:519-21489:flowmailer Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Li Hua Qian This patch adds a reserved memory for the TI AM65X platform watchdog to reserve the specific info, triggering the watchdog reset in last boot, to know if the board reboot is due to a watchdog reset. Signed-off-by: Li Hua Qian --- arch/arm64/boot/dts/ti/k3-am65-iot2050-common.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/arm64/boot/dts/ti/k3-am65-iot2050-common.dtsi b/arch/arm6= 4/boot/dts/ti/k3-am65-iot2050-common.dtsi index e26bd988e522..77380e52a334 100644 --- a/arch/arm64/boot/dts/ti/k3-am65-iot2050-common.dtsi +++ b/arch/arm64/boot/dts/ti/k3-am65-iot2050-common.dtsi @@ -63,6 +63,12 @@ rtos_ipc_memory_region: ipc-memories@a2000000 { alignment =3D <0x1000>; no-map; }; + + /* To reserve the power-on(PON) reason for watchdog reset */ + wdt_reset_memory_region: wdt-memory@a2200000 { + reg =3D <0x00 0xa2200000 0x00 0x00001000>; + no-map; + }; }; =20 leds { @@ -718,3 +724,8 @@ &mcu_r5fss0_core1 { <&mcu_r5fss0_core1_memory_region>; mboxes =3D <&mailbox0_cluster1>, <&mbox_mcu_r5fss0_core1>; }; + +&mcu_rti1 { + reg =3D <0x0 0x40610000 0x0 0x100>, + <0x0 0xa2200000 0x0 0x1000>; +}; --=20 2.34.1 From nobody Mon Feb 9 08:15:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F135EEB64DC for ; Tue, 11 Jul 2023 09:21:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231569AbjGKJVy (ORCPT ); Tue, 11 Jul 2023 05:21:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231913AbjGKJVR (ORCPT ); Tue, 11 Jul 2023 05:21:17 -0400 Received: from mta-64-227.siemens.flowmailer.net (mta-64-227.siemens.flowmailer.net [185.136.64.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 586253A87 for ; Tue, 11 Jul 2023 02:17:55 -0700 (PDT) Received: by mta-64-227.siemens.flowmailer.net with ESMTPSA id 20230711091750642eb4c725723f0b94 for ; Tue, 11 Jul 2023 11:17:50 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=huaqian.li@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=cNKNC6oIcXI+MaGN9+y8x9Kvw+smz8uL9Y684QAwSc8=; b=V8ml7pwKF0A7d+MuOgmVtfrIc1O0Y+20hKNN4rl4H8w/aO8hILniyh75PI4TpKr1Tgevss ZYEKlBY4Dx3WMnyPnjIOzxhYT1EHxSUvYFV5BZ4s6BkuyXopa1z/BlfLsai6xRkCHvvDSL3G uUWrc/96uefC2BvXuX5NrAqX+GYEs=; From: huaqian.li@siemens.com To: wim@linux-watchdog.org, linux@roeck-us.net, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Cc: huaqianlee@gmail.com, nm@ti.com, vigneshr@ti.com, kristo@kernel.org, linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, jan.kiszka@siemens.com, baocheng.su@siemens.com, Li Hua Qian Subject: [PATCH v2 3/3] watchdog:rit_wdt: Add support for WDIOF_CARDRESET Date: Tue, 11 Jul 2023 17:17:13 +0800 Message-Id: <20230711091713.1113010-4-huaqian.li@siemens.com> In-Reply-To: <20230711091713.1113010-1-huaqian.li@siemens.com> References: <20230711091713.1113010-1-huaqian.li@siemens.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-959203:519-21489:flowmailer Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Li Hua Qian This patch adds the WDIOF_CARDRESET support for the platform watchdog whose hardware does not support this feature, to know if the board reboot is due to a watchdog reset. This is done via reserved memory(RAM), which indicates if specific info saved, triggering the watchdog reset in last boot. Signed-off-by: Li Hua Qian --- drivers/watchdog/rti_wdt.c | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c index ce8f18e93aa9..77fd6b54137c 100644 --- a/drivers/watchdog/rti_wdt.c +++ b/drivers/watchdog/rti_wdt.c @@ -18,6 +18,7 @@ #include #include #include +#include =20 #define DEFAULT_HEARTBEAT 60 =20 @@ -52,6 +53,11 @@ =20 #define DWDST BIT(1) =20 +#define PON_REASON_SOF_NUM 0xBBBBCCCC +#define PON_REASON_MAGIC_NUM 0xDDDDDDDD +#define PON_REASON_EOF_NUM 0xCCCCBBBB +#define PON_REASON_ITEM_BITS 0xFFFFFFFF + static int heartbeat =3D DEFAULT_HEARTBEAT; =20 /* @@ -198,6 +204,11 @@ static int rti_wdt_probe(struct platform_device *pdev) struct rti_wdt_device *wdt; struct clk *clk; u32 last_ping =3D 0; + u32 reserved_mem_size; + unsigned long *vaddr; + unsigned long paddr; + u32 data[3]; + u32 reg[8]; =20 wdt =3D devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); if (!wdt) @@ -284,6 +295,43 @@ static int rti_wdt_probe(struct platform_device *pdev) } } =20 + ret =3D of_property_read_variable_u32_array(pdev->dev.of_node, "reg", reg, + 0, ARRAY_SIZE(reg)); + if (ret < 0) { + dev_err(dev, "cannot read the reg info.\n"); + goto err_iomap; + } + + /* + * If reserved memory is defined for watchdog reset cause. + * Readout the Power-on(PON) reason and pass to bootstatus. + */ + if (ret =3D=3D 8) { + paddr =3D reg[5]; + reserved_mem_size =3D reg[7]; + vaddr =3D memremap(paddr, reserved_mem_size, MEMREMAP_WB); + if (vaddr =3D=3D NULL) { + dev_err(dev, "Failed to map memory-region.\n"); + goto err_iomap; + } + + data[0] =3D *vaddr & PON_REASON_ITEM_BITS; + data[1] =3D *(vaddr + 1) & PON_REASON_ITEM_BITS; + data[2] =3D *(vaddr + 2) & PON_REASON_ITEM_BITS; + + dev_dbg(dev, "Watchdog: sof =3D %lX, data =3D %lX, eof =3D %lX\n", + data[0], data[1], data[2]); + + if ((data[0] =3D=3D PON_REASON_SOF_NUM) + && (data[1] =3D=3D PON_REASON_MAGIC_NUM) + && (data[1] =3D=3D PON_REASON_MAGIC_NUM)) { + dev_info(dev, "Watchdog reset cause detected.\n"); + wdd->bootstatus |=3D WDIOF_CARDRESET; + } + memset(vaddr, 0, reserved_mem_size); + memunmap(vaddr); + } + watchdog_init_timeout(wdd, heartbeat, dev); =20 ret =3D watchdog_register_device(wdd); --=20 2.34.1