Skip to content

Commit

Permalink
clocksource: samsung_pwm_timer: Do not use clocksource_mmio
Browse files Browse the repository at this point in the history
In case of Samsung PWM timer, clocksource MMIO can not be used, because
custom suspend/resume callbacks are required.

Signed-off-by: Tomasz Figa <[email protected]>
Reviewed-by: Daniel Lezcano <[email protected]>
Reviewed-by: Sylwester Nawrocki <[email protected]>
Tested-by: Heiko Stuebner <[email protected]>
Tested-by: Mark Brown <[email protected]>
Tested-by: Sylwester Nawrocki <[email protected]>
Acked-by: Arnd Bergmann <[email protected]>
  • Loading branch information
tom3q committed Aug 5, 2013
1 parent 61d7e20 commit 6792e63
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
1 change: 0 additions & 1 deletion drivers/clocksource/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ config CLKSRC_EXYNOS_MCT

config CLKSRC_SAMSUNG_PWM
bool
select CLKSRC_MMIO
help
This is a new clocksource driver for the PWM timer found in
Samsung S3C, S5P and Exynos SoCs, replacing an earlier driver
Expand Down
19 changes: 15 additions & 4 deletions drivers/clocksource/samsung_pwm_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,18 @@ static void __init samsung_clockevent_init(void)
}
}

static cycle_t samsung_clocksource_read(struct clocksource *c)
{
return ~readl_relaxed(pwm.source_reg);
}

static struct clocksource samsung_clocksource = {
.name = "samsung_clocksource_timer",
.rating = 250,
.read = samsung_clocksource_read,
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};

/*
* Override the global weak sched_clock symbol with this
* local implementation which uses the clocksource to get some
Expand All @@ -307,7 +319,7 @@ static void __init samsung_clockevent_init(void)
*/
static u32 notrace samsung_read_sched_clock(void)
{
return ~__raw_readl(pwm.source_reg);
return samsung_clocksource_read(NULL);
}

static void __init samsung_clocksource_init(void)
Expand All @@ -334,9 +346,8 @@ static void __init samsung_clocksource_init(void)
setup_sched_clock(samsung_read_sched_clock,
pwm.variant.bits, clock_rate);

ret = clocksource_mmio_init(pwm.source_reg, "samsung_clocksource_timer",
clock_rate, 250, pwm.variant.bits,
clocksource_mmio_readl_down);
samsung_clocksource.mask = CLOCKSOURCE_MASK(pwm.variant.bits);
ret = clocksource_register_hz(&samsung_clocksource, clock_rate);
if (ret)
panic("samsung_clocksource_timer: can't register clocksource\n");
}
Expand Down

0 comments on commit 6792e63

Please sign in to comment.