Skip to content

Commit f3af3dc

Browse files
claudiubezneadlezcano
authored andcommitted
clocksource/drivers/timer-microchip-pit64b: Add delay timer
Add delay timer. Signed-off-by: Claudiu Beznea <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Daniel Lezcano <[email protected]>
1 parent d19c8b2 commit f3af3dc

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

drivers/clocksource/timer-microchip-pit64b.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <linux/clk.h>
1111
#include <linux/clockchips.h>
12+
#include <linux/delay.h>
1213
#include <linux/interrupt.h>
1314
#include <linux/of_address.h>
1415
#include <linux/of_irq.h>
@@ -92,6 +93,8 @@ struct mchp_pit64b_clksrc {
9293
static void __iomem *mchp_pit64b_cs_base;
9394
/* Default cycles for clockevent timer. */
9495
static u64 mchp_pit64b_ce_cycles;
96+
/* Delay timer. */
97+
static struct delay_timer mchp_pit64b_dt;
9598

9699
static inline u64 mchp_pit64b_cnt_read(void __iomem *base)
97100
{
@@ -169,6 +172,11 @@ static u64 notrace mchp_pit64b_sched_read_clk(void)
169172
return mchp_pit64b_cnt_read(mchp_pit64b_cs_base);
170173
}
171174

175+
static unsigned long notrace mchp_pit64b_dt_read(void)
176+
{
177+
return mchp_pit64b_cnt_read(mchp_pit64b_cs_base);
178+
}
179+
172180
static int mchp_pit64b_clkevt_shutdown(struct clock_event_device *cedev)
173181
{
174182
struct mchp_pit64b_timer *timer = clkevt_to_mchp_pit64b_timer(cedev);
@@ -376,6 +384,10 @@ static int __init mchp_pit64b_init_clksrc(struct mchp_pit64b_timer *timer,
376384

377385
sched_clock_register(mchp_pit64b_sched_read_clk, 64, clk_rate);
378386

387+
mchp_pit64b_dt.read_current_timer = mchp_pit64b_dt_read;
388+
mchp_pit64b_dt.freq = clk_rate;
389+
register_current_timer_delay(&mchp_pit64b_dt);
390+
379391
return 0;
380392
}
381393

0 commit comments

Comments
 (0)