All of lore.kernel.org
 help / color / mirror / Atom feed
From: Loic Pallardy <loic.pallardy-ext@stericsson.com>
To: linux-mmc@vger.kernel.org, Chris Ball <cjb@laptop.org>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	STEricsson_nomadik_linux <STEricsson_nomadik_linux@list.st.com>,
	Ulf Hansson <ulf.hansson@stericcson.com>,
	Loic Pallardy <loic.pallardy-ext@stericsson.com>,
	Alex Macro <alex.macro@stericsson.com>,
	Loic Pallardy <loic.pallardy@stericsson.com>
Subject: [PATCH v3 4/5] mmc: core: Add mmc_set_blockcount feature
Date: Mon, 6 Aug 2012 17:12:30 +0200	[thread overview]
Message-ID: <1344265951-22437-5-git-send-email-loic.pallardy-ext@stericsson.com> (raw)
In-Reply-To: <1344265951-22437-1-git-send-email-loic.pallardy-ext@stericsson.com>

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>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Johan Rudholm <johan.rudholm@stericsson.com>
Reviewed-by: Namjae Jeon <linkinjeon@gmail.com>
---
 drivers/mmc/core/core.c  | 14 ++++++++++++++
 include/linux/mmc/core.h |  2 ++
 2 files changed, 16 insertions(+)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 0b6141d..7990e2c 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1827,6 +1827,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)
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 1b431c7..098b7dd 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -166,6 +166,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);
-- 
1.7.11.1


  parent reply	other threads:[~2012-08-06 15:13 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-06 15:12 [PATCH v3 0/5] mmc: Add access to RPMB partition Loic Pallardy
2012-08-06 15:12 ` [PATCH v3 1/5] mmc: core: Expose " Loic Pallardy
     [not found]   ` <CAJOk3oHfTMr7-esASZKV0kmiFmeGzD1OjgwMZrTtz8Pk61Lswg@mail.gmail.com>
2012-11-16 21:32     ` Fwd: " Krishna Konda
2012-08-06 15:12 ` [PATCH v3 2/5] mmc: card: Do not scan RPMB partitions Loic Pallardy
     [not found]   ` <CAJOk3oE2gXH1AQQBqq-nuLCEb4--vcMZRYnQJNWOdCP8c0JcAA@mail.gmail.com>
2012-11-16 21:31     ` Fwd: " Krishna Konda
2012-08-06 15:12 ` [PATCH v3 3/5] mmc: core: Extend sysfs to ext_csd parameters for RPMB support Loic Pallardy
     [not found]   ` <CAJOk3oHSTygZBkj847a+OKcSAB8=G0YN8vrz07080sUdPB0+_Q@mail.gmail.com>
2012-11-16 21:27     ` Fwd: " Krishna Konda
2012-08-06 15:12 ` Loic Pallardy [this message]
     [not found]   ` <CAJOk3oEvYUEBAP729nbkxA9XKn=1H6076OPLDSsvq5GP7Z8Qxg@mail.gmail.com>
2012-11-16 21:26     ` Fwd: [PATCH v3 4/5] mmc: core: Add mmc_set_blockcount feature Krishna Konda
2012-08-06 15:12 ` [PATCH v3 5/5] mmc: card: Add RPMB support in IOCTL interface Loic Pallardy
2012-08-21  7:17   ` shashidhar hiremath
2012-08-22  7:43     ` Loic pallardy
     [not found]   ` <CAJOk3oERiGjxm-u6iGZLxK0Mq5noC76d33ojwVtY3gtdRBju3g@mail.gmail.com>
2012-11-16 21:23     ` Fwd: " Krishna Konda
     [not found] ` <CAJOk3oGMtZvrkw9ic306BKNSKCAzPQCYmJrvq5=zDi1pHjjQxg@mail.gmail.com>
2012-11-14 21:14   ` Fwd: [PATCH v3 0/5] mmc: Add access to RPMB partition Krishna Konda
2012-11-15  8:04     ` Linus Walleij
2012-11-16 21:11       ` Krishna Konda
2012-11-17 20:19         ` Linus Walleij
2012-11-17 23:12 ` Chris Ball
2012-11-19 10:09   ` Linus Walleij
2012-11-19 18:12   ` Krishna Konda
2012-11-20  8:25     ` Loic PALLARDY
2012-11-20 18:54       ` Krishna Konda
2012-11-21  9:55         ` Loic PALLARDY
2012-11-21 11:02           ` Sundar J. Dev
2012-11-21 17:32             ` Loic PALLARDY
2012-11-22  4:32               ` Sundar J. Dev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1344265951-22437-5-git-send-email-loic.pallardy-ext@stericsson.com \
    --to=loic.pallardy-ext@stericsson.com \
    --cc=STEricsson_nomadik_linux@list.st.com \
    --cc=alex.macro@stericsson.com \
    --cc=cjb@laptop.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=loic.pallardy@stericsson.com \
    --cc=ulf.hansson@stericcson.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.