summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorBo Shen <voice.shen@atmel.com>2014-10-24 16:13:25 +0800
committerTom Rini <trini@ti.com>2014-11-17 08:47:15 -0500
commita5f35d63f2ec0f95162da924d346922d5888aa38 (patch)
tree37808e437cc7e708c9825ee31c21992cc86f405e /arch
parent59158ba39db9463feddefa54c243da07987b4a09 (diff)
downloadu-boot-imx-a5f35d63f2ec0f95162da924d346922d5888aa38.zip
u-boot-imx-a5f35d63f2ec0f95162da924d346922d5888aa38.tar.gz
u-boot-imx-a5f35d63f2ec0f95162da924d346922d5888aa38.tar.bz2
ARM: atmel: spl: make initialization more stable
We need to make sure the main clock ready field in MCFR is set after switch to main crystal oscillator. Signed-off-by: Bo Shen <voice.shen@atmel.com> Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/cpu/at91-common/spl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/arm/cpu/at91-common/spl.c b/arch/arm/cpu/at91-common/spl.c
index 674a470..57fb041 100644
--- a/arch/arm/cpu/at91-common/spl.c
+++ b/arch/arm/cpu/at91-common/spl.c
@@ -50,6 +50,10 @@ static void switch_to_main_crystal_osc(void)
while (!(readl(&pmc->sr) & AT91_PMC_IXR_MOSCSELS))
;
+ /* Wait until MAINRDY field is set to make sure main clock is stable */
+ while (!(readl(&pmc->mcfr) & AT91_PMC_MAINRDY))
+ ;
+
tmp = readl(&pmc->mor);
tmp &= ~AT91_PMC_MOR_MOSCRCEN;
tmp &= ~AT91_PMC_MOR_KEY(0xff);