summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 674a47061e..57fb04106d 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);
OpenPOWER on IntegriCloud