Skip to content

Commit

Permalink
clocksource: exynos_mct: Don't reset the counter during boot and resume
Browse files Browse the repository at this point in the history
Unfortunately on some exynos systems, resetting the mct counter also
resets the architected timer counter.  This can cause problems if the
architected timer driver has already been initialized because the kernel
will think that the counter has wrapped around, causing a big jump in
printk timestamps and delaying any scheduled clock events until the
counter reaches the value it had before it was reset.

The kernel code makes no assumptions about the initial value of the mct
counter so there is no reason from a software perspective to clear the
counter before starting it.  This also fixes the problems described in
the previous paragraph.

Cc: Olof Johansson <olof@lixom.net>
Cc: Tomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Tested-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
  • Loading branch information
Chirantan Ekbote authored and Kukjin Kim committed Jun 16, 2014
1 parent cf286b4 commit 1d80415
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions drivers/clocksource/exynos_mct.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,10 @@ static void exynos4_mct_write(unsigned int value, unsigned long offset)
}

/* Clocksource handling */
static void exynos4_mct_frc_start(u32 hi, u32 lo)
static void exynos4_mct_frc_start(void)
{
u32 reg;

exynos4_mct_write(lo, EXYNOS4_MCT_G_CNT_L);
exynos4_mct_write(hi, EXYNOS4_MCT_G_CNT_U);

reg = __raw_readl(reg_base + EXYNOS4_MCT_G_TCON);
reg |= MCT_G_TCON_START;
exynos4_mct_write(reg, EXYNOS4_MCT_G_TCON);
Expand All @@ -181,7 +178,7 @@ static cycle_t exynos4_frc_read(struct clocksource *cs)

static void exynos4_frc_resume(struct clocksource *cs)
{
exynos4_mct_frc_start(0, 0);
exynos4_mct_frc_start();
}

struct clocksource mct_frc = {
Expand All @@ -200,7 +197,7 @@ static u64 notrace exynos4_read_sched_clock(void)

static void __init exynos4_clocksource_init(void)
{
exynos4_mct_frc_start(0, 0);
exynos4_mct_frc_start();

if (clocksource_register_hz(&mct_frc, clk_rate))
panic("%s: can't register clocksource\n", mct_frc.name);
Expand Down

0 comments on commit 1d80415

Please sign in to comment.