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 20ADAECAAA1 for ; Thu, 15 Sep 2022 05:02:35 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0A7AD84A4D; Thu, 15 Sep 2022 07:02:33 +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=1663218153; bh=OYMtdfLV6ubBTpgjbUYUXKR1zh+p1GhuwtLJwDGxdvc=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=d8ekSEynDR1SxsM+CqAUimxfaEfo1eBvtY142Y+5RJ44iNSv4628CaJwDc0PfpoHI cONRlvsrK/PMTcOULZnPbLhhVL/O6MCZtRCliFiJ8rTSfMzXJRW7f2er3TpymekGyQ Q0MMY9DvjZTdRhV9VrNQIbgCQvrfUojD6O207RS3dXNoKcq0Ekq9BLmjEqIpfFx/dV Dd6B98R+Sq5OsOLIgTEqInSA+N/fiBHXN3IQC+CFR8DOYg4pgrbsOBm6xD/f2ISHJ5 tWJ0LAcouUVLfvw7odjRn31j8oFU5t2zcp1DqEfPkN8uD/7ACI7TlXOQOeD/2kQ8Fy U0BgvRBvTlFqQ== Received: by phobos.denx.de (Postfix, from userid 109) id 0B7E684355; Thu, 15 Sep 2022 07:02:31 +0200 (CEST) Received: from mout-u-107.mailbox.org (mout-u-107.mailbox.org [80.241.59.207]) (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 AB60384355 for ; Thu, 15 Sep 2022 07:02:28 +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 smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (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-107.mailbox.org (Postfix) with ESMTPS id 4MSlSL5yLqz9sSG; Thu, 15 Sep 2022 07:02:26 +0200 (CEST) Message-ID: <2a04086c-eb95-a077-976e-575475c09758@denx.de> Date: Thu, 15 Sep 2022 07:02:24 +0200 MIME-Version: 1.0 Subject: Re: [PATCH v1] wdt: nuvoton: add expire function for generic reset Content-Language: en-US To: Jim Liu , Jim Liu , Stanley Chu , u-boot@lists.denx.de, KWLIU@nuvoton.com References: <20220913061924.5502-1-JJLIU0@nuvoton.com> From: Stefan Roese In-Reply-To: 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 Hi Jim, On 15.09.22 04:35, Jim Liu wrote: > Hi Stefan Roese > > Thanks for your review. > Here is my log from uboot master. > And i add the debug log as below: > > ----------------------------------------------- > U-Boot 2022.10-rc4-00038-ge3fce5e560-dirty (Sep 15 2022 - 09:58:25 +0800) > > CPU: NPCM750 A1 @ Model: Nuvoton npcm750 Development Board (Device Tree) > DRAM: 464 MiB > RNG: NPCM RNG module bind OK > OTP: NPCM OTP module bind OK > AES: NPCM AES module bind OK > SHA: NPCM SHA module bind OK > Core: 210 devices, 22 uclasses, devicetree: separate > WDT: Started watchdog@801C without servicing (60s timeout) > MMC: sdhci0@f0842000: 0 > Loading Environment from SPIFlash... SF: Detected mx66l51235l with > page size 256 Bytes, erase size 64 KiB, total 64 MiB > OK > In: serial@1000 > Out: serial@1000 > Err: serial@1000 > Net: eth0: eth@f0802000, eth1: eth@f0825000 > Hit any key to stop autoboot: 0 > U-Boot>reset > resetting ... > jim[wdt_reboot_request] > jim[npcm_wdt_expire_now] > jim[npcm_wdt_reset] Interesting. Thanks for sending this log. And what does "wdt expire" say? Thanks, Stefan >> ================================================ >> BootBlock by Nuvoton Technology Corp. Ver 10.10.17 >> ================================================ > > BB Basic > Mar 24 2021 > 12:06:08 > > > > >> CORSTC = 0x4fff9f9d >> WD0RCR = 0x4fff9f9d >> WD1RCR = 0x4fff9f9d >> WD2RCR = 0x4fff9f9d >> SWRSTC1 = 0x4fff9f9d >> SWRSTC2 = 0x4fff9f9d >> SWRSTC3 = 0x4fff9f9d > ---------------------------------------------------- > > If you have any suggestions, please provide to me. > I will follow to modify it. > > Best regards, > Jim > > On Thu, Sep 15, 2022 at 10:23 AM JJLIU0@nuvoton.com wrote: >> >> >> >> -----Original Message----- >> From: Stefan Roese >> Sent: Wednesday, September 14, 2022 2:27 PM >> To: Jim Liu ; CS20 JJLiu0 ; CS20 YSChu ; CS20 KWLiu >> Cc: u-boot@lists.denx.de >> Subject: Re: [PATCH v1] wdt: nuvoton: add expire function for generic reset >> >> On 13.09.22 08:19, Jim Liu wrote: >>> Add expire_now function for generic sysreset request >>> >>> Signed-off-by: Jim Liu >>> --- >>> drivers/watchdog/npcm_wdt.c | 6 ++++++ >>> 1 file changed, 6 insertions(+) >>> >>> diff --git a/drivers/watchdog/npcm_wdt.c b/drivers/watchdog/npcm_wdt.c >>> index 256020f5d3..e56aa0ebe1 100644 >>> --- a/drivers/watchdog/npcm_wdt.c >>> +++ b/drivers/watchdog/npcm_wdt.c >>> @@ -75,6 +75,11 @@ static int npcm_wdt_reset(struct udevice *dev) >>> return 0; >>> } >>> >>> +static int npcm_wdt_expire_now(struct udevice *dev, ulong flags) { >>> + return npcm_wdt_reset(dev); >>> +} >>> + >> >> Does this really work? You are calling the watchdog reset function here in the expire function, which will just reset / trigger the WDT. I would not expect that this will expire the WDT and result in a CPU / SoC reset. >> >> Thanks, >> Stefan >> >>> static int npcm_wdt_of_to_plat(struct udevice *dev) >>> { >>> struct npcm_wdt_priv *priv = dev_get_priv(dev); @@ -87,6 +92,7 @@ >>> static int npcm_wdt_of_to_plat(struct udevice *dev) >>> } >>> >>> static const struct wdt_ops npcm_wdt_ops = { >>> + .expire_now = npcm_wdt_expire_now, >>> .start = npcm_wdt_start, >>> .reset = npcm_wdt_reset, >>> .stop = npcm_wdt_stop, >> >> 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 >> ________________________________ >> ________________________________ >> The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original sender of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such a person, please kindly reply to the sender indicating this fact and delete all copies of it from your computer and network server immediately. Your cooperation is highly appreciated. It is advised that any unauthorized use of confidential information of Nuvoton is strictly prohibited; and any information in this email irrelevant to the official business of Nuvoton shall be deemed as neither given nor endorsed by Nuvoton. 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