NAND: add more watchdog resets
authorScott Wood <scottwood@freescale.com>
Thu, 3 Feb 2011 00:15:57 +0000 (18:15 -0600)
committerScott Wood <scottwood@freescale.com>
Fri, 1 Apr 2011 19:49:08 +0000 (14:49 -0500)
Poke the watchdog in a variety of looping constructs, which could take
a long time to complete.

Signed-off-by: Scott Wood <scottwood@freescale.com>
drivers/mtd/nand/nand_base.c
drivers/mtd/nand/nand_util.c

index 70c05939c1cb2d6ce1fa594d6df1e106fd54ca99..b9bd3942f27bf815522598460ef3d843a695a875 100644 (file)
@@ -1156,6 +1156,8 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
        oob = ops->oobbuf;
 
        while(1) {
+               WATCHDOG_RESET();
+
                bytes = min(mtd->writesize - col, readlen);
                aligned = (bytes == mtd->writesize);
 
@@ -1485,6 +1487,7 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
        page = realpage & chip->pagemask;
 
        while(1) {
+               WATCHDOG_RESET();
                sndcmd = chip->ecc.read_oob(mtd, chip, page, sndcmd);
 
                len = min(len, readlen);
@@ -1884,6 +1887,8 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
                memset(chip->oob_poi, 0xff, mtd->oobsize);
 
        while(1) {
+               WATCHDOG_RESET();
+
                int bytes = mtd->writesize;
                int cached = writelen > bytes && page != blockmask;
                uint8_t *wbuf = buf;
@@ -2215,6 +2220,7 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
        instr->state = MTD_ERASING;
 
        while (len) {
+               WATCHDOG_RESET();
                /*
                 * heck if we have a bad block, we do not erase bad blocks !
                 */
index 8b4f7388152c70e209d2f8f8193d3ea0a35306e3..5a6f7aec8884bb9af295fe3dd8d04bb534faf505 100644 (file)
@@ -542,6 +542,8 @@ int nand_write_skip_bad(nand_info_t *nand, loff_t offset, size_t *length,
 
                        pages = write_size / pagesize_oob;
                        for (page = 0; page < pages; page++) {
+                               WATCHDOG_RESET();
+
                                ops.datbuf = p_buffer;
                                ops.oobbuf = ops.datbuf + pagesize;