Skip to content

Commit 3cc3b4f

Browse files
Stephen.Zhangeasonxiang
authored andcommitted
driver: sfc: set delay for sfc status request.
Signed-off-by: Stephen.Zhang <Stephen.Zhang@unisoc.com>
1 parent e838739 commit 3cc3b4f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

drivers/src/sfc/hal_sfc.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,11 +531,20 @@ __ramfunc void spiflash_cmd_write(struct spi_flash *flash, const u8_t *cmd,
531531
__ramfunc int spiflash_cmd_poll_bit(struct spi_flash *flash,
532532
unsigned long timeout, u8_t cmd, u32_t poll_bit, u32_t bit_value)
533533
{
534-
u32_t status = 0;
534+
u8_t status = 0;
535535

536536
do {
537537

538+
status = 0;
538539
spiflash_cmd_read(flash, &cmd, 1, 0xFFFFFFFF, &status, 1);
540+
541+
/*flash chip request to reset delay and add read for preventing optimize*/
542+
#if !defined(CONFIG_XIP)
543+
for (u32_t i = 0; i < 300; i++) {
544+
sci_read32(SFC_STATUS);
545+
}
546+
#endif
547+
539548
if (bit_value) {
540549
if ((status & poll_bit))
541550
return 0;

0 commit comments

Comments
 (0)