summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Howard <github@gadgetoid.com>2025-06-17 14:55:25 +0100
committerPhil Howard <github@gadgetoid.com>2025-06-17 15:17:12 +0100
commitdc8daad3c90d48efb50f5f0469346fae8402540d (patch)
tree335e8d1d57501d318e7afa6f7384681c84fbf099
parentb725c26b4e351b71b8f72ad8e55bbbd5ccce4602 (diff)
rp2/rp2_flash: Add default MICROPY_HW_FLASH_MAX_FREQ.
Set a default MICROPY_HW_FLASH_MAX_FREQ if PICO_FLASH_SPI_CLKDIV is unset. Use a divider of 4, which is the default in boot2_generic_03h.S. Signed-off-by: Phil Howard <github@gadgetoid.com>
-rw-r--r--ports/rp2/rp2_flash.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ports/rp2/rp2_flash.c b/ports/rp2/rp2_flash.c
index 8b467fc6c..d6b9e1365 100644
--- a/ports/rp2/rp2_flash.c
+++ b/ports/rp2/rp2_flash.c
@@ -54,7 +54,12 @@ static_assert(MICROPY_HW_FLASH_STORAGE_BYTES % 4096 == 0, "Flash storage size mu
// On RP2040 if PICO_USE_FASTEST_SUPPORTED_CLOCK is set then SYS_CLK_HZ can be
// 200MHz, potentially putting timings derived from PICO_FLASH_SPI_CLKDIV
// out of range.
+#ifdef PICO_FLASH_SPI_CLKDIV
#define MICROPY_HW_FLASH_MAX_FREQ (SYS_CLK_HZ / PICO_FLASH_SPI_CLKDIV)
+#else
+// A default PICO_FLASH_SPI_CLKDIV of 4 is set in boot2_generic_03h.S
+#define MICROPY_HW_FLASH_MAX_FREQ (SYS_CLK_HZ / 4)
+#endif
#endif
#ifndef MICROPY_HW_FLASH_STORAGE_BASE