27 static void timer_get_base_and_rate(
struct device_node *np,
33 panic(
"Unable to map regs for %s", np->
name);
35 if (of_property_read_u32(np,
"clock-freq", rate) &&
36 of_property_read_u32(np,
"clock-frequency", rate))
37 panic(
"No clock-frequency property for %s", np->
name);
40 static void add_clockevent(
struct device_node *event_timer)
48 panic(
"No IRQ for clock event timer");
50 timer_get_base_and_rate(event_timer, &iobase, &rate);
55 panic(
"Unable to initialise clockevent device");
60 static void add_clocksource(
struct device_node *source_timer)
66 timer_get_base_and_rate(source_timer, &iobase, &rate);
70 panic(
"Unable to initialise clocksource device");
76 static void __iomem *sched_io_base;
78 static u32 read_sched_clock(
void)
84 { .compatible =
"picochip,pc3x2-rtc" },
85 { .compatible =
"snps,dw-apb-timer-sp" },
89 static void init_sched_clock(
void)
96 panic(
"No RTC for sched clock to use");
98 timer_get_base_and_rate(sched_timer, &sched_io_base, &rate);
99 of_node_put(sched_timer);
104 static const struct of_device_id osctimer_ids[] __initconst = {
106 { .compatible =
"snps,dw-apb-timer-osc" },
116 panic(
"No timer for clockevent");
117 add_clockevent(event_timer);
121 panic(
"No timer for clocksource");
122 add_clocksource(source_timer);
124 of_node_put(source_timer);