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 EAE13C3A59D for ; Mon, 24 Oct 2022 05:26:46 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3BDAE84571; Mon, 24 Oct 2022 07:26:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (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=1666589204; bh=zPXqmHbWBjF6S12+cWNKu8cUhQ/bs+TUoPVeDI8YTDE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=gmNU+SzdJXrld5p4A5J52urPtAYu103NnsX8HtToyeUp2Jut9MVx9g4mFySn48+6j kg7gwWpgmsb6J5TA5LAyG9h47Pls6KjwxmL4PSiNX9u1t12Iu4dtlZWor1KtlzPTbU idJ/Nhz1bUCgxEpFXBkJbhaRObJkPMC4Mp2sNL4QANevrxvQ8pz2uyt42WdSpuHPzt mYVFSWlrfTp6S85Z3bTuFBExX7ZT5tpdJnGA/9j0pU9Ok2bUiMm381UlbBZprAeR1k bg+qZ176Hat3Gn6/DAhs9rmaY6c93dnwQ605xEF3vYsRLOkRzAIIHtHbnm8SvFTh+L TqyzQBHtktXUA== Received: by phobos.denx.de (Postfix, from userid 109) id 60894808A1; Mon, 24 Oct 2022 07:26:42 +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 758F684EF3 for ; Mon, 24 Oct 2022 07:26:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sr@denx.de Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (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 4Mwk8F48Nvz9sNX; Mon, 24 Oct 2022 07:26:37 +0200 (CEST) Message-ID: <10176c4c-114a-2e7b-b984-557feaed7a9e@denx.de> Date: Mon, 24 Oct 2022 07:26:35 +0200 MIME-Version: 1.0 Subject: Re: [PATCH v2 2/4] watchdog: ulp_wdog: Update watchdog driver for imx93 Content-Language: en-US To: "Alice Guo (OSS)" , sbabic@denx.de, festevam@gmail.com, sjg@chromium.org Cc: uboot-imx@nxp.com, u-boot@lists.denx.de References: <20221021084118.2367-1-alice.guo@oss.nxp.com> <20221021084118.2367-3-alice.guo@oss.nxp.com> From: Stefan Roese In-Reply-To: <20221021084118.2367-3-alice.guo@oss.nxp.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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.6 at phobos.denx.de X-Virus-Status: Clean On 21.10.22 10:41, Alice Guo (OSS) wrote: > From: Alice Guo > > The WDOG clocks are sourced from the fixed 32KHz (lpo_clk).When the > timeout period exceeds 2 seconds, the value written to the TOVAL > register is larger than 16-bit can represent. Enabling watchdog > prescaler to solve this problem. > > Signed-off-by: Alice Guo Reviewed-by: Stefan Roese Thanks, Stefan > --- > > Changes for v2: > use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' > > drivers/watchdog/ulp_wdog.c | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > > diff --git a/drivers/watchdog/ulp_wdog.c b/drivers/watchdog/ulp_wdog.c > index 820da0f9dd..17778587ee 100644 > --- a/drivers/watchdog/ulp_wdog.c > +++ b/drivers/watchdog/ulp_wdog.c > @@ -36,6 +36,7 @@ struct wdog_regs { > > #define WDGCS_RCS BIT(10) > #define WDGCS_ULK BIT(11) > +#define WDOG_CS_PRES BIT(12) > #define WDGCS_CMD32EN BIT(13) > #define WDGCS_FLG BIT(14) > > @@ -89,7 +90,12 @@ void hw_watchdog_init(void) > writel(0, &wdog->win); > > /* setting 1-kHz clock source, enable counter running, and clear interrupt */ > - writel((cmd32 | WDGCS_WDGE | WDGCS_WDGUPDATE | (WDG_LPO_CLK << 8) | WDGCS_FLG), &wdog->cs); > + if (IS_ENABLED(CONFIG_ARCH_IMX9)) > + writel((cmd32 | WDGCS_WDGE | WDGCS_WDGUPDATE | (WDG_LPO_CLK << 8) | > + WDGCS_FLG | WDOG_CS_PRES), &wdog->cs); > + else > + writel((cmd32 | WDGCS_WDGE | WDGCS_WDGUPDATE | (WDG_LPO_CLK << 8) | > + WDGCS_FLG), &wdog->cs); > > /* Wait WDOG reconfiguration */ > while (!(readl(&wdog->cs) & WDGCS_RCS)) > @@ -117,11 +123,14 @@ void reset_cpu(void) > while (!(readl(&wdog->cs) & WDGCS_ULK)) > ; > > - hw_watchdog_set_timeout(5); /* 5ms timeout */ > + hw_watchdog_set_timeout(5); /* 5ms timeout for general; 40ms timeout for imx93 */ > writel(0, &wdog->win); > > /* enable counter running */ > - writel((cmd32 | WDGCS_WDGE | (WDG_LPO_CLK << 8)), &wdog->cs); > + if (IS_ENABLED(CONFIG_ARCH_IMX9)) > + writel((cmd32 | WDGCS_WDGE | (WDG_LPO_CLK << 8) | WDOG_CS_PRES), &wdog->cs); > + else > + writel((cmd32 | WDGCS_WDGE | (WDG_LPO_CLK << 8)), &wdog->cs); > > /* Wait WDOG reconfiguration */ > while (!(readl(&wdog->cs) & WDGCS_RCS)) Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de