From mboxrd@z Thu Jan 1 00:00:00 1970 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 3E6E9C38A2D for ; Tue, 25 Oct 2022 11:22:36 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=yp3tzL2eUUof+EqAxOxPTvGWwesf/CTeHhIcQwsOQ4c=; b=wsDuyTLBjbAeqf 9m+/CQM+UPffryvPqBVqJtP2KfTvO7kY11X5scIcwWk0rKpBGKoY523qX+tsANkCops1tyJK93ZU9 F/bU6IQddVxU3f4nkrf1P4J4yYM2oBhYlxZJS0YgWcMRv7JUWb/ooRRAESZoKRunMemB5DgILJPKf frKRe5oyj4OP2VoXRWbZqZ7JX+5U0y3rv8zHIb7PDKYqA0SkNfk7hk1Cgx2AUG1CUVO2L885Y4FJQ T4/Q6Ho0qeH4iODBC7oLabW4DxSD63XP3jmLvP5msvpusMN9VLUQOuHanMdueQxeunoRIGM83zQCy fhTzVnVaj50bTq7qQuQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1onHzt-004ysE-8o; Tue, 25 Oct 2022 11:21:29 +0000 Received: from cpanel.siel.si ([46.19.9.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1onHzp-004yqW-JM for linux-arm-kernel@lists.infradead.org; Tue, 25 Oct 2022 11:21:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=norik.com; s=default; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: 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=+YhmmoZMLY7XrNhYbkL+EQRVhqHSiXfciFzZavrXBJg=; b=NJg02Upj0PEyhmA81VlVsjmBPH 8A2RCWamtgL1y372jrQ4PJrhaYtAuAfyZW4g/FC+8a8A6bdj/Dbb/RZtMcYdil9ZXq6bnZotxF2L4 AUOfC/Gz89HejPyjPgHjT59vYJ14vp7ZYR9uERNbQ5DdbrpgtdtY3Tgbh0wOGPr0baptndvI+PqpJ mXHGpRD6Bb/ner9r/s4N+zHenQgijZQxsmqm1TqdTvEE5Ee1ibdh7gfndUqAeKb1h/WNKAX0j8/sk 4LxDbx7ltzbnsy0jOOe1E5nKV0QOA/AUzQ3BRoMdnDm0c3AjpacJ++bzDDsvnoK+UT5OeU4znCnFS 0uLZCpJg==; Received: from 89-212-21-243.static.t-2.net ([89.212.21.243]:38524 helo=[192.168.69.85]) by cpanel.siel.si with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.95) (envelope-from ) id 1onHze-006z2X-4R; Tue, 25 Oct 2022 13:21:14 +0200 Message-ID: <56af1cc3-c10e-5694-d25f-252304732568@norik.com> Date: Tue, 25 Oct 2022 13:21:18 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH v2 1/3] watchdog: imx2_wdg: suspend watchdog in WAIT mode Content-Language: en-GB To: Alexander Stein Cc: linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org, wim@linux-watchdog.org, linux@roeck-us.net, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, Anson.Huang@nxp.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20221025072533.2980154-1-andrej.picej@norik.com> <20221025072533.2980154-2-andrej.picej@norik.com> <13126397.uLZWGnKmhe@steina-w> From: Andrej Picej In-Reply-To: <13126397.uLZWGnKmhe@steina-w> 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 - lists.infradead.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: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221025_042126_142533_33AA7B75 X-CRM114-Status: GOOD ( 23.50 ) 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: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Alexander, On 25. 10. 22 11:38, Alexander Stein wrote: > Am Dienstag, 25. Oktober 2022, 09:25:31 CEST schrieb Andrej Picej: >> Putting device into the "Suspend-To-Idle" mode causes watchdog to >> trigger and reset the board after set watchdog timeout period elapses. >> >> Introduce new device-tree property "fsl,suspend-in-wait" which suspends >> watchdog in WAIT mode. This is done by setting WDW bit in WCR >> (Watchdog Control Register) Watchdog operation is restored after exiting >> WAIT mode as expected. WAIT mode coresponds with Linux's >> "Suspend-To-Idle". >> >> Signed-off-by: Andrej Picej >> Reviewed-by: Fabio Estevam >> --- >> Changes in v2: >> - validate the property with compatible string, as this functionality >> is not supported by all devices. >> --- >> drivers/watchdog/imx2_wdt.c | 37 +++++++++++++++++++++++++++++++++++++ >> 1 file changed, 37 insertions(+) >> >> diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c >> index d0c5d47ddede..dd9866c6f1e5 100644 >> --- a/drivers/watchdog/imx2_wdt.c >> +++ b/drivers/watchdog/imx2_wdt.c >> @@ -35,6 +35,7 @@ >> >> #define IMX2_WDT_WCR 0x00 /* Control > Register */ >> #define IMX2_WDT_WCR_WT (0xFF << 8) /* -> > Watchdog Timeout Field */ >> +#define IMX2_WDT_WCR_WDW BIT(7) /* -> Watchdog disable > for WAIT */ >> #define IMX2_WDT_WCR_WDA BIT(5) /* -> External Reset > WDOG_B */ >> #define IMX2_WDT_WCR_SRS BIT(4) /* -> Software Reset > Signal */ >> #define IMX2_WDT_WCR_WRE BIT(3) /* -> WDOG Reset Enable > */ >> @@ -67,6 +68,27 @@ struct imx2_wdt_device { >> bool ext_reset; >> bool clk_is_on; >> bool no_ping; >> + bool sleep_wait; >> +}; >> + >> +static const char * const wdw_boards[] __initconst = { >> + "fsl,imx25-wdt", >> + "fsl,imx35-wdt", >> + "fsl,imx50-wdt", >> + "fsl,imx51-wdt", >> + "fsl,imx53-wdt", >> + "fsl,imx6q-wdt", >> + "fsl,imx6sl-wdt", >> + "fsl,imx6sll-wdt", >> + "fsl,imx6sx-wdt", >> + "fsl,imx6ul-wdt", >> + "fsl,imx7d-wdt", >> + "fsl,imx8mm-wdt", >> + "fsl,imx8mn-wdt", >> + "fsl,imx8mp-wdt", >> + "fsl,imx8mq-wdt", >> + "fsl,vf610-wdt", >> + NULL >> }; > > So the models listed in Documentation/devicetree/bindings/watchdog/fsl-imx- > wdt.yaml not supporting this feature are > * fsl,imx21-wdt > * fsl,imx27-wdt > * fsl,imx31-wdt > * fsl,ls1012a-wdt > * fsl,ls1043a-wdt > ? yes, you are correct. > > But all models are listed as compatible to fsl,imx21-wdt. So there is > something wrong here. IMHO this sounds like the compatible list has to be > split and updated. Depending on that this feature can be detected. Maintaining > another list seems error prone to me. > So basically the compatible lists would be split into two groups, one for the devices which support this WDW bit and the rest which don't support this? You got a point here, but...this means that every processors device-tree, which has two compatible strings (with "fsl,imx21-wdt") should be updated, right? That sounds like quite a lot of changes, which I'd like to avoid if possible. Best regards, Andrej > Best regards, > Alexander > >> static bool nowayout = WATCHDOG_NOWAYOUT; >> @@ -129,6 +151,9 @@ static inline void imx2_wdt_setup(struct watchdog_device >> *wdog) >> >> /* Suspend timer in low power mode, write once-only */ >> val |= IMX2_WDT_WCR_WDZST; >> + /* Suspend timer in low power WAIT mode, write once-only */ >> + if (wdev->sleep_wait) >> + val |= IMX2_WDT_WCR_WDW; >> /* Strip the old watchdog Time-Out value */ >> val &= ~IMX2_WDT_WCR_WT; >> /* Generate internal chip-level reset if WDOG times out */ >> @@ -313,6 +338,18 @@ static int __init imx2_wdt_probe(struct platform_device >> *pdev) >> >> wdev->ext_reset = of_property_read_bool(dev->of_node, >> "fsl,ext- > reset-output"); >> + >> + if (of_property_read_bool(dev->of_node, "fsl,suspend-in-wait")) >> + if (of_device_compatible_match(dev->of_node, > wdw_boards)) >> + wdev->sleep_wait = 1; >> + else { >> + dev_warn(dev, "Warning: Suspending watchdog > during " \ >> + "WAIT mode is not supported for > this device.\n"); >> + wdev->sleep_wait = 0; >> + } >> + else >> + wdev->sleep_wait = 0; >> + >> /* >> * The i.MX7D doesn't support low power mode, so we need to ping > the >> watchdog * during suspend. > > > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel