sparc: leon3: Clear all unused GPTIMER registers.
authorDaniel Hellstrom <daniel@gaisler.com>
Wed, 22 Sep 2010 15:42:29 +0000 (17:42 +0200)
committerFrancois Retief <fgretief@spaceteq.co.za>
Thu, 3 Dec 2015 11:15:49 +0000 (13:15 +0200)
Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
arch/sparc/cpu/leon3/cpu_init.c

index 20a6a256f044eb933d1d69fab03abcc912d66493..0ce2f89dffae3394b8d2b68f08bd7b9f39996f63 100644 (file)
@@ -90,7 +90,7 @@ int arch_cpu_init(void)
 int cpu_init_r(void)
 {
        ambapp_apbdev apbdev;
-       int index, cpu;
+       int index, cpu, ntimers, i;
        ambapp_dev_gptimer *timer = NULL;
        unsigned int bus_freq;
 
@@ -135,6 +135,14 @@ int cpu_init_r(void)
                timer->scalar = timer->scalar_reload =
                    (((bus_freq / 1000) + 500) / 1000) - 1;
 
+               /* Clear All Timers */
+               ntimers = timer->config & 0x7;
+               for (i = 0; i < ntimers; i++) {
+                       timer->e[i].ctrl = GPTIMER_CTRL_IP;
+                       timer->e[i].rld = 0;
+                       timer->e[i].ctrl = GPTIMER_CTRL_LD;
+               }
+
                index++;
        }
        if (!gptimer) {