diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-07-03 15:22:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-07-03 15:22:49 -0400 |
commit | 31351f73ea37a5881fa24377ebc9e79487a77039 (patch) | |
tree | 190ddb8cb56fba4d726c13eb47acdad85ca1378c | |
parent | 9a3c284a6dc894af066bbd6238a37996bb156c40 (diff) | |
parent | a8955cc3a504e43ecd606e9f0d9bc25de240aacb (diff) |
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 @@ | |||
19 | #include <linux/io.h> | 19 | #include <linux/io.h> |
20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
21 | 21 | ||
22 | #define ALTERA_TIMER_STATUS_REG 0 | 22 | #define ALTR_TIMER_COMPATIBLE "altr,timer-1.0" |
23 | |||
24 | #define ALTERA_TIMER_STATUS_REG 0 | ||
23 | #define ALTERA_TIMER_CONTROL_REG 4 | 25 | #define ALTERA_TIMER_CONTROL_REG 4 |
24 | #define ALTERA_TIMER_PERIODL_REG 8 | 26 | #define ALTERA_TIMER_PERIODL_REG 8 |
25 | #define ALTERA_TIMER_PERIODH_REG 12 | 27 | #define ALTERA_TIMER_PERIODH_REG 12 |
@@ -304,7 +306,16 @@ void read_persistent_clock(struct timespec *ts) | |||
304 | 306 | ||
305 | void __init time_init(void) | 307 | void __init time_init(void) |
306 | { | 308 | { |
309 | struct device_node *np; | ||
310 | int count = 0; | ||
311 | |||
312 | for_each_compatible_node(np, NULL, ALTR_TIMER_COMPATIBLE) | ||
313 | count++; | ||
314 | |||
315 | if (count < 2) | ||
316 | panic("%d timer is found, it needs 2 timers in system\n", count); | ||
317 | |||
307 | clocksource_of_init(); | 318 | clocksource_of_init(); |
308 | } | 319 | } |
309 | 320 | ||
310 | CLOCKSOURCE_OF_DECLARE(nios2_timer, "altr,timer-1.0", nios2_time_init); | 321 | CLOCKSOURCE_OF_DECLARE(nios2_timer, ALTR_TIMER_COMPATIBLE, nios2_time_init); |