From patchwork Wed Nov 6 22:00:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: pekon gupta X-Patchwork-Id: 3149461 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 59172BEEB2 for ; Wed, 6 Nov 2013 22:00:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BF7C620630 for ; Wed, 6 Nov 2013 22:00:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 27AEA2062F for ; Wed, 6 Nov 2013 22:00:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755242Ab3KFWAl (ORCPT ); Wed, 6 Nov 2013 17:00:41 -0500 Received: from comal.ext.ti.com ([198.47.26.152]:45389 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753923Ab3KFWAk (ORCPT ); Wed, 6 Nov 2013 17:00:40 -0500 Received: from dbdlxv05.itg.ti.com ([172.24.171.60]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id rA6M0ESW020220; Wed, 6 Nov 2013 16:00:14 -0600 Received: from DBDE72.ent.ti.com (dbde72.ent.ti.com [172.24.171.97]) by dbdlxv05.itg.ti.com (8.14.3/8.13.8) with ESMTP id rA6M0Bl9015805; Wed, 6 Nov 2013 16:00:12 -0600 Received: from DBDE04.ent.ti.com ([fe80::21ac:d9f:f810:c8e7]) by DBDE72.ent.ti.com ([fe80::bd56:32bf:87fd:2763%27]) with mapi id 14.02.0342.003; Thu, 7 Nov 2013 06:00:10 +0800 From: "Gupta, Pekon" To: Ezequiel Garcia CC: Brian Norris , "linux-omap@vger.kernel.org" , "linux-mtd@lists.infradead.org" , "Balbi, Felipe" , "marek.belisko@gmail.com" Subject: RE: [PATCH 0/1] Fix OMAP2 NAND ONFI device detection Thread-Topic: [PATCH 0/1] Fix OMAP2 NAND ONFI device detection Thread-Index: AQHO1VXito7z1DPlG0eFqYaAKWI0FJoNF6kAgACMoRD//7gGgIALW2KA//+DBQCAAIkuwA== Date: Wed, 6 Nov 2013 22:00:09 +0000 Message-ID: <20980858CB6D3A4BAE95CA194937D5E73EA31BB3@DBDE04.ent.ti.com> References: <1383126788-27426-1-git-send-email-ezequiel.garcia@free-electrons.com> <20131030191414.GA16668@norris.computersforpeace.net> <20980858CB6D3A4BAE95CA194937D5E73EA2D41D@DBDE04.ent.ti.com> <20131030231956.GA2489@localhost> <20980858CB6D3A4BAE95CA194937D5E73EA31B19@DBDE04.ent.ti.com> <20131106211833.GB12624@localhost> In-Reply-To: <20131106211833.GB12624@localhost> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.24.170.142] MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP > From: Ezequiel Garcia [...] > But: on the other hand, I'd really like you to convince me as to > why is it so bad to require the DTB to have the proper GPMC bus width. > No its not at all bad, all I want is either of the one way (not mixture of both). - Either depend on DT completely (which is current case for all drivers) - OR depend on ONFI and nand_flash_id[] for bus-width detection. > Once again: > 1. the NAND devices aren't hot-pluggable > 2. the "user" (who is actually an engineer, not some regular dummy user) > knows perfectly well the width of the device. > > What's the problem with describing the hardware in the DT and saving us > lots of runtime re-configuration trouble? I agree with both your arguments above. So shouldn't we kill NAND_BUSWIDTH_AUTO ? And probably therefore NAND_BUSWIDTH_AUTO isn't that popular. Now what remains is ONFI probe, which should always happen in x8 mode. So for that below patch should be sufficient .. ---------------------- ------------------------- with regards, pekon diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index ec1db1e..d1220fb 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -2942,14 +2942,8 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip, chip->read_byte(mtd) != 'F' || chip->read_byte(mtd) != 'I') return 0; - /* - * ONFI must be probed in 8-bit mode or with NAND_BUSWIDTH_AUTO, not - * with NAND_BUSWIDTH_16 - */ - if (chip->options & NAND_BUSWIDTH_16) { - pr_err("ONFI cannot be probed in 16-bit mode; aborting\n"); - return 0; - } + /* ONFI must be probed in 8-bit mode only */ + nand_set_defaults(chip, 0); chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1); for (i = 0; i < 3; i++) { @@ -2962,7 +2956,7 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip, if (i == 3) { pr_err("Could not find valid ONFI parameter page; aborting\n"); - return 0; + goto return_error; } /* Check version */ @@ -2980,7 +2974,7 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip, if (!chip->onfi_version) { pr_info("%s: unsupported ONFI version: %d\n", __func__, val); - return 0; + goto return_error; } sanitize_string(p->manufacturer, sizeof(p->manufacturer)); @@ -3033,6 +3027,12 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip, } return 1; + +return_error: + /* revert original bus-width */ + nand_set_defaults( chip->options & NAND_BUSWIDTH_16); + return 0; + } /*