/* Wait until Elmer's MI1 interface is ready for new operations.  */
static int mi1_wait_until_ready(adapter_t *adapter, int mi1_reg)
/* Wait until Elmer's MI1 interface is ready for new operations.  */
static int mi1_wait_until_ready(adapter_t *adapter, int mi1_reg)
{
	int attempts = 100, busy;
	do {
		u32 val;
		__t1_tpi_read(adapter, mi1_reg, &val);
		busy = val & F_MI1_OP_BUSY;
		if (busy)
			udelay(10);
	} while (busy && --attempts);
	if (busy)
		CH_ALERT("%s: MDIO operation timed out\n", adapter->name);
	return busy;
}