From patchwork Sat Nov 30 06:04:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 295545 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7C0F62C009D for ; Sat, 30 Nov 2013 17:05:40 +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 1Vmdg4-0004Uk-MT; Sat, 30 Nov 2013 06:05:16 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vmdg1-0006FH-Q7; Sat, 30 Nov 2013 06:05:13 +0000 Received: from mail-pd0-x232.google.com ([2607:f8b0:400e:c02::232]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vmdft-0006Ea-Qx for linux-mtd@lists.infradead.org; Sat, 30 Nov 2013 06:05:06 +0000 Received: by mail-pd0-f178.google.com with SMTP id y10so14834705pdj.37 for ; Fri, 29 Nov 2013 22:04:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=+v6VGFuXhyisn44lsi+abExdprm42BCQRphehCzByfs=; b=snpmYsmh+swIPQFzccC/YSqvp8lMIT4BZdSDizHPhhfBEc3waBKc11OKibdJqv90Hu DnfQsf8vihY5oF5uEawnF4Sr3fvKacFRg5ktPkrPcakU9kt80gJB5pNzmmbXh/n1lbpm gGdoBVwinFz456j3GxzHKn5uYGZGefzkcePadwySejwEWaM5dAspgmnn+lUblNeagFDo Bh2gzBPTMy7Pp9unL1h7/E8z6zVQvbgn/IHdwS2nT3N7zkA4/1bXdqrOvyQozO7b+Bf4 QzSRgqJ5R3PIxbgI95+RfL90F50CrlpM4T7qGjwjeX2uOL+1vDdfyA387eKEM08Lx/rH uNSw== X-Received: by 10.68.193.233 with SMTP id hr9mr20070297pbc.26.1385791480654; Fri, 29 Nov 2013 22:04:40 -0800 (PST) Received: from norris.computersforpeace.net (cpe-76-174-184-232.socal.res.rr.com. [76.174.184.232]) by mx.google.com with ESMTPSA id hu10sm106393026pbc.11.2013.11.29.22.04.37 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 29 Nov 2013 22:04:39 -0800 (PST) Date: Fri, 29 Nov 2013 22:04:28 -0800 From: Brian Norris To: Ezequiel Garcia Subject: Re: [PATCH v3] mtd/nand: don't use {read,write}_buf for 8-bit transfers Message-ID: <20131130060428.GA29397@norris.computersforpeace.net> References: <1365164021.28127.109.camel@i7.infradead.org> <1385500515-5376-1-git-send-email-u.kleine-koenig@pengutronix.de> <20131127073512.GB13929@norris.computersforpeace.net> <20131129122018.GB2815@localhost> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20131129122018.GB2815@localhost> User-Agent: Mutt/1.5.21 (2010-09-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131130_010505_985016_2CF7760F X-CRM114-Status: GOOD ( 17.54 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (computersforpeace[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Huang Shijie , linux-mtd@lists.infradead.org, Pekon Gupta , kernel@pengutronix.de, Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= 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 Hi Ezequiel, On Fri, Nov 29, 2013 at 09:20:19AM -0300, Ezequiel Garcia wrote: > On Tue, Nov 26, 2013 at 11:35:12PM -0800, Brian Norris wrote: > > + Pekon, Ezequiel > > > > Can one of you see how this patch works with your BeagleBones w/ x16 > > NAND? I see that you are pushing to straighten out the auto-buswidth part of nand_base, and I think there may be good reasons to do so. But I think that part of your problem can be resolved by a patch like Uwe's, where rather than forcing the entire driver to be configured for x8 just to use ONFI, we can fix the ONFI operations to use the lower 8 bits. IOW, I expect that a patch like Uwe's can shed some better light on the auto-buswidh situation. (This is why I CC'd you and Pekon.) Unfortunately, I realized that Uwe's patch doesn't go far enough, I don't think. It looks like it needs something like the following diff (only compile-tested). What do you think? (And more importantly, how does this test out for you?) Brian diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index bd39f7b67906..1ab264457d94 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -2933,7 +2933,7 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip, int *busw) { struct nand_onfi_params *p = &chip->onfi_params; - int i; + int i, j; int val; /* Try ONFI for unknown chip or LP */ @@ -2942,18 +2942,10 @@ 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; - } - chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1); for (i = 0; i < 3; i++) { - chip->read_buf(mtd, (uint8_t *)p, sizeof(*p)); + for (j = 0; j < sizeof(*p); j++) + *(uint8_t *)p = chip->read_byte(mtd); if (onfi_crc16(ONFI_CRC_BASE, (uint8_t *)p, 254) == le16_to_cpu(p->crc)) { break;