1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/clockchips.h>
7 #define TIMER_OF_BASE 0x1
8 #define TIMER_OF_CLOCK 0x2
9 #define TIMER_OF_IRQ 0x4
17 irq_handler_t handler
;
20 struct of_timer_base
{
36 struct device_node
*np
;
37 struct clock_event_device clkevt
;
38 struct of_timer_base of_base
;
39 struct of_timer_irq of_irq
;
40 struct of_timer_clk of_clk
;
44 static inline struct timer_of
*to_timer_of(struct clock_event_device
*clkevt
)
46 return container_of(clkevt
, struct timer_of
, clkevt
);
49 static inline void __iomem
*timer_of_base(struct timer_of
*to
)
51 return to
->of_base
.base
;
54 static inline int timer_of_irq(struct timer_of
*to
)
56 return to
->of_irq
.irq
;
59 static inline unsigned long timer_of_rate(struct timer_of
*to
)
61 return to
->of_clk
.rate
;
64 static inline unsigned long timer_of_period(struct timer_of
*to
)
66 return to
->of_clk
.period
;
69 extern int __init
timer_of_init(struct device_node
*np
,
72 extern void __init
timer_of_cleanup(struct timer_of
*to
);