@@ -67,6 +67,7 @@ struct flash_flexspi_nor_data {
67
67
const struct device * controller ;
68
68
flexspi_device_config_t config ;
69
69
flexspi_port_t port ;
70
+ uint64_t * size ;
70
71
struct flash_pages_layout layout ;
71
72
struct flash_parameters flash_parameters ;
72
73
};
@@ -497,6 +498,15 @@ static const struct flash_parameters *flash_flexspi_nor_get_parameters(
497
498
return & data -> flash_parameters ;
498
499
}
499
500
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
+
500
510
#if defined(CONFIG_FLASH_PAGE_LAYOUT )
501
511
static void flash_flexspi_nor_pages_layout (const struct device * dev ,
502
512
const struct flash_pages_layout * * layout , size_t * layout_size )
@@ -552,6 +562,7 @@ static const struct flash_driver_api flash_flexspi_nor_api = {
552
562
.write = flash_flexspi_nor_write ,
553
563
.read = flash_flexspi_nor_read ,
554
564
.get_parameters = flash_flexspi_nor_get_parameters ,
565
+ .get_size = flash_flexspi_nor_get_size ,
555
566
#if defined(CONFIG_FLASH_PAGE_LAYOUT )
556
567
.page_layout = flash_flexspi_nor_pages_layout ,
557
568
#endif
@@ -595,6 +606,7 @@ static const struct flash_driver_api flash_flexspi_nor_api = {
595
606
.controller = DEVICE_DT_GET(DT_INST_BUS(n)), \
596
607
.config = FLASH_FLEXSPI_DEVICE_CONFIG(n), \
597
608
.port = DT_INST_REG_ADDR(n), \
609
+ .size = DT_INST_PROP(n, size) / 8, \
598
610
.layout = { \
599
611
.pages_count = DT_INST_PROP(n, size) / 8 \
600
612
/ SPI_NOR_SECTOR_SIZE, \
0 commit comments