]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
mmc: core: Add mmc_set_blockcount feature
authorLoic Pallardy <loic.pallardy-ext@stericsson.com>
Mon, 6 Aug 2012 15:12:30 +0000 (17:12 +0200)
committerChris Ball <cjb@laptop.org>
Thu, 6 Dec 2012 18:54:48 +0000 (13:54 -0500)
Provide support for automatically sending Set Block Count
(CMD23) messages. Used at least for RPMB support.

Signed-off-by: Alex Macro <alex.macro@stericsson.com>
Signed-off-by: Loic Pallardy <loic.pallardy@stericsson.com>
Reviewed-by: Namjae Jeon <linkinjeon@gmail.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Johan Rudholm <johan.rudholm@stericsson.com>
Acked-by: Krishna Konda <kkonda@codeaurora.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/core/core.c
include/linux/mmc/core.h

index bccfd1858b08282cfcabfbf47b6f10d7341cce07..aaed7687cf094fd9659dae2892b89c9ccd89c138 100644 (file)
@@ -1958,6 +1958,20 @@ int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen)
 }
 EXPORT_SYMBOL(mmc_set_blocklen);
 
+int mmc_set_blockcount(struct mmc_card *card, unsigned int blockcount,
+                       bool is_rel_write)
+{
+       struct mmc_command cmd = {0};
+
+       cmd.opcode = MMC_SET_BLOCK_COUNT;
+       cmd.arg = blockcount & 0x0000FFFF;
+       if (is_rel_write)
+               cmd.arg |= 1 << 31;
+       cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC;
+       return mmc_wait_for_cmd(card->host, &cmd, 5);
+}
+EXPORT_SYMBOL(mmc_set_blockcount);
+
 static void mmc_hw_reset_for_init(struct mmc_host *host)
 {
        if (!(host->caps & MMC_CAP_HW_RESET) || !host->ops->hw_reset)
index 9b9cdafc7737931f12bcd790112faa907edc8bc1..5bf7c2274fcb711138d517a131b2898d12f5b8a8 100644 (file)
@@ -170,6 +170,8 @@ extern int mmc_erase_group_aligned(struct mmc_card *card, unsigned int from,
 extern unsigned int mmc_calc_max_discard(struct mmc_card *card);
 
 extern int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen);
+extern int mmc_set_blockcount(struct mmc_card *card, unsigned int blockcount,
+                             bool is_rel_write);
 extern int mmc_hw_reset(struct mmc_host *host);
 extern int mmc_hw_reset_check(struct mmc_host *host);
 extern int mmc_can_reset(struct mmc_card *card);