drivers: flash: silabs: Fix DT_DRV_COMPAT setting

For a flash driver DT_DRV_COMPAT should be the compatible for the flash
controller and not the soc-nv-flash.  Change to driver to use the flash
controllers compatible and get the soc-nv-flash properties as a child of
that controller.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2020-04-09 12:11:47 -05:00 committed by Kumar Gala
commit 14b6b8b07c

View file

@ -4,7 +4,8 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#define DT_DRV_COMPAT soc_nv_flash #define DT_DRV_COMPAT silabs_gecko_flash_controller
#define SOC_NV_FLASH_NODE DT_INST(0, soc_nv_flash)
#include <stddef.h> #include <stddef.h>
#include <string.h> #include <string.h>
@ -163,9 +164,9 @@ static int erase_flash_block(off_t offset, size_t size)
#if CONFIG_FLASH_PAGE_LAYOUT #if CONFIG_FLASH_PAGE_LAYOUT
static const struct flash_pages_layout flash_gecko_0_pages_layout = { static const struct flash_pages_layout flash_gecko_0_pages_layout = {
.pages_count = (CONFIG_FLASH_SIZE * 1024) / .pages_count = DT_REG_SIZE(SOC_NV_FLASH_NODE) /
DT_INST_PROP(0, erase_block_size), DT_PROP(SOC_NV_FLASH_NODE, erase_block_size),
.pages_size = DT_INST_PROP(0, erase_block_size), .pages_size = DT_PROP(SOC_NV_FLASH_NODE, erase_block_size),
}; };
void flash_gecko_page_layout(struct device *dev, void flash_gecko_page_layout(struct device *dev,
@ -201,7 +202,7 @@ static const struct flash_driver_api flash_gecko_driver_api = {
#ifdef CONFIG_FLASH_PAGE_LAYOUT #ifdef CONFIG_FLASH_PAGE_LAYOUT
.page_layout = flash_gecko_page_layout, .page_layout = flash_gecko_page_layout,
#endif #endif
.write_block_size = DT_INST_PROP(0, write_block_size), .write_block_size = DT_PROP(SOC_NV_FLASH_NODE, write_block_size),
}; };
static struct flash_gecko_data flash_gecko_0_data; static struct flash_gecko_data flash_gecko_0_data;