From a261a1badcff1705b95ba5debd0b9bac0263bb7a Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Mon, 4 Dec 2006 20:25:47 +0100 Subject: [PATCH] --- yaml --- r: 43411 b: refs/heads/master c: 2f1675c11a0a214855ff6cba23aca239eef7a5fb h: refs/heads/master i: 43409: 3d389995417ac3d1b0cdaf6c4de0b2d43a688e8e 43407: 7e95889f2135f731ff2ac54aa65ccbad9392422f v: v3 --- [refs] | 2 +- trunk/arch/arm/mach-sa1100/generic.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index 00f03af8ec32..0122e5297054 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 838ccbc35eae5b44d47724e5f694dbec4a26d269 +refs/heads/master: 2f1675c11a0a214855ff6cba23aca239eef7a5fb diff --git a/trunk/arch/arm/mach-sa1100/generic.c b/trunk/arch/arm/mach-sa1100/generic.c index 4575f316e141..e510295c2580 100644 --- a/trunk/arch/arm/mach-sa1100/generic.c +++ b/trunk/arch/arm/mach-sa1100/generic.c @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -118,15 +119,21 @@ EXPORT_SYMBOL(cpufreq_get); /* * This is the SA11x0 sched_clock implementation. This has - * a resolution of 271ns, and a maximum value of 1165s. + * a resolution of 271ns, and a maximum value of 32025597s (370 days). + * + * The return value is guaranteed to be monotonic in that range as + * long as there is always less than 582 seconds between successive + * calls to this function. + * * ( * 1E9 / 3686400 => * 78125 / 288) */ unsigned long long sched_clock(void) { - unsigned long long v; + unsigned long long v = cnt32_to_63(OSCR); - v = (unsigned long long)OSCR * 78125; - do_div(v, 288); + /* the <<1 gets rid of the cnt_32_to_63 top bit saving on a bic insn */ + v *= 78125<<1; + do_div(v, 288<<1); return v; }