From 524ebbc7b36731c863df831a9310320c65064d8a Mon Sep 17 00:00:00 2001 From: "Lars R. Hansen" Date: Sat, 10 Aug 2019 11:11:41 +0100 Subject: [PATCH] atsamd: Add support for SAMD51 overclocking Signed-off-by: Lars R. Hansen Signed-off-by: Kevin O'Connor --- src/atsamd/Kconfig | 26 +++++++++++++++++++++----- src/atsamd/samd51_clock.c | 2 +- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/atsamd/Kconfig b/src/atsamd/Kconfig index bc91c9a5..b847291c 100644 --- a/src/atsamd/Kconfig +++ b/src/atsamd/Kconfig @@ -56,11 +56,6 @@ config MCU default "samd51n19a" if MACH_SAMD51N19 default "samd51p20a" if MACH_SAMD51P20 -config CLOCK_FREQ - int - default 48000000 if MACH_SAMD21 - default 120000000 if MACH_SAMD51 - config FLASH_SIZE hex default 0x8000 if MACH_SAMD21E15 @@ -91,6 +86,27 @@ choice bool "Internal clock" endchoice +choice + depends on MACH_SAMD51 && LOW_LEVEL_OPTIONS + prompt "Processor speed" + config SAMD51_FREQ_120 + bool "120 MHz (standard)" + config SAMD51_FREQ_150 + bool "150 MHz (overclock)" + config SAMD51_FREQ_180 + bool "180 MHz (overclock)" + config SAMD51_FREQ_200 + bool "200 MHz (overclock)" +endchoice + +config CLOCK_FREQ + int + default 48000000 if MACH_SAMD21 + default 150000000 if SAMD51_FREQ_150 + default 180000000 if SAMD51_FREQ_180 + default 200000000 if SAMD51_FREQ_200 + default 120000000 if MACH_SAMD51 + choice prompt "Bootloader offset" config FLASH_START_2000 diff --git a/src/atsamd/samd51_clock.c b/src/atsamd/samd51_clock.c index 1256ac5f..2f5062c2 100644 --- a/src/atsamd/samd51_clock.c +++ b/src/atsamd/samd51_clock.c @@ -13,7 +13,7 @@ #define CLKGEN_48M 3 #define CLKGEN_2M 4 -#define FREQ_MAIN 120000000 +#define FREQ_MAIN CONFIG_CLOCK_FREQ #define FREQ_32K 32768 #define FREQ_48M 48000000 #define FREQ_2M 2000000