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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68B9DC433FE for ; Wed, 19 Oct 2022 15:40:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231722AbiJSPkS (ORCPT ); Wed, 19 Oct 2022 11:40:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232145AbiJSPi5 (ORCPT ); Wed, 19 Oct 2022 11:38:57 -0400 Received: from mail-oi1-x22d.google.com (mail-oi1-x22d.google.com [IPv6:2607:f8b0:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8B9611D9AB; Wed, 19 Oct 2022 08:35:04 -0700 (PDT) Received: by mail-oi1-x22d.google.com with SMTP id w196so19629996oiw.8; Wed, 19 Oct 2022 08:35:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=laOx8JEUkYOBVsrZgeUaM0M4fbp7OLGnhupIrYPqb4w=; b=RrQWM8yAa/UvluekZaABCeB0Aj49W8VpK7/qpWX2XyabhBVIJvyvImRc16Kl82x/uo 5R+MTXu1XvFUSP6G6VbvChnhXMP8cM0E51V1JhLmDEyblBauJ/cKBTUS6HI82gLxRAqS mkeBpyf4OH9NkCQnbK1tuYa1ZGhftb4k0C3HiQIMxxniZNH1WzgF6LkbO9PDHgsz6kcC Tg6GLPCG2shArlndJslH2NaHOjE2wHOIjv/dZrZ42KyQlm7mXZa0+ptZ70uj+uheX4/p ee9PwIFwCvZww9BCYZvKcXBXCakOWaaiTp8xsCYPNa7jpKqiFkaCN/gVyM+VJG+u6G91 fosw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=laOx8JEUkYOBVsrZgeUaM0M4fbp7OLGnhupIrYPqb4w=; b=vnooGYSHblFoi+DiJcXM+LVwVo5D8/2Z/9HfEWzSS+U6LCiQvekaxPHLd7Nyf49tAs g02c2WLJhZITMmYW4uHLU4vFOeuUKKKtz5IuC7tRq4Z4oYpzEGJ0/IsBJpeRIBCc8RiH GGUGOwtPeuX6wHIZokGupk0L4UjpK01vy98h4pNFoakO9uIi8qYHChZKkdlep9ffLfZB HvGvN9aYJDXbD+dp6Nlx1SsOwYiwQ0vTX04j24THZLANaxK+cAWZEJf4ytSlQki50Wvm oc9YWfDRD0cHT2H5azUgAlG2p9V6m+sa36Akbhn47QSHP8hq2gShniaMnVrldwIEP7lK beUQ== X-Gm-Message-State: ACrzQf3H4enb/erunmPhxtXIgqW/wdxKGbu8CnVcSey3oIn7qsWpgaF0 HrNMDj6f2/qKl32uD9fI1/M= X-Google-Smtp-Source: AMsMyM7S1b7Sbh6MAlG1ceyYKGiYGhaEiw1qbNfnuu1w0Mxwzi9gAiWFmoQkB+AdGBRzHRfgyzfBSA== X-Received: by 2002:a05:6808:221b:b0:354:cca5:9215 with SMTP id bd27-20020a056808221b00b00354cca59215mr4756130oib.53.1666193589306; Wed, 19 Oct 2022 08:33:09 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id bd40-20020a056870d7a800b0012d6f3d370bsm7507906oab.55.2022.10.19.08.33.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Oct 2022 08:33:07 -0700 (PDT) Sender: Guenter Roeck Date: Wed, 19 Oct 2022 08:33:06 -0700 From: Guenter Roeck To: Andrej Picej Cc: linux-watchdog@vger.kernel.org, shawnguo@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-imx@nxp.com, festevam@gmail.com, kernel@pengutronix.de, s.hauer@pengutronix.de, wim@linux-watchdog.org, robh+dt@kernel.org Subject: Re: [PATCH 1/3] watchdog: imx2_wdg: suspend watchdog in WAIT mode Message-ID: <20221019153306.GC4602@roeck-us.net> References: <20221019111714.1953262-1-andrej.picej@norik.com> <20221019111714.1953262-2-andrej.picej@norik.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221019111714.1953262-2-andrej.picej@norik.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 19, 2022 at 01:17:12PM +0200, Andrej Picej wrote: > 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". > Does that have any impact on suspend/resume handling in the driver, specifically with the "no_ping" variable used for fsl,imx7d-wdt ? Thanks, Guenter > Signed-off-by: Andrej Picej > --- > drivers/watchdog/imx2_wdt.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c > index d0c5d47ddede..150ba83ce176 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,7 @@ struct imx2_wdt_device { > bool ext_reset; > bool clk_is_on; > bool no_ping; > + bool sleep_wait; > }; > > static bool nowayout = WATCHDOG_NOWAYOUT; > @@ -129,6 +131,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 +318,8 @@ 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->sleep_wait = of_property_read_bool(dev->of_node, > + "fsl,suspend-in-wait"); > /* > * The i.MX7D doesn't support low power mode, so we need to ping the watchdog > * during suspend. > -- > 2.25.1 > 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 146DCC433FE for ; Wed, 19 Oct 2022 15:50:26 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iReJQn3bjHGGbyfU3jU3dd6xsiQnq4loT36+3nVjbmM=; b=Bt1M3vwpHL0z5q Q7GQzsjKUTPAZxOQ2WcmIcOg9hcZ4gLsjFHhWTnxlxzKSRjJMXG7tF0HG7WWZxWPXTIbgulk2dXaC AO8uHdHYeoaGKh+G4L0uxpolkm+2tdmEj2e84KWtbFbsGB397M7DT6in0uK0RbrlD8XfxJPT/Eduz 6G2TOC5GECysrW7ONs7RAmAn0HYtNhbrGuT6+p4Ki5ld9C908PiQ5nBsJVxSN/HQ7K2uyX/dDICem x4vTUoldinW2n0yYiBSP+pE7y7YROnklvsaGeX6BJmRvgdAmUOPQe5KpT/PuKGr8ig8C3UpfbpZaX ibNq5wUWFBvVH9OU54FQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1olBJb-003UIv-Q7; Wed, 19 Oct 2022 15:49:09 +0000 Received: from mail-oi1-x233.google.com ([2607:f8b0:4864:20::233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1olB4C-003Imj-QX for linux-arm-kernel@lists.infradead.org; Wed, 19 Oct 2022 15:33:14 +0000 Received: by mail-oi1-x233.google.com with SMTP id n83so19618556oif.11 for ; Wed, 19 Oct 2022 08:33:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=laOx8JEUkYOBVsrZgeUaM0M4fbp7OLGnhupIrYPqb4w=; b=RrQWM8yAa/UvluekZaABCeB0Aj49W8VpK7/qpWX2XyabhBVIJvyvImRc16Kl82x/uo 5R+MTXu1XvFUSP6G6VbvChnhXMP8cM0E51V1JhLmDEyblBauJ/cKBTUS6HI82gLxRAqS mkeBpyf4OH9NkCQnbK1tuYa1ZGhftb4k0C3HiQIMxxniZNH1WzgF6LkbO9PDHgsz6kcC Tg6GLPCG2shArlndJslH2NaHOjE2wHOIjv/dZrZ42KyQlm7mXZa0+ptZ70uj+uheX4/p ee9PwIFwCvZww9BCYZvKcXBXCakOWaaiTp8xsCYPNa7jpKqiFkaCN/gVyM+VJG+u6G91 fosw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=laOx8JEUkYOBVsrZgeUaM0M4fbp7OLGnhupIrYPqb4w=; b=VE/4kgKFAkg8YwQvKPgDROHOLFoEUEWiboy6Jec9PElejXrKo8nYqo9k/kyZrCvTSi NtS8O8R31kcTPb85bqVu82sl/0JLpxoHekuCsR8rGcAHthnCMYR7nlc514a64CQ0itdM j/ulbxRO9Dehkaq1tVWeZBng56d/MrkN8Z6zTBqDanBuqurcEJKWHMXw8BI1fag8mVAD QAPsZO4kcWkLh07JG+m+1c9QuG6e1RlEFiuxIFG12NCixJU7bBxjVGXOsXGkBRt7R8HR 09kmEDIm/E2iZdsZ/3aIS5cydLTuEH4PQVFsYw5F8OT+axR+ymDem1cEcMFG4usWacqs 3AKA== X-Gm-Message-State: ACrzQf1zWw+iRi4SrCyVv27FgrEIVrIqi6ERrNBwynnEdvJv56cuDxEY VOu4/pIB/TneYe85zb3xtIc= X-Google-Smtp-Source: AMsMyM7S1b7Sbh6MAlG1ceyYKGiYGhaEiw1qbNfnuu1w0Mxwzi9gAiWFmoQkB+AdGBRzHRfgyzfBSA== X-Received: by 2002:a05:6808:221b:b0:354:cca5:9215 with SMTP id bd27-20020a056808221b00b00354cca59215mr4756130oib.53.1666193589306; Wed, 19 Oct 2022 08:33:09 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id bd40-20020a056870d7a800b0012d6f3d370bsm7507906oab.55.2022.10.19.08.33.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Oct 2022 08:33:07 -0700 (PDT) Date: Wed, 19 Oct 2022 08:33:06 -0700 From: Guenter Roeck To: Andrej Picej Cc: linux-watchdog@vger.kernel.org, shawnguo@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-imx@nxp.com, festevam@gmail.com, kernel@pengutronix.de, s.hauer@pengutronix.de, wim@linux-watchdog.org, robh+dt@kernel.org Subject: Re: [PATCH 1/3] watchdog: imx2_wdg: suspend watchdog in WAIT mode Message-ID: <20221019153306.GC4602@roeck-us.net> References: <20221019111714.1953262-1-andrej.picej@norik.com> <20221019111714.1953262-2-andrej.picej@norik.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20221019111714.1953262-2-andrej.picej@norik.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221019_083312_921022_29D75E37 X-CRM114-Status: GOOD ( 23.70 ) 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Oct 19, 2022 at 01:17:12PM +0200, Andrej Picej wrote: > 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". > Does that have any impact on suspend/resume handling in the driver, specifically with the "no_ping" variable used for fsl,imx7d-wdt ? Thanks, Guenter > Signed-off-by: Andrej Picej > --- > drivers/watchdog/imx2_wdt.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c > index d0c5d47ddede..150ba83ce176 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,7 @@ struct imx2_wdt_device { > bool ext_reset; > bool clk_is_on; > bool no_ping; > + bool sleep_wait; > }; > > static bool nowayout = WATCHDOG_NOWAYOUT; > @@ -129,6 +131,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 +318,8 @@ 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->sleep_wait = of_property_read_bool(dev->of_node, > + "fsl,suspend-in-wait"); > /* > * The i.MX7D doesn't support low power mode, so we need to ping the watchdog > * during suspend. > -- > 2.25.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel