All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: linux-mmc@vger.kernel.org, Ulf Hansson <ulf.hansson@linaro.org>,
	Adrian Hunter <adrian.hunter@intel.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Shawn Lin <shawn.lin@rock-chips.com>,
	Avri Altman <avri.altman@wdc.com>,
	Masami Hiramatsu <masami.hiramatsu@linaro.org>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 06/11] mmc: core: Prepare mmc_send_cxd_data() to be re-used for additional cmds
Date: Tue,  4 May 2021 18:12:17 +0200	[thread overview]
Message-ID: <20210504161222.101536-7-ulf.hansson@linaro.org> (raw)
In-Reply-To: <20210504161222.101536-1-ulf.hansson@linaro.org>

The function mmc_send_cxd_data() sends a data read command of ADTC type and
prepares to receive an R1 response. To make it even more re-usable, let's
extend it with another in-parameter for the command argument. While at it,
let's also rename the function to mmc_send_adtc_data() as it better
describes its purpose.

Note that, this change doesn't add any new users of the function. Instead
that is done from subsequent changes.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/mmc/core/mmc_ops.c | 11 +++++------
 drivers/mmc/core/mmc_ops.h |  2 ++
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
index 653627fe02a3..b1da8f1950ee 100644
--- a/drivers/mmc/core/mmc_ops.c
+++ b/drivers/mmc/core/mmc_ops.c
@@ -252,9 +252,8 @@ mmc_send_cxd_native(struct mmc_host *host, u32 arg, u32 *cxd, int opcode)
  * NOTE: void *buf, caller for the buf is required to use DMA-capable
  * buffer or on-stack buffer (with some overhead in callee).
  */
