From patchwork Sun Jan 9 11:41:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12707741 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 01ABAC433EF for ; Sun, 9 Jan 2022 11:43:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ck91U2ixG+OInV722iUCLwyc/ec1jRIfM4WhOPoq2Cs=; b=b/kaBVgEOqL0PD 6lN76bedRM2zL1ZefGF7r8GDSSmiY96cUQUzs6PbW5CGTlLBhHyP+cw0geL0/ztA6zJGoAw5SErQu HpNm4LcT0UY5UE8WB4EA03/UlQigaCmF76raFSQbXfZGlpYKjD1RxH+PjbrcAXSLdJYJ92uk3aYSo Ynu9eKtehlcKOprdsWHrwLV/fuXZ3jA56MzH08SA2sLx+onyQmbqi2So3UZrGIPB+iPAPz5V/hpFI xBUpRriQcVStJ+dmt60OkEG3MFOdsgH3uvQKMuXpF6yn/ee3XW/ghGN+hVmyg32Uy8i93jjviFgR6 ZHsNjCecyR2rBoa/9JeQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n6Wa4-007hZl-M2; Sun, 09 Jan 2022 11:41:48 +0000 Received: from new4-smtp.messagingengine.com ([66.111.4.230]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n6WZs-007hXL-Cc for linux-arm-kernel@lists.infradead.org; Sun, 09 Jan 2022 11:41:37 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id BC5B058017B; Sun, 9 Jan 2022 06:41:35 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sun, 09 Jan 2022 06:41:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alistair23.me; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=LDXYYE+MqxWyK 1qhbbPA/YRmiGTmz4Uzxb4a/XgCPCI=; b=C4ba/oa49ptB3yL66l0g8c3ysSxMY spHltFdr11Cl2/Bm/j+/uNZg+4FLLXny4Yt8+XI+e68ckXEg/gZuJQ+mS2RTKY+k 2kEM7Og5MJbIQqec8olvDvHTHpiB1QIpYa5+PN7DC8xR+3ajM216IR19PfMDkfBY kJJKyq3Csd6YS9iK52a7V4VL0td0cDCrpmFclNvvQKs5heIkfamUiE6EEMNo4imC 8rSF01h9ommT7natpvBXOiyVlilbAz0DZmn5gqfR2VhGUDpTYJzRwwUVmm4ocm2z ZR8B5dciGUHq6faCaSaPz36RuGBXSXhlT/Y2oZHc8ud80hxMIJ1vya8Pw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=LDXYYE+MqxWyK1qhbbPA/YRmiGTmz4Uzxb4a/XgCPCI=; b=eXl1V4MZ iUWZRXBisFm54HkZiWNL+3SI9KzVv0Nnf+8zCBUdplNgpgBMEkvvDexSJowkPoTw YF5dwSLBFHMwLaNpgdBOsHgFquf2AL/n6V+/AXJilGNL8o1mIhrJzZ0epvICKRXR GWptVpKG95r29SmUYw3147ysaedF6XzhdAv8df4/Be2gLU31Rh5CAvJjVkZB28qh guI2jH+p1nCMX5IP1jzJRcxTi9BvKBe3hzBij+Lc/kyy5DA4iS6lwxqgvrhlCyBR g/wynQ0a9LYs4YHBkTigM04Ac4faUyiL1pWSblUwh1kqfSf9YfFA3Z9CZarJKMOX rIfVMo+soIA86A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrudegkedgfeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlihhsthgrihhrucfhrhgrnhgtihhsuceorghlihhsthgr ihhrsegrlhhishhtrghirhdvfedrmhgvqeenucggtffrrghtthgvrhhnpeeggedtteejke eggeeugfehueevudegvdetjeeviedugedvtdekffekhedtteduhfenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhishhtrghirhesrghlih hsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 9 Jan 2022 06:41:29 -0500 (EST) From: Alistair Francis To: linux-kernel@vger.kernel.org, linux@roeck-us.net, shawnguo@kernel.org, wim@linux-watchdog.org, linux-watchdog@vger.kernel.org, s.hauer@pengutronix.de, linux-arm-kernel@lists.infradead.org Cc: linux-imx@nxp.com, kernel@pengutronix.de, festevam@gmail.com, devicetree@vger.kernel.org, robh+dt@kernel.org, Alistair Francis Subject: [PATCH 1/2] watchdog: imx2_wdg: Alow ping on suspend Date: Sun, 9 Jan 2022 21:41:19 +1000 Message-Id: <20220109114120.386013-2-alistair@alistair23.me> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220109114120.386013-1-alistair@alistair23.me> References: <20220109114120.386013-1-alistair@alistair23.me> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220109_034136_527108_75E04F05 X-CRM114-Status: GOOD ( 18.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The i.MX watchdog cannot be disabled by softwrae once it has been enabled. This means that it can't be stopped before suspend. For systems that enter low power mode this is fine, as the watchdog will be automatically stopped by hardwrae in low power mode. Not all i.MX platforms support low power mode in the mainline kernel. For example the i.MX7D does not enter low power mode and so will be rebooted 2 minutes after entering freeze or mem sleep states. This patch introduces a device tree property "fsl,ping-during-suspend" that can be used to enable ping on suspend support for these systems. Signed-off-by: Alistair Francis --- .../bindings/watchdog/fsl-imx-wdt.yaml | 7 ++++++ drivers/watchdog/imx2_wdt.c | 22 +++++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml b/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml index fb7695515be1..b8660a3c456c 100644 --- a/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml +++ b/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml @@ -55,6 +55,13 @@ properties: If present, the watchdog device is configured to assert its external reset (WDOG_B) instead of issuing a software reset. + fsl,ping-during-suspend: + $ref: /schemas/types.yaml#/definitions/flag + description: | + If present, the kernel will ping the watchdog during suspend. + This should be used on platforms that don't enter low power mode + during suspend. + required: - compatible - interrupts diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c index 51bfb796898b..9a5fdb3173a8 100644 --- a/drivers/watchdog/imx2_wdt.c +++ b/drivers/watchdog/imx2_wdt.c @@ -66,6 +66,7 @@ struct imx2_wdt_device { struct watchdog_device wdog; bool ext_reset; bool clk_is_on; + bool no_ping; }; static bool nowayout = WATCHDOG_NOWAYOUT; @@ -312,12 +313,14 @@ static int __init imx2_wdt_probe(struct platform_device *pdev) wdev->ext_reset = of_property_read_bool(dev->of_node, "fsl,ext-reset-output"); + wdev->no_ping = !of_property_read_bool(dev->of_node, "fsl,ping-during-suspend"); platform_set_drvdata(pdev, wdog); watchdog_set_drvdata(wdog, wdev); watchdog_set_nowayout(wdog, nowayout); watchdog_set_restart_priority(wdog, 128); watchdog_init_timeout(wdog, timeout, dev); - watchdog_stop_ping_on_suspend(wdog); + if (wdev->no_ping) + watchdog_stop_ping_on_suspend(wdog); if (imx2_wdt_is_running(wdev)) { imx2_wdt_set_timeout(wdog, wdog->timeout); @@ -366,9 +369,11 @@ static int __maybe_unused imx2_wdt_suspend(struct device *dev) imx2_wdt_ping(wdog); } - clk_disable_unprepare(wdev->clk); + if (wdev->no_ping) { + clk_disable_unprepare(wdev->clk); - wdev->clk_is_on = false; + wdev->clk_is_on = false; + } return 0; } @@ -380,11 +385,14 @@ static int __maybe_unused imx2_wdt_resume(struct device *dev) struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); int ret; - ret = clk_prepare_enable(wdev->clk); - if (ret) - return ret; + if (wdev->no_ping) { + ret = clk_prepare_enable(wdev->clk); - wdev->clk_is_on = true; + if (ret) + return ret; + + wdev->clk_is_on = true; + } if (watchdog_active(wdog) && !imx2_wdt_is_running(wdev)) { /* From patchwork Sun Jan 9 11:41:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12707742 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 29D36C433EF for ; Sun, 9 Jan 2022 11:43:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Tz+OdRbKy1qqQ3bpHcIkomJIjagiDPZa11MhRYHWOlU=; b=x9HXHIP0KdfqN6 khbVJ0l8VNA/Pjzcs1VqqPbvIsNatpNZpzX3zcsdPNQg5UP3qEwsufwOgLvvNwZ9S3HZihGhAHxlm gMqXwDuDvSjPEoOtHomFJutLfqrdxfMQs1pHS4aFe+3vlyuxbgey/bAUR+iuyv7VBiIPP3YBT7uYU beDfDtfwqVBxynAWTessAD4Etk7tkDQ7/j29NDDqvpxKkaPa/aCT+NRF6UO7WFJMzpQoYWIn/cg4N D1D2v89M2iNCvD/mnx5tnRz8FDTdco1EBgE0AH+3fqSzX96CkSPAt8F76zwmFrcASGKLAAflSJOQC T0g42fJctRhnFSuZz9ug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n6WaE-007hbg-6I; Sun, 09 Jan 2022 11:41:58 +0000 Received: from new4-smtp.messagingengine.com ([66.111.4.230]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n6WZz-007hYh-Mm for linux-arm-kernel@lists.infradead.org; Sun, 09 Jan 2022 11:41:44 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id 11EED580184; Sun, 9 Jan 2022 06:41:43 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Sun, 09 Jan 2022 06:41:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alistair23.me; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=nG8bOs8F336LG PIsiLK/Afxk6tT8J6l6oaR6iuHcX3Y=; b=rSfe0ATSzZZDQpE82n3l6oGld/DoS N/WUt60XIBbTT90LTMbxwhwrvkWXrhlr9zlWimYpIbHBIbgLqRmvieSgrFPbfId7 lPN/yNwP2VFor7B7H+bJkrAPA3Kv1a2DoTVMvhHpn2zq2vQJsXukQV0rVXc7ZbEd tgmH6ua8cWc6JB3nLMPlINhT/2rEkuUhQRWFP1zXqORwcwz1eAR86kFss9qsexon sv/XtoJT35GVLV1MOFLnZrZJ4apXVTkr39e5fGjzaEQpWiBdv883IFDeIkUQUDqf 49DPksYZpHuusfobksaPytoIXrT5tQcckjq0NPlT849bDxAOcFgtnLb1g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=nG8bOs8F336LGPIsiLK/Afxk6tT8J6l6oaR6iuHcX3Y=; b=QlMJ7kJ7 rcCaGoGsAVHCkCF73X7GprlxzhSz1guXsP3Q/l1De0DOFCvhwNDHHIL+lfoYMltK bXbr8dnhujqQvQ7XZcQ43Px6J+gjdfW4RxreFSE9VvVno4FT5y85fBk49GE1aLmj DB4yHlA7t/tm96f0TK5nhq4yr5Ma0RPMwZ59jKed/kZTfD7Jam7bdSso9/iFEZQK cHuU32qinpvIkmywexZNyN+2NAC69EAvXRfBKQ5mHPT4h3Jd4ufXeslDS/MNjYui M/PdtaX9kzVzCCUGN15mKj5V9IkF2245zJ9vRrZmN9h1g7IPlEcs3ZzpHVgvBLy0 eTsGqyU4/5ZklQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrudegkedgfeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlihhsthgrihhrucfhrhgrnhgtihhsuceorghlihhsthgr ihhrsegrlhhishhtrghirhdvfedrmhgvqeenucggtffrrghtthgvrhhnpeeggedtteejke eggeeugfehueevudegvdetjeeviedugedvtdekffekhedtteduhfenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhishhtrghirhesrghlih hsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 9 Jan 2022 06:41:36 -0500 (EST) From: Alistair Francis To: linux-kernel@vger.kernel.org, linux@roeck-us.net, shawnguo@kernel.org, wim@linux-watchdog.org, linux-watchdog@vger.kernel.org, s.hauer@pengutronix.de, linux-arm-kernel@lists.infradead.org Cc: linux-imx@nxp.com, kernel@pengutronix.de, festevam@gmail.com, devicetree@vger.kernel.org, robh+dt@kernel.org, Alistair Francis Subject: [PATCH 2/2] ARM: dts: imx7d: remarkable2: set ping-during-suspend for watchdog Date: Sun, 9 Jan 2022 21:41:20 +1000 Message-Id: <20220109114120.386013-3-alistair@alistair23.me> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220109114120.386013-1-alistair@alistair23.me> References: <20220109114120.386013-1-alistair@alistair23.me> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220109_034143_839475_F1C41BC3 X-CRM114-Status: UNSURE ( 7.92 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Set ping-during-suspend for the reMarkable watchdog timer to avoid the device rebooting when asleep. Signed-off-by: Alistair Francis --- arch/arm/boot/dts/imx7d-remarkable2.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/imx7d-remarkable2.dts b/arch/arm/boot/dts/imx7d-remarkable2.dts index 89cbf13097a4..99a453108af7 100644 --- a/arch/arm/boot/dts/imx7d-remarkable2.dts +++ b/arch/arm/boot/dts/imx7d-remarkable2.dts @@ -115,6 +115,7 @@ &wdog1 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_wdog>; fsl,ext-reset-output; + fsl,ping-during-suspend; }; &iomuxc {