[U-Boot] [PATCH 5/5] mmc: don't support write & erase for SPL builds

Paul Burton paul.burton at imgtec.com
Wed Sep 4 17:14:03 CEST 2013


For SPL builds this is just dead code since we'll only need to read.
Eliminating it results in a significant size reduction for the SPL
binary.

Signed-off-by: Paul Burton <paul.burton at imgtec.com>
---
 drivers/mmc/mmc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 30a985b..d305257 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -248,6 +248,7 @@ err_out:
 static unsigned long
 mmc_berase(int dev_num, lbaint_t start, lbaint_t blkcnt)
 {
+#ifndef CONFIG_SPL_BUILD
 	int err = 0;
 	struct mmc *mmc = find_mmc_device(dev_num);
 	lbaint_t blk = 0, blk_r = 0;
@@ -281,6 +282,9 @@ mmc_berase(int dev_num, lbaint_t start, lbaint_t blkcnt)
 	}
 
 	return blk;
+#else /* CONFIG_SPL_BUILD */
+	return -1;
+#endif
 }
 
 static ulong
@@ -349,6 +353,7 @@ mmc_write_blocks(struct mmc *mmc, lbaint_t start, lbaint_t blkcnt, const void*sr
 static ulong
 mmc_bwrite(int dev_num, lbaint_t start, lbaint_t blkcnt, const void*src)
 {
+#ifndef CONFIG_SPL_BUILD
 	lbaint_t cur, blocks_todo = blkcnt;
 
 	struct mmc *mmc = find_mmc_device(dev_num);
@@ -368,6 +373,9 @@ mmc_bwrite(int dev_num, lbaint_t start, lbaint_t blkcnt, const void*src)
 	} while (blocks_todo > 0);
 
 	return blkcnt;
+#else /* CONFIG_SPL_BUILD */
+	return 0;
+#endif
 }
 
 static int mmc_read_blocks(struct mmc *mmc, void *dst, lbaint_t start,
-- 
1.8.3.4




More information about the U-Boot mailing list