]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ARM: 7653/2: do not scale loops_per_jiffy when using a constant delay clock
authorNicolas Pitre <nicolas.pitre@linaro.org>
Mon, 18 Feb 2013 15:36:13 +0000 (16:36 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 21 Feb 2013 13:25:36 +0000 (13:25 +0000)
When udelay() is implemented using an architected timer, it is wrong
to scale loops_per_jiffy when changing the CPU clock frequency since
the timer clock remains constant.

The lpj should probably become an implementation detail relevant to
the CPU loop based delay routine only and more confined to it. In the
mean time this is the minimal fix needed to have expected delays with
the timer based implementation when cpufreq is also in use.

Reported-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Nicolas Pitre <nico@linaro.org>
Tested-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Liviu Dudau <Liviu.Dudau@arm.com>
Cc: stable@vger.kernel.org
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/include/asm/delay.h
arch/arm/kernel/smp.c
arch/arm/lib/delay.c

index ab98fdd083bd35064c8e10d04ec041e21c694432..720799fd3a81195f02563ed5540d649adea14e05 100644 (file)
@@ -24,6 +24,7 @@ extern struct arm_delay_ops {
        void (*delay)(unsigned long);
        void (*const_udelay)(unsigned long);
        void (*udelay)(unsigned long);
+       bool const_clock;
 } arm_delay_ops;
 
 #define __delay(n)             arm_delay_ops.delay(n)
index 84f4cbf652e58b3acfea846ad1cad9ddbee72d95..58af91c2a2f79de57df7bb09a25b773f3618c279 100644 (file)
@@ -693,6 +693,9 @@ static int cpufreq_callback(struct notifier_block *nb,
        if (freq->flags & CPUFREQ_CONST_LOOPS)
                return NOTIFY_OK;
 
+       if (arm_delay_ops.const_clock)
+               return NOTIFY_OK;
+
        if (!per_cpu(l_p_j_ref, cpu)) {
                per_cpu(l_p_j_ref, cpu) =
                        per_cpu(cpu_data, cpu).loops_per_jiffy;
index 0dc53854a5d8eb423e468fe255cb0f7c1fa30e15..6b93f6a1a3c7413982d455e674c0a12ba5f70186 100644 (file)
@@ -77,6 +77,7 @@ void __init register_current_timer_delay(const struct delay_timer *timer)
                arm_delay_ops.delay             = __timer_delay;
                arm_delay_ops.const_udelay      = __timer_const_udelay;
                arm_delay_ops.udelay            = __timer_udelay;
+               arm_delay_ops.const_clock       = true;
                delay_calibrated                = true;
        } else {
                pr_info("Ignoring duplicate/late registration of read_current_timer delay\n");