summaryrefslogtreecommitdiff
path: root/cpu/arm926ejs/at91/clock.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2009-07-13 23:45:10 +0200
committerWolfgang Denk <wd@denx.de>2009-07-13 23:45:10 +0200
commitbb272ec8df6e35b7e19ce1237cae28798167a624 (patch)
tree9e8b05cce8c18296234c7596d6099038ae086485 /cpu/arm926ejs/at91/clock.c
parent9833865a2b84ad2bddb54fa9d896f0890be71797 (diff)
parentc3ae126c2cad03f04be36c92dd9437b9ee2385b6 (diff)
downloadu-boot-imx-bb272ec8df6e35b7e19ce1237cae28798167a624.zip
u-boot-imx-bb272ec8df6e35b7e19ce1237cae28798167a624.tar.gz
u-boot-imx-bb272ec8df6e35b7e19ce1237cae28798167a624.tar.bz2
Merge branch 'master' of /home/wd/git/u-boot/custodians
Diffstat (limited to 'cpu/arm926ejs/at91/clock.c')
-rw-r--r--cpu/arm926ejs/at91/clock.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/cpu/arm926ejs/at91/clock.c b/cpu/arm926ejs/at91/clock.c
index 9f03468..574f488 100644
--- a/cpu/arm926ejs/at91/clock.c
+++ b/cpu/arm926ejs/at91/clock.c
@@ -183,15 +183,23 @@ int at91_clock_init(unsigned long main_clock)
* For now, assume this parentage won't change.
*/
mckr = at91_sys_read(AT91_PMC_MCKR);
+#if defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45)
+ /* plla divisor by 2 */
+ plla_rate_hz /= (1 << ((mckr & 1 << 12) >> 12));
+#endif
freq = mck_rate_hz = at91_css_to_rate(mckr & AT91_PMC_CSS);
+
freq /= (1 << ((mckr & AT91_PMC_PRES) >> 2)); /* prescale */
#if defined(CONFIG_AT91RM9200)
mck_rate_hz = freq / (1 + ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */
#elif defined(CONFIG_AT91SAM9G20)
mck_rate_hz = (mckr & AT91_PMC_MDIV) ?
- freq / ((mckr & AT91_PMC_MDIV) >> 7) : freq; /* mdiv ; (x >> 7) = ((x >> 8) * 2) */
+ freq / ((mckr & AT91_PMC_MDIV) >> 7) : freq; /* mdiv ; (x >> 7) = ((x >> 8) * 2) */
if (mckr & AT91_PMC_PDIV)
- freq /= 2; /* processor clock division */
+ freq /= 2; /* processor clock division */
+#elif defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45)
+ mck_rate_hz = (mckr & AT91_PMC_MDIV) == AT91SAM9_PMC_MDIV_3 ?
+ freq / 3 : freq / (1 << ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */
#else
mck_rate_hz = freq / (1 << ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */
#endif