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 457E4C32771 for ; Wed, 21 Sep 2022 14:07:59 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 58A4C84CC1; Wed, 21 Sep 2022 16:06:56 +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=1663769216; bh=sHvRAbGiqo7i7gGZiETrjekw260KJsmm2hFhRdG1E8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=e6ZpdY+7v/RBvF7lyiy77wrMPc4eepTq7kl8kWH9r8E97dGVSM+7V/7ROlt4X4G+S jn48BYQypPGUvCrU6yO5eGWNS1jbg43TWqU+O2bnuKnDZoU4bTU2CEoCNp65xcUopL EBfTBMhCiZl3dVHev8BZCO32anAngfsmaHH1wo7LJrxNQYM0H3N+WEqPBrKZGl4woM jsxT3KbITHcIKXb9XC9Lhllf2El7yhUGVGGfboyiVo4Zy89dWM6w28tHTvOfLUWz21 0PC+2ZuS/zSRrqS6FQ8K3MoO/6a+Jd/N3JYlWJY5mUt7xCzz+pSWAoOLcBQ2GAWY6N +d+iRlCuVptPA== Received: by phobos.denx.de (Postfix, from userid 109) id D9B1284BB3; Wed, 21 Sep 2022 16:06:40 +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 3C7CC84CA5 for ; Wed, 21 Sep 2022 16:06:32 +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 smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::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 4MXgFL2MzWz9sW5; Wed, 21 Sep 2022 16:06:30 +0200 (CEST) From: Stefan Roese To: u-boot@lists.denx.de Cc: sjg@chromium.org, trini@konsulko.com Subject: [PATCH 08/10] board_f/r: Don't call timer_init() when TIMER is enabled Date: Wed, 21 Sep 2022 16:06:23 +0200 Message-Id: <20220921140625.999002-9-sr@denx.de> In-Reply-To: <20220921140625.999002-1-sr@denx.de> References: <20220921140625.999002-1-sr@denx.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4MXgFL2MzWz9sW5 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 The timer initialization is done implicitly when CONFIG_TIMER is enabled. There is no need to re-configure the timer again. Even worse, another call to the timer init function may lead to a re-init of the counter register and therefore non consecutive timer values. This patch makes sure, that timer_init() is not called in case that CONFIG_TIMER is configured. Signed-off-by: Stefan Roese --- common/board_f.c | 2 +- common/board_r.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/common/board_f.c b/common/board_f.c index b1f67bfa72aa..fbc5d3e9d205 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -851,7 +851,7 @@ static const init_fnc_t init_sequence_f[] = { /* get CPU and bus clocks according to the environment variable */ get_clocks, /* get CPU and bus clocks (etc.) */ #endif -#if !defined(CONFIG_M68K) +#if !defined(CONFIG_M68K) && !IS_ENABLED(CONFIG_TIMER) timer_init, /* initialize timer */ #endif #if defined(CONFIG_BOARD_POSTCLK_INIT) diff --git a/common/board_r.c b/common/board_r.c index 56575e552df8..149cfdc3d351 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -745,7 +745,8 @@ static init_fnc_t init_sequence_r[] = { kgdb_init, #endif interrupt_init, -#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_M68K) +#if (defined(CONFIG_MICROBLAZE) || defined(CONFIG_M68K)) && \ + !IS_ENABLED(CONFIG_TIMER) timer_init, /* initialize timer */ #endif #if defined(CONFIG_LED_STATUS) -- 2.37.3