Re: [PATCH V5 2/7] clocksource: tegra: add Tegra210 timer support

From: Joseph Lo
Date: Fri Feb 01 2019 - 10:49:25 EST


On 2/1/19 11:43 PM, Jon Hunter wrote:


On 01/02/2019 14:39, Joseph Lo wrote:
On 2/1/19 8:44 PM, Jon Hunter wrote:

On 01/02/2019 03:36, Joseph Lo wrote:
Add support for the Tegra210 timer that runs at oscillator clock
(TMR10-TMR13). We need these timers to work as clock event device and to
replace the ARMv8 architected timer due to it can't survive across the
power cycle of the CPU core or CPUPORESET signal. So it can't be a
wake-up
source when CPU suspends in power down state.

Also convert the original driver to use timer-of API.

It may have been nice to split this into 2 patches to make it easier to
see what is going on but not a big deal.

Cc: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx
Signed-off-by: Joseph Lo <josephl@xxxxxxxxxx>
Acked-by: Thierry Reding <treding@xxxxxxxxxx>
---
snip.

This can't get the timer base address. I think you mean ...

+#ifdef CONFIG_ARM
+#define TIMER_CPU0 0x50 /* TIMER3 */
+#else
+#define TIMER_CPU0 0x90 /* TIMER10 */
+#endif
+#define TIMER_BASE_FOR_CPU(cpu) (TIMER_CPU0 + (cpu) * 8)

Ah I see.

This doesn't need.
+#define TIMER_FOR_CPU(cpu) (TIMER_CPU0 + cpu)
How come? Don't you still need to know the timer index for a given CPU?


Doesn't need. TIMER_BASE_FOR_CPU is enough. Other use cases are well handled by timer-of API. :)

Thanks,
Joseph