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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 39A9BC001DC for ; Mon, 31 Jul 2023 07:24:27 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EC7BA8699C; Mon, 31 Jul 2023 09:24:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1690788265; bh=7GBRgmXML21o366Tn+JXtWlRNYZWDN6wFTzGVjLDDcw=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=0FbEdSikF0FOrKV7hw0i8B+0ERxqZpUZkfL90Kh7K+c1vww0BHDCknuaqegUAptqD M8uXEhPxZuz+7iteWV4WcndtuQjMferOvUYCJvcJACPti/CygeCN0HgDMl20OQxJei /DxkK6LhZMDuzGxuja2UPYmil8OoyU4ayK1Evu2dGC+MUzTB+Vb/Ly/VA2w1egmaRE ylT9wqH6aL5Pgnu4akPN227CMAV6VzzfvKD4olXfQiTIDIyCo/uRubpGEKev7xnR+x aK922liY7Vdk4N1lnnZmJhqR4oDpE1ms3Sc+6FAieYsKLjEfS4cy1jDTrx5CBEe5sP MjigyklEZD/tQ== Received: by phobos.denx.de (Postfix, from userid 109) id BE2BC8688B; Mon, 31 Jul 2023 09:24:22 +0200 (CEST) Received: from mout-u-204.mailbox.org (mout-u-204.mailbox.org [IPv6:2001:67c:2050:101:465::204]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 942728688B for ; Mon, 31 Jul 2023 09:24:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sr@denx.de Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-204.mailbox.org (Postfix) with ESMTPS id 4RDqVm4y4Fz9sQp; Mon, 31 Jul 2023 09:24:16 +0200 (CEST) Message-ID: <7aedddfa-0557-28a8-07b7-2f5f350dda09@denx.de> Date: Mon, 31 Jul 2023 09:24:16 +0200 MIME-Version: 1.0 Subject: Re: [PATCH] watchdog: ftwdt010: need to reset watchdog in ftwdt010_wdt_start() Content-Language: en-US To: Sergei Antonov , u-boot@lists.denx.de References: <20230730171416.1568607-1-saproj@gmail.com> From: Stefan Roese In-Reply-To: <20230730171416.1568607-1-saproj@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4RDqVm4y4Fz9sQp X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean On 7/30/23 19:14, Sergei Antonov wrote: > ftwdt010_wdt_start() has to call ftwdt010_wdt_reset() after setting-up > the timeout in the same fashion ftwdt010_wdt_expire_now() does it. > > Without this patch the "wdt start " command does not actually start > the watchdog timer until the "wdt reset" command is executed. > > Signed-off-by: Sergei Antonov Reviewed-by: Stefan Roese Thanks, Stefan > --- > drivers/watchdog/ftwdt010_wdt.c | 40 +++++++++++++++++---------------- > 1 file changed, 21 insertions(+), 19 deletions(-) > > diff --git a/drivers/watchdog/ftwdt010_wdt.c b/drivers/watchdog/ftwdt010_wdt.c > index a6b33b17209d..1f5f301b1251 100644 > --- a/drivers/watchdog/ftwdt010_wdt.c > +++ b/drivers/watchdog/ftwdt010_wdt.c > @@ -25,8 +25,27 @@ struct ftwdt010_wdt_priv { > struct ftwdt010_wdt __iomem *regs; > }; > > +static int ftwdt010_wdt_reset(struct udevice *dev) > +{ > + struct ftwdt010_wdt_priv *priv = dev_get_priv(dev); > + struct ftwdt010_wdt *wd = priv->regs; > + > + debug("Reset WDT..\n"); > + > + /* clear control register */ > + writel(0, &wd->wdcr); > + > + /* Write Magic number */ > + writel(FTWDT010_WDRESTART_MAGIC, &wd->wdrestart); > + > + /* Enable WDT */ > + writel(FTWDT010_WDCR_RST | FTWDT010_WDCR_ENABLE, &wd->wdcr); > + > + return 0; > +} > + > /* > - * Set the watchdog time interval. > + * Set the watchdog time interval and start the timer. > * Counter is 32 bit. > */ > static int ftwdt010_wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags) > @@ -52,24 +71,7 @@ static int ftwdt010_wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags) > > writel(reg, &wd->wdload); > > - return 0; > -} > - > -static int ftwdt010_wdt_reset(struct udevice *dev) > -{ > - struct ftwdt010_wdt_priv *priv = dev_get_priv(dev); > - struct ftwdt010_wdt *wd = priv->regs; > - > - /* clear control register */ > - writel(0, &wd->wdcr); > - > - /* Write Magic number */ > - writel(FTWDT010_WDRESTART_MAGIC, &wd->wdrestart); > - > - /* Enable WDT */ > - writel((FTWDT010_WDCR_RST | FTWDT010_WDCR_ENABLE), &wd->wdcr); > - > - return 0; > + return ftwdt010_wdt_reset(dev); > } > > static int ftwdt010_wdt_stop(struct udevice *dev) Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de