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 164D3C6FA89 for ; Thu, 15 Sep 2022 14:21:32 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 357A284BE6; Thu, 15 Sep 2022 16:21:13 +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=1663251673; bh=m/oId9ieKyjicpurzfJzahUP29u/t+DuiObmFFONd4k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=di/nteAg/U9UGn63IZRjbG50KU2rf6jNi7FnYWqjIUCYWWfFzOvqOdcrjMDAgZUu0 EsuRCAIPTXrzSy/WLcYsPqZmYHGEUlQun7pyCo/IgJqXOvjzk+38ksYCuwkw/bKxnC 8vT4SSl9zzIgnJn2M4+hv/FtHXqAQKj/e3lZ+qrqDgUqW5v7rn5wMdryVgWa2R4x8w t2YR5FZr1In9MwxOaX/hasaZ0vpwC9tXC8iLtqFjTvMblMPPtlagxWVgNUbBW5b4MT BJ/01sOljYzt6kEO6BaVXWizQV4FPHTl/9CwFxU7jYgtQOM24v2sDILfnnISajuFOC F+7iUgBrkJyNQ== Received: by phobos.denx.de (Postfix, from userid 109) id 9B7F584BB8; Thu, 15 Sep 2022 16:21:01 +0200 (CEST) Received: from mout-u-107.mailbox.org (mout-u-107.mailbox.org [IPv6:2001:67c:2050:101:465::107]) (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 5FF4684BE0 for ; Thu, 15 Sep 2022 16:20:46 +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 smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (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 4MSzrX3f34z9sT7; Thu, 15 Sep 2022 16:20:44 +0200 (CEST) From: Stefan Roese To: u-boot@lists.denx.de Cc: pali@kernel.org, mibodhi@gmail.com, michael@walle.cc, Stefan Herbrechtsmeier Subject: [PATCH v3 1/8] timer: orion-timer: Use timer_conv_64() to fix timer wrap around Date: Thu, 15 Sep 2022 16:20:36 +0200 Message-Id: <20220915142043.1549061-2-sr@denx.de> In-Reply-To: <20220915142043.1549061-1-sr@denx.de> References: <20220915142043.1549061-1-sr@denx.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4MSzrX3f34z9sT7 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. Fixes: e9e73d78a8fb ("timer: add orion-timer support") Suggested-by: Stefan Herbrechtsmeier Signed-off-by: Stefan Roese Tested-by: Tony Dinh --- v3: - Add Fixes tag 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