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 <mahesh.mahadevan@nxp.com>
This commit is contained in:
Mahesh Mahadevan 2024-04-17 10:50:57 -05:00 committed by Fabio Baltieri
commit 496802178a

View file

@ -4,6 +4,7 @@
*/
#include <zephyr/init.h>
#include <zephyr/device.h>
#include <zephyr/dt-bindings/clock/mcux_lpc_syscon_clock.h>
#include <fsl_clock.h>
#include <fsl_spc.h>
#include <soc.h>
@ -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;