summaryrefslogtreecommitdiff
path: root/drivers/mmc/mmc_legacy.c
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2016-12-01 04:06:33 +0300
committerJaehoon Chung <jh80.chung@samsung.com>2016-12-01 07:51:57 +0300
commitb5b838f1a726e9ab7eea505740e8169b55e90ed6 (patch)
tree30c1d1b44a48d97813e9595f66850d89363992a9 /drivers/mmc/mmc_legacy.c
parentce9eca9438d69306441060e7ac90e45d47882f34 (diff)
downloadu-boot-b5b838f1a726e9ab7eea505740e8169b55e90ed6.tar.xz
mmc: Tinification of the mmc code
Add new configuration option CONFIG_MMC_TINY which strips away all memory allocation within the MMC code and code for handling multiple cards. This allows extremely space-constrained SPL code use the MMC framework. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Marek Vasut <marex@denx.de> Cc: Tom Rini <trini@konsulko.com> Cc: Jaehoon Chung <jh80.chung@samsung.com>
Diffstat (limited to 'drivers/mmc/mmc_legacy.c')
-rw-r--r--drivers/mmc/mmc_legacy.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/mmc/mmc_legacy.c b/drivers/mmc/mmc_legacy.c
index 25361d10f6..bdf9d984dd 100644
--- a/drivers/mmc/mmc_legacy.c
+++ b/drivers/mmc/mmc_legacy.c
@@ -13,6 +13,7 @@
static struct list_head mmc_devices;
static int cur_dev_num = -1;
+#if !CONFIG_IS_ENABLED(MMC_TINY)
struct mmc *find_mmc_device(int dev_num)
{
struct mmc *m;
@@ -62,6 +63,7 @@ void mmc_do_preinit(void)
mmc_start_init(m);
}
}
+#endif
void mmc_list_init(void)
{
@@ -109,6 +111,35 @@ void print_mmc_devices(char separator)
void print_mmc_devices(char separator) { }
#endif
+#if CONFIG_IS_ENABLED(MMC_TINY)
+static struct mmc mmc_static = {
+ .dsr_imp = 0,
+ .dsr = 0xffffffff,
+ .block_dev = {
+ .if_type = IF_TYPE_MMC,
+ .removable = 1,
+ .devnum = 0,
+ .block_read = mmc_bread,
+ .block_write = mmc_bwrite,
+ .block_erase = mmc_berase,
+ .part_type = 0,
+ },
+};
+
+struct mmc *mmc_create(const struct mmc_config *cfg, void *priv)
+{
+ struct mmc *mmc = &mmc_static;
+
+ mmc->cfg = cfg;
+ mmc->priv = priv;
+
+ return mmc;
+}
+
+void mmc_destroy(struct mmc *mmc)
+{
+}
+#else
struct mmc *mmc_create(const struct mmc_config *cfg, void *priv)
{
struct blk_desc *bdesc;
@@ -157,6 +188,7 @@ void mmc_destroy(struct mmc *mmc)
/* only freeing memory for now */
free(mmc);
}
+#endif
static int mmc_select_hwpartp(struct blk_desc *desc, int hwpart)
{