| .. | .. |
|---|
| 13 | 13 | #include <linux/timex.h> |
|---|
| 14 | 14 | #include <linux/time.h> |
|---|
| 15 | 15 | #include <linux/list.h> |
|---|
| 16 | +#include <linux/hashtable.h> |
|---|
| 16 | 17 | #include <linux/cache.h> |
|---|
| 17 | 18 | #include <linux/timer.h> |
|---|
| 19 | +#include <linux/cdev.h> |
|---|
| 18 | 20 | #include <linux/init.h> |
|---|
| 19 | 21 | #include <linux/of.h> |
|---|
| 20 | 22 | #include <asm/div64.h> |
|---|
| 21 | 23 | #include <asm/io.h> |
|---|
| 24 | +#include <uapi/linux/clocksource.h> |
|---|
| 22 | 25 | |
|---|
| 23 | 26 | struct clocksource; |
|---|
| 24 | 27 | struct module; |
|---|
| .. | .. |
|---|
| 28 | 31 | #include <asm/clocksource.h> |
|---|
| 29 | 32 | #endif |
|---|
| 30 | 33 | |
|---|
| 34 | + |
|---|
| 31 | 35 | #include <vdso/clocksource.h> |
|---|
| 36 | + |
|---|
| 37 | +enum clocksource_vdso_type { |
|---|
| 38 | + CLOCKSOURCE_VDSO_NONE = 0, |
|---|
| 39 | + CLOCKSOURCE_VDSO_ARCHITECTED, |
|---|
| 40 | + CLOCKSOURCE_VDSO_MMIO, /* <= Must be last. */ |
|---|
| 41 | +}; |
|---|
| 32 | 42 | |
|---|
| 33 | 43 | /** |
|---|
| 34 | 44 | * struct clocksource - hardware abstraction for a free running counter |
|---|
| .. | .. |
|---|
| 101 | 111 | struct list_head list; |
|---|
| 102 | 112 | int rating; |
|---|
| 103 | 113 | enum vdso_clock_mode vdso_clock_mode; |
|---|
| 114 | + enum clocksource_vdso_type vdso_type; |
|---|
| 104 | 115 | unsigned long flags; |
|---|
| 105 | 116 | |
|---|
| 106 | 117 | int (*enable)(struct clocksource *cs); |
|---|
| .. | .. |
|---|
| 118 | 129 | u64 wd_last; |
|---|
| 119 | 130 | #endif |
|---|
| 120 | 131 | struct module *owner; |
|---|
| 132 | +}; |
|---|
| 133 | + |
|---|
| 134 | +struct clocksource_mmio { |
|---|
| 135 | + void __iomem *reg; |
|---|
| 136 | + struct clocksource clksrc; |
|---|
| 137 | +}; |
|---|
| 138 | + |
|---|
| 139 | +struct clocksource_user_mmio { |
|---|
| 140 | + struct clocksource_mmio mmio; |
|---|
| 141 | + void __iomem *reg_upper; |
|---|
| 142 | + unsigned int bits_lower; |
|---|
| 143 | + unsigned int mask_lower; |
|---|
| 144 | + unsigned int mask_upper; |
|---|
| 145 | + enum clksrc_user_mmio_type type; |
|---|
| 146 | + unsigned long phys_lower; |
|---|
| 147 | + unsigned long phys_upper; |
|---|
| 148 | + unsigned int id; |
|---|
| 149 | + struct device *dev; |
|---|
| 150 | + struct cdev cdev; |
|---|
| 151 | + DECLARE_HASHTABLE(mappings, 10); |
|---|
| 152 | + struct spinlock lock; |
|---|
| 153 | + struct list_head link; |
|---|
| 154 | +}; |
|---|
| 155 | + |
|---|
| 156 | +struct clocksource_mmio_regs { |
|---|
| 157 | + void __iomem *reg_upper; |
|---|
| 158 | + void __iomem *reg_lower; |
|---|
| 159 | + unsigned int bits_upper; |
|---|
| 160 | + unsigned int bits_lower; |
|---|
| 161 | + unsigned long (*revmap)(void *); |
|---|
| 121 | 162 | }; |
|---|
| 122 | 163 | |
|---|
| 123 | 164 | /* |
|---|
| .. | .. |
|---|
| 264 | 305 | extern u64 clocksource_mmio_readl_down(struct clocksource *); |
|---|
| 265 | 306 | extern u64 clocksource_mmio_readw_up(struct clocksource *); |
|---|
| 266 | 307 | extern u64 clocksource_mmio_readw_down(struct clocksource *); |
|---|
| 308 | +extern u64 clocksource_dual_mmio_readw_up(struct clocksource *); |
|---|
| 309 | +extern u64 clocksource_dual_mmio_readl_up(struct clocksource *); |
|---|
| 267 | 310 | |
|---|
| 268 | 311 | extern int clocksource_mmio_init(void __iomem *, const char *, |
|---|
| 269 | 312 | unsigned long, int, unsigned, u64 (*)(struct clocksource *)); |
|---|
| 270 | 313 | |
|---|
| 314 | +extern int clocksource_user_mmio_init(struct clocksource_user_mmio *ucs, |
|---|
| 315 | + const struct clocksource_mmio_regs *regs, |
|---|
| 316 | + unsigned long hz); |
|---|
| 317 | + |
|---|
| 318 | +extern int clocksource_user_single_mmio_init( |
|---|
| 319 | + void __iomem *base, const char *name, |
|---|
| 320 | + unsigned long hz, int rating, unsigned int bits, |
|---|
| 321 | + u64 (*read)(struct clocksource *)); |
|---|
| 322 | + |
|---|
| 271 | 323 | extern int clocksource_i8253_init(void); |
|---|
| 272 | 324 | |
|---|
| 273 | 325 | #define TIMER_OF_DECLARE(name, compat, fn) \ |
|---|