arm: mmc: omap: spl size reduction by removing write/erase ops
PATCH 1/1 arm: mmc: omap: spl size reduction by removing write/erase ops
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
--- drivers/mmc/mmc.c | 17 +++++++++++++++++ drivers/mmc/omap_hsmmc.c | 2 ++ include/configs/omap4_common.h | 4 ++++ 3 files changed, 23 insertions(+), 0 deletions(-)
drivers/mmc/mmc.c +17 -0
@@ -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) {
drivers/mmc/omap_hsmmc.c +2 -0
@@ -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 ; }
include/configs/omap4_common.h +4 -0
@@ -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
Signature · 1 line
1.7.0.4
PATCH 1/1 arm: mmc: omap: spl size reduction by removing write/erase ops
Quoted 5 lines · Balaji T K
spl for OMAP4 does not use mmc read/write.
AddCONFIG_MMC_NO_ERASE,CONFIG_MMC_NO_WRITEto platforms where mmc write/erase operation is not needed in spl.
Use these CONFIGS to remove write/erase code inmmc.candomap_hsmmc.cThis reduces the spl size by ~1128 Bytes
Are you running into a size limitation again? If not, I think we want to wait until we sort out how SPL includes/excludes stuff moving forward as this shows there's probably a lot of other unused code being pulled in.
Signature · 1 line
Tom
PATCH 1/1 arm: mmc: omap: spl size reduction by removing write/erase ops
Tom,
Quoted 8 lines · Tom Rini
Quoted 5 lines · Balaji T K
spl for OMAP4 does not use mmc read/write.
AddCONFIG_MMC_NO_ERASE,CONFIG_MMC_NO_WRITEto platforms where mmc write/erase operation is not needed in spl.
Use these CONFIGS to remove write/erase code inmmc.candomap_hsmmc.cThis reduces the spl size by ~1128 BytesAre you running into a size limitation again? If not, I think we want
We are always on the border. Minor fluctuations are affecting us. And our EMU boards(secure devices) are permanently broken due to this. I am not sure if this one helps EMU devices though.
Quoted 4 lines
to wait until we sort out how SPL includes/excludes stuff moving forward as this shows there's probably a lot of other unused code being pulled in.
We use -ffunction-sections -fdata-sections and --gc-sections while building SPL. So, un-necessary stuff will not be included unless the function pointers are set in some structures and not used. I think that is what is happening in this case. Other than that I am not expecting much scope for improvement.
One key experiment I want to do is Thumb mode build. I have some old patches that I may cleanup and post sometime soon. But Thumb mode had some tool-chain related issues last time I tried.
br,
Aneesh
PATCH 1/1 arm: mmc: omap: spl size reduction by removing write/erase ops
Quoted 14 lines · Aneesh V
Tom,
Quoted 10 lines · Tom Rini
Quoted 6 lines · On Thu, Feb 2, 2012 at 6:04 AM, Balaji T K<[email protected]> ?wrote:
spl for OMAP4 does not use mmc read/write.
AddCONFIG_MMC_NO_ERASE,CONFIG_MMC_NO_WRITEto platforms where mmc write/erase operation is not needed in spl.
Use these CONFIGS to remove write/erase code inmmc.candomap_hsmmc.cThis reduces the spl size by ~1128 Bytes
Quoted 5 lines
Quoted 1 line
Are you running into a size limitation again? ?If not, I think we want
We are always on the border. Minor fluctuations are affecting us. And our EMU boards(secure devices) are permanently broken due to this. I am not sure if this one helps EMU devices though.
Ick, OK. So lets re-do this for now with #define CONFIG_FOO not #define CONFIG_FOO 1 and push for this going in now to solve problems with real devices.
Quoted 10 lines
Quoted 4 lines
to wait until we sort out how SPL includes/excludes stuff moving forward as this shows there's probably a lot of other unused code being pulled in.
We use -ffunction-sections -fdata-sections and --gc-sections while building SPL. So, un-necessary stuff will not be included unless the function pointers are set in some structures and not used. I think that is what is happening in this case. Other than that I am not expecting much scope for improvement.
Exactly. I think part of the problem is that this discussion is buried in the thread about SPL YMODEM support, but Wolfgang isn't happy with some of the direction SPL stuff is heading.
Signature · 1 line
Tom