From 55eec942e5808ed57e8b11b3c0c432fbb27c474f Mon Sep 17 00:00:00 2001 From: Mahesh Mahadevan Date: Wed, 17 Apr 2024 10:50:57 -0500 Subject: [PATCH] boards: frdm_mcxn947: Add clock setup for FlexSPI The MEMC driver in memc_mcux_flexspi.c is initialized before the FlexSPI driver (flash_mcux_flexspi_nor.c) and hangs during FlexSPI init. Initialize the FlexSPI clock to 50MHz before the speed is set to the optimum speed by the FlexSPI driver. Signed-off-by: Mahesh Mahadevan --- boards/nxp/frdm_mcxn947/board.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/boards/nxp/frdm_mcxn947/board.c b/boards/nxp/frdm_mcxn947/board.c index e874eddcb8292..29b4bbf846129 100644 --- a/boards/nxp/frdm_mcxn947/board.c +++ b/boards/nxp/frdm_mcxn947/board.c @@ -4,6 +4,7 @@ */ #include #include +#include #include #include #include @@ -191,6 +192,14 @@ static int frdm_mcxn947_init(void) CLOCK_AttachClk(kPLL0_to_CTIMER4); #endif +#if CONFIG_FLASH_MCUX_FLEXSPI_NOR + /* We downclock the FlexSPI to 50MHz, it will be set to the + * optimum speed supported by the Flash device during FLEXSPI + * Init + */ + flexspi_clock_set_freq(MCUX_FLEXSPI_CLK, MHZ(50)); +#endif + /* Set SystemCoreClock variable. */ SystemCoreClock = CLOCK_INIT_CORE_CLOCK;