diff options
-rw-r--r-- | arch/arm/mach-omap2/timer.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c index 69e46631a7cd..def9a0ebe42d 100644 --- a/arch/arm/mach-omap2/timer.c +++ b/arch/arm/mach-omap2/timer.c | |||
@@ -144,6 +144,41 @@ static struct clock_event_device clockevent_gpt = { | |||
144 | .set_mode = omap2_gp_timer_set_mode, | 144 | .set_mode = omap2_gp_timer_set_mode, |
145 | }; | 145 | }; |
146 | 146 | ||
147 | static struct property device_disabled = { | ||
148 | .name = "status", | ||
149 | .length = sizeof("disabled"), | ||
150 | .value = "disabled", | ||
151 | }; | ||
152 | |||
153 | static struct of_device_id omap_timer_match[] __initdata = { | ||
154 | { .compatible = "ti,omap2-timer", }, | ||
155 | { } | ||
156 | }; | ||
157 | |||
158 | /** | ||
159 | * omap_dmtimer_init - initialisation function when device tree is used | ||
160 | * | ||
161 | * For secure OMAP3 devices, timers with device type "timer-secure" cannot | ||
162 | * be used by the kernel as they are reserved. Therefore, to prevent the | ||
163 | * kernel registering these devices remove them dynamically from the device | ||
164 | * tree on boot. | ||
165 | */ | ||
166 | void __init omap_dmtimer_init(void) | ||
167 | { | ||
168 | struct device_node *np; | ||
169 | |||
170 | if (!cpu_is_omap34xx()) | ||
171 | return; | ||
172 | |||
173 | /* If we are a secure device, remove any secure timer nodes */ | ||
174 | if ((omap_type() != OMAP2_DEVICE_TYPE_GP)) { | ||
175 | for_each_matching_node(np, omap_timer_match) { | ||
176 | if (of_get_property(np, "ti,timer-secure", NULL)) | ||
177 | prom_add_property(np, &device_disabled); | ||
178 | } | ||
179 | } | ||
180 | } | ||
181 | |||
147 | static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer, | 182 | static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer, |
148 | int gptimer_id, | 183 | int gptimer_id, |
149 | const char *fck_source) | 184 | const char *fck_source) |
@@ -437,6 +472,7 @@ static inline void __init realtime_counter_init(void) | |||
437 | clksrc_nr, clksrc_src) \ | 472 | clksrc_nr, clksrc_src) \ |
438 | static void __init omap##name##_timer_init(void) \ | 473 | static void __init omap##name##_timer_init(void) \ |
439 | { \ | 474 | { \ |
475 | omap_dmtimer_init(); \ | ||
440 | omap2_gp_clockevent_init((clkev_nr), clkev_src); \ | 476 | omap2_gp_clockevent_init((clkev_nr), clkev_src); \ |
441 | omap2_clocksource_init((clksrc_nr), clksrc_src); \ | 477 | omap2_clocksource_init((clksrc_nr), clksrc_src); \ |
442 | } | 478 | } |