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 D1349C32771 for ; Wed, 21 Sep 2022 14:06:50 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 847FC84BB3; Wed, 21 Sep 2022 16:06:41 +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=1663769202; bh=QC+v2R8G14KgojG8Nov118E0cMsuNVBIU5LDjBzXRI0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=W/QrIF3wTZI+DnIqHpTWZH1mNSkJg2So9HM6fAZiFHOgaI9+o4uhTMJTqc0WfZyPa bHL38N9ST9FBdhFz6fiWvbQ/kPW0YiP2461IqL1GvBVmO3eJooxaPOBp/U1ehYcAFT DoPZECLsBZMJ+UBVlFHhkvozlqOZoDAVhSkc6O8ZaI+rjbX4DXwImfuV+Z4pwfIGZW dlFPXPrE31mueGngzBgh8OJl+5Pe4qfL/qyK9GHbN/JC0/xtqV0av8qNpwTipaj8Df fhbK35Krt89Lc/qjlamV1asiA0QkytTXVa2cXhEns4vi4bs96IdmEcmbV6rkT4+yc7 zaw0CXQpW/5Lw== Received: by phobos.denx.de (Postfix, from userid 109) id D9D0484C72; Wed, 21 Sep 2022 16:06:34 +0200 (CEST) Received: from mout-u-107.mailbox.org (mout-u-107.mailbox.org [80.241.59.207]) (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 65F5984C72 for ; Wed, 21 Sep 2022 16:06:29 +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 [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-107.mailbox.org (Postfix) with ESMTPS id 4MXgFH44bXz9sgL; Wed, 21 Sep 2022 16:06:27 +0200 (CEST) From: Stefan Roese To: u-boot@lists.denx.de Cc: sjg@chromium.org, trini@konsulko.com, Jun Nie , Shawn Guo , Fabio Estevam , Stefano Babic Subject: [PATCH 02/10] arm: imx: syscounter: Add timer_early functions Date: Wed, 21 Sep 2022 16:06:17 +0200 Message-Id: <20220921140625.999002-3-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-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 Currently this timer driver provides timer_get_boot_us() to support the BOOTSTAGE functionality. This patch adds the timer_early functions so that the "normal" timer functions can be used, when CONFIG_TIMER_EARLY is enabled. timer_get_boot_us() will get removed in a follow-up patch, once the BOOTSTAGE interface is migrated to timer_get_us(). Signed-off-by: Stefan Roese Cc: Jun Nie Cc: Shawn Guo Cc: Fabio Estevam Cc: Stefano Babic --- arch/arm/mach-imx/syscounter.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/arm/mach-imx/syscounter.c b/arch/arm/mach-imx/syscounter.c index df478a232637..dbe55ee3913d 100644 --- a/arch/arm/mach-imx/syscounter.c +++ b/arch/arm/mach-imx/syscounter.c @@ -109,6 +109,22 @@ ulong timer_get_boot_us(void) return tick_to_time(get_ticks()); } +unsigned long notrace timer_early_get_rate(void) +{ + if (!gd->arch.timer_rate_hz) + timer_init(); + + return gd->arch.timer_rate_hz; +} + +u64 notrace timer_early_get_count(void) +{ + if (!gd->arch.timer_rate_hz) + timer_init(); + + return get_ticks(); +} + void __udelay(unsigned long usec) { unsigned long long tmp; -- 2.37.3