diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-07-03 12:22:49 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-07-03 12:22:49 -0700 |
commit | 31351f73ea37a5881fa24377ebc9e79487a77039 (patch) | |
tree | 190ddb8cb56fba4d726c13eb47acdad85ca1378c | |
parent | 9a3c284a6dc894af066bbd6238a37996bb156c40 (diff) | |
parent | a8955cc3a504e43ecd606e9f0d9bc25de240aacb (diff) | |
download | linux-31351f73ea37a5881fa24377ebc9e79487a77039.tar.bz2 |
Merge tag 'nios2-v4.2' of git://git.rocketboards.org/linux-socfpga-next
Pull nios2 update from Ley Foon Tan:
"Check number of timer instances"
* tag 'nios2-v4.2' of git://git.rocketboards.org/linux-socfpga-next:
nios2: check number of timer instances
-rw-r--r-- | arch/nios2/kernel/time.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/arch/nios2/kernel/time.c b/arch/nios2/kernel/time.c index be186a75f622..9e3cc8a40ee9 100644 --- a/arch/nios2/kernel/time.c +++ b/arch/nios2/kernel/time.c @@ -19,7 +19,9 @@ #include <linux/io.h> #include <linux/slab.h> -#define ALTERA_TIMER_STATUS_REG 0 +#define ALTR_TIMER_COMPATIBLE "altr,timer-1.0" + +#define ALTERA_TIMER_STATUS_REG 0 #define ALTERA_TIMER_CONTROL_REG 4 #define ALTERA_TIMER_PERIODL_REG 8 #define ALTERA_TIMER_PERIODH_REG 12 @@ -304,7 +306,16 @@ void read_persistent_clock(struct timespec *ts) void __init time_init(void) { + struct device_node *np; + int count = 0; + + for_each_compatible_node(np, NULL, ALTR_TIMER_COMPATIBLE) + count++; + + if (count < 2) + panic("%d timer is found, it needs 2 timers in system\n", count); + clocksource_of_init(); } -CLOCKSOURCE_OF_DECLARE(nios2_timer, "altr,timer-1.0", nios2_time_init); +CLOCKSOURCE_OF_DECLARE(nios2_timer, ALTR_TIMER_COMPATIBLE, nios2_time_init); |