From 23dbee50ac46d67612bff22ef4059806d9934ca1 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Wed, 3 Jun 2009 11:22:32 +0200 Subject: [PATCH] --- yaml --- r: 160863 b: refs/heads/master c: 6d73665f052a8dadf6f33dfd2546e15199ad7c5f h: refs/heads/master i: 160861: 5287904b6e62d2c856132b6585584d9c206df29c 160859: 93bcdee2367ccb096338b0b0f0cca4ffa353e087 160855: 51a8e163b1cfe6fdfe8b6b04bfba8f7f81718f57 160847: 1279d45857e5e6c95b6d3dbde268461a38c38db0 160831: ab1c7e0e7a2730a31cae4ce036d8d8b0e5c7ef79 v: v3 --- [refs] | 2 +- trunk/arch/arm/plat-mxc/clock.c | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/[refs] b/[refs] index e244f8986dc3..1e2d17a3da00 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5ef881bbecc72862fa379cb286a50f2781db4cec +refs/heads/master: 6d73665f052a8dadf6f33dfd2546e15199ad7c5f diff --git a/trunk/arch/arm/plat-mxc/clock.c b/trunk/arch/arm/plat-mxc/clock.c index 92e13566cd4f..f653213b7416 100644 --- a/trunk/arch/arm/plat-mxc/clock.c +++ b/trunk/arch/arm/plat-mxc/clock.c @@ -39,6 +39,7 @@ #include #include +#include static LIST_HEAD(clocks); static DEFINE_MUTEX(clocks_mutex); @@ -363,12 +364,11 @@ unsigned long mxc_decode_pll(unsigned int reg_val, u32 freq) mfn_abs = mfn; -#if !defined CONFIG_ARCH_MX1 && !defined CONFIG_ARCH_MX21 - if (mfn >= 0x200) { - mfn |= 0xFFFFFE00; - mfn_abs = -mfn; - } -#endif + /* On all i.MXs except i.MX1 and i.MX21 mfn is a 10bit + * 2's complements number + */ + if (!cpu_is_mx1() && !cpu_is_mx21() && mfn >= 0x200) + mfn_abs = 0x400 - mfn; freq *= 2; freq /= pd + 1; @@ -376,8 +376,10 @@ unsigned long mxc_decode_pll(unsigned int reg_val, u32 freq) ll = (unsigned long long)freq * mfn_abs; do_div(ll, mfd + 1); - if (mfn < 0) + + if (!cpu_is_mx1() && !cpu_is_mx21() && mfn >= 0x200) ll = -ll; + ll = (freq * mfi) + ll; return ll;