Skip to content

Commit 5bbc6ee

Browse files
iperrykartben
authored andcommitted
soc: atmel: samx7x: implement main oscillator bypass mode
Enable support for using an external clock as the main clock. When bypass mode is enabled, the external crystal oscillator is bypassed, and the main clock is directly driven by an external clock signal. Signed-off-by: Perry Hung <perry@mosi.io>
1 parent f6b54b1 commit 5bbc6ee

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

soc/atmel/sam/common/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@ config SOC_ATMEL_SAM_EXT_MAINCK
3232

3333
Says n here will use the internal fast RC oscillator running at 12 MHz.
3434

35+
config SOC_ATMEL_SAM_EXT_MAINCK_BYPASS
36+
bool "Use bypass mode for external crystal oscillator"
37+
depends on SOC_ATMEL_SAM_EXT_MAINCK
38+
help
39+
When bypass mode is enabled, the external crystal oscillator is bypassed,
40+
and the main clock is directly driven by an external clock signal.
41+
42+
Says y here if you want to use an external clock signal directly instead
43+
of the crystal oscillator.
44+
45+
Says n here to use the external crystal oscillator normally.
46+
3547
menu "PLL A"
3648

3749
config SOC_ATMEL_SAM_PLLA_MULA

soc/atmel/sam/samx7x/soc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ static ALWAYS_INLINE void clock_init(void)
5757
* this optimization is not deemed
5858
* critical now.
5959
*/
60-
soc_pmc_switch_mainck_to_xtal(false, 0xff);
60+
bool bypass = IS_ENABLED(CONFIG_SOC_ATMEL_SAM_EXT_MAINCK_BYPASS);
61+
62+
soc_pmc_switch_mainck_to_xtal(bypass, 0xff);
6163
}
6264

6365
/*

0 commit comments

Comments
 (0)