ARM: highbank: set timer prescaler to 256
authorRob Herring <rob.herring@calxeda.com>
Thu, 13 Jun 2013 03:24:49 +0000 (22:24 -0500)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Thu, 25 Jul 2013 06:15:33 +0000 (08:15 +0200)
The 150MHz clock rate gives u-boot time functions problems and there's no
benefit to a fast clock, so lower the rate.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
arch/arm/cpu/armv7/highbank/timer.c
arch/arm/include/asm/arch-armv7/systimer.h

index da33d3c3e57e842e8a02251ee62c26ce998b62f1..d93de1e611411f96b19c2c8e3da3674ded45cc9c 100644 (file)
@@ -26,7 +26,7 @@
 
 #undef SYSTIMER_BASE
 #define SYSTIMER_BASE          0xFFF34000      /* Timer 0 and 1 base   */
-#define SYSTIMER_RATE          150000000
+#define SYSTIMER_RATE          (150000000 / 256)
 
 static ulong timestamp;
 static ulong lastinc;
@@ -40,9 +40,11 @@ int timer_init(void)
        /*
         * Setup timer0
         */
+       writel(0, &systimer_base->timer0control);
        writel(SYSTIMER_RELOAD, &systimer_base->timer0load);
        writel(SYSTIMER_RELOAD, &systimer_base->timer0value);
-       writel(SYSTIMER_EN | SYSTIMER_32BIT, &systimer_base->timer0control);
+       writel(SYSTIMER_EN | SYSTIMER_32BIT | SYSTIMER_PRESC_256,
+               &systimer_base->timer0control);
 
        reset_timer_masked();
 
index e745e3750946a7981cdb5dc4c23c376c0b841687..08125f71e72e28c5426c4088c7269efda6be061c 100644 (file)
@@ -30,6 +30,8 @@
 #define SYSTIMER_RELOAD                0xFFFFFFFF
 #define SYSTIMER_EN            (1 << 7)
 #define SYSTIMER_32BIT         (1 << 1)
+#define SYSTIMER_PRESC_16      (1 << 2)
+#define SYSTIMER_PRESC_256     (1 << 3)
 
 struct systimer {
        u32 timer0load;         /* 0x00 */