From patchwork Wed Apr 6 20:01:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex X-Patchwork-Id: 90064 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id B4C02B6F10 for ; Thu, 7 Apr 2011 06:04:33 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4D86E2809D; Wed, 6 Apr 2011 22:04:29 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bX+HZYLW5g8g; Wed, 6 Apr 2011 22:04:29 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 55DE42809E; Wed, 6 Apr 2011 22:04:27 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 490FF2809E for ; Wed, 6 Apr 2011 22:04:25 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bWrJ40HzAMQr for ; Wed, 6 Apr 2011 22:04:24 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail.dawning.com (mail.dawning.com [63.247.149.203]) by theia.denx.de (Postfix) with ESMTP id 07FAC2809D for ; Wed, 6 Apr 2011 22:04:22 +0200 (CEST) Received: from victoria.dawning.com by mail.dawning.com (MDaemon PRO v9.5.4) with ESMTP id 33-md50000008339.msg for ; Wed, 06 Apr 2011 16:04:21 -0400 Message-ID: <4D9CC6B0.6020608@dawning.com> Date: Wed, 06 Apr 2011 16:01:52 -0400 From: Alex Waterman User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Thunderbird/3.1.9 MIME-Version: 1.0 To: Scott Wood References: <4D9B29FC.1040405@dawning.com> <20110405184220.GA31867@schlenkerla.am.freescale.net> In-Reply-To: <20110405184220.GA31867@schlenkerla.am.freescale.net> X-Authenticated-Sender: awaterman@dawning.com X-Spam-Processed: mail.dawning.com, Wed, 06 Apr 2011 16:04:21 -0400 (not processed: message from trusted or authenticated source) X-Return-Path: awaterman@dawning.com X-Envelope-From: awaterman@dawning.com X-MDaemon-Deliver-To: u-boot@lists.denx.de Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH v2] nand_spl: Fix large page nand_command() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Sorry, I screwed up the settings in Thunderbird, hopefully I fixed the white space/name issues now. About the patch not applying, I used git format-patch and git apply to test the stuff locally, was that wrong? Here is a revised patch, I hope this is better. - Alex From: Alex Waterman Date: Wed, 6 Apr 2011 15:09:57 -0400 Subject: [PATCH] nand_spl: Fix large page nand_command() This patch changes the large page nand_command() routine to use a word offset instead of a byte offset. The 'offs' argument gets divided by 2 so that the offset passed to nand_command() is still by byte offset. Originally, the offset was not shifted and when too high an offset was requested the nand chip would attempt to read non-existent data. Changes for v2: - Moved the offset calculation to outside of the OOB emulation code. - Hopefully no more whitespace mangling. Signed-off-by: Alex Waterman --- nand_spl/nand_boot.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) -- 1.7.3.1 diff --git a/nand_spl/nand_boot.c b/nand_spl/nand_boot.c index 76b8566..4a96878 100644 --- a/nand_spl/nand_boot.c +++ b/nand_spl/nand_boot.c @@ -90,6 +90,10 @@ static int nand_command(struct mtd_info *mtd, int block, int page, int offs, u8 cmd = NAND_CMD_READ0; } + /* Shift the offset from byte addressing to word addressing. */ + if (this->options & NAND_BUSWIDTH_16) + offs >>= 1; + /* Begin command latch cycle */ this->cmd_ctrl(mtd, cmd, NAND_CTRL_CLE | NAND_CTRL_CHANGE); /* Set ALE and clear CLE to start address cycle */