.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2012 Regents of the University of California |
---|
3 | 4 | * Copyright (C) 2017 SiFive |
---|
4 | | - * |
---|
5 | | - * This program is free software; you can redistribute it and/or |
---|
6 | | - * modify it under the terms of the GNU General Public License |
---|
7 | | - * as published by the Free Software Foundation, version 2. |
---|
8 | | - * |
---|
9 | | - * This program is distributed in the hope that it will be useful, |
---|
10 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | | - * GNU General Public License for more details. |
---|
13 | 5 | */ |
---|
14 | 6 | |
---|
15 | 7 | #include <linux/of_clk.h> |
---|
16 | 8 | #include <linux/clocksource.h> |
---|
17 | 9 | #include <linux/delay.h> |
---|
18 | 10 | #include <asm/sbi.h> |
---|
| 11 | +#include <asm/processor.h> |
---|
19 | 12 | |
---|
20 | 13 | unsigned long riscv_timebase; |
---|
| 14 | +EXPORT_SYMBOL_GPL(riscv_timebase); |
---|
21 | 15 | |
---|
22 | 16 | void __init time_init(void) |
---|
23 | 17 | { |
---|
.. | .. |
---|
27 | 21 | cpu = of_find_node_by_path("/cpus"); |
---|
28 | 22 | if (!cpu || of_property_read_u32(cpu, "timebase-frequency", &prop)) |
---|
29 | 23 | panic(KERN_WARNING "RISC-V system with no 'timebase-frequency' in DTS\n"); |
---|
| 24 | + of_node_put(cpu); |
---|
30 | 25 | riscv_timebase = prop; |
---|
31 | 26 | |
---|
32 | 27 | lpj_fine = riscv_timebase / HZ; |
---|
.. | .. |
---|
34 | 29 | of_clk_init(NULL); |
---|
35 | 30 | timer_probe(); |
---|
36 | 31 | } |
---|
| 32 | + |
---|
| 33 | +void clocksource_arch_init(struct clocksource *cs) |
---|
| 34 | +{ |
---|
| 35 | +#ifdef CONFIG_GENERIC_GETTIMEOFDAY |
---|
| 36 | + cs->vdso_clock_mode = VDSO_CLOCKMODE_ARCHTIMER; |
---|
| 37 | +#else |
---|
| 38 | + cs->vdso_clock_mode = VDSO_CLOCKMODE_NONE; |
---|
| 39 | +#endif |
---|
| 40 | +} |
---|