Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
[linux-stable.git] / drivers / clocksource / timer-of.h
blob01a2c6b7db0659219742cca98401bf065819f6b6
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __TIMER_OF_H__
3 #define __TIMER_OF_H__
5 #include <linux/clockchips.h>
7 #define TIMER_OF_BASE 0x1
8 #define TIMER_OF_CLOCK 0x2
9 #define TIMER_OF_IRQ 0x4
11 struct of_timer_irq {
12 int irq;
13 int index;
14 const char *name;
15 unsigned long flags;
16 irq_handler_t handler;
19 struct of_timer_base {
20 void __iomem *base;
21 const char *name;
22 int index;
25 struct of_timer_clk {
26 struct clk *clk;
27 const char *name;
28 int index;
29 unsigned long rate;
30 unsigned long period;
33 struct timer_of {
34 unsigned int flags;
35 struct device_node *np;
36 struct clock_event_device clkevt;
37 struct of_timer_base of_base;
38 struct of_timer_irq of_irq;
39 struct of_timer_clk of_clk;
40 void *private_data;
43 static inline struct timer_of *to_timer_of(struct clock_event_device *clkevt)
45 return container_of(clkevt, struct timer_of, clkevt);
48 static inline void __iomem *timer_of_base(struct timer_of *to)
50 return to->of_base.base;
53 static inline int timer_of_irq(struct timer_of *to)
55 return to->of_irq.irq;
58 static inline unsigned long timer_of_rate(struct timer_of *to)
60 return to->of_clk.rate;
63 static inline unsigned long timer_of_period(struct timer_of *to)
65 return to->of_clk.period;
68 extern int __init timer_of_init(struct device_node *np,
69 struct timer_of *to);
71 extern void __init timer_of_cleanup(struct timer_of *to);
73 #endif