/* Abort any transmit and receive operations and put DMA in idle state. AT and AR bits are cleared upon entering in IDLE state. So poll those bits to verify operation.  */
static void abortdma(struct eth_device *dev)
/* Abort any transmit and receive operations and put DMA in idle state. AT and AR bits are cleared upon entering in IDLE state. So poll those bits to verify operation.  */
static void abortdma(struct eth_device *dev)
{
	struct armdfec_device *darmdfec = to_darmdfec(dev);
	struct armdfec_reg *regs = darmdfec->regs;
	int delay;
	int maxretries = 40;
	u32 tmp;
	while (--maxretries) {
		writel(SDMA_CMD_AR | SDMA_CMD_AT, &regs->sdma_cmd);
		udelay(100);
		delay = 10;
		while (--delay) {
			tmp = readl(&regs->sdma_cmd);
			if (!(tmp & (SDMA_CMD_AR | SDMA_CMD_AT)))
				break;
			udelay(10);
		}
		if (delay)
			break;
	}
	if (!maxretries)
		printf("ARMD100 FEC: (%s) DMA Stuck\n", __func__);
}