/* Function to check IO scan chain engine status and wait if the engine is is active. Poll the IO scan chain engine till maximum iteration reached.  */
static u32 scan_chain_engine_is_idle(u32 max_iter)
/* Function to check IO scan chain engine status and wait if the engine is is active. Poll the IO scan chain engine till maximum iteration reached.  */
static u32 scan_chain_engine_is_idle(u32 max_iter)
{
	const u32 mask = SCANMGR_STAT_ACTIVE | SCANMGR_STAT_WFIFOCNT_MASK;
	u32 status;
	do {
		status = readl(&scan_manager_base->stat);
		if (!(status & mask))
			return 0;
	} while (max_iter--);
	return -ETIMEDOUT;
}