From patchwork Mon Apr 18 06:50:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Weitzel X-Patchwork-Id: 714371 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3I6ot3B019635 for ; Mon, 18 Apr 2011 06:50:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752993Ab1DRGuy (ORCPT ); Mon, 18 Apr 2011 02:50:54 -0400 Received: from mail.x-arc.de ([217.6.246.34]:41219 "EHLO root.phytec.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752821Ab1DRGuy (ORCPT ); Mon, 18 Apr 2011 02:50:54 -0400 Received: from idefix.phytec.de (idefix.phytec.de [172.16.0.10]) by root.phytec.de (Postfix) with ESMTP id EB5E7BF0F4; Mon, 18 Apr 2011 08:52:59 +0200 (CEST) Received: from numalfix.phytec.de ([127.0.0.1]) by idefix.phytec.de (Lotus Domino Release 8.5.2 HF194) with ESMTP id 2011041808505109-185857 ; Mon, 18 Apr 2011 08:50:51 +0200 Received: by numalfix.phytec.de (Postfix, from userid 1002) id 0F6CB1A1448; Mon, 18 Apr 2011 08:50:48 +0200 (CEST) From: Jan Weitzel To: linux-omap@vger.kernel.org, linux-mtd@lists.infradead.org, Artem.Bityutskiy@nokia.com Cc: s.hauer@pengutronix.de, dwmw2@infradead.org, tony@atomide.com, s-ghorai@ti.com, vimalsingh@ti.com, Jan Weitzel Subject: [PATCH v2] ARM: omap2: mtd split nand_scan in ident and tail Date: Mon, 18 Apr 2011 08:50:38 +0200 Message-Id: <1303109438-24309-1-git-send-email-j.weitzel@phytec.de> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1302876214.3220.62.camel@localhost> References: <1302876214.3220.62.camel@localhost> X-MIMETrack: Itemize by SMTP Server on Idefix/Phytec(Release 8.5.2 HF194|November 09, 2010) at 18.04.2011 08:50:51, Serialize by Router on Idefix/Phytec(Release 8.5.2 HF194|November 09, 2010) at 18.04.2011 08:50:52, Serialize complete at 18.04.2011 08:50:52 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 18 Apr 2011 06:50:55 +0000 (UTC) nand_scan calls nand_scan_tail and here we got a ecc.layout and calculate oobavail for this layout. After calling nand_scan, we change the layout pointer if OMAP_ECC_HAMMING_CODE_HW_ROMCODE is set. This results in not calcluated oobavail. Mountig as jffs2 is not possible. To fix that nand_scan has to split up in nand_scan_ident and nand_scan_tail setting ecc.layout between these calls. So nand_scan_tail calculates oobvail for the used layout. This is also done in serveral other platforms. v2: update commit message Signed-off-by: Jan Weitzel Reviewed-by: Vimal Singh --- drivers/mtd/nand/omap2.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index da9a351..288423f 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c @@ -1073,9 +1073,9 @@ static int __devinit omap_nand_probe(struct platform_device *pdev) /* DIP switches on some boards change between 8 and 16 bit * bus widths for flash. Try the other width if the first try fails. */ - if (nand_scan(&info->mtd, 1)) { + if (nand_scan_ident(&info->mtd, 1, NULL)) { info->nand.options ^= NAND_BUSWIDTH_16; - if (nand_scan(&info->mtd, 1)) { + if (nand_scan_ident(&info->mtd, 1, NULL)) { err = -ENXIO; goto out_release_mem_region; } @@ -1101,6 +1101,12 @@ static int __devinit omap_nand_probe(struct platform_device *pdev) info->nand.ecc.layout = &omap_oobinfo; } + /* second phase scan */ + if (nand_scan_tail(&info->mtd)) { + err = -ENXIO; + goto out_release_mem_region; + } + #ifdef CONFIG_MTD_PARTITIONS err = parse_mtd_partitions(&info->mtd, part_probes, &info->parts, 0); if (err > 0)