Skip to content

Commit

Permalink
drivers: soc_flash_mcux: remove dependency on CONFIG_HAS_MCUX_IAP
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
danieldegrasse authored and fabiobaltieri committed Aug 17, 2022
1 parent f2a6c73 commit 2a53abd
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions drivers/flash/soc_flash_mcux.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
#include "flash_priv.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
#include <zephyr/logging/log.h>
Expand All @@ -33,12 +28,21 @@ LOG_MODULE_REGISTER(flash_mcux);
#define DT_DRV_COMPAT nxp_kinetis_ftfl
#elif DT_NODE_HAS_STATUS(DT_INST(0, nxp_iap_fmc55), okay)
#define DT_DRV_COMPAT nxp_iap_fmc55
#define SOC_HAS_IAP 1
#elif DT_NODE_HAS_STATUS(DT_INST(0, nxp_iap_fmc553), okay)
#define DT_DRV_COMPAT nxp_iap_fmc553
#define SOC_HAS_IAP 1
#else
#error No matching compatible for soc_flash_mcux.c
#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)

#ifdef CONFIG_CHECK_BEFORE_READING
Expand Down Expand Up @@ -272,7 +276,7 @@ static int flash_mcux_init(const struct device *dev)

rc = FLASH_Init(&priv->config);

#ifdef CONFIG_HAS_MCUX_IAP
#ifdef SOC_HAS_IAP
FLASH_GetProperty(&priv->config, kFLASH_PropertyPflashBlockBaseAddr,
&pflash_block_base);
#else
Expand Down

0 comments on commit 2a53abd

Please sign in to comment.