From patchwork Tue Apr 5 19:39:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew McClintock X-Patchwork-Id: 89923 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 24857B6EDF for ; Wed, 6 Apr 2011 05:39:52 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 319442807E; Tue, 5 Apr 2011 21:39:49 +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 Tux8qe2diopT; Tue, 5 Apr 2011 21:39:49 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EA3D32809D; Tue, 5 Apr 2011 21:39:46 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C63E02809D for ; Tue, 5 Apr 2011 21:39: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 wluilTjjgrZy for ; Tue, 5 Apr 2011 21:39:42 +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 ch1outboundpool.messaging.microsoft.com (ch1outboundpool.messaging.microsoft.com [216.32.181.184]) by theia.denx.de (Postfix) with ESMTPS id 0778C2807E for ; Tue, 5 Apr 2011 21:39:40 +0200 (CEST) Received: from mail60-ch1-R.bigfish.com (216.32.181.169) by CH1EHSOBE017.bigfish.com (10.43.70.67) with Microsoft SMTP Server id 14.1.225.8; Tue, 5 Apr 2011 19:39:38 +0000 Received: from mail60-ch1 (localhost.localdomain [127.0.0.1]) by mail60-ch1-R.bigfish.com (Postfix) with ESMTP id B561655850B for ; Tue, 5 Apr 2011 19:39:38 +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 mail60-ch1 (localhost.localdomain [127.0.0.1]) by mail60-ch1 (MessageSwitch) id 1302032377297869_14387; Tue, 5 Apr 2011 19:39:37 +0000 (UTC) Received: from CH1EHSMHS025.bigfish.com (snatpool1.int.messaging.microsoft.com [10.43.68.244]) by mail60-ch1.bigfish.com (Postfix) with ESMTP id 470EF1030053 for ; Tue, 5 Apr 2011 19:39:37 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CH1EHSMHS025.bigfish.com (10.43.70.25) with Microsoft SMTP Server (TLS) id 14.1.225.8; Tue, 5 Apr 2011 19:39:36 +0000 Received: from az33smr01.freescale.net (10.64.34.199) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server id 14.1.270.2; Tue, 5 Apr 2011 14:39:35 -0500 Received: from right.am.freescale.net (right.am.freescale.net [10.82.193.13]) by az33smr01.freescale.net (8.13.1/8.13.0) with ESMTP id p35JdYD5021549 for ; Tue, 5 Apr 2011 14:39:35 -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 p35JdY45028887; Tue, 5 Apr 2011 14:39:34 -0500 Received: (from mattsm@localhost) by right.am.freescale.net (8.14.4/8.14.4/Submit) id p35JdY2o028886; Tue, 5 Apr 2011 14:39:34 -0500 From: Matthew McClintock To: Date: Tue, 5 Apr 2011 14:39:34 -0500 Message-ID: <1302032374-28857-2-git-send-email-msm@freescale.com> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: <1302032374-28857-1-git-send-email-msm@freescale.com> References: <20110405140350.37fb9928@schlenkerla.am.freescale.net> <1302032374-28857-1-git-send-email-msm@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.net Cc: Scott Wood , Matthew McClintock Subject: [U-Boot] [PATCH v1 2/2] 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 v1: Add prior patch to correct naming of CONFIG_SYS_NAND_*_PRELIM 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..502605b 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_SYS_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;