/* Wait for MSTATUS bit to be set, and clear it afterwards with time out.  */
static int mcux_i3c_state_wait_timeout(I3C_Type *base, uint32_t state, uint32_t init_delay_us, uint32_t step_delay_us, uint32_t total_delay_us)
/* Wait for MSTATUS bit to be set, and clear it afterwards with time out.  */
static int mcux_i3c_state_wait_timeout(I3C_Type *base, uint32_t state, 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) {
		if (mcux_i3c_state_get(base) == state) {
			ret = 0;
			break;
		}
		k_busy_wait(step_delay_us);
		delayed += step_delay_us;
	}
	return ret;
}