@@ -67,6 +67,7 @@ struct flash_flexspi_nor_data {
6767 const struct device * controller ;
6868 flexspi_device_config_t config ;
6969 flexspi_port_t port ;
70+ uint64_t * size ;
7071 struct flash_pages_layout layout ;
7172 struct flash_parameters flash_parameters ;
7273};
@@ -497,6 +498,15 @@ static const struct flash_parameters *flash_flexspi_nor_get_parameters(
497498 return & data -> flash_parameters ;
498499}
499500
501+ static int flash_flexspi_nor_get_size (const struct device * dev , uint64_t * size )
502+ {
503+ const struct flash_flexspi_nor_config * config = dev -> config ;
504+
505+ * size = config -> size ;
506+
507+ return 0 ;
508+ }
509+
500510#if defined(CONFIG_FLASH_PAGE_LAYOUT )
501511static void flash_flexspi_nor_pages_layout (const struct device * dev ,
502512 const struct flash_pages_layout * * layout , size_t * layout_size )
@@ -552,6 +562,7 @@ static const struct flash_driver_api flash_flexspi_nor_api = {
552562 .write = flash_flexspi_nor_write ,
553563 .read = flash_flexspi_nor_read ,
554564 .get_parameters = flash_flexspi_nor_get_parameters ,
565+ .get_size = flash_flexspi_nor_get_size ,
555566#if defined(CONFIG_FLASH_PAGE_LAYOUT )
556567 .page_layout = flash_flexspi_nor_pages_layout ,
557568#endif
@@ -595,6 +606,7 @@ static const struct flash_driver_api flash_flexspi_nor_api = {
595606 .controller = DEVICE_DT_GET(DT_INST_BUS(n)), \
596607 .config = FLASH_FLEXSPI_DEVICE_CONFIG(n), \
597608 .port = DT_INST_REG_ADDR(n), \
609+ .size = DT_INST_PROP(n, size) / 8, \
598610 .layout = { \
599611 .pages_count = DT_INST_PROP(n, size) / 8 \
600612 / SPI_NOR_SECTOR_SIZE, \
0 commit comments