drivers: flash: Implement flash page layout api in mcux driver
Uses the new flash erase-block-size dts property to implement the flash page layout api in the mcux flash driver. Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
This commit is contained in:
parent
d107411820
commit
262595f09f
2 changed files with 17 additions and 2 deletions
|
@ -141,6 +141,7 @@ config SOC_FLASH_NRF5_RADIO_SYNC
|
|||
config SOC_FLASH_MCUX
|
||||
bool "MCUX flash shim driver"
|
||||
depends on FLASH && HAS_MCUX
|
||||
select FLASH_HAS_PAGE_LAYOUT
|
||||
default n
|
||||
help
|
||||
Enables the MCUX flash shim driver.
|
||||
|
|
|
@ -86,6 +86,21 @@ static int flash_mcux_write_protection(struct device *dev, bool enable)
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_FLASH_PAGE_LAYOUT)
|
||||
static const struct flash_pages_layout dev_layout = {
|
||||
.pages_count = KB(CONFIG_FLASH_SIZE) / FLASH_ERASE_BLOCK_SIZE,
|
||||
.pages_size = FLASH_ERASE_BLOCK_SIZE,
|
||||
};
|
||||
|
||||
static void flash_mcux_pages_layout(struct device *dev,
|
||||
const struct flash_pages_layout **layout,
|
||||
size_t *layout_size)
|
||||
{
|
||||
*layout = &dev_layout;
|
||||
*layout_size = 1;
|
||||
}
|
||||
#endif /* CONFIG_FLASH_PAGE_LAYOUT */
|
||||
|
||||
static struct flash_priv flash_data;
|
||||
|
||||
static const struct flash_driver_api flash_mcux_api = {
|
||||
|
@ -94,8 +109,7 @@ static const struct flash_driver_api flash_mcux_api = {
|
|||
.write = flash_mcux_write,
|
||||
.read = flash_mcux_read,
|
||||
#if defined(CONFIG_FLASH_PAGE_LAYOUT)
|
||||
.page_layout = (flash_api_pages_layout)
|
||||
flash_page_layout_not_implemented,
|
||||
.page_layout = flash_mcux_pages_layout,
|
||||
#endif
|
||||
.write_block_size = FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue