Skip to content

Commit a6ef37c

Browse files
de-nordickartben
authored andcommitted
drivers/flash/spi_nor: Add flash_get_size API call
The commit adds implementation of flash_get_size. Signed-off-by: Dominik Ermel <[email protected]>
1 parent b4a9f1d commit a6ef37c

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

drivers/flash/spi_nor.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,11 +1676,19 @@ flash_nor_get_parameters(const struct device *dev)
16761676
return &flash_nor_parameters;
16771677
}
16781678

1679+
static int flash_nor_get_size(const struct device *dev, uint64_t *size)
1680+
{
1681+
*size = (uint64_t)dev_flash_size(dev);
1682+
1683+
return 0;
1684+
}
1685+
16791686
static const struct flash_driver_api spi_nor_api = {
16801687
.read = spi_nor_read,
16811688
.write = spi_nor_write,
16821689
.erase = spi_nor_erase,
16831690
.get_parameters = flash_nor_get_parameters,
1691+
.get_size = flash_nor_get_size,
16841692
#if defined(CONFIG_FLASH_PAGE_LAYOUT)
16851693
.page_layout = spi_nor_pages_layout,
16861694
#endif
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
CONFIG_SPI=y
22
CONFIG_SPI_NOR=y
33
CONFIG_SOC_FLASH_NRF=n
4+
CONFIG_TEST_DRIVER_FLASH_SIZE=2097152

0 commit comments

Comments
 (0)