drivers: soc_flash_mcux: remove dependency on CONFIG_HAS_MCUX_IAP

Remove flash driver dependency on CONFIG_HAS_MCUX_IAP for determining
if the SOC uses an NXP IAP flash controller, and instead use the
devicetree compatible to determine this.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
This commit is contained in:
Daniel DeGrasse 2022-08-17 15:17:31 -05:00 committed by Fabio Baltieri
commit 2a53abd511

View file

@ -14,11 +14,6 @@
#include "flash_priv.h" #include "flash_priv.h"
#include "fsl_common.h" #include "fsl_common.h"
#ifdef CONFIG_HAS_MCUX_IAP
#include "fsl_iap.h"
#else
#include "fsl_flash.h"
#endif
#define LOG_LEVEL CONFIG_FLASH_LOG_LEVEL #define LOG_LEVEL CONFIG_FLASH_LOG_LEVEL
#include <zephyr/logging/log.h> #include <zephyr/logging/log.h>
@ -33,12 +28,21 @@ LOG_MODULE_REGISTER(flash_mcux);
#define DT_DRV_COMPAT nxp_kinetis_ftfl #define DT_DRV_COMPAT nxp_kinetis_ftfl
#elif DT_NODE_HAS_STATUS(DT_INST(0, nxp_iap_fmc55), okay) #elif DT_NODE_HAS_STATUS(DT_INST(0, nxp_iap_fmc55), okay)
#define DT_DRV_COMPAT nxp_iap_fmc55 #define DT_DRV_COMPAT nxp_iap_fmc55
#define SOC_HAS_IAP 1
#elif DT_NODE_HAS_STATUS(DT_INST(0, nxp_iap_fmc553), okay) #elif DT_NODE_HAS_STATUS(DT_INST(0, nxp_iap_fmc553), okay)
#define DT_DRV_COMPAT nxp_iap_fmc553 #define DT_DRV_COMPAT nxp_iap_fmc553
#define SOC_HAS_IAP 1
#else #else
#error No matching compatible for soc_flash_mcux.c #error No matching compatible for soc_flash_mcux.c
#endif #endif
#ifdef SOC_HAS_IAP
#include "fsl_iap.h"
#else
#include "fsl_flash.h"
#endif /* SOC_HAS_IAP */
#define SOC_NV_FLASH_NODE DT_INST(0, soc_nv_flash) #define SOC_NV_FLASH_NODE DT_INST(0, soc_nv_flash)
#ifdef CONFIG_CHECK_BEFORE_READING #ifdef CONFIG_CHECK_BEFORE_READING
@ -272,7 +276,7 @@ static int flash_mcux_init(const struct device *dev)
rc = FLASH_Init(&priv->config); rc = FLASH_Init(&priv->config);
#ifdef CONFIG_HAS_MCUX_IAP #ifdef SOC_HAS_IAP
FLASH_GetProperty(&priv->config, kFLASH_PropertyPflashBlockBaseAddr, FLASH_GetProperty(&priv->config, kFLASH_PropertyPflashBlockBaseAddr,
&pflash_block_base); &pflash_block_base);
#else #else