]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ARM: at91: clock: correct PRES offset for at91sam9x5
authorHeiko Schocher <hs@denx.de>
Wed, 17 Aug 2016 07:13:24 +0000 (09:13 +0200)
committerAndreas Bießmann <andreas@biessmann.org>
Fri, 28 Oct 2016 16:37:13 +0000 (18:37 +0200)
on at91sam9x5 PRES offset is 4 in the PMC master
clock register.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Wenyou Yang <wenyou.yang@atmel.com>
Acked-by: Andreas Bießmann <andreas@biessmann.org>
arch/arm/mach-at91/arm926ejs/clock.c

index c8d24ae826508d2cd254c8717cbbad7eaa5125e1..e3181fab84feaa0c5cdf8e98dc508fd62bf9270d 100644 (file)
@@ -162,7 +162,13 @@ int at91_clock_init(unsigned long main_clock)
        gd->arch.mck_rate_hz = at91_css_to_rate(mckr & AT91_PMC_MCKR_CSS_MASK);
        freq = gd->arch.mck_rate_hz;
 
+#if defined(CONFIG_AT91SAM9X5)
+       /* different in prescale on at91sam9x5 */
+       freq /= (1 << ((mckr & AT91_PMC_MCKR_PRES_MASK) >> 4));
+#else
        freq /= (1 << ((mckr & AT91_PMC_MCKR_PRES_MASK) >> 2)); /* prescale */
+#endif
+
 #if defined(CONFIG_AT91SAM9G20)
        /* mdiv ; (x >> 7) = ((x >> 8) * 2) */
        gd->arch.mck_rate_hz = (mckr & AT91_PMC_MCKR_MDIV_MASK) ?