From patchwork Tue Apr 5 15:30:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew McClintock X-Patchwork-Id: 89897 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 A80A7B6F9D for ; Wed, 6 Apr 2011 01:46:15 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 854A1280A2; Tue, 5 Apr 2011 17:46:12 +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 MDG9PVmItXpe; Tue, 5 Apr 2011 17:46:12 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B1A29280AC; Tue, 5 Apr 2011 17:46:10 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B61DB280AC for ; Tue, 5 Apr 2011 17:46:07 +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 vKp0cijExaLD for ; Tue, 5 Apr 2011 17:46:03 +0200 (CEST) X-Greylist: delayed 907 seconds by postgrey-1.27 at theia; Tue, 05 Apr 2011 17:46:01 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 ch1outboundpool.messaging.microsoft.com (ch1outboundpool.messaging.microsoft.com [216.32.181.181]) by theia.denx.de (Postfix) with ESMTPS id 070B6280A2 for ; Tue, 5 Apr 2011 17:46:01 +0200 (CEST) Received: from mail14-ch1-R.bigfish.com (216.32.181.168) by CH1EHSOBE009.bigfish.com (10.43.70.59) with Microsoft SMTP Server id 14.1.225.8; Tue, 5 Apr 2011 15:30:50 +0000 Received: from mail14-ch1 (localhost.localdomain [127.0.0.1]) by mail14-ch1-R.bigfish.com (Postfix) with ESMTP id 54F9A18B80B8 for ; Tue, 5 Apr 2011 15:30:50 +0000 (UTC) X-SpamScore: 3 X-BigFish: VS3(zzzz1202h1082kzz8275bhz2dh2a8h668h839h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: KIP:(null); UIP:(null); IPVD:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail14-ch1 (localhost.localdomain [127.0.0.1]) by mail14-ch1 (MessageSwitch) id 1302017450118928_27030; Tue, 5 Apr 2011 15:30:50 +0000 (UTC) Received: from CH1EHSMHS013.bigfish.com (snatpool1.int.messaging.microsoft.com [10.43.68.249]) by mail14-ch1.bigfish.com (Postfix) with ESMTP id 19C9E1C5004C for ; Tue, 5 Apr 2011 15:30:50 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CH1EHSMHS013.bigfish.com (10.43.70.13) with Microsoft SMTP Server (TLS) id 14.1.225.8; Tue, 5 Apr 2011 15:30:48 +0000 Received: from de01smr01.freescale.net (10.208.0.31) by 039-SN1MMR1-001.039d.mgd.msft.net (10.84.1.13) with Microsoft SMTP Server id 14.1.270.2; Tue, 5 Apr 2011 10:30:47 -0500 Received: from right.am.freescale.net (right.am.freescale.net [10.82.193.13]) by de01smr01.freescale.net (8.13.1/8.13.0) with ESMTP id p35FUkOl014239 for ; Tue, 5 Apr 2011 10:30:46 -0500 (CDT) Received: from right.am.freescale.net (localhost.localdomain [127.0.0.1]) by right.am.freescale.net (8.14.4/8.14.4) with ESMTP id p35FUk9S029357; Tue, 5 Apr 2011 10:30:46 -0500 Received: (from mattsm@localhost) by right.am.freescale.net (8.14.4/8.14.4/Submit) id p35FUjoS029355; Tue, 5 Apr 2011 10:30:45 -0500 From: Matthew McClintock To: Date: Tue, 5 Apr 2011 10:30:45 -0500 Message-ID: <1302017445-29331-1-git-send-email-msm@freescale.com> X-Mailer: git-send-email 1.5.6.5 MIME-Version: 1.0 X-OriginatorOrg: freescale.net Cc: Scott Wood , Matthew McClintock Subject: [U-Boot] [PATCH] nand/spl: Assuming a static nand page size to reduce code size 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 Change variables to const to reduce code size, these values are hardcoded via defines anyways so we might as well assume they are constants Signed-off-by: Matthew McClintock cc: Scott Wood --- With this change we can reduce the size of the nand_spl by 148 bytes with my particular board/compiler nand_spl/nand_boot_fsl_elbc.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nand_spl/nand_boot_fsl_elbc.c b/nand_spl/nand_boot_fsl_elbc.c index 9547d44..922284f 100644 --- a/nand_spl/nand_boot_fsl_elbc.c +++ b/nand_spl/nand_boot_fsl_elbc.c @@ -51,11 +51,11 @@ static void nand_load(unsigned int offs, int uboot_size, uchar *dst) { fsl_lbc_t *regs = LBC_BASE_ADDR; uchar *buf = (uchar *)CONFIG_SYS_NAND_BASE; - int large = in_be32(®s->bank[0].or) & OR_FCM_PGS; - int block_shift = large ? 17 : 14; - int block_size = 1 << block_shift; - int page_size = large ? 2048 : 512; - int bad_marker = large ? page_size + 0 : page_size + 5; + const int large = CONFIG_NAND_OR_PRELIM & OR_FCM_PGS; + const int block_shift = large ? 17 : 14; + const int block_size = 1 << block_shift; + const int page_size = large ? 2048 : 512; + const int bad_marker = large ? page_size + 0 : page_size + 5; int fmr = (15 << FMR_CWTO_SHIFT) | (2 << FMR_AL_SHIFT) | 2; int pos = 0;