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: 592129 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b811:0:0:0:0 with SMTP id fc17csp332373mab; Thu, 21 Jul 2022 03:31:01 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uGXSChP1xjHGOshrIqnh9Ck2z0LxRAG6IbatKXme1ZHrScKhodr5tw3E1vdF2IaLIuwHCa X-Received: by 2002:a05:6638:1643:b0:33f:7f6b:5e39 with SMTP id a3-20020a056638164300b0033f7f6b5e39mr21842240jat.54.1658399461235; Thu, 21 Jul 2022 03:31:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658399461; cv=none; d=google.com; s=arc-20160816; b=cNCzYWgTmhkCXy5nnYKAiqN0IcZDKCCSDUBI9EBYAHMR6S9Qkb+/vcaSavM9ryu+xH jLYpKct8YyWlfI3gr7eUvHbTbQPo2kGMS30iJhoMjndzrnPw0/4F2KdcykPuQRiRdFVi cVrZHOErEUGf3JadRvQDutcrV+CS+Lg2F4gaV7Vj1wCgS8uhfrflkqtB9ykAw4K/jz6B HPyYgjn332undPIAikCmXeaL5epvd+CVhOnEbHEsPlddeo2cZCg/AfGQnAnVrM2PYc95 +9Ix23H4WZgDrjRLS1pkG3U0vtGEV3g5cvyN8CL3pTH17fTSEoVkzjiFU2BiiMquVHCB oh2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=6HwlmtYwQsa4NMlZtRiDC9+KNDwknN3duqpEuPw+6Z0=; b=pDRspBfzvf453NgaO3eVP76CPclHJpjy8qYSQhslEABi2sVZe/57twF8ljXKGjdtGo BgytTG/arKeHHH8cZLhH+30Y20k8LVBygp1+ZLwXaaAza3Ka1RaNaTUXcST7AkCDOH9z E6VrO1PNDZeWAk4OIhfIR8rOvGO35fsJG8pWOliU3yceveMYfLZCL2j7hN2z0Rvn1q1v 7HYf5JvvvXnmOG0AQChpswu9tkqgLO6atyEH/uZx2cPudRGPH9zv8fh5nmPGpWhAPyq5 JIfwx5rSTTEecjqsuPEhDc4CUz4SovIxAslWtTnikvb8qfu5iY1hJEXzzwYlVw9alldr qzwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pyfY89cs; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id w8-20020a056e02190800b002dc3228a0f7si1472342ilu.141.2022.07.21.03.31.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jul 2022 03:31:01 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pyfY89cs; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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-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;