@@ -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 ,
@@ -449,23 +446,23 @@ static int flash_flexspi_hyperflash_write(const struct device *dev, off_t offset
449
446
hyperflash_write_buf [j ] = src [j ];
450
447
}
451
448
#endif
452
- ret = flash_flexspi_hyperflash_write_enable (dev , offset );
449
+ ret = flash_flexspi_hyperflash_write_enable (data , offset );
453
450
if (ret != 0 ) {
454
451
LOG_ERR ("failed to enable write" );
455
452
break ;
456
453
}
457
454
#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 ,
459
456
hyperflash_write_buf , i );
460
457
#else
461
- ret = flash_flexspi_hyperflash_page_program (dev , offset , src , i );
458
+ ret = flash_flexspi_hyperflash_page_program (data , offset , src , i );
462
459
#endif
463
460
if (ret != 0 ) {
464
461
LOG_ERR ("failed to write" );
465
462
break ;
466
463
}
467
464
468
- ret = flash_flexspi_hyperflash_wait_bus_busy (dev );
465
+ ret = flash_flexspi_hyperflash_wait_bus_busy (data );
469
466
if (ret != 0 ) {
470
467
LOG_ERR ("failed to wait bus busy" );
471
468
break ;
@@ -530,7 +527,7 @@ static int flash_flexspi_hyperflash_erase(const struct device *dev, off_t offset
530
527
}
531
528
532
529
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 );
534
531
if (ret != 0 ) {
535
532
LOG_ERR ("failed to write_enable" );
536
533
break ;
@@ -551,7 +548,7 @@ static int flash_flexspi_hyperflash_erase(const struct device *dev, off_t offset
551
548
}
552
549
553
550
/* wait bus busy */
554
- ret = flash_flexspi_hyperflash_wait_bus_busy (dev );
551
+ ret = flash_flexspi_hyperflash_wait_bus_busy (data );
555
552
if (ret != 0 ) {
556
553
LOG_ERR ("failed to wait bus busy" );
557
554
break ;
0 commit comments