Skip to content

Commit f39940b

Browse files
de-nordickartben
authored andcommitted
drivers/flash/at45: Add flash_get_size API call
The commit adds implementation of flash_get_size to the flash driver. Signed-off-by: Dominik Ermel <[email protected]>
1 parent 8acf0a1 commit f39940b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

drivers/flash/spi_flash_at45.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020 Nordic Semiconductor ASA
2+
* Copyright (c) 2020-2024 Nordic Semiconductor ASA
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -646,11 +646,21 @@ flash_at45_get_parameters(const struct device *dev)
646646
return &flash_at45_parameters;
647647
}
648648

649+
static int spi_flash_at45_get_size(const struct device *dev, uint64_t *size)
650+
{
651+
const struct spi_flash_at45_config *cfg = dev->config;
652+
653+
*size = (uint64_t)cfg->chip_size;
654+
655+
return 0;
656+
}
657+
649658
static const struct flash_driver_api spi_flash_at45_api = {
650659
.read = spi_flash_at45_read,
651660
.write = spi_flash_at45_write,
652661
.erase = spi_flash_at45_erase,
653662
.get_parameters = flash_at45_get_parameters,
663+
.get_size = spi_flash_at45_get_size,
654664
#if defined(CONFIG_FLASH_PAGE_LAYOUT)
655665
.page_layout = spi_flash_at45_pages_layout,
656666
#endif

0 commit comments

Comments
 (0)