[U-Boot] Odd value for I2C_TIMEOUT in fsl_i2c.c
Scott Wood
scottwood at freescale.com
Fri Sep 4 20:34:38 CEST 2009
On Fri, Sep 04, 2009 at 05:29:48PM +0200, Wolfgang Denk wrote:
> > >> Kumar, any thoughts? Is there something sneaky going on here, or did
> > >> you just misinterpret the value of I2C_TIMEOUT?
> > >
> > > I guess I2C_TIMEOUT might always have been misinterpeted.
> >
> > I think the original code was correct, because it was counting clock ticks.
>
> It cannot have been correct. get_timer() takes an argument of
> milliseconds, i. e. a time. "(CONFIG_SYS_HZ / 4)" is a frequency,
> i. e. not a time, but the inverse of it.
>
> It is plain wront to write "250 per second" when you mean "250 milliseconds"
It is not a frequency, it is a number of ticks. This is a very common
idiom.
The "milliseconds" interpretation of get_timer() is not documented
anywhere in the code that I can see. Neither, again as far as I can see
from a quick grep, is the requirement that CONFIG_SYS_HZ be 1000, other
than in some board- or arch-specific files (some actually say that
CONFIG_SYS_HZ must be *less* than 1000), or in mailing list archives.
-Scott
More information about the U-Boot
mailing list