diff mbox

mvsdio: Add ERASE caps

Message ID 1481532074.21423.9.camel@vitec.com
State New
Headers show

Commit Message

Damien Thébault Dec. 12, 2016, 8:41 a.m. UTC
Hello,

I was trying to use ERASE with mvsdio and it did not have the
capability. But the Marvell SDIO host controller does support sending
ERASE commands.

This is similar to the patch that Sascha Silbe sent a few years ago [1],
but this one is based on the latest kernel sources.

[1]: https://lkml.org/lkml/2011/3/17/297

The patch stays in the spirit of what have been done in other drivers
like dw_mmc or sunxi-mmc, setting MMC_CAP_ERASE before calling
mmc_of_parse().

This has been tested successfully with blkdiscard and blkdiscard -s on
an eMMC card.

---
 drivers/mmc/host/mvsdio.c | 5 +++++
 1 file changed, 5 insertions(+)

-- 
2.10.2
diff mbox

Patch

diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c
index 42296e5..e14247e 100644
--- a/drivers/mmc/host/mvsdio.c
+++ b/drivers/mmc/host/mvsdio.c
@@ -749,6 +749,11 @@  static int mvsd_probe(struct platform_device *pdev)
 	mmc->max_seg_size = mmc->max_blk_size * mmc->max_blk_count;
 	mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
 
+	/*
+	 * Support MMC_CAP_ERASE, needed to use trim/discard/erase commands.
+	 */
+	mmc->caps |= MMC_CAP_ERASE;
+
 	host->base_clock = clk_get_rate(host->clk) / 2;
 	ret = mmc_of_parse(mmc);
 	if (ret < 0)