[U-Boot] [PATCH] Move ICS CLK chip frequenty calculation code into a common board library

Timur Tabi timur at freescale.com
Fri May 21 23:09:26 CEST 2010


Wolfgang Denk wrote:

> Well, the function is "strMHZ", and it prints a frequency in MHz with
> exactly 3 digits precision - so rounding to the nearest kHz is
> exactly the right thing to do.

Actually, it's not really three significant digits.  "799.992" is six
significant digits.  If you you wanted three, it would have to be "800".

See http://en.wikipedia.org/wiki/Significant_figures

I guess it's a question of taste, but I don't see how printing "799.992 MHz"
is better than "800 MHz".

>> it prints KHz, MHz, or GHz as appropriate, and rounds to the nearest 10th,
>> instead of 1000th.
> 
> That would IMHO be less useful, and require changes to MANY boards
> (essentially all of them) as the output format needs to be adjusted.

How about adding a function to strmhz.c that acts like print_size(), and
then the caller can choose which one he wants?  We could call it print_hz or
print_freq.

-- 
Timur Tabi
Linux kernel developer at Freescale


More information about the U-Boot mailing list