From patchwork Tue Nov 30 13:42:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrej Picej X-Patchwork-Id: 12647347 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 5869CC43217 for ; Tue, 30 Nov 2021 13:43:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241580AbhK3NqU (ORCPT ); Tue, 30 Nov 2021 08:46:20 -0500 Received: from cpanel.siel.si ([46.19.9.99]:38776 "EHLO cpanel.siel.si" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240974AbhK3NqS (ORCPT ); Tue, 30 Nov 2021 08:46:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=norik.com; s=default; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=BprRzp7NTlqfFQGFNx7txt6EhUkXQQBm9V5lXLBQLcg=; b=MIKZ9EtUovRfza2Vuz86FTufpQ usm7nF3gMGHW8L1ju5kdcQmfqq54vtNfq3G7qHkOsaj6agsvI11RyPgCrTizcfUgBq+pI534g4Wgz +ai7TE1Dn3AiBeE8B9Vn4goBp4WP60DqlHNFyxCSnACa8sajCiGyacGNy0RzUOrufHWZhtpcHBhee tnCAkrng2T7Nk6TVwx+ipw6ptfRflGrWS/SQrDBzBJanmxGPcuZ6BY8hCKL2h5whkxe9nsGkhdiQX xNMAA3iuCC906vCVctKI9NeGy/qoteFOh9j8RjHoFZkq3L42Z2Mb2mJNtCDZ4KjdwN2ZCEyi7EUMn zgoZ2bYQ==; Received: from [89.212.21.243] (port=49710 helo=localhost.localdomain) by cpanel.siel.si with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1ms3PJ-0039GW-6o; Tue, 30 Nov 2021 14:42:53 +0100 From: Andrej Picej Cc: andrej.picej@norik.com, support.opensource@diasemi.com, wim@linux-watchdog.org, linux@roeck-us.net, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, devicetree@vger.kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 1/4] mfd: da9062: make register CONFIG_I writable Date: Tue, 30 Nov 2021 14:42:39 +0100 Message-Id: <20211130134242.3516619-1-andrej.picej@norik.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cpanel.siel.si X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - norik.com X-Get-Message-Sender-Via: cpanel.siel.si: authenticated_id: andrej.picej@norik.com X-Authenticated-Sender: cpanel.siel.si: andrej.picej@norik.com X-Source: X-Source-Args: X-Source-Dir: To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org From: Stefan Christ Make the config register CONFIG_I writable to change the watchdog mode. Signed-off-by: Stefan Christ Signed-off-by: Andrej Picej --- drivers/mfd/da9062-core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mfd/da9062-core.c b/drivers/mfd/da9062-core.c index 01f8e10dfa55..7041ba53efb4 100644 --- a/drivers/mfd/da9062-core.c +++ b/drivers/mfd/da9062-core.c @@ -556,6 +556,7 @@ static const struct regmap_range da9062_aa_writeable_ranges[] = { regmap_reg_range(DA9062AA_VBUCK3_B, DA9062AA_VBUCK3_B), regmap_reg_range(DA9062AA_VLDO1_B, DA9062AA_VLDO4_B), regmap_reg_range(DA9062AA_BBAT_CONT, DA9062AA_BBAT_CONT), + regmap_reg_range(DA9062AA_CONFIG_I, DA9062AA_CONFIG_I), regmap_reg_range(DA9062AA_GP_ID_0, DA9062AA_GP_ID_19), }; From patchwork Tue Nov 30 13:42:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrej Picej X-Patchwork-Id: 12647345 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 7959BC433FE for ; Tue, 30 Nov 2021 13:43:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241505AbhK3NqT (ORCPT ); Tue, 30 Nov 2021 08:46:19 -0500 Received: from cpanel.siel.si ([46.19.9.99]:38798 "EHLO cpanel.siel.si" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232272AbhK3NqS (ORCPT ); Tue, 30 Nov 2021 08:46:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=norik.com; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=GQkn179EA6RB5tPAroeqjE3Zjye4M/4SllOBH6o7hPI=; b=TwXaE1j6UOw7LwmcPgBY3TuMI8 hxX6aOKGkZB8N5jrOxtlMTeUeHYEQPDTe8mgESYBDbipsVVftHpfKy/VByaSmw6/vLuTrfQKATEha 2hd+Tb2eT6pKW12bfgUt8IXUtxRjXQEc1HKYKP/ZgEPxqvDjU5Y4YYkgo+YmiV8eohQV7KWC88SDP kugBwzn5MwXe7x3OWOlqb2wjq5sGw0TprfR1lHFqkCaHitQWrMy8MrXddlJFqCLxFmpva2D1wKMp+ hQtedl3lK+cazrJOSamrJ6II/cBmyziOFIHczXKmh+6eixy+tykLoBYJlSfYMzM+jOuU4PVppe5Dl 58SGsy6g==; Received: from [89.212.21.243] (port=49710 helo=localhost.localdomain) by cpanel.siel.si with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1ms3PJ-0039GW-C2; Tue, 30 Nov 2021 14:42:53 +0100 From: Andrej Picej Cc: andrej.picej@norik.com, support.opensource@diasemi.com, wim@linux-watchdog.org, linux@roeck-us.net, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, devicetree@vger.kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 2/4] watchdog: da9062: reset board on watchdog timeout Date: Tue, 30 Nov 2021 14:42:40 +0100 Message-Id: <20211130134242.3516619-2-andrej.picej@norik.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211130134242.3516619-1-andrej.picej@norik.com> References: <20211130134242.3516619-1-andrej.picej@norik.com> MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cpanel.siel.si X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - norik.com X-Get-Message-Sender-Via: cpanel.siel.si: authenticated_id: andrej.picej@norik.com X-Authenticated-Sender: cpanel.siel.si: andrej.picej@norik.com X-Source: X-Source-Args: X-Source-Dir: To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org Implement a method to change watchdog timeout configuration based on DT binding ("dlg,wdt-sd"). There is a possibility to change the bahaviour of watchdog reset. Setting WATCHDOG_SD bit enables SHUTDOWN mode, and clearing it enables POWERDOWN mode on watchdog timeout. If no DT binding is specified the WATCHDOG_SD bit stays in default configuration, not breaking behaviour of devices which might depend on default fuse configuration. Note: This patch requires that the config register CONFIG_I is configured as writable in the da9062 multi function device. Signed-off-by: Andrej Picej --- drivers/watchdog/da9062_wdt.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c index f02cbd530538..e342e9e50cb1 100644 --- a/drivers/watchdog/da9062_wdt.c +++ b/drivers/watchdog/da9062_wdt.c @@ -85,8 +85,33 @@ static int da9062_wdt_start(struct watchdog_device *wdd) { struct da9062_watchdog *wdt = watchdog_get_drvdata(wdd); unsigned int selector; + unsigned int mask; + u32 val; int ret; + /* Configure what happens on watchdog timeout. Can be specified with + * "dlg,wdt-sd" dt-binding (0 -> POWERDOWN, 1 -> SHUTDOWN). + * If "dlg,wdt-sd" dt-binding is NOT set use the default. + */ + ret = device_property_read_u32(wdd->parent, "dlg,wdt-sd", &val); + if (!ret) { + if (val) + /* Use da9062's SHUTDOWN mode */ + mask = DA9062AA_WATCHDOG_SD_MASK; + else + /* Use da9062's POWERDOWN mode. */ + mask = 0x0; + + ret = regmap_update_bits(wdt->hw->regmap, + DA9062AA_CONFIG_I, + DA9062AA_WATCHDOG_SD_MASK, + mask); + + if (ret) + dev_err(wdt->hw->dev, "failed to set wdt reset mode: %d\n", + ret); + } + selector = da9062_wdt_timeout_to_sel(wdt->wdtdev.timeout); ret = da9062_wdt_update_timeout_register(wdt, selector); if (ret) From patchwork Tue Nov 30 13:42:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrej Picej X-Patchwork-Id: 12647349 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 53149C43219 for ; Tue, 30 Nov 2021 13:43:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241593AbhK3NqU (ORCPT ); Tue, 30 Nov 2021 08:46:20 -0500 Received: from cpanel.siel.si ([46.19.9.99]:38808 "EHLO cpanel.siel.si" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229473AbhK3NqS (ORCPT ); Tue, 30 Nov 2021 08:46:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=norik.com; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=BvHiFyzOTpt2hGyCVuXl2Hq70zeCH55Isy6IrmH3KWk=; b=cWl9oq/4vTFGXnI+wJBiW6mF9D /IK6jOjzj+mymY26YgwwFEqP4Pundtak8vH9c+qepdVo4nypxPu93IoBmYpPnu6U5lItXYiiAk/Tj VXT7WV/u3VWc7ugdw8AV3PDJ44EyLnznAcLBYayR9BxKDUL9q3RZz3nfE5YWON2/eIp7dSBCCyklk hRguONk6kSdBpxvJSribO/aDhBPcAmebZ0XID07uGfTCkzaxfLC4Jy6ka6BqBvh9AcWvNpxKujBrc TTLdf66vW+r0Uxb2YzSACwyXvTlASv65CGLAdoEriO9uw3BeZatVJIW1KzMHBq+dUqxZegqQHkb4/ jOAwRHcg==; Received: from [89.212.21.243] (port=49710 helo=localhost.localdomain) by cpanel.siel.si with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1ms3PJ-0039GW-Hp; Tue, 30 Nov 2021 14:42:53 +0100 From: Andrej Picej Cc: andrej.picej@norik.com, support.opensource@diasemi.com, wim@linux-watchdog.org, linux@roeck-us.net, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, devicetree@vger.kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 3/4] dt-bindings: watchdog: da9062: add watchdog timeout mode Date: Tue, 30 Nov 2021 14:42:41 +0100 Message-Id: <20211130134242.3516619-3-andrej.picej@norik.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211130134242.3516619-1-andrej.picej@norik.com> References: <20211130134242.3516619-1-andrej.picej@norik.com> MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cpanel.siel.si X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - norik.com X-Get-Message-Sender-Via: cpanel.siel.si: authenticated_id: andrej.picej@norik.com X-Authenticated-Sender: cpanel.siel.si: andrej.picej@norik.com X-Source: X-Source-Args: X-Source-Dir: To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org Document the watchdog timeout mode property. If this property is used the user can select what happens on watchdog timeout. Set this property to 1 to enable SHUTDOWN (the device resets), set it to 0 and the device will go to POWERDOWN on watchdog timeout. Signed-off-by: Andrej Picej --- Documentation/devicetree/bindings/watchdog/da9062-wdt.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/watchdog/da9062-wdt.txt b/Documentation/devicetree/bindings/watchdog/da9062-wdt.txt index 950e4fba8dbc..e3e6e56cee21 100644 --- a/Documentation/devicetree/bindings/watchdog/da9062-wdt.txt +++ b/Documentation/devicetree/bindings/watchdog/da9062-wdt.txt @@ -10,6 +10,9 @@ Optional properties: - dlg,use-sw-pm: Add this property to disable the watchdog during suspend. Only use this option if you can't use the watchdog automatic suspend function during a suspend (see register CONTROL_B). +- dlg,wdt-sd: Set what happens on watchdog timeout. If this bit is set the + watchdog timeout triggers SHUTDOWN, if cleared the watchdog triggers + POWERDOWN. Can be 0 or 1. Example: DA9062 From patchwork Tue Nov 30 13:42:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrej Picej X-Patchwork-Id: 12647343 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 BC510C433F5 for ; Tue, 30 Nov 2021 13:43:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241229AbhK3NqT (ORCPT ); Tue, 30 Nov 2021 08:46:19 -0500 Received: from cpanel.siel.si ([46.19.9.99]:38828 "EHLO cpanel.siel.si" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241132AbhK3NqS (ORCPT ); Tue, 30 Nov 2021 08:46:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=norik.com; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=jFZ3uMjYEFalQXScfWqlj3bLcO8oaYoOVDLUfNpK/9U=; b=B8KxikQbrMLQyVt+8LdQwYMs8Q KVyTP1NkAxLof2kbsVRRH95E9/tDKXAt7hId1vOw8lmcg/JutmkR68YVHv98P4XtBfw7QTk9PgdVU s7hG5q8nJegUp91JaRtLDbX0ZaeRiaKeQOQ2Iu9LyBfupLlRZvQDQgWQSdDZBXoOI1goaWxRw0KOv EjukFq6DlTbMIyBQPG6Pb+ljA5ykf8Oup/TzUnynThktmYpCmsSAKTFxZzJuWk7+hsHOYP4MILER+ 1+neSv01W94V/UY4Y5G4anXXGHRKoG1vkdoBZgXh8vYvPZJtlPHnRP4tcI2OHYamBtyOsvBnmP0aU eD7WBlCw==; Received: from [89.212.21.243] (port=49710 helo=localhost.localdomain) by cpanel.siel.si with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1ms3PJ-0039GW-Mw; Tue, 30 Nov 2021 14:42:53 +0100 From: Andrej Picej Cc: andrej.picej@norik.com, support.opensource@diasemi.com, wim@linux-watchdog.org, linux@roeck-us.net, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, devicetree@vger.kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 4/4] ARM: dts: imx6: phycore-som: set watchdog timeout mode to shutdown Date: Tue, 30 Nov 2021 14:42:42 +0100 Message-Id: <20211130134242.3516619-4-andrej.picej@norik.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211130134242.3516619-1-andrej.picej@norik.com> References: <20211130134242.3516619-1-andrej.picej@norik.com> MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cpanel.siel.si X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - norik.com X-Get-Message-Sender-Via: cpanel.siel.si: authenticated_id: andrej.picej@norik.com X-Authenticated-Sender: cpanel.siel.si: andrej.picej@norik.com X-Source: X-Source-Args: X-Source-Dir: To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org Enable system restart when the watchdog timeout occurs. Signed-off-by: Andrej Picej --- arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi index a80aa08a37cb..743343e525cf 100644 --- a/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi +++ b/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi @@ -111,6 +111,7 @@ da9062_onkey: onkey { watchdog { compatible = "dlg,da9062-watchdog"; dlg,use-sw-pm; + dlg,wdt-sd = <1>; }; regulators {