drivers/flash/flexspi_nor: 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
6a06c10f3f
commit
9a162e0b79
1 changed files with 12 additions and 0 deletions
|
|
@ -75,6 +75,7 @@ struct flash_flexspi_nor_data {
|
|||
flexspi_device_config_t config;
|
||||
flexspi_port_t port;
|
||||
bool legacy_poll;
|
||||
uint64_t size;
|
||||
struct flash_pages_layout layout;
|
||||
struct flash_parameters flash_parameters;
|
||||
};
|
||||
|
|
@ -456,6 +457,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)
|
||||
{
|
||||
struct flash_flexspi_nor_data *data = dev->data;
|
||||
|
||||
*size = (uint64_t)data->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)
|
||||
|
|
@ -1259,6 +1269,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
|
||||
|
|
@ -1309,6 +1320,7 @@ static const struct flash_driver_api flash_flexspi_nor_api = {
|
|||
flash_flexspi_nor_data_##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