From mboxrd@z Thu Jan 1 00:00:00 1970 From: Timur Tabi Date: Fri, 21 May 2010 15:28:00 -0500 Subject: [U-Boot] [PATCH] Move ICS CLK chip frequenty calculation code into a common board library In-Reply-To: <20100521201643.7E4FACCF026@gemini.denx.de> References: <1274433495-31885-1-git-send-email-galak@kernel.crashing.org> <20100521195233.A5156CCF026@gemini.denx.de> <4BF6E5DF.5020306@freescale.com> <20100521201643.7E4FACCF026@gemini.denx.de> Message-ID: <4BF6ECD0.4060202@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Wolfgang Denk wrote: > 799.992 MHz seems to be 24 * 33,333,000 Hz. Are you sure this is the > exact quartz frequency on your board? If yes, then the number printed > should probably remain 799.992 MHz. Or is it 33,333,333 Hz? Or > 33,000,000 ? Ok, I see your point. Technically, I am returning a less precise number. However, the current code adds a 1 to the result, which is definitely wrong. On my board, for example, it returns 99999001, which is not correct. So the existing "rounding" algorithm is broken. However, I believe that displaying 799.999 MHz instead of 800 MHz is silly. The problem is that strmhz() rounds to the nearest KHz. I wonder if that's really useful. Perhaps we should make it act more like print_size(), where it prints KHz, MHz, or GHz as appropriate, and rounds to the nearest 10th, instead of 1000th. -- Timur Tabi Linux kernel developer at Freescale