/* write given data into mii register and wait for transfer to end with timeout (average measured transfer time is 25us)  */
static int do_mdio_op(struct bcm_enet_priv *priv, unsigned int data)
/* write given data into mii register and wait for transfer to end with timeout (average measured transfer time is 25us)  */
static int do_mdio_op(struct bcm_enet_priv *priv, unsigned int data)
{
	int limit;
	enet_writel(priv, ENET_IR_MII, ENET_IR_REG);
	enet_writel(priv, data, ENET_MIIDATA_REG);
	wmb();
	limit = 1000;
	do {
		if (enet_readl(priv, ENET_IR_REG) & ENET_IR_MII)
			break;
		udelay(1);
	} while (limit-- > 0);
	return (limit < 0) ? 1 : 0;
}