From: Wolfgang Denk Date: Wed, 23 Jun 2010 00:34:36 +0200 Subject: [U-Boot] [PATCH] sa1100 change get_timer(base) to return time since base In-Reply-To: References: <1274031318-22876-1-git-send-email-jochen@scram.de> <20100622212951.836F81524EE@gemini.denx.de> Message-ID: <20100622223436.0B1F21524EE@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Andrew, In message 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"