Commit ac161f57 authored by Anson Huang's avatar Anson Huang Committed by Daniel Lezcano

clocksource/drivers/imx-tpm: Add support for ARM64

Allows building and compile-testing the i.MX TPM driver also
for ARM64. The delay_timer is only supported on ARMv7.
Signed-off-by: default avatarAnson Huang <Anson.Huang@nxp.com>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/1585715222-24489-1-git-send-email-Anson.Huang@nxp.com
parent 4855f2bd
...@@ -61,17 +61,19 @@ static inline void tpm_irq_acknowledge(void) ...@@ -61,17 +61,19 @@ static inline void tpm_irq_acknowledge(void)
writel(TPM_STATUS_CH0F, timer_base + TPM_STATUS); writel(TPM_STATUS_CH0F, timer_base + TPM_STATUS);
} }
static struct delay_timer tpm_delay_timer;
static inline unsigned long tpm_read_counter(void) static inline unsigned long tpm_read_counter(void)
{ {
return readl(timer_base + TPM_CNT); 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) static unsigned long tpm_read_current_timer(void)
{ {
return tpm_read_counter(); return tpm_read_counter();
} }
#endif
static u64 notrace tpm_read_sched_clock(void) static u64 notrace tpm_read_sched_clock(void)
{ {
...@@ -144,9 +146,11 @@ static struct timer_of to_tpm = { ...@@ -144,9 +146,11 @@ static struct timer_of to_tpm = {
static int __init tpm_clocksource_init(void) static int __init tpm_clocksource_init(void)
{ {
#if defined(CONFIG_ARM)
tpm_delay_timer.read_current_timer = &tpm_read_current_timer; tpm_delay_timer.read_current_timer = &tpm_read_current_timer;
tpm_delay_timer.freq = timer_of_rate(&to_tpm) >> 3; tpm_delay_timer.freq = timer_of_rate(&to_tpm) >> 3;
register_current_timer_delay(&tpm_delay_timer); register_current_timer_delay(&tpm_delay_timer);
#endif
sched_clock_register(tpm_read_sched_clock, counter_width, sched_clock_register(tpm_read_sched_clock, counter_width,
timer_of_rate(&to_tpm) >> 3); timer_of_rate(&to_tpm) >> 3);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment