From patchwork Wed May 4 13:10:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex X-Patchwork-Id: 94037 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 D76FBB6F7C for ; Wed, 4 May 2011 23:11:52 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AF90828096; Wed, 4 May 2011 15:11:48 +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 tVf7EnC6fI-E; Wed, 4 May 2011 15:11:48 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8879428099; Wed, 4 May 2011 15:11:46 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5CE7E28099 for ; Wed, 4 May 2011 15:11:44 +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 IEzlPg8cu4o0 for ; Wed, 4 May 2011 15:11:43 +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 07AC528096 for ; Wed, 4 May 2011 15:11:41 +0200 (CEST) Received: from victoria.dawning.com by mail.dawning.com (MDaemon PRO v9.5.4) with ESMTP id 20-md50000008627.msg for ; Wed, 04 May 2011 09:11:39 -0400 Message-ID: <4DC15037.70109@dawning.com> Date: Wed, 04 May 2011 09:10:15 -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: u-boot@lists.denx.de X-Authenticated-Sender: awaterman@dawning.com X-Spam-Processed: mail.dawning.com, Wed, 04 May 2011 09:11:39 -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: Scott Wood Subject: [U-Boot] [PATCH] Decreases code size of the nand_spl 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 From b59f1e5b0bc3684615756c12fd5c5f9fcaa4c812 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Tue, 3 May 2011 15:00:23 -0400 Subject: [PATCH] Decreases code size of the nand_spl The canyonland boards nand_spl size is just under the maximum 4KByte size. This patch decreases the size of the nand_spl to make a previous commit - commit 65a9db7be0868be91ba81b9b5bf821de82e6d9b0 - fit in the nand_spl. Signed-off-by: Alex Waterman --- This patch uses a function pointer declared as a local variable; checkpatch didn't mind but this seems like it could be (stylistically) a very bad idea. Any thoughts? nand_spl/nand_boot.c | 18 ++++++++++-------- 1 files changed, 10 insertions(+), 8 deletions(-) diff --git a/nand_spl/nand_boot.c b/nand_spl/nand_boot.c index 4a96878..79048b3 100644 --- a/nand_spl/nand_boot.c +++ b/nand_spl/nand_boot.c @@ -77,6 +77,8 @@ static int nand_command(struct mtd_info *mtd, int block, int page, int offs, u8 { struct nand_chip *this = mtd->priv; int page_addr = page + block * CONFIG_SYS_NAND_PAGE_COUNT; + void (*hwctrl)(struct mtd_info *mtd, int cmd, + unsigned int ctrl) = this->cmd_ctrl; if (this->dev_ready) while (!this->dev_ready(mtd)) @@ -95,25 +97,25 @@ static int nand_command(struct mtd_info *mtd, int block, int page, int offs, u8 offs >>= 1; /* Begin command latch cycle */ - this->cmd_ctrl(mtd, cmd, NAND_CTRL_CLE | NAND_CTRL_CHANGE); + hwctrl(mtd, cmd, NAND_CTRL_CLE | NAND_CTRL_CHANGE); /* Set ALE and clear CLE to start address cycle */ /* Column address */ - this->cmd_ctrl(mtd, offs & 0xff, + hwctrl(mtd, offs & 0xff, NAND_CTRL_ALE | NAND_CTRL_CHANGE); /* A[7:0] */ - this->cmd_ctrl(mtd, (offs >> 8) & 0xff, NAND_CTRL_ALE); /* A[11:9] */ + hwctrl(mtd, (offs >> 8) & 0xff, NAND_CTRL_ALE); /* A[11:9] */ /* Row address */ - this->cmd_ctrl(mtd, (page_addr & 0xff), NAND_CTRL_ALE); /* A[19:12] */ - this->cmd_ctrl(mtd, ((page_addr >> 8) & 0xff), + hwctrl(mtd, (page_addr & 0xff), NAND_CTRL_ALE); /* A[19:12] */ + hwctrl(mtd, ((page_addr >> 8) & 0xff), NAND_CTRL_ALE); /* A[27:20] */ #ifdef CONFIG_SYS_NAND_5_ADDR_CYCLE /* One more address cycle for devices > 128MiB */ - this->cmd_ctrl(mtd, (page_addr >> 16) & 0x0f, + hwctrl(mtd, (page_addr >> 16) & 0x0f, NAND_CTRL_ALE); /* A[31:28] */ #endif /* Latch in address */ - this->cmd_ctrl(mtd, NAND_CMD_READSTART, + hwctrl(mtd, NAND_CMD_READSTART, NAND_CTRL_CLE | NAND_CTRL_CHANGE); - this->cmd_ctrl(mtd, NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE); + hwctrl(mtd, NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE); /* * Wait a while for the data to be ready