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 <CHLin56@nuvoton.com>
This commit is contained in:
parent
3295f7c5e2
commit
dee7927a21
1 changed files with 3 additions and 0 deletions
|
@ -26,6 +26,8 @@ LOG_MODULE_REGISTER(flash_npcx_fiu_nor, CONFIG_FLASH_LOG_LEVEL);
|
||||||
#define BLOCK_64K_SIZE KB(64)
|
#define BLOCK_64K_SIZE KB(64)
|
||||||
#define BLOCK_4K_SIZE KB(4)
|
#define BLOCK_4K_SIZE KB(4)
|
||||||
|
|
||||||
|
#define POLLING_BUSY_SLEEP_TIME_US 100
|
||||||
|
|
||||||
/* Device config */
|
/* Device config */
|
||||||
struct flash_npcx_nor_config {
|
struct flash_npcx_nor_config {
|
||||||
/* QSPI bus device for mutex control and bus configuration */
|
/* 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)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
k_usleep(POLLING_BUSY_SLEEP_TIME_US);
|
||||||
} while ((k_uptime_get() - st) < config->max_timeout);
|
} while ((k_uptime_get() - st) < config->max_timeout);
|
||||||
|
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue