From 1fd24fbdbb808308adcf0aa3799f9533131a0a28 Mon Sep 17 00:00:00 2001 From: Derek Snell Date: Wed, 28 May 2025 12:52:35 -0400 Subject: [PATCH] soc: nxp: mcx: MCXNx4x: update SOC to use flash_k4 driver Use flash_k4 driver for internal flash instead of ROM API driver. One benefit is the flash program phrase size decreases from 128 Bytes to 16 Bytes. 16 Byte phrases enables this SOC to leverage the Zephyr NVS subsystem, and the MCUboot swap mode. Signed-off-by: Derek Snell Conflicts: west.yml --- dts/arm/nxp/nxp_mcxnx4x_common.dtsi | 3 +-- modules/hal_nxp/mcux/mcux-sdk-ng/drivers/drivers.cmake | 4 ++-- soc/nxp/mcx/mcxn/Kconfig.defconfig | 4 ++++ west.yml | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/dts/arm/nxp/nxp_mcxnx4x_common.dtsi b/dts/arm/nxp/nxp_mcxnx4x_common.dtsi index 33330aa72bf..7505d44aaaa 100644 --- a/dts/arm/nxp/nxp_mcxnx4x_common.dtsi +++ b/dts/arm/nxp/nxp_mcxnx4x_common.dtsi @@ -629,8 +629,7 @@ compatible = "soc-nv-flash"; reg = <0 DT_SIZE_M(2)>; erase-block-size = <8192>; - /* MCXN54x ROM Flash API supports writing of 128B pages. */ - write-block-size = <128>; + write-block-size = <16>; }; uuid: uuid@1100000 { diff --git a/modules/hal_nxp/mcux/mcux-sdk-ng/drivers/drivers.cmake b/modules/hal_nxp/mcux/mcux-sdk-ng/drivers/drivers.cmake index 9c6ae45585b..14af317323b 100644 --- a/modules/hal_nxp/mcux/mcux-sdk-ng/drivers/drivers.cmake +++ b/modules/hal_nxp/mcux/mcux-sdk-ng/drivers/drivers.cmake @@ -197,7 +197,7 @@ if(CONFIG_SOC_MK82F25615 OR CONFIG_SOC_MK64F12 OR CONFIG_SOC_MK66F18 OR set(CONFIG_MCUX_COMPONENT_driver.sysmpu ON) endif() -if(CONFIG_SOC_SERIES_MCXW) +if(CONFIG_SOC_SERIES_MCXW OR CONFIG_SOC_MCXN947 OR CONFIG_SOC_MCXN547) set_variable_ifdef(CONFIG_SOC_FLASH_MCUX CONFIG_MCUX_COMPONENT_driver.flash_k4) endif() @@ -262,7 +262,7 @@ if(CONFIG_SOC_SERIES_MCXA) set(CONFIG_MCUX_COMPONENT_driver.romapi ON) endif() -if(CONFIG_SOC_SERIES_MCXN) +if(CONFIG_SOC_SERIES_MCXN AND !CONFIG_SOC_MCXN947 AND !CONFIG_SOC_MCXN547) set_variable_ifdef(CONFIG_SOC_FLASH_MCUX CONFIG_MCUX_COMPONENT_driver.romapi_flashiap) endif() diff --git a/soc/nxp/mcx/mcxn/Kconfig.defconfig b/soc/nxp/mcx/mcxn/Kconfig.defconfig index 50d7ba40eb6..2d70ffa3510 100644 --- a/soc/nxp/mcx/mcxn/Kconfig.defconfig +++ b/soc/nxp/mcx/mcxn/Kconfig.defconfig @@ -24,8 +24,12 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC default 16000 if MCUX_LPTMR_TIMER default 150000000 if CORTEX_M_SYSTICK +config MCUX_FLASH_K4_API + default y if (SOC_MCXN947 || SOC_MCXN547) # Initially, only Nx4x uses the k4 driver + # Set to the minimal size of data which can be written. config FLASH_FILL_BUFFER_SIZE + default 16 if (SOC_MCXN947 || SOC_MCXN547) # Initially, only Nx4x uses the k4 driver default 128 # The existing SAI diver cannot initialize the PLL on the board, diff --git a/west.yml b/west.yml index c666805fe12..b21198ed0cd 100644 --- a/west.yml +++ b/west.yml @@ -210,7 +210,7 @@ manifest: groups: - hal - name: hal_nxp - revision: cea5006f1829520e40db1b550a9f49cc69ceba7d + revision: 2fe4ab6cd0d5586d12cc396197d956493575a0dd path: modules/hal/nxp groups: - hal