From patchwork Thu Jan 7 06:46:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: vimal singh X-Patchwork-Id: 42397 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 5F173B6ED0 for ; Thu, 7 Jan 2010 17:48:32 +1100 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NSm91-0001qW-9k; Thu, 07 Jan 2010 06:46:55 +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 1NSm8u-0001Zq-IK for linux-mtd@lists.infradead.org; Thu, 07 Jan 2010 06:46:53 +0000 Received: by bwz4 with SMTP id 4so11360792bwz.2 for ; Wed, 06 Jan 2010 22:46:46 -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=vqmlGCz+tK/h8TWPLyulT5SCzc9pseQlWN8W+SfKG9Y=; b=H5dgITLyQyn7JLjPUDJfDXvMkksgjJJzTV6QahYxeTR3grBc9en+09ECb/GYZ042nh rsvMNFDt9gEoGS2Nnh+Bk6N3HlNUHBxEJ0FXGi1iRMU8QXty9lP/qG4x/uPatUNLRjF3 3BIRQ0K45kRBF6cOu9WE4MognQKsyAnFfniGg= 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=ZbNrUU9Oy2XVqmyvkr/L0aN6qhPDh17Y7hnDvdp7NpjnVXlXsggSSjj2/KdDLAB9zh BiXyUsK3zD0hUQQgfqt8kuKPqCl6npESXlQgb5cwNnZ6WLNBppSLigvUKN9lg3SOrJRv 8KubjNO+G+nlCT33LFly3HSf+FgHj6tpqUMNs= MIME-Version: 1.0 Received: by 10.204.154.208 with SMTP id p16mr1531414bkw.80.1262846806102; Wed, 06 Jan 2010 22:46:46 -0800 (PST) In-Reply-To: References: From: Vimal Singh Date: Thu, 7 Jan 2010 12:16:26 +0530 Message-ID: Subject: Re: [PATCH 3/3][NAND][OMAP]: Fixing issue in oamp nand driver in prefetch mode read To: Linux MTD X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20100107_014648_913732_78F1595D X-CRM114-Status: GOOD ( 25.34 ) 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: linux-omap@vger.kernel.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, Jan 6, 2010 at 7:36 PM, Vimal Singh wrote: > From 3700088e8da8c890d9e4c6eb626e18287d149b97 Mon Sep 17 00:00:00 2001 > From: Vimal Singh > Date: Tue, 5 Jan 2010 16:37:03 +0530 > Subject: [PATCH] NAND: OMAP: Fixing issue in oamp nand driver in > prefetch mode read > > 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. > > This patch fixes the issue. > > Signed-off-by: Vimal Singh > --- >  drivers/mtd/nand/omap2.c |   11 +++++++---- >  1 files changed, 7 insertions(+), 4 deletions(-) > > diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c > index 16120e2..7df303a 100644 > --- a/drivers/mtd/nand/omap2.c > +++ b/drivers/mtd/nand/omap2.c > @@ -295,11 +295,14 @@ static void omap_read_buf_pref(struct mtd_info > *mtd, u_char *buf, int len) >        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); > -- > 1.5.5 > Above patch was line wrapped. Here is the correct one: From 3700088e8da8c890d9e4c6eb626e18287d149b97 Mon Sep 17 00:00:00 2001 From: Vimal Singh Date: Tue, 5 Jan 2010 16:37:03 +0530 Subject: [PATCH] NAND: OMAP: Fixing issue in oamp nand driver in prefetch mode read 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. This patch fixes the issue. Signed-off-by: Vimal Singh --- drivers/mtd/nand/omap2.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index 16120e2..7df303a 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);