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 73E77ECAAD5 for ; Sat, 3 Sep 2022 09:44:41 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 35519848CA; Sat, 3 Sep 2022 11:44:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="FZyKyGrm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id ED26884912; Sat, 3 Sep 2022 11:44:36 +0200 (CEST) Received: from mail-vs1-xe35.google.com (mail-vs1-xe35.google.com [IPv6:2607:f8b0:4864:20::e35]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4E133845E7 for ; Sat, 3 Sep 2022 11:44:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mibodhi@gmail.com Received: by mail-vs1-xe35.google.com with SMTP id o123so4346646vsc.3 for ; Sat, 03 Sep 2022 02:44:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=+xz/69BRZpcibTAJtNo8NfWQDFFFAbCuTIMBqhOfqd8=; b=FZyKyGrm2BjbxcgtZnhHoI1RiEbddHdQTPrL+aj1fUyP3FnEFRx4v2YkSx+ugMtCN6 4QLE1KXpZTzE0GUo8AFnpurLl7TtBwFm5uoMHqcF6GqRuj0HHkwo9GC7dFxuu4e8FFJU eR+O/CUWFteAajA3Rj3f+XyzfMBFazzA0pWX/FH23AL8Qg1iGFMWOULVcRUZaYTQG6pF BW+q6bsYv/IgfnhvgG9Rxsi3jvsgeTRFkSnUhmaaHE7avpIrgpJ6qJmrD054fD0b0mKv sNp0vYSL1DwFdY4S/vjnX4fufobztnv7UKgVKAKXbh/Lw10bhmgttgovMH72DeLzBG9m iQzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=+xz/69BRZpcibTAJtNo8NfWQDFFFAbCuTIMBqhOfqd8=; b=kkgjNdOxu8NrJzW1eDNrpSxaFP/ZS3NZhpoaQWXwMiXyTL2Y6LtbUF72GaF1Qv+5gk MvujtSlNIxohZt4UINVc6l+gyd8O9P+NzeXrebfq+3bdOExJyMMlxv8AvTtbRPij1CHd 4SYaF0KlCGT0qs9PGQw4P4hlyvIVE12dx8BamEWppRac8+bPq5pZX5uZbNMiwXDWMab1 GrLA/Zvj6IGluvu7dSnoiXqiY4Kxnq+K3QIo1Pk5+B5Y+oJKgAihYA1L1P6sEUuriSI3 VhTlqu9PndO9+U6nVohOGtpipzIiJkjZHcXqFlHNaWpSUBEoYTD+zJfhZgKEpuKK3i44 P8ag== X-Gm-Message-State: ACgBeo2unExFk27xqi0XExTebevaH2ttW0q8+YQl3qt7hpUDCjtxh4eT frBBYAg5ACp5KEsas2r75h79GD6tmU7FJUe/dRA= X-Google-Smtp-Source: AA6agR4OBuYYTDfj4DVx6twrMafiUyXWVqdpnwPKJkN/ChPw5YxXXzqNOaunlQeqOgK/pIGza5GrAEBap8zOYGMPCYc= X-Received: by 2002:a67:f342:0:b0:38c:8b81:629f with SMTP id p2-20020a67f342000000b0038c8b81629fmr12007285vsm.60.1662198273010; Sat, 03 Sep 2022 02:44:33 -0700 (PDT) MIME-Version: 1.0 References: <20220902062554.1197435-1-sr@denx.de> <20220902062554.1197435-4-sr@denx.de> In-Reply-To: <20220902062554.1197435-4-sr@denx.de> From: Tony Dinh Date: Sat, 3 Sep 2022 02:44:21 -0700 Message-ID: Subject: Re: [PATCH v2 3/8] timer: orion-timer: Add timer_get_boot_us() for BOOTSTAGE support To: Stefan Roese Cc: U-Boot Mailing List , =?UTF-8?Q?Pali_Roh=C3=A1r?= , Michael Walle , Simon Glass Content-Type: text/plain; charset="UTF-8" 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 Hi Stefan, On Thu, Sep 1, 2022 at 11:25 PM Stefan Roese wrote: > > 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. Indeed, as you've mentioned above, I think timer_early_get_count() and timer_early_get_rate() do need to take into consideration what the input_clock_type is for Kirkwood boards with CONFIG_BOOTSTAGE such as the Pogo V4. I'm seeing on the Pogo V4 test, the timer command reports time about 6 times slower than it should. It does seem to jive with the fact that the Pogo V4 CONFIG_SYS_TCLK is 166Mhz, versus MVEBU 25MHz clock rate. All the best, Tony > > 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 >