From mboxrd@z Thu Jan 1 00:00:00 1970 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 A873FEB64DC for ; Sun, 25 Jun 2023 19:36:22 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BD97186237; Sun, 25 Jun 2023 21:36:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=kernel-space.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=kernel-space.org header.i=@kernel-space.org header.b="RL9d1Gik"; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=kernel-space.org header.i=@kernel-space.org header.b="dkcHUSSU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5D95986237; Sun, 25 Jun 2023 21:36:11 +0200 (CEST) Received: from mail.kernel-space.org (unknown [IPv6:2a01:4f8:c2c:5a84::1]) (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 5936B861CA for ; Sun, 25 Jun 2023 21:36:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=kernel-space.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=angelo@kernel-space.org Received: from ziongate (localhost [127.0.0.1]) by ziongate (OpenSMTPD) with ESMTP id 77e615a0; Sun, 25 Jun 2023 19:36:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=simple; d=kernel-space.org; h=from:to :cc:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=default; bh=WX6DbI0kNhCQZZBMd2U66K 1tf9I=; b=RL9d1Gik3r3GBhjxT+FVCcdGHLkovf7KXNk1LP01utbbYhCdn/fiky kaCwf4LHm4WU/irD3Zz00cvf2+W/qMwWB7KEGuI7HKaGYi3RMe4apqS8Qgzlz261 71+w68+HwIbhbJvy5yyB/dYLBIAp8zRGeWsQJ6jBFaxLfOvY8mkLk= DomainKey-Signature: a=rsa-sha1; c=simple; d=kernel-space.org; h=from:to :cc:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; q=dns; s=default; b=E261mfBRKVSENMpt IBcowLCNcqckCSY6v5QcX7pJ8r02BG8SXefvkl9V0UrzqGRDDftSzoylUBJhKU8y 6m8lTwo58KC6KbO0EQlxPZ6PtOJZOb6bzWhufx7YrB3Zuv113GOAibODHxTf7sV4 RuYw3l10Uhj1Ea+c1fpHrslbXlk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-space.org; s=20190913; t=1687721765; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GGNFYFSEABtFQsGAFqsZxcmCeGjLH/uvv7wcWXC1e3U=; b=dkcHUSSUgGqu9jf1j0nTrIJDZS/k/HtKUiVFOTEPU8dbnxlfWpED82J1UEO0pt5TBJg6aH ktZYP+aSuC+h/1Vl+x7pi+3iloJPnoslurxbDurskiuKOrfy9014fz4vYwWy2GF1fInkTt wsJrHyg02wVIodBHjeZuyEcowtJVrWs= Received: from localhost.localdomain (host-79-51-191-2.retail.telecomitalia.it [79.51.191.2]) by ziongate (OpenSMTPD) with ESMTPSA id 6a0360e6 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sun, 25 Jun 2023 19:36:05 +0000 (UTC) From: Angelo Dureghello To: trini@konsulko.com, sr@denx.de Cc: u-boot@lists.denx.de, Angelo Dureghello Subject: [PATCH 2/5] m68k: move watchdog functions in mcf_wdt driver Date: Sun, 25 Jun 2023 21:35:18 +0200 Message-ID: <20230625193521.981846-3-angelo@kernel-space.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230625193521.981846-1-angelo@kernel-space.org> References: <20230625193521.981846-1-angelo@kernel-space.org> MIME-Version: 1.0 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 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(-) 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: -- 2.41.0