drivers/flash/flexspi_x25um51345g: Add flash_get_size API call
The commit adds implementation of flash_get_size. Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This commit is contained in:
parent
9a162e0b79
commit
6efba38e97
1 changed files with 12 additions and 0 deletions
|
|
@ -67,6 +67,7 @@ struct flash_flexspi_nor_data {
|
|||
const struct device *controller;
|
||||
flexspi_device_config_t config;
|
||||
flexspi_port_t port;
|
||||
uint64_t *size;
|
||||
struct flash_pages_layout layout;
|
||||
struct flash_parameters flash_parameters;
|
||||
};
|
||||
|
|
@ -497,6 +498,15 @@ static const struct flash_parameters *flash_flexspi_nor_get_parameters(
|
|||
return &data->flash_parameters;
|
||||
}
|
||||
|
||||
static int flash_flexspi_nor_get_size(const struct device *dev, uint64_t *size)
|
||||
{
|
||||
const struct flash_flexspi_nor_config *config = dev->config;
|
||||
|
||||
*size = config->size;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_FLASH_PAGE_LAYOUT)
|
||||
static void flash_flexspi_nor_pages_layout(const struct device *dev,
|
||||
const struct flash_pages_layout **layout, size_t *layout_size)
|
||||
|
|
@ -552,6 +562,7 @@ static const struct flash_driver_api flash_flexspi_nor_api = {
|
|||
.write = flash_flexspi_nor_write,
|
||||
.read = flash_flexspi_nor_read,
|
||||
.get_parameters = flash_flexspi_nor_get_parameters,
|
||||
.get_size = flash_flexspi_nor_get_size,
|
||||
#if defined(CONFIG_FLASH_PAGE_LAYOUT)
|
||||
.page_layout = flash_flexspi_nor_pages_layout,
|
||||
#endif
|
||||
|
|
@ -595,6 +606,7 @@ static const struct flash_driver_api flash_flexspi_nor_api = {
|
|||
.controller = DEVICE_DT_GET(DT_INST_BUS(n)), \
|
||||
.config = FLASH_FLEXSPI_DEVICE_CONFIG(n), \
|
||||
.port = DT_INST_REG_ADDR(n), \
|
||||
.size = DT_INST_PROP(n, size) / 8, \
|
||||
.layout = { \
|
||||
.pages_count = DT_INST_PROP(n, size) / 8 \
|
||||
/ SPI_NOR_SECTOR_SIZE, \
|
||||
|
|
|
|||
Loading…
Reference in a new issue