]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
mmc: add a Kconfig option to enable the support for MMC write operations
authorJean-Jacques Hiblot <jjhiblot@ti.com>
Thu, 4 Jan 2018 14:23:32 +0000 (15:23 +0100)
committerJaehoon Chung <jh80.chung@samsung.com>
Fri, 12 Jan 2018 09:11:24 +0000 (18:11 +0900)
This allows using CONFIG_IS_ENABLED(MMC_WRITE) to compile out code
needed only if write support is required.
The option is added for u-boot and for SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
cmd/mvebu/bubt.c
common/spl/Kconfig
drivers/mmc/Kconfig
drivers/mmc/Makefile
drivers/mmc/mmc-uclass.c
drivers/mmc/mmc_private.h

index a1997ac0d34416dfa4d82081bc7154ad0e0068f6..23fb8cd807422da4597d610401266f5bef175de5 100644 (file)
@@ -110,7 +110,7 @@ static ulong get_load_addr(void)
 /********************************************************************
  *     eMMC services
  ********************************************************************/
-#ifdef CONFIG_DM_MMC
+#if CONFIG_IS_ENABLED(DM_MMC) && CONFIG_IS_ENABLED(MMC_WRITE)
 static int mmc_burn_image(size_t image_size)
 {
        struct mmc      *mmc;
index 9d35f412336522162e659d6ac9953ad1861c9469..d686b1ecbdf6c17d33a07ef0549f1a34c4bf7023 100644 (file)
@@ -301,6 +301,7 @@ config SPL_ENV_SUPPORT
 config SPL_SAVEENV
        bool "Support save environment"
        depends on SPL_ENV_SUPPORT
+       select SPL_MMC_WRITE if ENV_IS_IN_MMC
        help
          Enable save environment support in SPL after setenv. By default
          the saveenv option is not provided in SPL, but some boards need
@@ -415,6 +416,14 @@ config SPL_MMC_SUPPORT
          this option to build the drivers in drivers/mmc as part of an SPL
          build.
 
+config SPL_MMC_WRITE
+       bool "MMC/SD/SDIO card support for write operations in SPL"
+       depends on SPL_MMC_SUPPORT
+       default n
+       help
+         Enable write access to MMC and SD Cards in SPL
+
+
 config SPL_MPC8XXX_INIT_DDR_SUPPORT
        bool "Support MPC8XXX DDR init"
        help
index d196eed540260edfbf65e05449182181079fd8b8..ab0627a8afb120035cf16053b76d42f780973541 100644 (file)
@@ -10,6 +10,13 @@ config MMC
          If you want MMC/SD/SDIO support, you should say Y here and
          also to your specific host controller driver.
 
+config MMC_WRITE
+       bool "support for MMC/SD write operations"
+       depends on MMC
+       default y
+       help
+         Enable write access to MMC and SD Cards
+
 config DM_MMC
        bool "Enable MMC controllers using Driver Model"
        depends on DM
index 9af375b044a467c855abede43b8dc2a20b40cbd9..64b6f21c6139dcde198d2d4a9ad6b4bb8dbf7e4f 100644 (file)
@@ -7,6 +7,7 @@
 
 obj-y += mmc.o
 obj-$(CONFIG_$(SPL_)DM_MMC) += mmc-uclass.o
+obj-$(CONFIG_$(SPL_)MMC_WRITE) += mmc_write.o
 
 ifndef CONFIG_$(SPL_)BLK
 obj-y += mmc_legacy.o
@@ -16,9 +17,6 @@ obj-$(CONFIG_SUPPORT_EMMC_BOOT) += mmc_boot.o
 
 ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_SPL_MMC_BOOT) += fsl_esdhc_spl.o
-obj-$(CONFIG_SPL_SAVEENV) += mmc_write.o
-else
-obj-y += mmc_write.o
 endif
 
 obj-$(CONFIG_ARM_PL180_MMCI) += arm_pl180_mmci.o
index 793196bfecbe02a3b9d275143c6e615e7030e4b0..26c6ab7ad1fde014f6680e594ba62abc6ab9c238 100644 (file)
@@ -370,7 +370,7 @@ static int mmc_blk_probe(struct udevice *dev)
 
 static const struct blk_ops mmc_blk_ops = {
        .read   = mmc_bread,
-#ifndef CONFIG_SPL_BUILD
+#if CONFIG_IS_ENABLED(MMC_WRITE)
        .write  = mmc_bwrite,
        .erase  = mmc_berase,
 #endif
index 1290eed590cd0af96487912fe4462cfb5bba9ea8..a9be4b0102951e324832c849a967fdb2757807b2 100644 (file)
@@ -28,7 +28,7 @@ ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
                void *dst);
 #endif
 
-#if !(defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_SAVEENV))
+#if CONFIG_IS_ENABLED(MMC_WRITE)
 
 #if CONFIG_IS_ENABLED(BLK)
 ulong mmc_bwrite(struct udevice *dev, lbaint_t start, lbaint_t blkcnt,
@@ -40,7 +40,7 @@ ulong mmc_bwrite(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
 ulong mmc_berase(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt);
 #endif
 
-#else /* CONFIG_SPL_BUILD and CONFIG_SPL_SAVEENV is not defined */
+#else /* CONFIG_SPL_MMC_WRITE is not defined */
 
 /* declare dummies to reduce code size. */