@@ -256,9 +256,8 @@ struct flash_flexspi_hyperflash_data {
256
256
struct flash_parameters flash_parameters ;
257
257
};
258
258
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 )
260
260
{
261
- struct flash_flexspi_hyperflash_data * data = dev -> data ;
262
261
flexspi_transfer_t transfer ;
263
262
int ret ;
264
263
bool is_busy ;
@@ -289,9 +288,9 @@ static int flash_flexspi_hyperflash_wait_bus_busy(const struct device *dev)
289
288
return ret ;
290
289
}
291
290
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 )
293
293
{
294
- struct flash_flexspi_hyperflash_data * data = dev -> data ;
295
294
flexspi_transfer_t transfer ;
296
295
int ret ;
297
296
@@ -370,11 +369,9 @@ static int flash_flexspi_hyperflash_check_vendor_id(const struct device *dev)
370
369
return ret ;
371
370
}
372
371
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 )
375
374
{
376
- struct flash_flexspi_hyperflash_data * data = dev -> data ;
377
-
378
375
flexspi_transfer_t transfer = {
379
376
.deviceAddress = offset ,
380
377
.port = data -> port ,
@@ -464,23 +461,23 @@ static int flash_flexspi_hyperflash_write(const struct device *dev, off_t offset
464
461
memc_flexspi_wait_bus_idle (& data -> controller );
465
462
}
466
463
#endif
467
- ret = flash_flexspi_hyperflash_write_enable (dev , offset );
464
+ ret = flash_flexspi_hyperflash_write_enable (data , offset );
468
465
if (ret != 0 ) {
469
466
LOG_ERR ("failed to enable write" );
470
467
break ;
471
468
}
472
469
#ifdef CONFIG_FLASH_MCUX_FLEXSPI_HYPERFLASH_WRITE_BUFFER
473
- ret = flash_flexspi_hyperflash_page_program (dev , offset ,
470
+ ret = flash_flexspi_hyperflash_page_program (data , offset ,
474
471
hyperflash_write_buf , i );
475
472
#else
476
- ret = flash_flexspi_hyperflash_page_program (dev , offset , src , i );
473
+ ret = flash_flexspi_hyperflash_page_program (data , offset , src , i );
477
474
#endif
478
475
if (ret != 0 ) {
479
476
LOG_ERR ("failed to write" );
480
477
break ;
481
478
}
482
479
483
- ret = flash_flexspi_hyperflash_wait_bus_busy (dev );
480
+ ret = flash_flexspi_hyperflash_wait_bus_busy (data );
484
481
if (ret != 0 ) {
485
482
LOG_ERR ("failed to wait bus busy" );
486
483
break ;
@@ -546,7 +543,7 @@ static int flash_flexspi_hyperflash_erase(const struct device *dev, off_t offset
546
543
}
547
544
548
545
for (i = 0 ; i < num_sectors ; i ++ ) {
549
- ret = flash_flexspi_hyperflash_write_enable (dev , offset );
546
+ ret = flash_flexspi_hyperflash_write_enable (data , offset );
550
547
if (ret != 0 ) {
551
548
LOG_ERR ("failed to write_enable" );
552
549
break ;
@@ -567,7 +564,7 @@ static int flash_flexspi_hyperflash_erase(const struct device *dev, off_t offset
567
564
}
568
565
569
566
/* wait bus busy */
570
- ret = flash_flexspi_hyperflash_wait_bus_busy (dev );
567
+ ret = flash_flexspi_hyperflash_wait_bus_busy (data );
571
568
if (ret != 0 ) {
572
569
LOG_ERR ("failed to wait bus busy" );
573
570
break ;
0 commit comments