From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-pl0-x22c.google.com ([2607:f8b0:400e:c01::22c]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fQdR5-0000pQ-NI for barebox@lists.infradead.org; Wed, 06 Jun 2018 18:46:14 +0000 Received: by mail-pl0-x22c.google.com with SMTP id t12-v6so4356561plo.7 for ; Wed, 06 Jun 2018 11:45:21 -0700 (PDT) From: Andrey Smirnov Date: Wed, 6 Jun 2018 11:44:13 -0700 Message-Id: <20180606184431.10348-21-andrew.smirnov@gmail.com> In-Reply-To: <20180606184431.10348-1-andrew.smirnov@gmail.com> References: <20180606184431.10348-1-andrew.smirnov@gmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH v3 20/38] ARM: i.MX8: Initialize system counter To: barebox@lists.infradead.org Cc: Andrey Smirnov Add code to properly initialize system counter, so it would be posible to get accurate time delays. Signed-off-by: Andrey Smirnov --- arch/arm/mach-imx/imx8mq.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/arch/arm/mach-imx/imx8mq.c b/arch/arm/mach-imx/imx8mq.c index 74fa8aca7..f3246e437 100644 --- a/arch/arm/mach-imx/imx8mq.c +++ b/arch/arm/mach-imx/imx8mq.c @@ -14,6 +14,8 @@ #include #include #include +#include +#include #include #include #include @@ -58,6 +60,23 @@ static void imx8mq_silicon_revision(void) imx_set_silicon_revision(cputypestr, reg); } +static int imx8mq_init_syscnt_frequency(void) +{ + void __iomem *syscnt = IOMEM(MX8MQ_SYSCNT_CTRL_BASE_ADDR); + /* + * Update with accurate clock frequency + */ + set_cntfrq(syscnt_get_cntfrq(syscnt)); + syscnt_enable(syscnt); + + return 0; +} +/* + * This call needs to happen before timer driver gets probed and + * requests its update frequency via cntfrq_el0 + */ +core_initcall(imx8mq_init_syscnt_frequency); + int imx8mq_init(void) { imx8mq_silicon_revision(); -- 2.17.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox