soc: same70: don't switch main clock if already did

Don't switch clock to external clock again if the
bootloader already did.

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
This commit is contained in:
qianfan Zhao 2018-11-19 13:57:24 +08:00 committed by Maureen Helm
commit c43a116f41

View file

@ -71,7 +71,7 @@ static ALWAYS_INLINE void clock_init(void)
* by a previous program i.e. bootloader * by a previous program i.e. bootloader
*/ */
if (PMC->PMC_SR & PMC_SR_MOSCRCS) { if (!(PMC->CKGR_MOR & CKGR_MOR_MOSCSEL_Msk)) {
/* Start the external crystal oscillator */ /* Start the external crystal oscillator */
PMC->CKGR_MOR = CKGR_MOR_KEY_PASSWD PMC->CKGR_MOR = CKGR_MOR_KEY_PASSWD
/* We select maximum setup time. /* We select maximum setup time.
@ -100,6 +100,7 @@ static ALWAYS_INLINE void clock_init(void)
while (!(PMC->PMC_SR & PMC_SR_MOSCSELS)) { while (!(PMC->PMC_SR & PMC_SR_MOSCSELS)) {
; ;
} }
}
/* Turn off RC OSC, not used any longer, to save power */ /* Turn off RC OSC, not used any longer, to save power */
PMC->CKGR_MOR = CKGR_MOR_KEY_PASSWD PMC->CKGR_MOR = CKGR_MOR_KEY_PASSWD
@ -111,7 +112,6 @@ static ALWAYS_INLINE void clock_init(void)
while (PMC->PMC_SR & PMC_SR_MOSCRCS) { while (PMC->PMC_SR & PMC_SR_MOSCRCS) {
; ;
} }
}
#ifdef CONFIG_SOC_ATMEL_SAME70_WAIT_MODE #ifdef CONFIG_SOC_ATMEL_SAME70_WAIT_MODE
/* /*