[U-Boot] [PATCH] improved strmhz()

Wolfgang Denk wd at denx.de
Tue Oct 21 21:15:54 CEST 2008


Dear Kumar Gala,

In message <0E4961A3-232C-4307-91E3-B2F7CB216BFA at kernel.crashing.org> you wrote:
>
> > --- a/lib_generic/strmhz.c
> > +++ b/lib_generic/strmhz.c
> > @@ -27,7 +27,7 @@ char *strmhz (char *buf, long hz)
> > 	long l, n;
> > 	long m;
> >
> > -	n = DIV_ROUND(hz, 1000000L);
> > +	n = DIV_ROUND(hz, 1000) / 1000L;
> > 	l = sprintf (buf, "%ld", n);
> >
> > 	hz -= n * 1000000L;
> > -- 
> > 1.5.5.1
> 
> I haven't been following this thread, but can we control the number of  
> significant digits.  I'm starting to see output like:
> 
> Clock Configuration:
>         CPU:1500.4294967282 MHz, CCB:600.4294967291 MHz,
>         DDR:400.4294967293 MHz (800.4294967289 MT/s data rate)  
> (Asynchronous), LBC:37.500 MHz
> 
> (it use to look like)
> 
> Clock Configuration:
>         CPU:1500 MHz, CCB: 600 MHz,
>         DDR: 401 MHz (801 MT/s data rate) (Asynchronous), LBC:  37 MHz

Can you please provide the input to the strmhz() function  (the  "hz"
parameter) that is causing such output?

I am aware that we will have a problem when "hz" exceeds the 2.147 GHz
limit (as that's the limit for a "long" data type), but that's another
problem, and requires many changes.

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
We are all agreed that your  theory  is  crazy.  The  question  which
divides  us  is  whether it is crazy enough to have a chance of being
correct. My own feeling is that it is not crazy enough.  - Niels Bohr


More information about the U-Boot mailing list