-static int
-mmc_send_cxd_data(struct mmc_card *card, struct mmc_host *host,
-		u32 opcode, void *buf, unsigned len)
+int mmc_send_adtc_data(struct mmc_card *card, struct mmc_host *host, u32 opcode,
+		       u32 args, void *buf, unsigned len)
 {
 	struct mmc_request mrq = {};
 	struct mmc_command cmd = {};
@@ -265,7 +264,7 @@ mmc_send_cxd_data(struct mmc_card *card, struct mmc_host *host,
 	mrq.data = &data;
 
 	cmd.opcode = opcode;
-	cmd.arg = 0;
+	cmd.arg = args;
 
 	/* NOTE HACK:  the MMC_RSP_SPI_R1 is always correct here, but we
 	 * rely on callers to never use this with "native" calls for reading
@@ -311,7 +310,7 @@ static int mmc_spi_send_cxd(struct mmc_host *host, u32 *cxd, u32 opcode)
 	if (!cxd_tmp)
 		return -ENOMEM;
 
-	ret = mmc_send_cxd_data(NULL, host, opcode, cxd_tmp, 16);
+	ret = mmc_send_adtc_data(NULL, host, opcode, 0, cxd_tmp, 16);
 	if (ret)
 		goto err;
 
@@ -359,7 +358,7 @@ int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd)
 	if (!ext_csd)
 		return -ENOMEM;
 
-	err = mmc_send_cxd_data(card, card->host, MMC_SEND_EXT_CSD, ext_csd,
+	err = mmc_send_adtc_data(card, card->host, MMC_SEND_EXT_CSD, 0, ext_csd,
 				512);
 	if (err)
 		kfree(ext_csd);
diff --git a/drivers/mmc/core/mmc_ops.h b/drivers/mmc/core/mmc_ops.h
index aca66c128804..2b1d730e56bf 100644
--- a/drivers/mmc/core/mmc_ops.h
+++ b/drivers/mmc/core/mmc_ops.h
@@ -26,6 +26,8 @@ int mmc_set_dsr(struct mmc_host *host);
 int mmc_go_idle(struct mmc_host *host);
 int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr);
 int mmc_set_relative_addr(struct mmc_card *card);
+int mmc_send_adtc_data(struct mmc_card *card, struct mmc_host *host, u32 opcode,
+		       u32 args, void *buf, unsigned len);
 int mmc_send_csd(struct mmc_card *card, u32 *csd);
 int __mmc_send_status(struct mmc_card *card, u32 *status, unsigned int retries);
 int mmc_send_status(struct mmc_card *card, u32 *status);
-- 
2.25.1


  parent reply	other threads:[~2021-05-04 16:12 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-04 16:12 [PATCH 00/11] Initital support for new power/perf features for SD cards Ulf Hansson
2021-05-04 16:12 ` [PATCH 01/11] mmc: core: Drop open coding when preparing commands with busy signaling Ulf Hansson
2021-05-06 12:50   ` Linus Walleij
2021-05-07  1:42   ` Shawn Lin
2021-05-04 16:12 ` [PATCH 02/11] mmc: core: Take into account MMC_CAP_NEED_RSP_BUSY for eMMC HPI commands Ulf Hansson
2021-05-06 12:51   ` Linus Walleij
2021-05-07  1:44   ` Shawn Lin
2021-05-04 16:12 ` [PATCH 03/11] mmc: core: Re-structure some code in __mmc_poll_for_busy() Ulf Hansson
2021-05-06 12:52   ` Linus Walleij
2021-05-07  1:48   ` Shawn Lin
2021-05-04 16:12 ` [PATCH 04/11] mmc: core: Extend re-use of __mmc_poll_for_busy() Ulf Hansson
2021-05-06 12:53   ` Linus Walleij
2021-05-07  1:51   ` Shawn Lin
2021-05-04 16:12 ` [PATCH 05/11] mmc: core: Enable eMMC sleep commands to use HW busy polling Ulf Hansson
2021-05-06 12:55   ` Linus Walleij
2021-05-07  1:52   ` Shawn Lin
2021-05-04 16:12 ` Ulf Hansson [this message]
2021-05-06 12:56   ` [PATCH 06/11] mmc: core: Prepare mmc_send_cxd_data() to be re-used for additional cmds Linus Walleij
2021-05-06 13:00   ` Linus Walleij
2021-05-07  7:30     ` Ulf Hansson
2021-05-07  1:53   ` Shawn Lin
2021-05-04 16:12 ` [PATCH 07/11] mmc: core: Drop open coding in mmc_sd_switch() Ulf Hansson
2021-05-06 12:57   ` Linus Walleij
2021-05-07  1:54   ` Shawn Lin
2021-05-04 16:12 ` [PATCH 08/11] mmc: core: Parse the SD SCR register for support of CMD48/49 and CMD58/59 Ulf Hansson
2021-05-06 13:01   ` Linus Walleij
2021-05-07  1:58   ` Shawn Lin
2021-05-04 16:12 ` [PATCH 09/11] mmc: core: Read the SD function extension registers for power management Ulf Hansson
2021-05-06 13:04   ` Linus Walleij
2021-05-07  2:06   ` Shawn Lin
2021-05-07  7:27     ` Ulf Hansson
2021-05-07  7:48       ` Shawn Lin
2021-05-07 11:36         ` Ulf Hansson
2021-05-04 16:12 ` [PATCH 10/11] mmc: core: Read performance enhancements registers for SD cards Ulf Hansson
2021-05-06 13:05   ` Linus Walleij
2021-05-04 16:12 ` [PATCH 11/11] mmc: core: Add support for Power Off Notification " Ulf Hansson
2021-05-06 13:07   ` Linus Walleij
2021-05-07  6:44 ` [PATCH 00/11] Initital support for new power/perf features " Avri Altman
2021-05-07  7:31   ` Ulf Hansson
2021-05-11 10:56 ` Ulf Hansson

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=20210504161222.101536-7-ulf.hansson@linaro.org \
    --to=ulf.hansson@linaro.org \
    --cc=adrian.hunter@intel.com \
    --cc=avri.altman@wdc.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=masami.hiramatsu@linaro.org \
    --cc=shawn.lin@rock-chips.com \
    --cc=wsa+renesas@sang-engineering.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.