[U-Boot] [PATCH] sa1100 change get_timer(base) to return time since base

Wolfgang Denk wd at denx.de
Wed Jun 23 00:34:36 CEST 2010


Dear Andrew,

In message <AANLkTim48UHND2wg0jCqs-EIZ2T_CGV-DUVatPzh6h6l at mail.gmail.com> you wrote:
>
> >> --- a/arch/arm/cpu/sa1100/timer.c
> >> +++ b/arch/arm/cpu/sa1100/timer.c
> >> @@ -41,7 +41,7 @@ void reset_timer (void)
> >>
> >>  ulong get_timer (ulong base)
> >>  {
> >> -     return get_timer_masked ();
> >> +     return get_timer_masked () - base;
> >
> > This patch is wrong. The get_timer() code is as it was designed to be.
> > If it is causing problems, then the caller must be fixed.
> 
> Hmmm. I put the same patch in a long time ago for imx for the same reason.
> http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/45922
> Looking at some other arm timer implementations they do it the same way.

Hm... ouch...

Guess this needs fixing.

> I see the cfi_flash code now has reset_timer calls sprinkled through
> it that should make the base offset functionality in the timer mostly
> a nop (assuming it's implemented).  Maybe the OP has old cfi_flash
> code?

Well, "sprinkled" - I see exactly two such calls. And I think these
are only needed because the implementer did not understand the
concept of how to implement a timeout using unsigned arithmentic in a
way that works even when the timer wraps around.



Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The Buddha, the Godhead, resides quite as comfortably in the circuits
of a digital computer or the gears of a cycle transmission as he does
at the top of a mountain or in the petals of a flower.
            - R.  Pirsig, "Zen and the Art of Motorcycle Maintenance"


More information about the U-Boot mailing list