diff options
author | Jean-Jacques Hiblot <jjhiblot@ti.com> | 2018-01-04 15:23:33 +0100 |
---|---|---|
committer | Jaehoon Chung <jh80.chung@samsung.com> | 2018-01-12 18:11:24 +0900 |
commit | 5b2e72f32721484d2dea3d0dcf8c020bf3cbe574 (patch) | |
tree | 3ef275f860354dcbb115081ee0dbe02c436eb68c | |
parent | d6400c3f8520bb9a203fe397039279c80f093c27 (diff) |
mmc: read ssr only if MMC write support is enabled
The content of ssr is useful only for erase operations.
on ARM, removing sd_read_ssr() saves around 300 bytes.
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
-rw-r--r-- | drivers/mmc/mmc.c | 25 | ||||
-rw-r--r-- | include/mmc.h | 2 |
2 files changed, 16 insertions, 11 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 5255c0dccf..fd9498708c 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -22,14 +22,6 @@ #include <div64.h> #include "mmc_private.h" -static const unsigned int sd_au_size[] = { - 0, SZ_16K / 512, SZ_32K / 512, - SZ_64K / 512, SZ_128K / 512, SZ_256K / 512, - SZ_512K / 512, SZ_1M / 512, SZ_2M / 512, - SZ_4M / 512, SZ_8M / 512, (SZ_8M + SZ_4M) / 512, - SZ_16M / 512, (SZ_16M + SZ_8M) / 512, SZ_32M / 512, SZ_64M / 512, -}; - static int mmc_set_signal_voltage(struct mmc *mmc, uint signal_voltage); static int mmc_power_cycle(struct mmc *mmc); static int mmc_select_mode_and_width(struct mmc *mmc, uint card_caps); @@ -1376,8 +1368,17 @@ int sd_select_bus_width(struct mmc *mmc, int w) return 0; } +#if CONFIG_IS_ENABLED(MMC_WRITE) static int sd_read_ssr(struct mmc *mmc) { + static const unsigned int sd_au_size[] = { + 0, SZ_16K / 512, SZ_32K / 512, + SZ_64K / 512, SZ_128K / 512, SZ_256K / 512, + SZ_512K / 512, SZ_1M / 512, SZ_2M / 512, + SZ_4M / 512, SZ_8M / 512, (SZ_8M + SZ_4M) / 512, + SZ_16M / 512, (SZ_16M + SZ_8M) / 512, SZ_32M / 512, + SZ_64M / 512, + }; int err, i; struct mmc_cmd cmd; ALLOC_CACHE_ALIGN_BUFFER(uint, ssr, 16); @@ -1431,7 +1432,7 @@ retry_ssr: return 0; } - +#endif /* frequency bases */ /* divided by 10 to be nice to platforms without floating point */ static const int fbase[] = { @@ -1689,12 +1690,14 @@ static int sd_select_mode_and_width(struct mmc *mmc, uint card_caps) } #endif +#if CONFIG_IS_ENABLED(MMC_WRITE) err = sd_read_ssr(mmc); if (!err) + pr_warn("unable to read ssr\n"); +#endif + if (!err) return 0; - pr_warn("bad ssr\n"); - error: /* revert to a safer bus speed */ mmc_select_mode(mmc, SD_LEGACY); diff --git a/include/mmc.h b/include/mmc.h index e89ba95e5d..f50c714428 100644 --- a/include/mmc.h +++ b/include/mmc.h @@ -588,7 +588,9 @@ struct mmc { uint write_bl_len; uint erase_grp_size; /* in 512-byte sectors */ uint hc_wp_grp_size; /* in 512-byte sectors */ +#if CONFIG_IS_ENABLED(MMC_WRITE) struct sd_ssr ssr; /* SD status register */ +#endif u64 capacity; u64 capacity_user; u64 capacity_boot; |