From patchwork Thu Feb 3 00:23:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Wood X-Patchwork-Id: 81601 X-Patchwork-Delegate: scottwood@freescale.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id D6B84B70A3 for ; Thu, 3 Feb 2011 11:23:58 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 40369282C8; Thu, 3 Feb 2011 01:23:57 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fCPwTuCwS-Pm; Thu, 3 Feb 2011 01:23:57 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 88B21282E4; Thu, 3 Feb 2011 01:23:55 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 20167282E4 for ; Thu, 3 Feb 2011 01:23:53 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KhgtwLeMvAvT for ; Thu, 3 Feb 2011 01:23:51 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from VA3EHSOBE008.bigfish.com (va3ehsobe001.messaging.microsoft.com [216.32.180.11]) by theia.denx.de (Postfix) with ESMTPS id 083E8282C8 for ; Thu, 3 Feb 2011 01:23:49 +0100 (CET) Received: from mail151-va3-R.bigfish.com (10.7.14.242) by VA3EHSOBE008.bigfish.com (10.7.40.28) with Microsoft SMTP Server id 14.1.225.8; Thu, 3 Feb 2011 00:23:47 +0000 Received: from mail151-va3 (localhost.localdomain [127.0.0.1]) by mail151-va3-R.bigfish.com (Postfix) with ESMTP id C33961938115; Thu, 3 Feb 2011 00:23:47 +0000 (UTC) X-SpamScore: -3 X-BigFish: VS-3(zzbb2cKzz1202hzz8275bhz2dh2a8h637h668h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: KIP:(null); UIP:(null); IPVD:NLI; H:de01egw01.freescale.net; RD:de01egw01.freescale.net; EFVD:NLI Received: from mail151-va3 (localhost.localdomain [127.0.0.1]) by mail151-va3 (MessageSwitch) id 1296692627601137_13132; Thu, 3 Feb 2011 00:23:47 +0000 (UTC) Received: from VA3EHSMHS004.bigfish.com (unknown [10.7.14.241]) by mail151-va3.bigfish.com (Postfix) with ESMTP id 8FD28111804E; Thu, 3 Feb 2011 00:23:47 +0000 (UTC) Received: from de01egw01.freescale.net (192.88.165.102) by VA3EHSMHS004.bigfish.com (10.7.99.14) with Microsoft SMTP Server (TLS) id 14.1.225.8; Thu, 3 Feb 2011 00:23:47 +0000 Received: from az33smr01.freescale.net (az33smr01.freescale.net [10.64.34.199]) by de01egw01.freescale.net (8.14.3/8.14.3) with ESMTP id p130NfF2001808; Wed, 2 Feb 2011 17:23:46 -0700 (MST) Received: from udp111988uds (udp111988uds.am.freescale.net [10.82.120.180]) by az33smr01.freescale.net (8.13.1/8.13.0) with ESMTP id p130Nex4010504; Wed, 2 Feb 2011 18:23:40 -0600 (CST) Date: Wed, 2 Feb 2011 18:23:31 -0600 From: Scott Wood To: Message-ID: <20110203002331.GA11521@udp111988uds> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-OriginatorOrg: freescale.com Subject: [U-Boot] [PATCH] NAND: add more watchdog resets X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Poke the watchdog in a variety of looping constructs, which could take a long time to complete. Signed-off-by: Scott Wood --- Jaap, does this resolve the watchdog problems you were seeing? drivers/mtd/nand/nand_base.c | 6 ++++++ drivers/mtd/nand/nand_util.c | 2 ++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 70c0593..b9bd394 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -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 ! */ diff --git a/drivers/mtd/nand/nand_util.c b/drivers/mtd/nand/nand_util.c index 8b4f738..5a6f7ae 100644 --- a/drivers/mtd/nand/nand_util.c +++ b/drivers/mtd/nand/nand_util.c @@ -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;