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 A40DAC001DE for ; Mon, 24 Jul 2023 07:41:23 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D841B8680B; Mon, 24 Jul 2023 09:41:21 +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=1690184481; bh=z70DCZ+xaKI3kMSWqWWw2QvvEU8XqGoMvMQJbtrsXnM=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=en4SB7aWJJptL7DgPDFqANz1ZMjytwW8ummPPdgoGqqKNeYeDgAxSRsKg53f6Ksft DXc6/XXRQwzR4/rvwmEoQ+90Tow9PzAJtaDmubUVOVvDIm4aMw+paSh95xYBJD4UzW pfhMmk86u9WODiUmeF/0N3Bfod/O1EZ1EoNRmt39zXbpYVF/FLnSwkS9v6MpegTNCj tYeGiYIGxetZ9zd6KY8DXc8b+RJZM70/MmAsadMF3V2pNrDLLpXmwyxSdWjxKbozAE NB1nkNNfcnIarun+wid/N9UxPAbXOPilEwQRvhT88dyKoF0tx/R58ssh0GEPCRCdZ5 nzeTRgw3F03aA== Received: by phobos.denx.de (Postfix, from userid 109) id 5F74386829; Mon, 24 Jul 2023 09:41:21 +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 0F361865D0 for ; Mon, 24 Jul 2023 09:41:19 +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 smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::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-204.mailbox.org (Postfix) with ESMTPS id 4R8XCd1DQdz9sQw; Mon, 24 Jul 2023 09:41:17 +0200 (CEST) Message-ID: Date: Mon, 24 Jul 2023 09:41:16 +0200 MIME-Version: 1.0 Subject: Re: [PATCH v3 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: <20230724064915.56445-1-angelo@kernel-space.org> <20230724064915.56445-3-angelo@kernel-space.org> From: Stefan Roese In-Reply-To: <20230724064915.56445-3-angelo@kernel-space.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4R8XCd1DQdz9sQw 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/24/23 08:49, Angelo Dureghello wrote: > Move watchdog functions inside a separate watchdog driver. > > Signed-off-by: Angelo Dureghello Reviewed-by: Stefan Roese Thanks, Stefan > --- > Changes for v2: > - none > Changes for v3: > - none > --- > 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(-) > > 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