linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Lai <jasonlai.genesyslogic@gmail.com>
To: ulf.hansson@linaro.org, takahiro.akashi@linaro.org,
	adrian.hunter@intel.com
Cc: linux-mmc@vger.kernel.org, dlunev@chromium.org,
	ben.chuang@genesyslogic.com.tw, greg.tu@genesyslogic.com.tw,
	jason.lai@genesyslogic.com.tw, otis.wu@genesyslogic.com.tw,
	jasonlai.genesyslogic@gmail.com
Subject: [PATCH V3 7/7] mmc: core: Support UHS-II card access
Date: Tue, 22 Feb 2022 11:39:31 +0800	[thread overview]
Message-ID: <20220222033931.237638-8-jasonlai.genesyslogic@gmail.com> (raw)
In-Reply-To: <20220222033931.237638-1-jasonlai.genesyslogic@gmail.com>

From: Jason Lai <jason.lai@genesyslogic.com.tw>

Embed UHS-II access functionality into the MMC request processing flow.

Signed-off-by: Jason Lai <jason.lai@genesyslogic.com.tw>
---
 drivers/mmc/core/core.c | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index fc3d8d61a97c..d2dcaa64bf27 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -31,6 +31,7 @@
 #include <linux/mmc/mmc.h>
 #include <linux/mmc/sd.h>
 #include <linux/mmc/slot-gpio.h>
+#include <linux/mmc/sd_uhs2.h>
 
 #define CREATE_TRACE_POINTS
 #include <trace/events/mmc.h>
@@ -42,6 +43,7 @@
 #include "host.h"
 #include "sdio_bus.h"
 #include "pwrseq.h"
+#include "sd_uhs2.h"
 
 #include "mmc_ops.h"
 #include "sd_ops.h"
@@ -335,6 +337,8 @@ static int mmc_mrq_prep(struct mmc_host *host, struct mmc_request *mrq)
 
 int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
 {
+	struct uhs2_command uhs2_cmd;
+	u32 payload[4]; /* for maximum size */
 	int err;
 
 	init_completion(&mrq->cmd_completion);
@@ -352,6 +356,13 @@ int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
 	if (err)
 		return err;
 
+	if (host->uhs2_caps.flags & MMC_UHS2_SUPPORT &&
+	    host->uhs2_caps.flags & MMC_UHS2_INITIALIZED) {
+		uhs2_cmd.payload = payload;
+		mrq->cmd->uhs2_cmd = &uhs2_cmd;
+		sd_uhs2_prepare_cmd(host, mrq);
+	}
+
 	led_trigger_event(host->led, LED_FULL);
 	__mmc_start_request(host, mrq);
 
@@ -431,6 +442,8 @@ EXPORT_SYMBOL(mmc_wait_for_req_done);
  */
 int mmc_cqe_start_req(struct mmc_host *host, struct mmc_request *mrq)
 {
+	struct uhs2_command uhs2_cmd;
+	u32 payload[4]; /* for maximum size */
 	int err;
 
 	/*
@@ -451,6 +464,13 @@ int mmc_cqe_start_req(struct mmc_host *host, struct mmc_request *mrq)
 	if (err)
 		goto out_err;
 
+	if (host->uhs2_caps.flags & MMC_UHS2_SUPPORT &&
+	    host->uhs2_caps.flags & MMC_UHS2_INITIALIZED) {
+		uhs2_cmd.payload = payload;
+		mrq->cmd->uhs2_cmd = &uhs2_cmd;
+		sd_uhs2_prepare_cmd(host, mrq);
+	}
+
 	err = host->cqe_ops->cqe_request(host, mrq);
 	if (err)
 		goto out_err;
@@ -899,8 +919,10 @@ static inline void mmc_set_ios(struct mmc_host *host)
  */
 void mmc_set_chip_select(struct mmc_host *host, int mode)
 {
-	host->ios.chip_select = mode;
-	mmc_set_ios(host);
+	if (!(host->uhs2_caps.flags & MMC_UHS2_INITIALIZED)) {
+		host->ios.chip_select = mode;
+		mmc_set_ios(host);
+	}
 }
 
 /*
-- 
2.35.1


  parent reply	other threads:[~2022-02-22  3:40 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-22  3:39 [PATCH V3 0/7] Preparations to support SD UHS-II cards Jason Lai
2022-02-22  3:39 ` [PATCH V3 1/7] mmc: core: Cleanup printing of speed mode at card insertion Jason Lai
2022-02-22  3:39 ` [PATCH V3 2/7] mmc: core: Prepare to support SD UHS-II cards Jason Lai
2022-02-22  3:39 ` [PATCH V3 3/7] mmc: core: Announce successful insertion of an SD UHS-II card Jason Lai
2022-02-22  3:39 ` [PATCH V3 4/7] mmc: core: Extend support for mmc regulators with a vqmmc2 Jason Lai
2022-02-22  3:39 ` [PATCH V3 5/7] mmc: add UHS-II related definitions in headers Jason Lai
2022-02-22  3:39 ` [PATCH V3 6/7] mmc: Implement content of UHS-II card initialization functions Jason Lai
2022-03-23 16:15   ` Ulf Hansson
2022-03-24  1:29     ` AKASHI Takahiro
2022-03-24  6:09       ` Lai Jason
2022-03-24 10:22       ` Ulf Hansson
2022-03-24 10:50         ` AKASHI Takahiro
2022-03-25  3:53           ` Lai Jason
2022-03-25  8:10             ` Ulf Hansson
2022-04-07 10:45     ` Lai Jason
2022-04-07 15:00       ` Ulf Hansson
2022-04-12  3:32         ` Lai Jason
2022-04-12 11:57           ` Ulf Hansson
2022-04-13  7:18             ` Lai Jason
2022-04-13 11:03               ` Ulf Hansson
2022-04-14 12:41                 ` Lai Jason
2022-02-22  3:39 ` Jason Lai [this message]
2022-03-23 16:23   ` [PATCH V3 7/7] mmc: core: Support UHS-II card access Ulf Hansson
2022-04-07 11:00     ` Lai Jason
2022-04-07 15:21       ` Ulf Hansson
2022-03-18 13:16 ` [PATCH V3 0/7] Preparations to support SD UHS-II cards Ulf Hansson
2022-03-23 13:45   ` 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=20220222033931.237638-8-jasonlai.genesyslogic@gmail.com \
    --to=jasonlai.genesyslogic@gmail.com \
    --cc=adrian.hunter@intel.com \
    --cc=ben.chuang@genesyslogic.com.tw \
    --cc=dlunev@chromium.org \
    --cc=greg.tu@genesyslogic.com.tw \
    --cc=jason.lai@genesyslogic.com.tw \
    --cc=linux-mmc@vger.kernel.org \
    --cc=otis.wu@genesyslogic.com.tw \
    --cc=takahiro.akashi@linaro.org \
    --cc=ulf.hansson@linaro.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).