|
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>
|
@@ -92,6 +93,8 @@ struct mchp_pit64b_clksrc {
|
92 | 93 | static void __iomem *mchp_pit64b_cs_base;
|
93 | 94 | /* Default cycles for clockevent timer. */
|
94 | 95 | static u64 mchp_pit64b_ce_cycles;
|
| 96 | +/* Delay timer. */ |
| 97 | +static struct delay_timer mchp_pit64b_dt; |
95 | 98 |
|
96 | 99 | static inline u64 mchp_pit64b_cnt_read(void __iomem *base)
|
97 | 100 | {
|
@@ -169,6 +172,11 @@ static u64 notrace mchp_pit64b_sched_read_clk(void)
|
169 | 172 | return mchp_pit64b_cnt_read(mchp_pit64b_cs_base);
|
170 | 173 | }
|
171 | 174 |
|
| 175 | +static unsigned long notrace mchp_pit64b_dt_read(void) |
| 176 | +{ |
| 177 | + return mchp_pit64b_cnt_read(mchp_pit64b_cs_base); |
| 178 | +} |
| 179 | + |
172 | 180 | static int mchp_pit64b_clkevt_shutdown(struct clock_event_device *cedev)
|
173 | 181 | {
|
174 | 182 | 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,
|
376 | 384 |
|
377 | 385 | sched_clock_register(mchp_pit64b_sched_read_clk, 64, clk_rate);
|
378 | 386 |
|
| 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 | + |
379 | 391 | return 0;
|
380 | 392 | }
|
381 | 393 |
|
|
0 commit comments