From patchwork Thu Feb 2 13:04:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: balajitk@ti.com X-Patchwork-Id: 139134 X-Patchwork-Delegate: trini@ti.com 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 8F1AE104785 for ; Thu, 2 Feb 2012 23:57:02 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 32D22280D0; Thu, 2 Feb 2012 13:56:59 +0100 (CET) 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 sfOzV4N9INqL; Thu, 2 Feb 2012 13:56:58 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C4757280D5; Thu, 2 Feb 2012 13:56:53 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 922B9280D5 for ; Thu, 2 Feb 2012 13:56:50 +0100 (CET) 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 vdFfhzSg0cet for ; Thu, 2 Feb 2012 13:56:49 +0100 (CET) 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 bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by theia.denx.de (Postfix) with ESMTPS id A4DFE280D0 for ; Thu, 2 Feb 2012 13:56:46 +0100 (CET) Received: from dbdp20.itg.ti.com ([172.24.170.38]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id q12CugnF004642; Thu, 2 Feb 2012 06:56:43 -0600 Received: from DBDE70.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id q12Cuf5b028617; Thu, 2 Feb 2012 18:26:41 +0530 (IST) Received: from dbdp31.itg.ti.com (172.24.170.98) by dbde70.ent.ti.com (172.24.170.148) with Microsoft SMTP Server id 14.1.323.3; Thu, 2 Feb 2012 18:26:40 +0530 Received: from localhost.localdomain (a0393241pc.india.ti.com [172.24.136.78]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id q12CudXf006803; Thu, 2 Feb 2012 18:26:39 +0530 (IST) From: Balaji T K To: , , , Date: Thu, 2 Feb 2012 18:34:36 +0530 Message-ID: <1328187876-31539-1-git-send-email-balajitk@ti.com> X-Mailer: git-send-email 1.7.0.4 MIME-Version: 1.0 Subject: [U-Boot] [PATCH 1/1] arm: mmc: omap: spl size reduction by removing write/erase ops X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 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 spl for OMAP4 does not use mmc read/write. Add CONFIG_MMC_NO_ERASE, CONFIG_MMC_NO_WRITE to platforms where mmc write/erase operation is not needed in spl. Use these CONFIGS to remove write/erase code in mmc.c and omap_hsmmc.c This reduces the spl size by ~1128 Bytes Signed-off-by: Balaji T K --- drivers/mmc/mmc.c | 17 +++++++++++++++++ drivers/mmc/omap_hsmmc.c | 2 ++ include/configs/omap4_common.h | 4 ++++ 3 files changed, 23 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 21665ec..852c896 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -31,6 +31,7 @@ #include #include #include +#include /* Set block count limit because of 16 bit register limit on some hardware*/ #ifndef CONFIG_SYS_MMC_MAX_BLK_COUNT @@ -175,6 +176,7 @@ struct mmc *find_mmc_device(int dev_num) return NULL; } +#ifndef CONFIG_MMC_NO_ERASE static ulong mmc_erase_t(struct mmc *mmc, ulong start, lbaint_t blkcnt) { struct mmc_cmd cmd; @@ -256,7 +258,15 @@ mmc_berase(int dev_num, unsigned long start, lbaint_t blkcnt) return blk; } +#else +static unsigned long +mmc_berase(int dev_num, unsigned long start, lbaint_t blkcnt) +{ + return -ENOSYS; +} +#endif +#ifndef CONFIG_MMC_NO_WRITE static ulong mmc_write_blocks(struct mmc *mmc, ulong start, lbaint_t blkcnt, const void*src) { @@ -336,6 +346,13 @@ mmc_bwrite(int dev_num, ulong start, lbaint_t blkcnt, const void*src) return blkcnt; } +#else +static ulong +mmc_bwrite(int dev_num, ulong start, lbaint_t blkcnt, const void *src) +{ + return -ENOSYS; +} +#endif int mmc_read_blocks(struct mmc *mmc, void *dst, ulong start, lbaint_t blkcnt) { diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c index c38b9e6..ce36481 100644 --- a/drivers/mmc/omap_hsmmc.c +++ b/drivers/mmc/omap_hsmmc.c @@ -360,6 +360,7 @@ static int mmc_read_data(struct hsmmc *mmc_base, char *buf, unsigned int size) static int mmc_write_data(struct hsmmc *mmc_base, const char *buf, unsigned int size) { +#ifndef CONFIG_MMC_NO_WRITE unsigned int *input_buf = (unsigned int *)buf; unsigned int mmc_stat; unsigned int count; @@ -406,6 +407,7 @@ static int mmc_write_data(struct hsmmc *mmc_base, const char *buf, break; } } +#endif return 0; } diff --git a/include/configs/omap4_common.h b/include/configs/omap4_common.h index a989721..0ae2ab3 100644 --- a/include/configs/omap4_common.h +++ b/include/configs/omap4_common.h @@ -109,6 +109,10 @@ #define CONFIG_SYS_MMC_SET_DEV 1 #define CONFIG_DOS_PARTITION 1 +#ifdef CONFIG_SPL_BUILD +#define CONFIG_MMC_NO_WRITE 1 +#define CONFIG_MMC_NO_ERASE 1 +#endif /* USB */ #define CONFIG_MUSB_UDC 1