/* Clear the MSTATUS bits and wait for them to be cleared with time out.  */
static int mcux_i3c_status_clear_timeout(I3C_Type *base, uint32_t mask, uint32_t init_delay_us, uint32_t step_delay_us, uint32_t total_delay_us)
/* Clear the MSTATUS bits and wait for them to be cleared with time out.  */
static int mcux_i3c_status_clear_timeout(I3C_Type *base, uint32_t mask, uint32_t init_delay_us, uint32_t step_delay_us, uint32_t total_delay_us)
{
	uint32_t delayed = init_delay_us;
	int ret = -ETIMEDOUT;
	while (delayed <= total_delay_us) {
		base->MSTATUS = mask;
		if (!mcux_i3c_status_is_set(base, mask)) {
			ret = 0;
			break;
		}
		k_busy_wait(step_delay_us);
		delayed += step_delay_us;
	}
	return ret;
}