From: Samuel Holland Date: Sun, 17 Mar 2019 13:54:32 -0500 Subject: [U-Boot] [PATCH] arm: timer: sunxi: fix a64 spurious timeout issues In-Reply-To: <8584a2c9-498b-d183-279b-adbec1ffb202@lemmela.net> References: <20190317145542.14069-1-oskari@lemmela.net> <8584a2c9-498b-d183-279b-adbec1ffb202@lemmela.net> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: u-boot@lists.denx.de On 03/17/19 13:41, Oskari Lemmelä wrote: > On 3/17/19 6:04 PM, Peter Robinson wrote: >> On Sun, Mar 17, 2019 at 2:56 PM Oskari Lemmela wrote: >>> Fixes spurious timeouts which have been seen during testing >>> SPI_SUNXI driver. The false timeouts disappear when number of >>> bits reduced to 10 in workaround. >>> >>> The false timeouts are caused by timer backward jumps. >> Wouldn't it be best to apply the same fix as the kernel uses here [1] >> as a more permanent fix? >> >> [1] https://www.spinics.net/lists/arm-kernel/msg699622.html This _is_ the same fix as the kernel uses. > Sure. Difference is that retry counter was added to while loop in kernel side. And the retry counter isn't needed here, since there is no preemption in u-boot. > Only CNTPCT is used in u-boot. > So CNTVCT part of kernel patch is currently not needed? Correct. >> >>> Signed-off-by: Oskari Lemmela >>> --- >>>   arch/arm/cpu/armv8/generic_timer.c | 2 +- >>>   1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/arch/arm/cpu/armv8/generic_timer.c >>> b/arch/arm/cpu/armv8/generic_timer.c >>> index c1706dcec1..2e06ee4ed2 100644 >>> --- a/arch/arm/cpu/armv8/generic_timer.c >>> +++ b/arch/arm/cpu/armv8/generic_timer.c >>> @@ -66,7 +66,7 @@ unsigned long timer_read_counter(void) >>>          isb(); >>>          do { >>>                  asm volatile("mrs %0, cntpct_el0" : "=r" (cntpct)); >>> -       } while (((cntpct + 1) & GENMASK(10, 0)) <= 1); >>> +       } while (((cntpct + 1) & GENMASK(9, 0)) <= 1); Please update the 11 to 10 in the comment above as well. >>>          return cntpct; >>>   } >>> -- >>> 2.17.1 Thanks, Samuel