From patchwork Thu Dec 31 12:20:44 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: vimal singh X-Patchwork-Id: 41965 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 33CF51007D1 for ; Thu, 31 Dec 2009 23:24:06 +1100 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NQK1p-0007qx-5a; Thu, 31 Dec 2009 12:21:21 +0000 Received: from mail-bw0-f212.google.com ([209.85.218.212]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NQK1b-0007pt-5i; Thu, 31 Dec 2009 12:21:12 +0000 Received: by bwz4 with SMTP id 4so8060294bwz.2 for ; Thu, 31 Dec 2009 04:21:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=sbOV9G0pTkSikSHoyv114G1EWGLWh46+0zR+u29QqUI=; b=WhDxr9qPVlas39ui3Ng5Ljq99E1fp6e+xH8UFQPIC/66Z3Dm8WbWjFlOlKBHbGTSmg yAt1m602l1IYhRcrCcHEOxLA75dU7p1Z9IaCMuIRgdEO7C1UbhcHkOCVby5NUhh7i4WL bRkCOP6kN7rNhBM7XKR+pi9SIDcl3qH/FZrak= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=ad2OssZXSUsZ3CVZWPUtgUegTk8z+wAk0yca11qwXlGJXPMnJPP2nXJuKdq4sEOh58 haErDhlNqgFz5cApDM+HxaMCsg8ppO6BDUIaFtODnJGfJdwArXb/WP78qVw8FSj3WzDg HX+nyqsH9pucxyhwgaV8EFHcHsDsY+0XegULI= MIME-Version: 1.0 Received: by 10.204.154.208 with SMTP id p16mr6911639bkw.80.1262262064148; Thu, 31 Dec 2009 04:21:04 -0800 (PST) In-Reply-To: <5e088bd90912291347j370ab30cid7c6cfc558c2ed18@mail.gmail.com> References: <20091223174429.GD3512@atomide.com> <5e088bd90912291238t1f2aba64na94887b2f864454d@mail.gmail.com> <5e088bd90912291347j370ab30cid7c6cfc558c2ed18@mail.gmail.com> From: Vimal Singh Date: Thu, 31 Dec 2009 17:50:44 +0530 Message-ID: Subject: Re: Issue in oamp nand driver with 32-bit reads in prefetch mode To: Steve Sakoman X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20091231_072107_341943_0793B075 X-CRM114-Status: GOOD ( 20.06 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.2.5 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- _SUMMARY_ Cc: Tony Lindgren , linux-omap@vger.kernel.org, Linux MTD , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org On Wed, Dec 30, 2009 at 3:17 AM, Steve Sakoman wrote: > On Tue, Dec 29, 2009 at 12:38 PM, Steve Sakoman wrote: > >> I can confirm that this issue exists on Overo too.  Sadly, switching >> to 16 bit reads does not fix the issue for me.  I'll start digging to >> see if I can find what's broken. > > I can also confirm that there are days when I am not even capable of > applying a patch properly :-( > > Switching to 16 bit read accesses does indeed fix the ECC issue on Overo too. > > Which still leaves us needing to find the root cause of the breakage . . . There is a bug in nand prefetch read routine, which comes into effect only if nand device is a 16-bit device (as we have in zoom boards). This bug is effective only with below combination of conditions: 1. nand deivce, in use, is a 16 bit device 2. nand driver supports 'subpage' read 3. SW ECC is in use This was not seen old kernel (ex: .23), because when, in early days, we tested this (nand prefetch read in LDP boards) there was no 'subpage read' support. Later when we had subpage read in (.27) kernel, we had hw ecc enabled always in our internal tree. So, we missed this bug. Here is a patch to fix this issue: diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index 1bb799f..75004fe 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c @@ -295,11 +295,14 @@ static void omap_read_buf_pref(struct u32 *p = (u32 *)buf; /* take care of subpage reads */ - for (; len % 4 != 0; ) { - *buf++ = __raw_readb(info->nand.IO_ADDR_R); - len--; + if (len % 4) { + if (info->nand.options & NAND_BUSWIDTH_16) + omap_read_buf16(mtd, buf, len % 4); + else + omap_read_buf8(mtd, buf, len % 4); + p = (u32 *) (buf + len % 4); + len -= len % 4; } - p = (u32 *) buf; /* configure and start prefetch transfer */ ret = gpmc_prefetch_enable(info->gpmc_cs, 0x0, len, 0x0);