/* Wait for status ready (i.e. command done) or timeout.  */
static void nand_wait_status_ready(struct mtd_info *mtd, unsigned long timeo)
/* Wait for status ready (i.e. command done) or timeout.  */
static void nand_wait_status_ready(struct mtd_info *mtd, unsigned long timeo)
{
	register struct nand_chip *chip = mtd_to_nand(mtd);
	u32 time_start;
	int ret;
	timeo = (CONFIG_SYS_HZ * timeo) / 1000;
	time_start = get_timer(0);
	while (get_timer(time_start) < timeo) {
		u8 status;
		ret = nand_read_data_op(chip, &status, sizeof(status), true);
		if (ret)
			return;
		if (status & NAND_STATUS_READY)
			break;
		WATCHDOG_RESET();
	}
}