drivers/flash/spi_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
b4a9f1d67a
commit
a6ef37ca8e
2 changed files with 9 additions and 0 deletions
|
@ -1676,11 +1676,19 @@ flash_nor_get_parameters(const struct device *dev)
|
||||||
return &flash_nor_parameters;
|
return &flash_nor_parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int flash_nor_get_size(const struct device *dev, uint64_t *size)
|
||||||
|
{
|
||||||
|
*size = (uint64_t)dev_flash_size(dev);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct flash_driver_api spi_nor_api = {
|
static const struct flash_driver_api spi_nor_api = {
|
||||||
.read = spi_nor_read,
|
.read = spi_nor_read,
|
||||||
.write = spi_nor_write,
|
.write = spi_nor_write,
|
||||||
.erase = spi_nor_erase,
|
.erase = spi_nor_erase,
|
||||||
.get_parameters = flash_nor_get_parameters,
|
.get_parameters = flash_nor_get_parameters,
|
||||||
|
.get_size = flash_nor_get_size,
|
||||||
#if defined(CONFIG_FLASH_PAGE_LAYOUT)
|
#if defined(CONFIG_FLASH_PAGE_LAYOUT)
|
||||||
.page_layout = spi_nor_pages_layout,
|
.page_layout = spi_nor_pages_layout,
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
CONFIG_SPI=y
|
CONFIG_SPI=y
|
||||||
CONFIG_SPI_NOR=y
|
CONFIG_SPI_NOR=y
|
||||||
CONFIG_SOC_FLASH_NRF=n
|
CONFIG_SOC_FLASH_NRF=n
|
||||||
|
CONFIG_TEST_DRIVER_FLASH_SIZE=2097152
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue