From b72db6b02e4b0cc4e20b037bf615d56dd956a211 Mon Sep 17 00:00:00 2001 From: Andrei Gansari Date: Tue, 12 Nov 2019 14:40:23 +0200 Subject: [PATCH] drivers: soc_flash_mcux enabled for LPC soc_flash_mcux added support for IAP Flash device specific to LPC SoC families. Signed-off-by: Andrei Gansari --- drivers/flash/Kconfig.mcux | 2 +- drivers/flash/soc_flash_mcux.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/flash/Kconfig.mcux b/drivers/flash/Kconfig.mcux index 5090cd0afb..a778bdafff 100644 --- a/drivers/flash/Kconfig.mcux +++ b/drivers/flash/Kconfig.mcux @@ -2,7 +2,7 @@ config SOC_FLASH_MCUX bool "MCUX flash shim driver" - depends on HAS_MCUX_FTFX + depends on (HAS_MCUX_FTFX || HAS_MCUX_IAP) select FLASH_HAS_PAGE_LAYOUT select FLASH_HAS_DRIVER_ENABLED help diff --git a/drivers/flash/soc_flash_mcux.c b/drivers/flash/soc_flash_mcux.c index b141a8b39e..8df16512f8 100644 --- a/drivers/flash/soc_flash_mcux.c +++ b/drivers/flash/soc_flash_mcux.c @@ -14,7 +14,11 @@ #include "flash_priv.h" #include "fsl_common.h" +#ifdef CONFIG_HAS_MCUX_IAP +#include "fsl_iap.h" +#else #include "fsl_flash.h" +#endif struct flash_priv { flash_config_t config; @@ -136,7 +140,11 @@ static const struct flash_driver_api flash_mcux_api = { #if defined(CONFIG_FLASH_PAGE_LAYOUT) .page_layout = flash_mcux_pages_layout, #endif +#ifdef DT_FLASH_WRITE_BLOCK_SIZE + .write_block_size = DT_FLASH_WRITE_BLOCK_SIZE, +#else .write_block_size = FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE, +#endif }; static int flash_mcux_init(struct device *dev) @@ -149,8 +157,13 @@ static int flash_mcux_init(struct device *dev) rc = FLASH_Init(&priv->config); +#ifdef CONFIG_HAS_MCUX_IAP + FLASH_GetProperty(&priv->config, kFLASH_PropertyPflashBlockBaseAddr, + &pflash_block_base); +#else FLASH_GetProperty(&priv->config, kFLASH_PropertyPflash0BlockBaseAddr, &pflash_block_base); +#endif priv->pflash_block_base = (u32_t) pflash_block_base; return (rc == kStatus_Success) ? 0 : -EIO;