
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 balajitk@ti.com --- 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 <malloc.h> #include <linux/list.h> #include <div64.h> +#include <asm/errno.h>
/* 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