From eb0c7d6b8bb1c3612c2065960b0bffb5e1bfc087 Mon Sep 17 00:00:00 2001 From: Ley Foon Tan Date: Thu, 7 Jul 2022 09:53:08 +0000 Subject: [PATCH] clocksource: starfive: Update timer names The existing implementation uses DT clock-names 'timer0', 'timer1' and etc as timer names. This will have issue if there are two timer instance IPs in the system. This patch update timer names to format below, example: timer@13050000.ch0 timer@13050000.ch1 timer@13050000.ch2 timer@13050000.ch3 Signed-off-by: Ley Foon Tan --- drivers/clocksource/timer-starfive.c | 9 ++++++--- drivers/clocksource/timer-starfive.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/clocksource/timer-starfive.c b/drivers/clocksource/timer-starfive.c index b7b7e36..9802874 100755 --- a/drivers/clocksource/timer-starfive.c +++ b/drivers/clocksource/timer-starfive.c @@ -410,14 +410,17 @@ static int __init do_starfive_timer_of_init(struct device_node *np, goto irq_err; } - ret = starfive_clockevents_register(clkevt, irq, np, name); + snprintf(clkevt->name, sizeof(clkevt->name), "%s.ch%d", + np->full_name, index); + + ret = starfive_clockevents_register(clkevt, irq, np, clkevt->name); if (ret) { - pr_err("%s: init clockevents failed.\n", name); + pr_err("%s: init clockevents failed.\n", clkevt->name); goto register_err; } clkevt->irq = irq; - ret = starfive_clocksource_init(clkevt, name, np); + ret = starfive_clocksource_init(clkevt, clkevt->name, np); if (ret) goto init_err; } diff --git a/drivers/clocksource/timer-starfive.h b/drivers/clocksource/timer-starfive.h index 940b7b9..a7fadfa 100755 --- a/drivers/clocksource/timer-starfive.h +++ b/drivers/clocksource/timer-starfive.h @@ -85,6 +85,7 @@ struct starfive_clkevt { struct clock_event_device evt; struct clk *clk; struct reset_control *rst; + char name[20]; int irq; u64 periodic; u64 rate; -- 2.7.4