From patchwork Fri Oct 25 10:17:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 3094841 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id ED88B9F2B7 for ; Fri, 25 Oct 2013 10:18:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C9166204E0 for ; Fri, 25 Oct 2013 10:18:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A7635203C4 for ; Fri, 25 Oct 2013 10:18:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753084Ab3JYKSN (ORCPT ); Fri, 25 Oct 2013 06:18:13 -0400 Received: from top.free-electrons.com ([176.31.233.9]:54088 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752548Ab3JYKSM (ORCPT ); Fri, 25 Oct 2013 06:18:12 -0400 Received: by mail.free-electrons.com (Postfix, from userid 106) id 40A897E3; Fri, 25 Oct 2013 12:18:12 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from localhost.localdomain (unknown [190.2.98.212]) by mail.free-electrons.com (Postfix) with ESMTPA id 9BBFA731; Fri, 25 Oct 2013 12:18:09 +0200 (CEST) From: Ezequiel Garcia To: , Cc: Brian Norris , Pekon Gupta , Felipe Balbi , marek.belisko@gmail.com, Ezequiel Garcia Subject: [PATCH v2 2/5] mtd: nand: omap2: Fix device detection path Date: Fri, 25 Oct 2013 07:17:54 -0300 Message-Id: <1382696277-9063-3-git-send-email-ezequiel.garcia@free-electrons.com> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1382696277-9063-1-git-send-email-ezequiel.garcia@free-electrons.com> References: <1382696277-9063-1-git-send-email-ezequiel.garcia@free-electrons.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Pekon Gupta Because the device bus can be 8-bit or 16-bit width, yet ONFI detection cannot work in 16-bit mode, we need to set the NAND_BUSWIDTH_AUTO option which allows proper initialization configuration. Once the bus width is detected, nand_scan_ident() updates the nand_chip struct 'option' field to use the appropriate read/write functions and configure the ECC engine. Signed-off-by: Pekon Gupta [rebased and clean-up a bit pekon's original work] Signed-off-by: Ezequiel Garcia --- drivers/mtd/nand/omap2.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index 4ecf0e5..e01a936 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c @@ -1855,8 +1855,7 @@ static int omap_nand_probe(struct platform_device *pdev) info->mtd.name = dev_name(&pdev->dev); info->mtd.owner = THIS_MODULE; - info->nand.options = pdata->devsize; - info->nand.options |= NAND_SKIP_BBTSCAN; + info->nand.options |= NAND_SKIP_BBTSCAN | NAND_BUSWIDTH_AUTO; #ifdef CONFIG_MTD_NAND_OMAP_BCH info->of_node = pdata->of_node; #endif @@ -1903,6 +1902,10 @@ static int omap_nand_probe(struct platform_device *pdev) info->nand.chip_delay = 50; } + err = nand_scan_ident(&info->mtd, 1, NULL); + if (err < 0) + goto out_release_mem_region; + switch (pdata->xfer_type) { case NAND_OMAP_PREFETCH_POLLED: info->nand.read_buf = omap_read_buf_pref; @@ -2013,17 +2016,6 @@ static int 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_ident(&info->mtd, 1, NULL)) { - info->nand.options ^= NAND_BUSWIDTH_16; - if (nand_scan_ident(&info->mtd, 1, NULL)) { - err = -ENXIO; - goto out_release_mem_region; - } - } - /* rom code layout */ if (pdata->ecc_opt == OMAP_ECC_HAMMING_CODE_HW_ROMCODE) {