@@ -256,9 +256,8 @@ struct flash_flexspi_hyperflash_data {
256256 struct flash_parameters flash_parameters ;
257257};
258258
259- static int flash_flexspi_hyperflash_wait_bus_busy (const struct device * dev )
259+ static int flash_flexspi_hyperflash_wait_bus_busy (struct flash_flexspi_hyperflash_data * data )
260260{
261- struct flash_flexspi_hyperflash_data * data = dev -> data ;
262261 flexspi_transfer_t transfer ;
263262 int ret ;
264263 bool is_busy ;
@@ -289,9 +288,9 @@ static int flash_flexspi_hyperflash_wait_bus_busy(const struct device *dev)
289288 return ret ;
290289}
291290
292- static int flash_flexspi_hyperflash_write_enable (const struct device * dev , uint32_t address )
291+ static int flash_flexspi_hyperflash_write_enable (struct flash_flexspi_hyperflash_data * data ,
292+ uint32_t address )
293293{
294- struct flash_flexspi_hyperflash_data * data = dev -> data ;
295294 flexspi_transfer_t transfer ;
296295 int ret ;
297296
@@ -370,11 +369,9 @@ static int flash_flexspi_hyperflash_check_vendor_id(const struct device *dev)
370369 return ret ;
371370}
372371
373- static int flash_flexspi_hyperflash_page_program (const struct device * dev , off_t
374- offset , const void * buffer , size_t len )
372+ static int flash_flexspi_hyperflash_page_program (struct flash_flexspi_hyperflash_data * data ,
373+ off_t offset , const void * buffer , size_t len )
375374{
376- struct flash_flexspi_hyperflash_data * data = dev -> data ;
377-
378375 flexspi_transfer_t transfer = {
379376 .deviceAddress = offset ,
380377 .port = data -> port ,
@@ -449,23 +446,23 @@ static int flash_flexspi_hyperflash_write(const struct device *dev, off_t offset
449446 hyperflash_write_buf [j ] = src [j ];
450447 }
451448#endif
452- ret = flash_flexspi_hyperflash_write_enable (dev , offset );
449+ ret = flash_flexspi_hyperflash_write_enable (data , offset );
453450 if (ret != 0 ) {
454451 LOG_ERR ("failed to enable write" );
455452 break ;
456453 }
457454#ifdef CONFIG_FLASH_MCUX_FLEXSPI_HYPERFLASH_WRITE_BUFFER
458- ret = flash_flexspi_hyperflash_page_program (dev , offset ,
455+ ret = flash_flexspi_hyperflash_page_program (data , offset ,
459456 hyperflash_write_buf , i );
460457#else
461- ret = flash_flexspi_hyperflash_page_program (dev , offset , src , i );
458+ ret = flash_flexspi_hyperflash_page_program (data , offset , src , i );
462459#endif
463460 if (ret != 0 ) {
464461 LOG_ERR ("failed to write" );
465462 break ;
466463 }
467464
468- ret = flash_flexspi_hyperflash_wait_bus_busy (dev );
465+ ret = flash_flexspi_hyperflash_wait_bus_busy (data );
469466 if (ret != 0 ) {
470467 LOG_ERR ("failed to wait bus busy" );
471468 break ;
@@ -530,7 +527,7 @@ static int flash_flexspi_hyperflash_erase(const struct device *dev, off_t offset
530527 }
531528
532529 for (i = 0 ; i < num_sectors ; i ++ ) {
533- ret = flash_flexspi_hyperflash_write_enable (dev , offset );
530+ ret = flash_flexspi_hyperflash_write_enable (data , offset );
534531 if (ret != 0 ) {
535532 LOG_ERR ("failed to write_enable" );
536533 break ;
@@ -551,7 +548,7 @@ static int flash_flexspi_hyperflash_erase(const struct device *dev, off_t offset
551548 }
552549
553550 /* wait bus busy */
554- ret = flash_flexspi_hyperflash_wait_bus_busy (dev );
551+ ret = flash_flexspi_hyperflash_wait_bus_busy (data );
555552 if (ret != 0 ) {
556553 LOG_ERR ("failed to wait bus busy" );
557554 break ;
0 commit comments