From patchwork Thu Aug 25 17:03:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary Bisson X-Patchwork-Id: 662878 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3sKrB7411Jz9sCg for ; Fri, 26 Aug 2016 03:04:15 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=boundarydevices-com.20150623.gappssmtp.com header.i=@boundarydevices-com.20150623.gappssmtp.com header.b=XStM9Zyj; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 30C4E4BA35; Thu, 25 Aug 2016 19:04:04 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id metdxM4pwbbF; Thu, 25 Aug 2016 19:04:04 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1E0464BDBD; Thu, 25 Aug 2016 19:03:53 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8AD384B660 for ; Thu, 25 Aug 2016 19:03:47 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rhEE0gOshqJ9 for ; Thu, 25 Aug 2016 19:03:47 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) by theia.denx.de (Postfix) with ESMTPS id 537CE4B62B for ; Thu, 25 Aug 2016 19:03:42 +0200 (CEST) Received: by mail-wm0-f42.google.com with SMTP id d196so39948000wmd.0 for ; Thu, 25 Aug 2016 10:03:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=boundarydevices-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5pQeYnbkduKBotLJlJV6Xs9yZ/ysrZe3mTPiRB7n/n0=; b=XStM9ZyjELTVB9u5VxfG95Py0D/9X1Wa56XxKl3qvmEzMgxsILIZtJzABV1Jr19/Bb M+lVVhbTpRzMg5H8dj9LwG3SV/FqtjwbVG34ike4ayu4hN5zqNHPEmNILRhKnhaPnM/3 Ugh7/nphda0IGFmea5kskZcTdQOrUdXOpO0VW0blqTeVhHYA+hjYEpLSnEyQSD4vAF8+ 4frSGCL0amBjoyqvhb5hN+YT6Sz8syzVXyQicy5O5I1zeJ23JbZUz1JchYby3ge/vUKD YniUB+0zI6N4cAyNMdSUFe8pz0VHW6LDAjrYALLrMDNc+2mi5iuIjAb6+70NdxWdMOUR LOeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5pQeYnbkduKBotLJlJV6Xs9yZ/ysrZe3mTPiRB7n/n0=; b=N9qzTacV4lnChM1maT4aaqWxkyo6K49rOGITkhVVHY6t8Uo9S7kBDd+Dkrjn0p28q/ 6ZxeDNoZLDnfNWaGaC0jIFXliloPTGhsn4LKdaTG9f5ryzZ0OKm69DxA1I319xBrRJjC gppwONQyn0JDWyYwrLqvM79VLzWrlCeCPIc5k80eVGLAZhlOwH1EmTbL3TYCBCNytJ3U 0F8kd0HxdOpWDd73dGTvvwFJiG+wNCqIvJFoQDi4GivjTxx0OrWs5SPIss7xsVVTLIvV QDKtrMXCBEBIdna167RdY2XoXlQvpj5Fkdtbq+oi7wbXUfWY7/P9FTuAIgqINSLntZna cA2A== X-Gm-Message-State: AE9vXwMN+wgTnkSy3+nLdpe7p/vTth+fraURcJsbookabWh0KjTxQcx3sJn4nWgONX5xnQ== X-Received: by 10.28.113.135 with SMTP id d7mr8733428wmi.43.1472144622556; Thu, 25 Aug 2016 10:03:42 -0700 (PDT) Received: from t450s.lan (89-92-156-188.hfc.dyn.abo.bbox.fr. [89.92.156.188]) by smtp.googlemail.com with ESMTPSA id d64sm16619069wmc.22.2016.08.25.10.03.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Aug 2016 10:03:42 -0700 (PDT) From: Gary Bisson To: u-boot@lists.denx.de Date: Thu, 25 Aug 2016 19:03:17 +0200 Message-Id: <1472144600-1834-3-git-send-email-gary.bisson@boundarydevices.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1472144600-1834-1-git-send-email-gary.bisson@boundarydevices.com> References: <1471989321-25280-1-git-send-email-gary.bisson@boundarydevices.com> <1472144600-1834-1-git-send-email-gary.bisson@boundarydevices.com> Cc: Gary Bisson , fabio.estevam@nxp.com Subject: [U-Boot] [PATCH v2 2/5] arm: imx-common: introduce back usec2ticks X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Peng Fan This commit "2bb014820c49a63902103bac710bc86b5772e843" do some clean up to use the code in lib/time.c. But usec2ticks is still being used by security related job ring code. Bring back the function to avoid build break when CONFIG_FSL_CAAM is defined. The computation logic has been changed, using 64-bit variable to ease the process, making it work on older (MX5) platforms. Signed-off-by: Peng Fan Signed-off-by: Troy Kisky Signed-off-by: Gary Bisson --- arch/arm/imx-common/timer.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/arm/imx-common/timer.c b/arch/arm/imx-common/timer.c index a01590c..a04c7ae 100644 --- a/arch/arm/imx-common/timer.c +++ b/arch/arm/imx-common/timer.c @@ -119,3 +119,19 @@ ulong get_tbclk(void) { return gpt_get_clk(); } + +/* + * This function is intended for SHORT delays only. + * It will overflow at around 10 seconds @ 400MHz, + * or 20 seconds @ 200MHz. + */ +unsigned long usec2ticks(unsigned long _usec) +{ + unsigned long long usec = _usec; + + usec *= get_tbclk(); + usec += 999999; + do_div(usec, 1000000); + + return usec; +}