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 A8B9EEB64DA for ; Tue, 18 Jul 2023 12:25:28 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 614D0866B9; Tue, 18 Jul 2023 14:25:26 +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=1689683126; bh=ThmxT5J0c8EDw2J4mr8AUPcTDxOEOfT8stCUsI6P+20=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=bz9gLhLndr6OKhBIiZFWA2zJNyWPtu+mgm4FqfXt7GWXUR1Qz5bbv8GtQjtS5qQ9B q6B+5FKKpIGUbWH2lFGlbP566+HGNNP2v+zENGOrU616O2yKNyNfeEjfFFmhOS/Zf+ F64KJwQotaAxfzvBm1tQPL74ZB5IrtXlqYLsZejjk3BVohEkHs9+MzcIxxngq37gZi p6GULiHhPeZbD+mt8+DYYUt9mFp5lb0ZsO8HtRsqKkO247I6JG+VHlWllttdLL5III EEqfXOBsWB4ZV1A+DzovWwueU1gnqOPvkbWioT/VIipQiQWtULsdiAfQdOIqiHvCnF a6q3dm4oYh+pQ== Received: by phobos.denx.de (Postfix, from userid 109) id C24B2866C9; Tue, 18 Jul 2023 14:25:24 +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 8D045866B2 for ; Tue, 18 Jul 2023 14:25:22 +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 smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (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 4R4yp84lwZz9sRt; Tue, 18 Jul 2023 14:25:20 +0200 (CEST) Message-ID: Date: Tue, 18 Jul 2023 14:25:20 +0200 MIME-Version: 1.0 Subject: Re: [PATCH 2/5] m68k: move watchdog functions in mcf_wdt driver Content-Language: en-US To: Angelo Dureghello , trini@konsulko.com Cc: u-boot@lists.denx.de References: <20230625193521.981846-1-angelo@kernel-space.org> <20230625193521.981846-3-angelo@kernel-space.org> From: Stefan Roese In-Reply-To: <20230625193521.981846-3-angelo@kernel-space.org> 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.8 at phobos.denx.de X-Virus-Status: Clean On 6/25/23 21:35, Angelo Dureghello wrote: > Move watchdog functions inside a separate watchdog driver. > > Signed-off-by: Angelo Dureghello > --- > arch/m68k/cpu/mcf523x/cpu.c | 42 --------------------------------- > arch/m68k/cpu/mcf52x2/cpu.c | 47 +------------------------------------ > arch/m68k/cpu/mcf532x/cpu.c | 44 ---------------------------------- > 3 files changed, 1 insertion(+), 132 deletions(-) Now this is a nice diff-stat. Thanks for cleaning this up and moving all this stuff into the watchdog driver. And again, please double-check, if the hw_foo stuff (now in the wdt driver) can be completely removed. Reviewed-by: Stefan Roese Thanks, Stefan > diff --git a/arch/m68k/cpu/mcf523x/cpu.c b/arch/m68k/cpu/mcf523x/cpu.c > index ba2c228911..bef67767b4 100644 > --- a/arch/m68k/cpu/mcf523x/cpu.c > +++ b/arch/m68k/cpu/mcf523x/cpu.c > @@ -12,7 +12,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -62,47 +61,6 @@ int print_cpuinfo(void) > }; > #endif /* CONFIG_DISPLAY_CPUINFO */ > > -#if defined(CONFIG_WATCHDOG) > -/* Called by macro WATCHDOG_RESET */ > -void watchdog_reset(void) > -{ > - wdog_t *wdp = (wdog_t *) (MMAP_WDOG); > - > - /* Count register */ > - out_be16(&wdp->sr, 0x5555); > - asm("nop"); > - out_be16(&wdp->sr, 0xaaaa); > -} > - > -int watchdog_disable(void) > -{ > - wdog_t *wdp = (wdog_t *) (MMAP_WDOG); > - > - /* UserManual, once the wdog is disabled, wdog cannot be re-enabled */ > - /* halted watchdog timer */ > - setbits_be16(&wdp->cr, WTM_WCR_HALTED); > - > - puts("WATCHDOG:disabled\n"); > - return (0); > -} > - > -int watchdog_init(void) > -{ > - wdog_t *wdp = (wdog_t *) (MMAP_WDOG); > - u32 wdog_module = 0; > - > - /* set timeout and enable watchdog */ > - wdog_module = ((CFG_SYS_CLK / CONFIG_SYS_HZ) * CONFIG_WATCHDOG_TIMEOUT_MSECS); > - wdog_module |= (wdog_module / 8192); > - out_be16(&wdp->mr, wdog_module); > - > - out_be16(&wdp->cr, WTM_WCR_EN); > - puts("WATCHDOG:enabled\n"); > - > - return (0); > -} > -#endif /* CONFIG_WATCHDOG */ > - > #if defined(CONFIG_MCFFEC) > /* Default initializations for MCFFEC controllers. To override, > * create a board-specific function called: > diff --git a/arch/m68k/cpu/mcf52x2/cpu.c b/arch/m68k/cpu/mcf52x2/cpu.c > index d7cbf11e25..5042a38b3e 100644 > --- a/arch/m68k/cpu/mcf52x2/cpu.c > +++ b/arch/m68k/cpu/mcf52x2/cpu.c > @@ -17,7 +17,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -53,51 +52,7 @@ int print_cpuinfo(void) > return 0; > }; > #endif /* CONFIG_DISPLAY_CPUINFO */ > - > -#if defined(CONFIG_WATCHDOG) > -/* Called by macro WATCHDOG_RESET */ > -void watchdog_reset(void) > -{ > - wdog_t *wdt = (wdog_t *)(MMAP_WDOG); > - > - out_be16(&wdt->sr, 0x5555); > - out_be16(&wdt->sr, 0xaaaa); > -} > - > -int watchdog_disable(void) > -{ > - wdog_t *wdt = (wdog_t *)(MMAP_WDOG); > - > - /* reset watchdog counter */ > - out_be16(&wdt->sr, 0x5555); > - out_be16(&wdt->sr, 0xaaaa); > - /* disable watchdog timer */ > - out_be16(&wdt->cr, 0); > - > - puts("WATCHDOG:disabled\n"); > - return (0); > -} > - > -int watchdog_init(void) > -{ > - wdog_t *wdt = (wdog_t *)(MMAP_WDOG); > - > - /* disable watchdog */ > - out_be16(&wdt->cr, 0); > - > - /* set timeout and enable watchdog */ > - out_be16(&wdt->mr, > - (CONFIG_WATCHDOG_TIMEOUT_MSECS * CONFIG_SYS_HZ) / (32768 * 1000) - 1); > - > - /* reset watchdog counter */ > - out_be16(&wdt->sr, 0x5555); > - out_be16(&wdt->sr, 0xaaaa); > - > - puts("WATCHDOG:enabled\n"); > - return (0); > -} > -#endif /* #ifdef CONFIG_WATCHDOG */ > -#endif /* #ifdef CONFIG_M5208 */ > +#endif /* #ifdef CONFIG_M5208 */ > > #ifdef CONFIG_M5271 > #if defined(CONFIG_DISPLAY_CPUINFO) > diff --git a/arch/m68k/cpu/mcf532x/cpu.c b/arch/m68k/cpu/mcf532x/cpu.c > index 548cbca36a..18d20a8926 100644 > --- a/arch/m68k/cpu/mcf532x/cpu.c > +++ b/arch/m68k/cpu/mcf532x/cpu.c > @@ -12,7 +12,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -102,49 +101,6 @@ int print_cpuinfo(void) > }; > #endif /* CONFIG_DISPLAY_CPUINFO */ > > -#if defined(CONFIG_WATCHDOG) > -/* Called by macro WATCHDOG_RESET */ > -void watchdog_reset(void) > -{ > - wdog_t *wdp = (wdog_t *) (MMAP_WDOG); > - > - /* Count register */ > - out_be16(&wdp->sr, 0x5555); > - out_be16(&wdp->sr, 0xaaaa); > -} > - > -int watchdog_disable(void) > -{ > - wdog_t *wdp = (wdog_t *) (MMAP_WDOG); > - > - /* UserManual, once the wdog is disabled, wdog cannot be re-enabled */ > - /* halted watchdog timer */ > - setbits_be16(&wdp->cr, WTM_WCR_HALTED); > - > - puts("WATCHDOG:disabled\n"); > - return (0); > -} > - > -int watchdog_init(void) > -{ > - wdog_t *wdp = (wdog_t *) (MMAP_WDOG); > - u32 wdog_module = 0; > - > - /* set timeout and enable watchdog */ > - wdog_module = ((CFG_SYS_CLK / 1000) * CONFIG_WATCHDOG_TIMEOUT_MSECS); > -#ifdef CONFIG_M5329 > - out_be16(&wdp->mr, wdog_module / 8192); > -#else > - out_be16(&wdp->mr, wdog_module / 4096); > -#endif > - > - out_be16(&wdp->cr, WTM_WCR_EN); > - puts("WATCHDOG:enabled\n"); > - > - return (0); > -} > -#endif /* CONFIG_WATCHDOG */ > - > #if defined(CONFIG_MCFFEC) > /* Default initializations for MCFFEC controllers. To override, > * create a board-specific function called: 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