Skip to content

Commit

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

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/1585715222-24489-1-git-send-email-Anson.Huang@nxp.com
  • Loading branch information
Anson Huang authored and Daniel Lezcano committed Apr 9, 2020
1 parent 4855f2b commit ac161f5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/clocksource/timer-imx-tpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,19 @@ static inline void tpm_irq_acknowledge(void)
writel(TPM_STATUS_CH0F, timer_base + TPM_STATUS);
}

static struct delay_timer tpm_delay_timer;

static inline unsigned long tpm_read_counter(void)
{
return readl(timer_base + TPM_CNT);
}

#if defined(CONFIG_ARM)
static struct delay_timer tpm_delay_timer;

static unsigned long tpm_read_current_timer(void)
{
return tpm_read_counter();
}
#endif

static u64 notrace tpm_read_sched_clock(void)
{
Expand Down Expand Up @@ -144,9 +146,11 @@ static struct timer_of to_tpm = {

static int __init tpm_clocksource_init(void)
{
#if defined(CONFIG_ARM)
tpm_delay_timer.read_current_timer = &tpm_read_current_timer;
tpm_delay_timer.freq = timer_of_rate(&to_tpm) >> 3;
register_current_timer_delay(&tpm_delay_timer);
#endif

sched_clock_register(tpm_read_sched_clock, counter_width,
timer_of_rate(&to_tpm) >> 3);
Expand Down

0 comments on commit ac161f5

Please sign in to comment.