Skip to content

Commit

Permalink
clocksource/drivers/imx-gpt: Add support for ARM64
Browse files Browse the repository at this point in the history
This patch allows building and compile-testing the i.MX GPT driver
also for ARM64. The delay_timer is only supported on ARMv7.

Signed-off-by: Anson Huang <[email protected]>
Signed-off-by: Daniel Lezcano <[email protected]>
  • Loading branch information
Anson-Huang authored and dlezcano committed Dec 18, 2018
1 parent fa83c6f commit df181e3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/clocksource/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ config H8300_TPU

config CLKSRC_IMX_GPT
bool "Clocksource using i.MX GPT" if COMPILE_TEST
depends on ARM && CLKDEV_LOOKUP
depends on (ARM || ARM64) && CLKDEV_LOOKUP
select CLKSRC_MMIO

config CLKSRC_IMX_TPM
Expand Down
4 changes: 4 additions & 0 deletions drivers/clocksource/timer-imx-gpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,21 +141,25 @@ static u64 notrace mxc_read_sched_clock(void)
return sched_clock_reg ? readl_relaxed(sched_clock_reg) : 0;
}

#if defined(CONFIG_ARM)
static struct delay_timer imx_delay_timer;

static unsigned long imx_read_current_timer(void)
{
return readl_relaxed(sched_clock_reg);
}
#endif

static int __init mxc_clocksource_init(struct imx_timer *imxtm)
{
unsigned int c = clk_get_rate(imxtm->clk_per);
void __iomem *reg = imxtm->base + imxtm->gpt->reg_tcn;

#if defined(CONFIG_ARM)
imx_delay_timer.read_current_timer = &imx_read_current_timer;
imx_delay_timer.freq = c;
register_current_timer_delay(&imx_delay_timer);
#endif

sched_clock_reg = reg;

Expand Down

0 comments on commit df181e3

Please sign in to comment.