Skip to content

Commit e1869ef

Browse files
erwangotpambor
authored andcommitted
drivers: flash: stm32 o/xspi: Implement get_size()
This api was missing from these driver. Add it. Signed-off-by: Erwan Gouriou <[email protected]>
1 parent da1dfc1 commit e1869ef

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

drivers/flash/flash_stm32_ospi.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,11 +1702,21 @@ static void flash_stm32_ospi_pages_layout(const struct device *dev,
17021702
}
17031703
#endif
17041704

1705+
static int flash_stm32_ospi_get_size(const struct device *dev, uint64_t *size)
1706+
{
1707+
const struct flash_stm32_ospi_config *dev_cfg = dev->config;
1708+
1709+
*size = (uint64_t)dev_cfg->flash_size;
1710+
1711+
return 0;
1712+
}
1713+
17051714
static DEVICE_API(flash, flash_stm32_ospi_driver_api) = {
17061715
.read = flash_stm32_ospi_read,
17071716
.write = flash_stm32_ospi_write,
17081717
.erase = flash_stm32_ospi_erase,
17091718
.get_parameters = flash_stm32_ospi_get_parameters,
1719+
.get_size = flash_stm32_ospi_get_size,
17101720
#if defined(CONFIG_FLASH_PAGE_LAYOUT)
17111721
.page_layout = flash_stm32_ospi_pages_layout,
17121722
#endif

drivers/flash/flash_stm32_xspi.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,11 +1562,21 @@ static void flash_stm32_xspi_pages_layout(const struct device *dev,
15621562
}
15631563
#endif
15641564

1565+
static int flash_stm32_xspi_get_size(const struct device *dev, uint64_t *size)
1566+
{
1567+
const struct flash_stm32_xspi_config *dev_cfg = dev->config;
1568+
1569+
*size = (uint64_t)dev_cfg->flash_size;
1570+
1571+
return 0;
1572+
}
1573+
15651574
static DEVICE_API(flash, flash_stm32_xspi_driver_api) = {
15661575
.read = flash_stm32_xspi_read,
15671576
.write = flash_stm32_xspi_write,
15681577
.erase = flash_stm32_xspi_erase,
15691578
.get_parameters = flash_stm32_xspi_get_parameters,
1579+
.get_size = flash_stm32_xspi_get_size,
15701580
#if defined(CONFIG_FLASH_PAGE_LAYOUT)
15711581
.page_layout = flash_stm32_xspi_pages_layout,
15721582
#endif

0 commit comments

Comments
 (0)