C6X: fix timer64 initialization
authorMark Salter <msalter@redhat.com>
Sat, 5 Nov 2011 14:57:40 +0000 (10:57 -0400)
committerMark Salter <msalter@redhat.com>
Sun, 8 Jan 2012 20:12:17 +0000 (15:12 -0500)
Some SoCs have a timer block enable controlled through the DSCR registers.
There is a problem in the timer64 driver initialization where the code
accesses a timer register to get the divisor used to calculate timer clock
rate. If the timer block has not been enabled when this register read takes
place, an exception is generated. This patch makes sure that the timer block
is enabled before accessing the registers.

Signed-off-by: Mark Salter <msalter@redhat.com>
arch/c6x/platforms/timer64.c

index 783415861daec0269d5b7e0648e07761cd0f589d..03c03c2491912084762027a2e5fecf9cbd6f7236 100644 (file)
@@ -215,9 +215,17 @@ void __init timer64_init(void)
 
        /* If there is a device state control, save the ID. */
        err = of_property_read_u32(np, "ti,dscr-dev-enable", &val);
-       if (!err)
+       if (!err) {
                timer64_devstate_id = val;
 
+               /*
+                * It is necessary to enable the timer block here because
+                * the TIMER_DIVISOR macro needs to read a timer register
+                * to get the divisor.
+                */
+               dscr_set_devstate(timer64_devstate_id, DSCR_DEVSTATE_ENABLED);
+       }
+
        pr_debug("%s: Timer irq=%d.\n", np->full_name, cd->irq);
 
        clockevents_calc_mult_shift(cd, c6x_core_freq / TIMER_DIVISOR, 5);
This page took 0.025811 seconds and 5 git commands to generate.