diff options
author | Pavel Pisa <ppisa@pikron.com> | 2006-12-06 17:08:27 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-12-07 16:24:15 +0000 |
commit | 5c894cd1c89fc10907febd93e6ef35cd3c65e25e (patch) | |
tree | a7be88236384910ee326402748f1cafd64b9b5ca /arch/arm/mach-imx | |
parent | 9073341c2ba5d5e77b3d05d84cf9e3a16e8a7902 (diff) | |
download | linux-5c894cd1c89fc10907febd93e6ef35cd3c65e25e.tar.bz2 |
[ARM] 3990/1: i.MX/MX1 more precise PLL decode
The future high resolution support inclusion utilizes
imx_decode_pll() in timer base frequency computation.
This use requires more precise computation without
discarding 10 bits by shifting left.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-imx')
-rw-r--r-- | arch/arm/mach-imx/generic.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/arch/arm/mach-imx/generic.c b/arch/arm/mach-imx/generic.c index 12ea58a3b84f..b5aa49d00ca3 100644 --- a/arch/arm/mach-imx/generic.c +++ b/arch/arm/mach-imx/generic.c @@ -104,6 +104,9 @@ EXPORT_SYMBOL(imx_gpio_mode); */ static unsigned int imx_decode_pll(unsigned int pll) { + unsigned long long ll; + unsigned long quot; + u32 mfi = (pll >> 10) & 0xf; u32 mfn = pll & 0x3ff; u32 mfd = (pll >> 16) & 0x3ff; @@ -112,7 +115,11 @@ static unsigned int imx_decode_pll(unsigned int pll) mfi = mfi <= 5 ? 5 : mfi; - return (2 * (f_ref>>10) * ( (mfi<<10) + (mfn<<10) / (mfd+1) )) / (pd+1); + ll = 2 * (unsigned long long)f_ref * ( (mfi<<16) + (mfn<<16) / (mfd+1) ); + quot = (pd+1) * (1<<16); + ll += quot / 2; + do_div(ll, quot); + return (unsigned int) ll; } unsigned int imx_get_system_clk(void) |