Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clocksource/drivers/timer-npcm7xx: Enable timer 1 clock before use

In the WPCM450 SoC, the clocks for each timer can be gated individually.
To prevent the timer 1 clock from being gated, enable it explicitly.

Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Link: https://lore.kernel.org/r/20221104161850.2889894-3-j.neuschaefer@gmx.net
Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org>

authored by

Jonathan Neuschäfer and committed by
Daniel Lezcano
db78539f aa3f72ea

+10
+10
drivers/clocksource/timer-npcm7xx.c
··· 188 188 189 189 static int __init npcm7xx_timer_init(struct device_node *np) 190 190 { 191 + struct clk *clk; 191 192 int ret; 192 193 193 194 ret = timer_of_init(np, &npcm7xx_to); ··· 199 198 /* to the counter */ 200 199 npcm7xx_to.of_clk.rate = npcm7xx_to.of_clk.rate / 201 200 (NPCM7XX_Tx_MIN_PRESCALE + 1); 201 + 202 + /* Enable the clock for timer1, if it exists */ 203 + clk = of_clk_get(np, 1); 204 + if (clk) { 205 + if (!IS_ERR(clk)) 206 + clk_prepare_enable(clk); 207 + else 208 + pr_warn("%pOF: Failed to get clock for timer1: %pe", np, clk); 209 + } 202 210 203 211 npcm7xx_clocksource_init(); 204 212 npcm7xx_clockevents_init();