Re: [PATCH] clocksource/drivers/timer-ti-dm: Fix suspend and resume for am3 and am4

From: Grygorii Strashko
Date: Wed Jul 15 2020 - 14:44:17 EST




On 15/07/2020 20:32, Tony Lindgren wrote:
* Grygorii Strashko <grygorii.strashko@xxxxxx> [200715 10:17]:
On 13/07/2020 19:26, Tony Lindgren wrote:
@@ -653,8 +679,8 @@ static int __init dmtimer_clocksource_init(struct device_node *np)
dev->mask = CLOCKSOURCE_MASK(32);
dev->flags = CLOCK_SOURCE_IS_CONTINUOUS;
- if (of_device_is_compatible(np, "ti,am33xx") ||
- of_device_is_compatible(np, "ti,am43")) {
+ /* Unlike for clockevent, legacy code sets suspend only for am4 */
+ if (of_machine_is_compatible("ti,am43")) {
dev->suspend = dmtimer_clocksource_suspend;
dev->resume = dmtimer_clocksource_resume;
}


It might be better to use SOC_BUS infra here, which is available on OMAP platforms by default,
instead if DT. What do you think?

Well we have time_init() run very early, and some SoCs have only external
timers. So timer-ti-dm-systimer must be initialized early. And I think
soc_device_match() depends on soc_bus_register() that runs later at
core_initcall().

Ah. right it's early init. I revoke my proposal then.


If you are thinking of something else, or we can use soc_device_match()
early, sure :) But sounds like that change should be a separate patch
then.

The reason for why we need to check for the SoC, we have the compatible
for ti,am335x-timer already in use on am3/4 and dm814x, so we can't use
TIMER_OF_DECLARE alone here.


--
Best regards,
grygorii