summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Herring <rob.herring@calxeda.com>2013-02-08 16:14:59 -0600
committerRob Herring <rob.herring@calxeda.com>2013-04-10 18:27:11 -0500
commitc115739da801ea1ea20c48e2991ce6761496bef1 (patch)
tree8d7632d56301903a8ab88a9121f2c1c1715958d8
parent3d5a96582303e28c48699f3faaf920ef7d43e6f2 (diff)
downloadlinux-stable-c115739da801ea1ea20c48e2991ce6761496bef1.tar.gz
linux-stable-c115739da801ea1ea20c48e2991ce6761496bef1.tar.bz2
linux-stable-c115739da801ea1ea20c48e2991ce6761496bef1.zip
ARM: sched_clock: allow changing to higher frequency counter
Allow multiple calls to setup_sched_clock and switch to the new counter if it is higher frequency. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
-rw-r--r--arch/arm/kernel/sched_clock.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/arm/kernel/sched_clock.c b/arch/arm/kernel/sched_clock.c
index bd6f56b9ec21..040168e8a60d 100644
--- a/arch/arm/kernel/sched_clock.c
+++ b/arch/arm/kernel/sched_clock.c
@@ -20,6 +20,7 @@ struct clock_data {
u64 epoch_ns;
u32 epoch_cyc;
u32 epoch_cyc_copy;
+ unsigned long rate;
u32 mult;
u32 shift;
bool suspended;
@@ -113,11 +114,14 @@ void __init setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate)
u64 res, wrap;
char r_unit;
+ if (cd.rate > rate)
+ return;
+
BUG_ON(bits > 32);
WARN_ON(!irqs_disabled());
- WARN_ON(read_sched_clock != jiffy_sched_clock_read);
read_sched_clock = read;
sched_clock_mask = (1 << bits) - 1;
+ cd.rate = rate;
/* calculate the mult/shift to convert counter ticks to ns. */
clocks_calc_mult_shift(&cd.mult, &cd.shift, rate, NSEC_PER_SEC, 0);