]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/clocksource/timer-of.h
Merge tag 'for-linus-timers-conversion-final-v4.15-rc1' of git://git.kernel.org/pub...
[mirror_ubuntu-bionic-kernel.git] / drivers / clocksource / timer-of.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
dc11bae7
DL
2#ifndef __TIMER_OF_H__
3#define __TIMER_OF_H__
4
5#include <linux/clockchips.h>
6
7#define TIMER_OF_BASE 0x1
8#define TIMER_OF_CLOCK 0x2
9#define TIMER_OF_IRQ 0x4
10
11struct of_timer_irq {
12 int irq;
13 int index;
14 int percpu;
15 const char *name;
16 unsigned long flags;
17 irq_handler_t handler;
18};
19
20struct of_timer_base {
21 void __iomem *base;
22 const char *name;
23 int index;
24};
25
26struct of_timer_clk {
27 struct clk *clk;
28 const char *name;
29 int index;
30 unsigned long rate;
31 unsigned long period;
32};
33
34struct timer_of {
35 unsigned int flags;
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;
41};
42
43static inline struct timer_of *to_timer_of(struct clock_event_device *clkevt)
44{
45 return container_of(clkevt, struct timer_of, clkevt);
46}
47
48static inline void __iomem *timer_of_base(struct timer_of *to)
49{
50 return to->of_base.base;
51}
52
53static inline int timer_of_irq(struct timer_of *to)
54{
55 return to->of_irq.irq;
56}
57
58static inline unsigned long timer_of_rate(struct timer_of *to)
59{
60 return to->of_clk.rate;
61}
62
63static inline unsigned long timer_of_period(struct timer_of *to)
64{
65 return to->of_clk.period;
66}
67
68extern int __init timer_of_init(struct device_node *np,
69 struct timer_of *to);
f48729a9 70
558de282 71extern void __init timer_of_cleanup(struct timer_of *to);
f48729a9 72
dc11bae7 73#endif