This is an automated email from the ASF dual-hosted git repository.

archer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 4401036406e13b986f0a9dd63c166b04c3c7c380
Author: Ian Douglas Scott <[email protected]>
AuthorDate: Wed Jan 15 22:31:41 2025 -0800

    arm/rp2040,rp2350: Use `BOARD_XOSC_FREQ` for calculating startup delay
    
    Previously this used a hard-coded value of 12 MHz, but this presumably
    should use `BOARD_XOSC_FREQ`. Similarly to how it is done in pico-sdk.
    
    It looks like all boards are currently defined to use 12 MHz XOSC
    clocks, so this won't change behavior with any of them.
    
    Signed-off-by: Ian Douglas Scott <[email protected]>
---
 arch/arm/src/rp2040/rp2040_xosc.c | 2 +-
 arch/arm/src/rp23xx/rp23xx_xosc.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/src/rp2040/rp2040_xosc.c 
b/arch/arm/src/rp2040/rp2040_xosc.c
index a2492a2dfe..6f8e24e531 100644
--- a/arch/arm/src/rp2040/rp2040_xosc.c
+++ b/arch/arm/src/rp2040/rp2040_xosc.c
@@ -80,7 +80,7 @@ void rp2040_xosc_init(void)
 
   /* Set xosc startup delay */
 
-  uint32_t startup_delay = (((12 * MHZ) / 1000) + 128) / 256;
+  uint32_t startup_delay = ((BOARD_XOSC_FREQ / 1000) + 128) / 256;
   putreg32(startup_delay, RP2040_XOSC_STARTUP);
 
   /* Set the enable bit now that we have set freq range and startup delay */
diff --git a/arch/arm/src/rp23xx/rp23xx_xosc.c 
b/arch/arm/src/rp23xx/rp23xx_xosc.c
index 0da0876e8b..7bd7b3a8f0 100644
--- a/arch/arm/src/rp23xx/rp23xx_xosc.c
+++ b/arch/arm/src/rp23xx/rp23xx_xosc.c
@@ -78,7 +78,7 @@ void rp23xx_xosc_init(void)
 
   /* Set xosc startup delay */
 
-  uint32_t startup_delay = (((12 * MHZ) / 1000) + 128) / 256;
+  uint32_t startup_delay = ((BOARD_XOSC_FREQ / 1000) + 128) / 256;
   putreg32(startup_delay, RP23XX_XOSC_STARTUP);
 
   /* Set the enable bit now that we have set freq range and startup delay */

Reply via email to