cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 4950410..d34d8ee 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -584,7 +584,7 @@
 	reset_timer();
 #endif
 	start = get_timer(0);
-	WATCHDOG_RESET();
+	schedule();
 	while (flash_is_busy(info, sector)) {
 		if (get_timer(start) > tout) {
 			printf("Flash %s timeout at address %lx data %lx\n",
@@ -677,7 +677,7 @@
 	reset_timer();
 #endif
 	start = get_timer(0);
-	WATCHDOG_RESET();
+	schedule();
 	while (1) {
 		switch (info->portwidth) {
 		case FLASH_CFI_8BIT:
diff --git a/drivers/mtd/nand/core.c b/drivers/mtd/nand/core.c
index 090834a..99c2967 100644
--- a/drivers/mtd/nand/core.c
+++ b/drivers/mtd/nand/core.c
@@ -173,7 +173,7 @@
 	nanddev_offs_to_pos(nand, einfo->addr, &pos);
 	nanddev_offs_to_pos(nand, einfo->addr + einfo->len - 1, &last);
 	while (nanddev_pos_cmp(&pos, &last) <= 0) {
-		WATCHDOG_RESET();
+		schedule();
 		ret = nanddev_erase(nand, &pos);
 		if (ret) {
 			einfo->fail_addr = nanddev_pos_to_offs(nand, &pos);
diff --git a/drivers/mtd/nand/raw/atmel_nand.c b/drivers/mtd/nand/raw/atmel_nand.c
index 06bf5ac..61bfd17 100644
--- a/drivers/mtd/nand/raw/atmel_nand.c
+++ b/drivers/mtd/nand/raw/atmel_nand.c
@@ -420,7 +420,7 @@
 	while (--timeout) {
 		if (pmecc_readl(host->pmerrloc, elisr) & PMERRLOC_CALC_DONE)
 			break;
-		WATCHDOG_RESET();
+		schedule();
 		udelay(1);
 	}
 
@@ -558,7 +558,7 @@
 	while (--timeout) {
 		if (!(pmecc_readl(host->pmecc, sr) & PMECC_SR_BUSY))
 			break;
-		WATCHDOG_RESET();
+		schedule();
 		udelay(1);
 	}
 
@@ -598,7 +598,7 @@
 	while (--timeout) {
 		if (!(pmecc_readl(host->pmecc, sr) & PMECC_SR_BUSY))
 			break;
-		WATCHDOG_RESET();
+		schedule();
 		udelay(1);
 	}
 
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index 1a1a757..215b9ba 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -595,7 +595,7 @@
 
 		if (status & NAND_STATUS_READY)
 			break;
-		WATCHDOG_RESET();
+		schedule();
 	}
 };
 
@@ -2342,7 +2342,7 @@
 	while (1) {
 		unsigned int ecc_failures = mtd->ecc_stats.failed;
 
-		WATCHDOG_RESET();
+		schedule();
 		bytes = min(mtd->writesize - col, readlen);
 		aligned = (bytes == mtd->writesize);
 
@@ -2695,7 +2695,7 @@
 	page = realpage & chip->pagemask;
 
 	while (1) {
-		WATCHDOG_RESET();
+		schedule();
 
 		if (ops->mode == MTD_OPS_RAW)
 			ret = chip->ecc.read_oob_raw(mtd, chip, page);
@@ -3263,7 +3263,7 @@
 		else
 			use_bufpoi = 0;
 
-		WATCHDOG_RESET();
+		schedule();
 		/* Partial page write?, or need to use bounce buffer */
 		if (use_bufpoi) {
 			pr_debug("%s: using write bounce buffer for buf@%p\n",
@@ -3556,7 +3556,7 @@
 	instr->state = MTD_ERASING;
 
 	while (len) {
-		WATCHDOG_RESET();
+		schedule();
 
 		/* Check if we have a bad block, we do not erase bad blocks! */
 		if (!instr->scrub && nand_block_checkbad(mtd, ((loff_t) page) <<
diff --git a/drivers/mtd/nand/raw/nand_util.c b/drivers/mtd/nand/raw/nand_util.c
index 5150607..b2345dc 100644
--- a/drivers/mtd/nand/raw/nand_util.c
+++ b/drivers/mtd/nand/raw/nand_util.c
@@ -103,7 +103,7 @@
 	     erased_length < erase_length;
 	     erase.addr += mtd->erasesize) {
 
-		WATCHDOG_RESET();
+		schedule();
 
 		if (opts->lim && (erase.addr >= (opts->offset + opts->lim))) {
 			puts("Size of erase exceeds limit\n");
@@ -638,7 +638,7 @@
 		size_t block_offset = offset & (mtd->erasesize - 1);
 		size_t write_size, truncated_write_size;
 
-		WATCHDOG_RESET();
+		schedule();
 
 		if (nand_block_isbad(mtd, block_start)) {
 			printf("Skip bad block 0x%08llx\n", block_start);
@@ -753,7 +753,7 @@
 		size_t block_offset = offset & (mtd->erasesize - 1);
 		size_t read_length;
 
-		WATCHDOG_RESET();
+		schedule();
 
 		if (nand_block_isbad(mtd, offset & ~(mtd->erasesize - 1))) {
 			printf("Skipping bad block 0x%08llx\n",
diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index e533095..134bf22 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -579,7 +579,7 @@
 #endif
 
 	nanddev_io_for_each_page(nand, from, ops, &iter) {
-		WATCHDOG_RESET();
+		schedule();
 		ret = spinand_select_target(spinand, iter.req.pos.target);
 		if (ret)
 			break;
@@ -631,7 +631,7 @@
 #endif
 
 	nanddev_io_for_each_page(nand, to, ops, &iter) {
-		WATCHDOG_RESET();
+		schedule();
 		ret = spinand_select_target(spinand, iter.req.pos.target);
 		if (ret)
 			break;
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index f94597c..08fe7d4 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -478,7 +478,7 @@
 	u32 timeo = (CONFIG_SYS_HZ * 20) / 1000;
 	u32 time_start = get_timer(0);
 	do {
-		WATCHDOG_RESET();
+		schedule();
 		if (get_timer(time_start) > timeo)
 			return -EIO;
 		interrupt = this->read_word(this->base + ONENAND_REG_INTERRUPT);
@@ -1170,7 +1170,7 @@
 	u32 timeo = (CONFIG_SYS_HZ * 20) / 1000;
 	u32 time_start = get_timer(0);
 	do {
-		WATCHDOG_RESET();
+		schedule();
 		if (get_timer(time_start) > timeo)
 			return ONENAND_BBT_READ_FATAL_ERROR;
 		interrupt = this->read_word(this->base + ONENAND_REG_INTERRUPT);
diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index f236e87..c73636d 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -958,7 +958,7 @@
 	addr_known = true;
 
 	while (len) {
-		WATCHDOG_RESET();
+		schedule();
 		if (!IS_ENABLED(CONFIG_SPL_BUILD) && ctrlc()) {
 			addr_known = false;
 			ret = -EINTR;
@@ -1721,7 +1721,7 @@
 	for (i = 0; i < len; ) {
 		ssize_t written;
 		loff_t addr = to + i;
-		WATCHDOG_RESET();
+		schedule();
 
 		/*
 		 * If page_size is a power of two, the offset can be quickly