Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 70AB7C54EE9 for ; Fri, 2 Sep 2022 06:26:14 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 809BA84A34; Fri, 2 Sep 2022 08:26:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1662099964; bh=49e0Kp9s5J9rya8rK8NvE4o86jMr/wYSlQaq9yEZPRo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=gIB5MCLKwLcU+y++TMGYLmByRVbw3PRKiytRWyVVYitUJ1wXTFFC7kua5vMKRk8Ga t7SXtFVldXCXjtPJH2w3/yTwzdPFKHGUk7qIgRJTey+JGHaUOQAWYnsjNXCVMi44ao yTIJslbzgY7LJS52GBbgkAvofPT+Bi9/uYeXV/hlksekh4LdcIaEFUHo7mDIwkIQcW 6X7n3jDAAhr/svStkDyrtolpKnsgdl2239sSDY3sy80leX6cLc5JBr9KzWFH+hxdfp Xlak0E0BJIZrTBrNwgtHA+q8xNXV+/+JiEPb5iaCYhz/YfTyxu/J3CwimMDTdTv6hN F8NWbPdBI7pHQ== Received: by phobos.denx.de (Postfix, from userid 109) id 0FAAE84A40; Fri, 2 Sep 2022 08:26:00 +0200 (CEST) Received: from mout-u-107.mailbox.org (mout-u-107.mailbox.org [80.241.59.207]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 162AE84A1B for ; Fri, 2 Sep 2022 08:25:58 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sr@denx.de Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-107.mailbox.org (Postfix) with ESMTPS id 4MJnwh1Mnpz9sQv; Fri, 2 Sep 2022 08:25:56 +0200 (CEST) From: Stefan Roese To: u-boot@lists.denx.de Cc: pali@kernel.org, mibodhi@gmail.com, michael@walle.cc, sjg@chromium.org, Stefan Herbrechtsmeier Subject: [PATCH v2 1/8] timer: orion-timer: Use timer_conv_64() to fix timer wrap around Date: Fri, 2 Sep 2022 08:25:47 +0200 Message-Id: <20220902062554.1197435-2-sr@denx.de> In-Reply-To: <20220902062554.1197435-1-sr@denx.de> References: <20220902062554.1197435-1-sr@denx.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 While testing on some Kirkwood platforms it was noticed that the timer did not function correctly all the time. The driver did not correctly handle 32bit timer value wrap arounds. Using the timer_conv_64() conversion function fixes this issue. Suggested-by: Stefan Herbrechtsmeier Signed-off-by: Stefan Roese --- v2: - New patch drivers/timer/orion-timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/timer/orion-timer.c b/drivers/timer/orion-timer.c index fd30e1bf036c..d7d1a1b24462 100644 --- a/drivers/timer/orion-timer.c +++ b/drivers/timer/orion-timer.c @@ -19,7 +19,7 @@ static uint64_t orion_timer_get_count(struct udevice *dev) { struct orion_timer_priv *priv = dev_get_priv(dev); - return ~readl(priv->base + TIMER0_VAL); + return timer_conv_64(~readl(priv->base + TIMER0_VAL)); } static int orion_timer_probe(struct udevice *dev) -- 2.37.3