From patchwork Thu Dec 24 07:33:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 1420419 X-Patchwork-Delegate: lokeshvutla@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=libero.it Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=libero.it header.i=@libero.it header.a=rsa-sha256 header.s=s2014 header.b=dHQy//hF; dkim-atps=neutral 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 (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4D1hgq5ycqz9sRR for ; Thu, 24 Dec 2020 18:35:35 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BADA982715; Thu, 24 Dec 2020 08:35:19 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=libero.it 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=libero.it header.i=@libero.it header.b="dHQy//hF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EEC18826EC; Thu, 24 Dec 2020 08:34:57 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=no autolearn_force=no version=3.4.2 Received: from libero.it (smtp-18.italiaonline.it [213.209.10.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 90FE1826F9 for ; Thu, 24 Dec 2020 08:34:52 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=libero.it Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=dariobin@libero.it Received: from passgat-Modern-14-A10M.homenet.telecomitalia.it ([79.54.115.44]) by smtp-18.iol.local with ESMTPA id sL93kry9c7QU9sL9AkXNC1; Thu, 24 Dec 2020 08:34:52 +0100 x-libjamoibt: 1601 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=libero.it; s=s2014; t=1608795292; bh=za2EbU86VCFE/qbbLdlpqTQ1PLdQ9iAHbP1Df+z7Feo=; h=From; b=dHQy//hFLPHhrNK4Ns4tZbOkH0j5AsvnFqKzsN3lzXadiQjaX/ycuU3q57bgvBxZS JhgjAV/mVN8LGv52sMc0G9CY9Mb+VFhkQ26Q4T9G2RAkbM50cMs/w+t25/lX+NV0My 0KQEONZyZfZUlYBz42UsAXxunnG64BZy3M5iijbNwaBCb2wazrUVSl8lxb/sPKt1L2 9XJATnQR8xz6jLw5XVGyrJiEpOPb6vxujGUoNy1ZFEUp7DBJmJjlM/cLdz3ST4X76N nJnTZLxyBYu4eVlTcX9cxsLRr80hwVYCzBiXlT7t73lL9OkHM2L9GU6fqfIqXGrMNw VgqpG9nZBAAnA== X-CNFS-Analysis: v=2.4 cv=Y+c9DjSN c=1 sm=1 tr=0 ts=5fe4449c cx=a_exe a=4XFUYcG0DNokufVEFeBjWw==:117 a=4XFUYcG0DNokufVEFeBjWw==:17 a=Oj4l5q2oWNqs8PrQqXwA:9 From: Dario Binacchi To: u-boot@lists.denx.de Cc: Lokesh Vutla , Dario Binacchi Subject: [PATCH v7 18/28] omap: timer: fix the rate setting Date: Thu, 24 Dec 2020 08:33:56 +0100 Message-Id: <20201224073406.16764-19-dariobin@libero.it> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201224073406.16764-15-dariobin@libero.it> References: <20201224073406.16764-15-dariobin@libero.it> X-CMAE-Envelope: MS4xfA7WgkCdCP38OULZbDPiAfVctri1q9Z0OCn8mPbiLD7L1sXOXNKilGU+fahnVRuEGhYZHsk1VgI0IFDIU3nV9s7CMo6c5pc61rvIL278EbQs7YElQfWd DBMpxkbZYbLJORmhGwd1/DTVIzfreyzY+unCzNcvHQ8/AU7Zyt8Ti8tt/vws5QawiuSQ+9DLiF+o4OlOM+C6tDSDzSYeVQSkgdtG551tekc0a0NL1y2xhz2J VyGDKbhtN53eByY87j92NaHqOV4VzH4XgdZ7OGrKLdStXRwcZdh0ifYuiL6AFytN X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean The prescaler (PTV) setting must be taken into account even when the timer input clock frequency has been set. Signed-off-by: Dario Binacchi --- (no changes since v1) drivers/timer/omap-timer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/timer/omap-timer.c b/drivers/timer/omap-timer.c index 4eecb3e64d..c08cb5ad2e 100644 --- a/drivers/timer/omap-timer.c +++ b/drivers/timer/omap-timer.c @@ -19,8 +19,6 @@ #define TCLR_PRE_EN BIT(5) /* Pre-scaler enable */ #define TCLR_PTV_SHIFT (2) /* Pre-scaler shift value */ -#define TIMER_CLOCK (V_SCLK / (2 << CONFIG_SYS_PTV)) - struct omap_gptimer_regs { unsigned int tidr; /* offset 0x00 */ unsigned char res1[12]; @@ -61,7 +59,9 @@ static int omap_timer_probe(struct udevice *dev) struct omap_timer_priv *priv = dev_get_priv(dev); if (!uc_priv->clock_rate) - uc_priv->clock_rate = TIMER_CLOCK; + uc_priv->clock_rate = V_SCLK; + + uc_priv->clock_rate /= (2 << CONFIG_SYS_PTV); /* start the counter ticking up, reload value on overflow */ writel(0, &priv->regs->tldr);