From mboxrd@z Thu Jan 1 00:00:00 1970 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 5FE7DC433FE for ; Wed, 12 Oct 2022 05:37:36 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6813984E37; Wed, 12 Oct 2022 07:37:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com 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=gmail.com header.i=@gmail.com header.b="iCR3GTrH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1470784C90; Wed, 12 Oct 2022 07:37:12 +0200 (CEST) Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9859684C90 for ; Wed, 12 Oct 2022 07:37:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ovpanait@gmail.com Received: by mail-ed1-x52d.google.com with SMTP id e18so23000089edj.3 for ; Tue, 11 Oct 2022 22:37:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CI98Ms9nAD/06m8b3mVshuCnl0TvCRSRATj6gbLJ6KY=; b=iCR3GTrH4QzdeM7xbJo7MmI2xNizVdKczyq/WuiJ2MexGnAMtEdBM2pUi5l+blCSg0 q3vzAYXOMWfp28rD276VCHp57cfJs5gXOYbTVdPU7vur+VST3TSg9ATOo9AfQcRSIEdB dDdnE1dOV7Lc78cQU1tibvYcottbCkBVrghG8Umag62HvzJAcEpM6Y1OGVtrFgSdk3dV sAq2ME9aq6r+PQxxoTauPuYpm991Qbc3/Tc7r2MWFwlLe+/Z++/py83X5LhSvk3IfmyE kHss5jMWckkBI1P1z9oSwSozyDhXOBs9rxGEx1RNwxFAQN+pV7MPMPkfEYstVezY8cgv Q/LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CI98Ms9nAD/06m8b3mVshuCnl0TvCRSRATj6gbLJ6KY=; b=SiNZUJBaPIFyk+Ahhhp0rl6Hwif6jBB6+GRnhocfvxnEVBga2+3/Gff5PYktgleJvR GkwhXP4RlDlDbwFoPqtebMon99d2vAZczWvavg+5y6m0IMbrFV7k7oJ8Wk0sTtj5U8ff YXCIhJRdJHFOS3FDlO21hkAcBCSIZoluvp/CL0NjigQt6NNDx0ZSJPMOCnNl/hRKlHGP PabjKRFX1/5oboExK+rkWRLACSJVfqICMrqFete8CNFT1QGHvwmMe7YEjAGqeGymIqL1 yfYUXXr4laH2l7EH8MTphHjHjLxjU8cJHm1b08ObC6SHnaMuJlcaAS2byvTcYYoYD9w1 Oyuw== X-Gm-Message-State: ACrzQf00n6CF78HTdWXg9hk7KPoJ3CsNZYh5isLWA7OehA1dm53GXkkk AdoBEDSh8M2BCFQ8YrdvJXECyHHZHGbk7w== X-Google-Smtp-Source: AMsMyM5RwrFJ1K/JfHElDsHeTu5/mUHmAAkAkbrhjGuBbbeDJWOLY5RqmdFbJUkVQnuwifqMaPz8Bw== X-Received: by 2002:a05:6402:1911:b0:45c:be41:a879 with SMTP id e17-20020a056402191100b0045cbe41a879mr177495edz.322.1665553029065; Tue, 11 Oct 2022 22:37:09 -0700 (PDT) Received: from localhost.localdomain ([2a02:2f0e:ca15:2800:c696:dfd3:f393:fcf7]) by smtp.gmail.com with ESMTPSA id i26-20020a170906265a00b00787f91a6b16sm644372ejc.26.2022.10.11.22.37.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Oct 2022 22:37:08 -0700 (PDT) From: Ovidiu Panait To: u-boot@lists.denx.de Cc: Ovidiu Panait , Michal Simek Subject: [PATCH 3/3] timer: xilinx-timer: use timer_conv_64() to fix timer wrap around Date: Wed, 12 Oct 2022 08:36:56 +0300 Message-Id: <20221012053656.1492457-3-ovpanait@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221012053656.1492457-1-ovpanait@gmail.com> References: <20221012053656.1492457-1-ovpanait@gmail.com> 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 Current xilinx_timer_get_count() implementation does not take into account the periodic 32-bit wrap arounds, as it directly returns the 32-bit counter register value. The roll-overs cause problems in the upper timer layers, as generic timer code expects an incrementing 64-bit value from get_count() to work correctly. Add the missing 64-bit up-conversion to fix random hangs/delays in __udelay(). Fixes: a36d86720f ("microblaze: Convert axi timer to DM driver") Signed-off-by: Ovidiu Panait --- drivers/timer/xilinx-timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/timer/xilinx-timer.c b/drivers/timer/xilinx-timer.c index 75b4473b63..172fd9f929 100644 --- a/drivers/timer/xilinx-timer.c +++ b/drivers/timer/xilinx-timer.c @@ -40,7 +40,7 @@ static u64 xilinx_timer_get_count(struct udevice *dev) regmap_read(priv->regs, TIMER_COUNTER_OFFSET, &value); - return value; + return timer_conv_64(value); } static int xilinx_timer_probe(struct udevice *dev) -- 2.25.1