From patchwork Wed Nov 24 08:32:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrej Picej X-Patchwork-Id: 12636345 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 5E2BEC433F5 for ; Wed, 24 Nov 2021 08:33:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240862AbhKXIgR (ORCPT ); Wed, 24 Nov 2021 03:36:17 -0500 Received: from cpanel.siel.si ([46.19.9.99]:47016 "EHLO cpanel.siel.si" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230101AbhKXIgQ (ORCPT ); Wed, 24 Nov 2021 03:36:16 -0500 X-Greylist: delayed 1563 seconds by postgrey-1.27 at vger.kernel.org; Wed, 24 Nov 2021 03:36:15 EST 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=VXZVT6OnJARkja8z0/Rqz7y0pi jsW93o7xf/xddQlC9jSDaFxL8nxFirQBf9JDwaJBFeR0ze8jxMFKHeVkMWmDk07tErtrzZpVtNI2X Vaqu8mA4MLWTKOoviAAyXlmZ26R17BzOu9lgqKsJvG3bfImT/b1+b3vbBWyGUJoJlSDXiI7kqyLNp twlg0XL4I6gyUep8T1qZF1391lRBsH9P5WXOwmn5ohwf7CbO1z0byezCS3GUBC1IvM69n+CRhft5j fgQkHULagz4ivezXiQ+xTSB4PZGtKcSCsK7fDwePOMjz4v+EPzH5j3n8RGAmkcAg4nuekpFgFoCGN XwbYpxog==; Received: from [89.212.21.243] (port=40936 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 1mpni2-006FoM-G3; Wed, 24 Nov 2021 09:33:01 +0100 From: Andrej Picej To: support.opensource@diasemi.com, wim@linux-watchdog.org, linux@roeck-us.net, linux-watchdog@vger.kernel.org Cc: andrej.picej@norik.com, y.bas@phytec.de, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] mfd: da9062: make register CONFIG_I writable Date: Wed, 24 Nov 2021 09:32:57 +0100 Message-Id: <20211124083258.2606511-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: 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 Wed Nov 24 08:32:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrej Picej X-Patchwork-Id: 12636347 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 091A5C433EF for ; Wed, 24 Nov 2021 08:33:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240896AbhKXIgS (ORCPT ); Wed, 24 Nov 2021 03:36:18 -0500 Received: from cpanel.siel.si ([46.19.9.99]:47024 "EHLO cpanel.siel.si" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240831AbhKXIgR (ORCPT ); Wed, 24 Nov 2021 03:36:17 -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=0GFj0ec5nvqhJicygYIAPY76a2qiNJxCIyQsOhKxA64=; b=RACAbDAe23kvZ4Emc1mQGF6zsA euZ21JKF+F70DH7Bf94xW7w0Ypo8jLeOKuOO1VuAlch2Kk7Sr4K00/YVMzb7bTxOu+DUMyRzBWDbK mgXQ5pWRgHiwCV3PXHQQAyyKAyD94MkakKBwS+UGsPnwu/kSkwl/weT2QiKNpEC7fYozFVdH4qW+k CEM1lirok3TYMACYgtKdU3+RIn+wKJ+OLJvDtCk6C2kA+2KEG2OvpyePWRnk+Lr6trnZB4zlAjYS/ 84qk0xIRQqiGvkkXxG6hU1AkXQh6ZweGeYYxJtS0fD6OrKC4Ld3jJGebcd5cvhuVGT3xjnSyBWvzC ub5Uy67Q==; Received: from [89.212.21.243] (port=40936 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 1mpni2-006FoM-J7; Wed, 24 Nov 2021 09:33:01 +0100 From: Andrej Picej To: support.opensource@diasemi.com, wim@linux-watchdog.org, linux@roeck-us.net, linux-watchdog@vger.kernel.org Cc: andrej.picej@norik.com, y.bas@phytec.de, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] watchdog: da9062: reset board on watchdog timeout Date: Wed, 24 Nov 2021 09:32:58 +0100 Message-Id: <20211124083258.2606511-2-andrej.picej@norik.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211124083258.2606511-1-andrej.picej@norik.com> References: <20211124083258.2606511-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: Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org From: Stefan Christ In the default fuse configuration the watchdog poweroffs the system instead of resetting it on a watchdog timeout. This patch changes the behavior. Now the board is reseted and reboots. Note: This patch requires that the config register CONFIG_I is configured as writable in the da9062 multi function device. Signed-off-by: Stefan Christ Signed-off-by: Andrej Picej --- drivers/watchdog/da9062_wdt.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c index f02cbd530538..a04613e68f4a 100644 --- a/drivers/watchdog/da9062_wdt.c +++ b/drivers/watchdog/da9062_wdt.c @@ -87,6 +87,20 @@ static int da9062_wdt_start(struct watchdog_device *wdd) unsigned int selector; int ret; + /* + * Use da9062's SHUTDOWN mode instead of POWERDOWN for watchdog reset. + * On timeout the PMIC should reset the system, not powering it + * off. + */ + ret = regmap_update_bits(wdt->hw->regmap, + DA9062AA_CONFIG_I, + DA9062AA_WATCHDOG_SD_MASK, + DA9062AA_WATCHDOG_SD_MASK); + if (ret) + dev_err(wdt->hw->dev, + "failed to set wdt reset mode. Expect poweroff on watchdog reset: %d\n", + ret); + selector = da9062_wdt_timeout_to_sel(wdt->wdtdev.timeout); ret = da9062_wdt_update_timeout_register(wdt, selector); if (ret)