reduce fclk on target, reoragnize feature flags into groups

Not all chips can hit rated speed, so for bringup we're defaulting
to the slower setting.
This commit is contained in:
bunnie 2024-06-19 21:33:14 +08:00
parent b9cdf166ca
commit d75624cfe4
2 changed files with 20 additions and 5 deletions

View file

@ -79,17 +79,21 @@ cramium-fpga = [
"cramium-hal",
]
atsama5d27 = ["utralib/atsama5d27", "armv7", "dep:atsama5d27"]
# precursor flags
platform-tests = []
debug-print = []
earlyprintk = []
renode-bypass = []
secboot = []
simulation-only = []
#default = ["debug-print"]
# swap flag
swap = ["aes-gcm-siv"]
# cramium target flags
board-bringup = []
sram-margin = []
boot-delay = []
#default = ["debug-print"]
swap = ["aes-gcm-siv"]
simulation-only = []
quantum-timer-test = ["pio", "pio-proc"]
spim-test = []
spi-alt-channel = []
@ -97,5 +101,10 @@ irq-test = []
usb-test = []
trng-test = []
dump-trng = []
fast-fclk = []
# general flags
debug-print = []
earlyprintk = []
resume = [] # suspend/resume pathway code
default = ["board-bringup", "dump-trng"]

View file

@ -1009,7 +1009,13 @@ unsafe fn init_clock_asic(freq_hz: u32) -> u32 {
// Hits a 16:8:4:2:1 ratio on fclk:aclk:hclk:iclk:pclk
// Resulting in 800:400:200:100:50 MHz assuming 800MHz fclk
#[cfg(feature = "fast-fclk")]
daric_cgu.add(utra::sysctrl::SFR_CGUFD_CFGFDCR_0_4_0.offset()).write_volatile(0x7fff); // fclk
// Hits a 8:8:4:2:1 ratio on fclk:aclk:hclk:iclk:pclk
// Resulting in 400:400:200:100:50 MHz assuming 800MHz fclk
#[cfg(not(feature = "fast-fclk"))]
daric_cgu.add(utra::sysctrl::SFR_CGUFD_CFGFDCR_0_4_0.offset()).write_volatile(0x7f7f); // fclk
daric_cgu.add(utra::sysctrl::SFR_CGUFD_CFGFDCR_0_4_1.offset()).write_volatile(0x3f7f); // aclk
daric_cgu.add(utra::sysctrl::SFR_CGUFD_CFGFDCR_0_4_2.offset()).write_volatile(0x1f3f); // hclk
daric_cgu.add(utra::sysctrl::SFR_CGUFD_CFGFDCR_0_4_3.offset()).write_volatile(0x0f1f); // iclk