From patchwork Mon Jan 6 16:02:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Denis Carikli X-Patchwork-Id: 307360 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from casper.infradead.org (unknown [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5D72B2C00CB for ; Tue, 7 Jan 2014 03:09:17 +1100 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W0CjW-0000dj-CN; Mon, 06 Jan 2014 16:08:54 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W0CjU-0006Ei-NQ; Mon, 06 Jan 2014 16:08:52 +0000 Received: from smtp5-g21.free.fr ([212.27.42.5]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W0CjR-0006Df-MI for linux-mtd@lists.infradead.org; Mon, 06 Jan 2014 16:08:50 +0000 Received: from denis-N73SV.local.eukrea.com (unknown [88.170.243.169]) by smtp5-g21.free.fr (Postfix) with ESMTP id EA05FD480D6; Mon, 6 Jan 2014 17:03:20 +0100 (CET) From: Denis Carikli To: David Woodhouse Subject: [PATCHv3][ 1/2] mtd: nand: mxc_nand: Enforce a minimum mtd_info writesize default value. Date: Mon, 6 Jan 2014 17:02:36 +0100 Message-Id: <1389024157-19279-1-git-send-email-denis@eukrea.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140106_110850_303074_70A6C230 X-CRM114-Status: GOOD ( 11.66 ) X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [212.27.42.5 listed in list.dnswl.org] 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Denis Carikli , Sascha Hauer , linux-mtd@lists.infradead.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The linux/mtd/mtd.h header has a comment in the mtd_info struct definition that says that having a writesize of 0 is illegal. When nand_flash_detect_onfi is called (in the case of an ONFI flash), it will call the function pointed by read_buf in order to get some parameters of the flash chip, including its writesize. Before decoding the writesize value that was retrived with that read, the mxc_nand's mtd_info struct had a writesize set to zero. Cc: David Woodhouse Cc: linux-mtd@lists.infradead.org Cc: Sascha Hauer Cc: Eric BĂ©nard Signed-off-by: Denis Carikli --- ChangeLog v2->v3: New patch in this serie. --- drivers/mtd/nand/mxc_nand.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index 567a5e5..d4d8d66 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c @@ -1415,6 +1415,9 @@ static int mxcnd_probe(struct platform_device *pdev) mtd->dev.parent = &pdev->dev; mtd->name = DRIVER_NAME; + /* Enforce a minimum writesize */ + mtd->writesize = 512; + /* 50 us command delay time */ this->chip_delay = 5;