[U-Boot] [PATCH v3 1/3] dm: mmc: Support erase
Simon Glass
sjg at chromium.org
Sat Oct 1 22:43:17 CEST 2016
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 at chromium.org>
---
Changes in v3: None
drivers/mmc/mmc-uclass.c | 1 +
drivers/mmc/mmc_private.h | 5 ++---
drivers/mmc/mmc_write.c | 10 ++++++++--
3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index 425abb1..77424cd 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -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,
};
diff --git a/drivers/mmc/mmc_private.h b/drivers/mmc/mmc_private.h
index 49ec022..8c0b993 100644
--- a/drivers/mmc/mmc_private.h
+++ b/drivers/mmc/mmc_private.h
@@ -30,15 +30,14 @@ ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
#ifndef CONFIG_SPL_BUILD
-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 */
diff --git a/drivers/mmc/mmc_write.c b/drivers/mmc/mmc_write.c
index 2289640..54acbf7 100644
--- a/drivers/mmc/mmc_write.c
+++ b/drivers/mmc/mmc_write.c
@@ -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;
--
2.8.0.rc3.226.g39d4020
More information about the U-Boot
mailing list