aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clocksource
diff options
context:
space:
mode:
authorTomasz Figa <tomasz.figa@gmail.com>2013-06-16 18:13:06 -0400
committerTomasz Figa <tomasz.figa@gmail.com>2013-08-05 19:21:43 -0400
commit6792e636d5bfc1b26c25e7ed056b358e1144c6df (patch)
tree96d83eca6d4485aed66bf8d605455800b36170a8 /drivers/clocksource
parent61d7e2056eb6147824a8689c6e6ab62396e26321 (diff)
clocksource: samsung_pwm_timer: Do not use clocksource_mmio
In case of Samsung PWM timer, clocksource MMIO can not be used, because custom suspend/resume callbacks are required. Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Tested-by: Heiko Stuebner <heiko@sntech.de> Tested-by: Mark Brown <broonie@linaro.org> Tested-by: Sylwester Nawrocki <sylvester.nawrocki@gmail.com> Acked-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers/clocksource')
-rw-r--r--drivers/clocksource/Kconfig1
-rw-r--r--drivers/clocksource/samsung_pwm_timer.c19
2 files changed, 15 insertions, 5 deletions
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index b7b9b040a89b..41c69469ce20 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -99,7 +99,6 @@ config CLKSRC_EXYNOS_MCT
99 99
100config CLKSRC_SAMSUNG_PWM 100config CLKSRC_SAMSUNG_PWM
101 bool 101 bool
102 select CLKSRC_MMIO
103 help 102 help
104 This is a new clocksource driver for the PWM timer found in 103 This is a new clocksource driver for the PWM timer found in
105 Samsung S3C, S5P and Exynos SoCs, replacing an earlier driver 104 Samsung S3C, S5P and Exynos SoCs, replacing an earlier driver
diff --git a/drivers/clocksource/samsung_pwm_timer.c b/drivers/clocksource/samsung_pwm_timer.c
index 0c005f4fa296..b3112dc293ba 100644
--- a/drivers/clocksource/samsung_pwm_timer.c
+++ b/drivers/clocksource/samsung_pwm_timer.c
@@ -298,6 +298,18 @@ static void __init samsung_clockevent_init(void)
298 } 298 }
299} 299}
300 300
301static cycle_t samsung_clocksource_read(struct clocksource *c)
302{
303 return ~readl_relaxed(pwm.source_reg);
304}
305
306static struct clocksource samsung_clocksource = {
307 .name = "samsung_clocksource_timer",
308 .rating = 250,
309 .read = samsung_clocksource_read,
310 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
311};
312
301/* 313/*
302 * Override the global weak sched_clock symbol with this 314 * Override the global weak sched_clock symbol with this
303 * local implementation which uses the clocksource to get some 315 * local implementation which uses the clocksource to get some
@@ -307,7 +319,7 @@ static void __init samsung_clockevent_init(void)
307 */ 319 */
308static u32 notrace samsung_read_sched_clock(void) 320static u32 notrace samsung_read_sched_clock(void)
309{ 321{
310 return ~__raw_readl(pwm.source_reg); 322 return samsung_clocksource_read(NULL);
311} 323}
312 324
313static void __init samsung_clocksource_init(void) 325static void __init samsung_clocksource_init(void)
@@ -334,9 +346,8 @@ static void __init samsung_clocksource_init(void)
334 setup_sched_clock(samsung_read_sched_clock, 346 setup_sched_clock(samsung_read_sched_clock,
335 pwm.variant.bits, clock_rate); 347 pwm.variant.bits, clock_rate);
336 348
337 ret = clocksource_mmio_init(pwm.source_reg, "samsung_clocksource_timer", 349 samsung_clocksource.mask = CLOCKSOURCE_MASK(pwm.variant.bits);
338 clock_rate, 250, pwm.variant.bits, 350 ret = clocksource_register_hz(&samsung_clocksource, clock_rate);
339 clocksource_mmio_readl_down);
340 if (ret) 351 if (ret)
341 panic("samsung_clocksource_timer: can't register clocksource\n"); 352 panic("samsung_clocksource_timer: can't register clocksource\n");
342} 353}