Skip to content

Commit bc26e1a

Browse files
ChiHuaLnashif
authored andcommitted
drivers: flash: npcx: add k_usleep when polling busy status
Adding k_usleep while polling the flash's busy status yields the CPU resource, giving lower-priority threads the opportunity to run. Signed-off-by: Jun Lin <[email protected]> (cherry picked from commit dee7927)
1 parent 7cfc153 commit bc26e1a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/flash/flash_npcx_fiu_nor.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ LOG_MODULE_REGISTER(flash_npcx_fiu_nor, CONFIG_FLASH_LOG_LEVEL);
2626
#define BLOCK_64K_SIZE KB(64)
2727
#define BLOCK_4K_SIZE KB(4)
2828

29+
#define POLLING_BUSY_SLEEP_TIME_US 100
30+
2931
/* Device config */
3032
struct flash_npcx_nor_config {
3133
/* QSPI bus device for mutex control and bus configuration */
@@ -153,6 +155,7 @@ static int flash_npcx_nor_wait_until_ready(const struct device *dev)
153155
return 0;
154156
}
155157

158+
k_usleep(POLLING_BUSY_SLEEP_TIME_US);
156159
} while ((k_uptime_get() - st) < config->max_timeout);
157160

158161
return -EBUSY;

0 commit comments

Comments
 (0)