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 13C7BECAAA1 for ; Fri, 2 Sep 2022 06:26:53 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 982F884A4B; Fri, 2 Sep 2022 08:26:13 +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=1662099974; bh=EnVxF9lQN4rxtrMmaBqCMNzIfA+n6sUKuIVJbgWGzmQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=dTciZ/jTA3lVRuRU1MSrEwA27pLshGX2ipw2Moh5HWNbMD2ZKJeE6giCds9qxRQxl jmpxkV6r9bIOuKD+bWJab4GcBYux1kbNg4/ZCKJBeOUYF8wak6wplqISYtvxfZH5vp hMGTKzp+sRiWn/AgT6+CJqCAPg/9nUinriQRbTAgQAAoYRKur2sI+Pk85H79yBC/d6 +dZffRqmWbtzmBPMjIxKM8qFoYji4ROpfVzpsoueCZyEUKFn5kyPt3Qeany11Se0XM Shtzw0lR2tRfTJdrCnAdwBIdTf1rPv1Ghp30nToIPdeuDvAdjBDVY4mUNk4cNU96mb KFAwlgLAeHPIA== Received: by phobos.denx.de (Postfix, from userid 109) id 167C584A48; Fri, 2 Sep 2022 08:26:02 +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 CAC7E84A38 for ; Fri, 2 Sep 2022 08:25:58 +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 [IPv6:2001:67c:2050:b231:465::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 4MJnwh75X0z9sQc; Fri, 2 Sep 2022 08:25:56 +0200 (CEST) From: Stefan Roese To: u-boot@lists.denx.de Cc: pali@kernel.org, mibodhi@gmail.com, michael@walle.cc, sjg@chromium.org Subject: [PATCH v2 3/8] timer: orion-timer: Add timer_get_boot_us() for BOOTSTAGE support Date: Fri, 2 Sep 2022 08:25:49 +0200 Message-Id: <20220902062554.1197435-4-sr@denx.de> In-Reply-To: <20220902062554.1197435-1-sr@denx.de> References: <20220902062554.1197435-1-sr@denx.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4MJnwh75X0z9sQc 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 Add timer_get_boot_us() to support boards, that have CONFIG_BOOTSTAGE enabled, like pogo_v4. Signed-off-by: Stefan Roese --- v2: - Change timer_get_boot_us() to use the timer_early functions - Remove #if CONFIG_IS_ENABLED(BOOTSTAGE) Simon, I'm currently looking into this timer_get_boot_us() to using timer_early_get_count() etc consolidation. drivers/timer/orion-timer.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/timer/orion-timer.c b/drivers/timer/orion-timer.c index 14f318e57d4d..6c0b8550412d 100644 --- a/drivers/timer/orion-timer.c +++ b/drivers/timer/orion-timer.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ #include #include +#include #include #include #include @@ -39,6 +40,14 @@ u64 notrace timer_early_get_count(void) return timer_conv_64(~readl(MVEBU_TIMER_BASE + TIMER0_VAL)); } +ulong timer_get_boot_us(void) +{ + u64 ticks; + + ticks = timer_early_get_count(); + return lldiv(ticks * 1000, timer_early_get_rate()); +} + static uint64_t orion_timer_get_count(struct udevice *dev) { struct orion_timer_priv *priv = dev_get_priv(dev); -- 2.37.3