/* returns: status for command completion, -1 for Timeout  */
static int zynq_nand_waitfor_ecc_completion(void)
/* returns: status for command completion, -1 for Timeout  */
static int zynq_nand_waitfor_ecc_completion(void)
{
	unsigned long timeout;
	u32 status;
	timeout = 10;
	status = readl(&zynq_nand_smc_base->esr);
	while (status & ZYNQ_NAND_ECC_BUSY) {
		status = readl(&zynq_nand_smc_base->esr);
		if (timeout == 0)
			return -1;
		timeout--;
		udelay(1);
	}
	return status;
}