From patchwork Thu Jul 21 10:30:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 1658952 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=pyfY89cs; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LpTPR52z4z9s1l for ; Thu, 21 Jul 2022 20:31:05 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7C95C83EC5; Thu, 21 Jul 2022 12:30:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="pyfY89cs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DFD1B8395F; Thu, 21 Jul 2022 12:30:54 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) (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 4FAAF83EC5 for ; Thu, 21 Jul 2022 12:30:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jun.nie@linaro.org Received: by mail-pl1-x635.google.com with SMTP id c6so1404212pla.6 for ; Thu, 21 Jul 2022 03:30:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6HwlmtYwQsa4NMlZtRiDC9+KNDwknN3duqpEuPw+6Z0=; b=pyfY89cs+PCaC9ilui5XPS9/Zn1rHFLVFsy2ai3Fkelc1crti9DMWcLsE7AmkCsrwI HoRgui9/UR87vzNuZiIZc23hQPH1olCJnVkRyeuJv8kCqaVBt6aFjEkQeTi8RLFmK+oV citmRGo90ms2uDEDGBQF7KR8wyXM5+pXbtJOwi6Qa7iAX2qRlywBsef+5Px/NTTIDZft zjHhyg5MzTA2UBdtjomnm8V16J3Z3joUN+uDalw6qOGcvXhiX3ExVRj1XOnPjX1ZElaR NsK3Cz0mybBh5yWAlhzOK9NsjdvR/hE7BUqesi7II0lzamHEcNNe+yAKbeac5U4LWb5B WHdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6HwlmtYwQsa4NMlZtRiDC9+KNDwknN3duqpEuPw+6Z0=; b=gXK5dAYUH+w9T6wb6190Sgt6o6W+yU63wse8JAmBDVcRCim0ASXiY1c9Db54USV81z HCH/qYBnbcO+vhSqP/ZKX3AkQCllrPlt/SAQC/LxpzABuNAcDb3vo2mAE+d7ygah5Wel lGJeZ/1VIbfBz42HwqnBdlpqkXuErN7ZUbgdgyodaVpHLz/XCNYdyVbenq8+5+F5okwY QGt14DZlrPVqgMx51TvCSV6MUFJsUOKEc0AZ+u7e42YADxqLZDev8EGWSMRgyhlLuOJw G1BxjMUM+/ptTGbLAzPvuW5VsnfTspaR8wBxnZE5seic+pE8s/ozSTn30xD4juvtArcK V0Tg== X-Gm-Message-State: AJIora97xr6eHlskXr+QIUS/SeuBSYqKQG3OyAX/WZfxkdChae3LOd5N +Scn7H718PHWwPYJJfGhj+l0/w== X-Google-Smtp-Source: AGRyM1vIjkk0xiAPIshGWRaI8vDzOEzE8fUNAUZgojTBMtzrO/OtgqMsgoJqYo42B91mATDUB0EnRg== X-Received: by 2002:a17:902:e84e:b0:16b:f773:4692 with SMTP id t14-20020a170902e84e00b0016bf7734692mr42837186plg.19.1658399450473; Thu, 21 Jul 2022 03:30:50 -0700 (PDT) Received: from localhost.localdomain ([112.64.61.72]) by smtp.gmail.com with ESMTPSA id e1-20020a621e01000000b0050dc76281e0sm1363882pfe.186.2022.07.21.03.30.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jul 2022 03:30:49 -0700 (PDT) From: Jun Nie To: adrian.alonso@nxp.com, sbabic@denx.de, festevam@gmail.com, u-boot@lists.denx.de Cc: peng.fan@nxp.com, shawn.guo@linaro.org, Jun Nie Subject: [PATCH] imx: syscounter: support timer_get_boot_us Date: Thu, 21 Jul 2022 18:30:05 +0800 Message-Id: <20220721103005.229257-1-jun.nie@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 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 With supporting timer_get_boot_us, we can profile boot up time with below configs and function bootstage_mark_name(). CONFIG_BOOTSTAGE=y CONFIG_BOOTSTAGE_REPORT=y CONFIG_CMD_BOOTSTAGE=y Signed-off-by: Jun Nie Acked-by: Shawn Guo Reviewed-by: Fabio Estevam --- arch/arm/mach-imx/syscounter.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm/mach-imx/syscounter.c b/arch/arm/mach-imx/syscounter.c index 7c02e199a3..df478a2326 100644 --- a/arch/arm/mach-imx/syscounter.c +++ b/arch/arm/mach-imx/syscounter.c @@ -79,6 +79,7 @@ int timer_init(void) gd->arch.tbl = 0; gd->arch.tbu = 0; + gd->arch.timer_rate_hz = freq; return 0; } #endif @@ -100,6 +101,14 @@ ulong get_timer(ulong base) return tick_to_time(get_ticks()) - base; } +ulong timer_get_boot_us(void) +{ + if (!gd->arch.timer_rate_hz) + timer_init(); + + return tick_to_time(get_ticks()); +} + void __udelay(unsigned long usec) { unsigned long long tmp;