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:
parent
4770528018
commit
c43a116f41
1 changed files with 10 additions and 10 deletions
|
@ -71,7 +71,7 @@ static ALWAYS_INLINE void clock_init(void)
|
|||
* 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 */
|
||||
PMC->CKGR_MOR = CKGR_MOR_KEY_PASSWD
|
||||
/* We select maximum setup time.
|
||||
|
@ -100,17 +100,17 @@ static ALWAYS_INLINE void clock_init(void)
|
|||
while (!(PMC->PMC_SR & PMC_SR_MOSCSELS)) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
/* Turn off RC OSC, not used any longer, to save power */
|
||||
PMC->CKGR_MOR = CKGR_MOR_KEY_PASSWD
|
||||
| CKGR_MOR_MOSCSEL
|
||||
| CKGR_MOR_MOSCXTST(0xFFu)
|
||||
| CKGR_MOR_MOSCXTEN;
|
||||
/* Turn off RC OSC, not used any longer, to save power */
|
||||
PMC->CKGR_MOR = CKGR_MOR_KEY_PASSWD
|
||||
| CKGR_MOR_MOSCSEL
|
||||
| CKGR_MOR_MOSCXTST(0xFFu)
|
||||
| CKGR_MOR_MOSCXTEN;
|
||||
|
||||
/* Wait for RC OSC to be turned off */
|
||||
while (PMC->PMC_SR & PMC_SR_MOSCRCS) {
|
||||
;
|
||||
}
|
||||
/* Wait for RC OSC to be turned off */
|
||||
while (PMC->PMC_SR & PMC_SR_MOSCRCS) {
|
||||
;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SOC_ATMEL_SAME70_WAIT_MODE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue