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 1FBB8ECAAD8 for ; Wed, 21 Sep 2022 06:27:01 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A8CC784B73; Wed, 21 Sep 2022 08:26:51 +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=1663741612; bh=a3gj7am63RfFSmIIU+3QDK8DHD/26oVnFWw1KKi0UVs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=S6U8YOgwy7U0phEqLt697moW0iqlq33K4yKMW8Zs4mjxX/bL4K0XKjFhHsWYBlnBt G5DxFaE8+KUAqESSLomtWAmkpcQl3AWiczDQ5N7ltAduIQ4tRn0u2Gk+sNcKPDaxdC ge/D/jnGYd/S5Uyn6dW5fI0HLQihBdetPEMjbbyGTNZZMsfhi0nJGirB+QgRseM2Cc TPbOpSqFfKBmZQr5nyXARO2ixKVgZH/My90IWCUgw5JBitBf/6gDaHCuHecvaraOwF M3x6kP82gLa9q2mTq5xQf35UG9gr1MJX8JMWYZCk/NfgB7cI6pCRHj6jd2BUt7lSk/ 2WfMIENN1IYIQ== Received: by phobos.denx.de (Postfix, from userid 109) id 1C88A84609; Wed, 21 Sep 2022 08:26:48 +0200 (CEST) Received: from mout-u-204.mailbox.org (mout-u-204.mailbox.org [80.241.59.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 1AEEC84915 for ; Wed, 21 Sep 2022 08:26:46 +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 smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1]) (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 4MXT2r1dXXz9sTn; Wed, 21 Sep 2022 08:26:44 +0200 (CEST) From: Stefan Roese To: u-boot@lists.denx.de Cc: Michael Walle , =?UTF-8?q?Pali=20Roh=C3=A1r?= Subject: [PATCH 2/2] timer: orion-timer: Only init timer once Date: Wed, 21 Sep 2022 08:26:42 +0200 Message-Id: <20220921062642.910994-2-sr@denx.de> In-Reply-To: <20220921062642.910994-1-sr@denx.de> References: <20220921062642.910994-1-sr@denx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 Move the code making sure that the timer is initialized only once into orion_timer_init(), which is called from timer_early_init() and from orion_timer_probe(). This way the timer is not re-initialized. Signed-off-by: Stefan Roese Cc: Michael Walle Cc: Pali Rohár --- drivers/timer/orion-timer.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/timer/orion-timer.c b/drivers/timer/orion-timer.c index cd63ea916237..d0eab3ce781d 100644 --- a/drivers/timer/orion-timer.c +++ b/drivers/timer/orion-timer.c @@ -28,6 +28,11 @@ static bool early_init_done __section(".data") = false; /* Common functions for early (boot) and DM based timer */ static void orion_timer_init(void *base, enum input_clock_type type) { + /* Only init the timer once */ + if (early_init_done) + return; + early_init_done = true; + writel(~0, base + TIMER0_VAL); writel(~0, base + TIMER0_RELOAD); @@ -51,11 +56,6 @@ static uint64_t orion_timer_get_count(void *base) /* Early (e.g. bootstage etc) timer functions */ static void notrace timer_early_init(void) { - /* Only init the timer once */ - if (early_init_done) - return; - early_init_done = true; - if (IS_ENABLED(CONFIG_ARCH_MVEBU)) orion_timer_init((void *)MVEBU_TIMER_BASE, INPUT_CLOCK_25MHZ); else -- 2.37.3