summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMakarand Kulkarni <makarand.kulkarni@timesys.com>2013-07-02 13:26:38 -0400
committerMakarand Kulkarni <makarand.kulkarni@timesys.com>2013-07-02 13:26:38 -0400
commit9195c464ad84836d85aa73aef384fe4382f7770d (patch)
treecfc94c68b67c12dd1dc0e9eab22040d826e5c9fc
parent2c4ead2dd6da019f5052a69b12c8f5b6b71f8dca (diff)
Fix for 51540: clock() function returns too large values3.0-vybrid-ts2.5
The issue was caused due to sched_clock() inplementation in pit.c which reported values which were incosistent with what it should
-rw-r--r--arch/arm/kernel/sched_clock.c1
-rw-r--r--arch/arm/plat-mxc/pit.c10
2 files changed, 8 insertions, 3 deletions
diff --git a/arch/arm/kernel/sched_clock.c b/arch/arm/kernel/sched_clock.c
index 9a46370fe9da..a481272d7e8a 100644
--- a/arch/arm/kernel/sched_clock.c
+++ b/arch/arm/kernel/sched_clock.c
@@ -66,6 +66,7 @@ void __init init_sched_clock(struct clock_data *cd, void (*update)(void),
* Ensure that sched_clock() starts off at 0ns
*/
cd->epoch_ns = 0;
+ cd->epoch_cyc = 0;
}
void __init sched_clock_postinit(void)
diff --git a/arch/arm/plat-mxc/pit.c b/arch/arm/plat-mxc/pit.c
index 1e350b950b9f..30b581bef12e 100644
--- a/arch/arm/plat-mxc/pit.c
+++ b/arch/arm/plat-mxc/pit.c
@@ -92,14 +92,18 @@ static DEFINE_CLOCK_DATA(cd);
static void __iomem *sched_clock_reg;
unsigned long long notrace sched_clock(void)
{
- cycle_t cyc = sched_clock_reg ? ((u32)~0
- - __raw_readl(sched_clock_reg)) : 0;
+ cycle_t cyc = 0;
+
+ if (sched_clock_reg)
+ cyc = pit_cnt + pit_cycle_per_jiffy - __raw_readl(sched_clock_reg);
return cyc_to_sched_clock(&cd, cyc, (u32)~0);
}
static void notrace mvf_update_sched_clock(void)
{
- cycle_t cyc = sched_clock_reg ? __raw_readl(sched_clock_reg) : 0;
+ cycle_t cyc = sched_clock_reg ? (pit_cnt + pit_cycle_per_jiffy -
+ __raw_readl(sched_clock_reg)) : 0;
+
update_sched_clock(&cd, cyc, (u32)~0);
}
static int __init pit_clocksource_init(struct clk *timer_clk)