From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Date: Tue, 23 Feb 2010 20:04:44 -0600 Subject: [U-Boot] [PATCH 2/2] ep93xx: Refactoring of timer code In-Reply-To: <20100223224402.GO20201@darwin> References: <7ee75976e78e2f82b4163fe1ff4233a850d4393c.1266962256.git.matthias@kaehlcke.net> <20100223220421.GK20201@darwin> <20100223222342.7BCDDE8CCE0@gemini.denx.de> <20100223224402.GO20201@darwin> Message-ID: <4B84893C.8000600@windriver.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Matthias Kaehlcke wrote: > Hi Wolfgang, > > El Tue, Feb 23, 2010 at 11:23:42PM +0100 Wolfgang Denk ha dit: > >> In message <20100223220421.GK20201@darwin> you wrote: >>> ep93xx: Refactoring of the timer code, including the following changes >> ... >>> +#define TIMER_FREQ 508469 >>> +#define CLK_TICKS_PER_SYS_TICK (TIMER_FREQ / CONFIG_SYS_HZ) >> ... >>> + ticks *= (CLK_TICKS_PER_SYS_TICK * CONFIG_SYS_HZ); >> ... >>> + ticks = usecs * CLK_TICKS_PER_SYS_TICK * CONFIG_SYS_HZ; >> Why don't you use >> >> ticks *= TIMER_FREQ; >> resp. >> ticks = usecs * TIMER_FREQ; >> >> The combination of " / CONFIG_SYS_HZ * CONFIG_SYS_HZ" is just a bad >> NO-OP (with rounding errors). > > you certainly have a point, i'm going to change this as you proposed > >> Hm... re-reading the optimized code makes me wonder if the variable >> really should be called "ticks" - looks more as a frequency to me? > > here i disagree, the function returns the number of ticks that pass in > a certain number of microseconds, so i think 'ticks' is an appropiate > name > Perhaps a comment on the units of TIMER_FREQ ? This is minor point. Otherwise looks fine. Tom > thanks for your review! >