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

clocksource/drivers/timer-microchip-pit64b: Add delay timer

Add delay timer.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20230203130537.1921608-3-claudiu.beznea@microchip.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

authored by

Claudiu Beznea and committed by
Daniel Lezcano
f3af3dc7 d19c8b2e

+12
+12
drivers/clocksource/timer-microchip-pit64b.c
··· 9 9 10 10 #include <linux/clk.h> 11 11 #include <linux/clockchips.h> 12 + #include <linux/delay.h> 12 13 #include <linux/interrupt.h> 13 14 #include <linux/of_address.h> 14 15 #include <linux/of_irq.h> ··· 93 92 static void __iomem *mchp_pit64b_cs_base; 94 93 /* Default cycles for clockevent timer. */ 95 94 static u64 mchp_pit64b_ce_cycles; 95 + /* Delay timer. */ 96 + static struct delay_timer mchp_pit64b_dt; 96 97 97 98 static inline u64 mchp_pit64b_cnt_read(void __iomem *base) 98 99 { ··· 168 165 } 169 166 170 167 static u64 notrace mchp_pit64b_sched_read_clk(void) 168 + { 169 + return mchp_pit64b_cnt_read(mchp_pit64b_cs_base); 170 + } 171 + 172 + static unsigned long notrace mchp_pit64b_dt_read(void) 171 173 { 172 174 return mchp_pit64b_cnt_read(mchp_pit64b_cs_base); 173 175 } ··· 383 375 } 384 376 385 377 sched_clock_register(mchp_pit64b_sched_read_clk, 64, clk_rate); 378 + 379 + mchp_pit64b_dt.read_current_timer = mchp_pit64b_dt_read; 380 + mchp_pit64b_dt.freq = clk_rate; 381 + register_current_timer_delay(&mchp_pit64b_dt); 386 382 387 383 return 0; 388 384 }