]> git.sur5r.net Git - u-boot/commitdiff
dm: mmc: Support erase
authorSimon Glass <sjg@chromium.org>
Sat, 1 Oct 2016 20:43:17 +0000 (14:43 -0600)
committersjg <sjg@chromium.org>
Mon, 10 Oct 2016 03:36:27 +0000 (21:36 -0600)
At present erase is not suported with CONFIG_DM_OPS. Add it so that MMC
devices can be erased.

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/mmc/mmc-uclass.c
drivers/mmc/mmc_private.h
drivers/mmc/mmc_write.c

index 425abb1b9ef748183909e208fe32210555de09c8..77424cdcea0b698c98e1cd442c2f54afdc045f1e 100644 (file)
@@ -262,6 +262,7 @@ static const struct blk_ops mmc_blk_ops = {
        .read   = mmc_bread,
 #ifndef CONFIG_SPL_BUILD
        .write  = mmc_bwrite,
+       .erase  = mmc_berase,
 #endif
        .select_hwpart  = mmc_select_hwpart,
 };
index d8b399e3641fc6cb241b1bbe22023488ec359031..03bf24d5febdf412943a0841f54c689999cb6b6f 100644 (file)
@@ -29,15 +29,15 @@ ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
 #endif
 
 #if !(defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_SAVEENV))
-unsigned long mmc_berase(struct blk_desc *block_dev, lbaint_t start,
-                        lbaint_t blkcnt);
 
 #ifdef CONFIG_BLK
 ulong mmc_bwrite(struct udevice *dev, lbaint_t start, lbaint_t blkcnt,
                 const void *src);
+ulong mmc_berase(struct udevice *dev, lbaint_t start, lbaint_t blkcnt);
 #else
 ulong mmc_bwrite(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
                 const void *src);
+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 */
index 22896403754beb6c1b1d0481d02ceecf9e3b4f13..54acbf73367b8acbb7d4597ef9c4c9815a05e7f4 100644 (file)
@@ -66,9 +66,15 @@ err_out:
        return err;
 }
 
-unsigned long mmc_berase(struct blk_desc *block_dev, lbaint_t start,
-                        lbaint_t blkcnt)
+#ifdef CONFIG_BLK
+ulong mmc_berase(struct udevice *dev, lbaint_t start, lbaint_t blkcnt)
+#else
+ulong mmc_berase(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt)
+#endif
 {
+#ifdef CONFIG_BLK
+       struct blk_desc *block_dev = dev_get_uclass_platdata(dev);
+#endif
        int dev_num = block_dev->devnum;
        int err = 0;
        u32 start_rem, blkcnt_rem;