[U-Boot] [PATCH v2] mmc: omap: timeout counter fix
Wolfgang Denk
wd at denx.de
Tue Oct 26 09:36:51 CEST 2010
Dear Reinhard Meyer,
In message <4CC66ECA.9000106 at emk-elektronik.de> you wrote:
>
> Agreed here. People are invited to dig through u-boot and find all
> those places.
You know the ones you added best :-)
> > int main(void)
> > {
> > unsigned int time = 0xFFFFFFF0;
> > unsigned int delay = 0x20;
> > unsigned int start;
>
> You are wrong here, because you take it out of context.
I am not wrong. Feel free to replace "unsigned int" by "unsigned long
long", and 0xFFFFFFF0 by 0xFFFFFFFFFFFFFFF0ULL, and the "%X" by "%llX".
> My "demo" is using the (declared as) 64 bit function get_ticks().
> I mentioned above that this function MUST be truly returning 64
> bits worth of (incrementing) value to make any version work.
What's the difference? It is inherently wrong to believe an overflow
would never occur just because the precision of a number is "long
enough". Remeber y2k issues. Remember the time overflog for UNIX
systems in 2038, etc. etc.
> If get_ticks() just returns a 32 bit counter value neither method will work
> reliably. Just check all implementations that this function is implemented
> correctly.
No, the code is still WRONG. It'ss just that the problem is less
likely to hit.
BTW - who says the timer starts counting at 0 ?
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
Lack of skill dictates economy of style. - Joey Ramone
More information about the U-Boot
mailing list