aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/nios2/kernel/time.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/arch/nios2/kernel/time.c b/arch/nios2/kernel/time.c
index 7f4547418ee1..bea8839d56d8 100644
--- a/arch/nios2/kernel/time.c
+++ b/arch/nios2/kernel/time.c
@@ -18,7 +18,9 @@
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20 20
21#define ALTERA_TIMER_STATUS_REG 0 21#define ALTR_TIMER_COMPATIBLE "altr,timer-1.0"
22
23#define ALTERA_TIMER_STATUS_REG 0
22#define ALTERA_TIMER_CONTROL_REG 4 24#define ALTERA_TIMER_CONTROL_REG 4
23#define ALTERA_TIMER_PERIODL_REG 8 25#define ALTERA_TIMER_PERIODL_REG 8
24#define ALTERA_TIMER_PERIODH_REG 12 26#define ALTERA_TIMER_PERIODH_REG 12
@@ -302,7 +304,16 @@ void read_persistent_clock(struct timespec *ts)
302 304
303void __init time_init(void) 305void __init time_init(void)
304{ 306{
307 struct device_node *np;
308 int count = 0;
309
310 for_each_compatible_node(np, NULL, ALTR_TIMER_COMPATIBLE)
311 count++;
312
313 if (count < 2)
314 panic("%d timer is found, it needs 2 timers in system\n", count);
315
305 clocksource_of_init(); 316 clocksource_of_init();
306} 317}
307 318
308CLOCKSOURCE_OF_DECLARE(nios2_timer, "altr,timer-1.0", nios2_time_init); 319CLOCKSOURCE_OF_DECLARE(nios2_timer, ALTR_TIMER_COMPATIBLE, nios2_time_init);