mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-21 06:01:23 +00:00
nios2: check number of timer instances
Display error message if number of timers is less than 2. Signed-off-by: Ley Foon Tan <lftan@altera.com>
This commit is contained in:
parent
b953c0d234
commit
a8955cc3a5
1 changed files with 13 additions and 2 deletions
|
@ -18,6 +18,8 @@
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
|
|
||||||
|
#define ALTR_TIMER_COMPATIBLE "altr,timer-1.0"
|
||||||
|
|
||||||
#define ALTERA_TIMER_STATUS_REG 0
|
#define ALTERA_TIMER_STATUS_REG 0
|
||||||
#define ALTERA_TIMER_CONTROL_REG 4
|
#define ALTERA_TIMER_CONTROL_REG 4
|
||||||
#define ALTERA_TIMER_PERIODL_REG 8
|
#define ALTERA_TIMER_PERIODL_REG 8
|
||||||
|
@ -302,7 +304,16 @@ void read_persistent_clock(struct timespec *ts)
|
||||||
|
|
||||||
void __init time_init(void)
|
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_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
CLOCKSOURCE_OF_DECLARE(nios2_timer, "altr,timer-1.0", nios2_time_init);
|
CLOCKSOURCE_OF_DECLARE(nios2_timer, ALTR_TIMER_COMPATIBLE, nios2_time_init);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue