[U-Boot] [PATCH 2/2] ep93xx: Refactoring of timer code

Wolfgang Denk wd at denx.de
Tue Feb 23 23:23:42 CET 2010


Dear Matthias Kaehlcke,

In message <20100223220421.GK20201 at 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).

Hm... re-reading the optimized code makes me wonder if the variable
really should be called "ticks" - looks more as a frequency to me?


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
If it went on at this rate, in several billion  years  he'd  be  rich
beyond his wildest dreams!            - Terry Pratchett, _Soul Music_


More information about the U-Boot mailing list