Skip to content

Commit

Permalink
clocksource/drivers/imx-sysctr: Add internal clock divider handle
Browse files Browse the repository at this point in the history
The system counter block guide states that the base clock is
internally divided by 3 before use, that means the clock input of
system counter defined in DT should be base clock which is normally
from OSC, and then internally divided by 3 before use.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
  • Loading branch information
Anson Huang authored and Daniel Lezcano committed Aug 26, 2019
1 parent 1ce861c commit 4419e19
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/clocksource/timer-imx-sysctr.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#define SYS_CTR_EN 0x1
#define SYS_CTR_IRQ_MASK 0x2

#define SYS_CTR_CLK_DIV 0x3

static void __iomem *sys_ctr_base;
static u32 cmpcr;

Expand Down Expand Up @@ -134,6 +136,9 @@ static int __init sysctr_timer_init(struct device_node *np)
if (ret)
return ret;

/* system counter clock is divided by 3 internally */
to_sysctr.of_clk.rate /= SYS_CTR_CLK_DIV;

sys_ctr_base = timer_of_base(&to_sysctr);
cmpcr = readl(sys_ctr_base + CMPCR);
cmpcr &= ~SYS_CTR_EN;
Expand Down

0 comments on commit 4419e19

Please sign in to comment.