Linux MultiMedia Card development
 help / color / mirror / Atom feed
From: Wenchao Chen <wenchao.chen@unisoc.com>
To: <ulf.hansson@linaro.org>, <adrian.hunter@intel.com>
Cc: <linux-mmc@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<wenchao.chen666@gmail.com>, <zhenxiong.lai@unisoc.com>,
	<chunyan.zhang@unisoc.com>, <yuelin.tang@unisoc.com>,
	Wenchao Chen <wenchao.chen@unisoc.com>
Subject: [PATCH V2 1/2] mmc: core: Add host specific tuning support for SD HS mode
Date: Tue, 15 Aug 2023 09:40:56 +0800	[thread overview]
Message-ID: <20230815014057.13589-2-wenchao.chen@unisoc.com> (raw)
In-Reply-To: <20230815014057.13589-1-wenchao.chen@unisoc.com>

Added .prepare_hs_tuning and .execute_hs_tuning host callbacks to
support host-specific tuning for SD high speed mode.

Signed-off-by: Wenchao Chen <wenchao.chen@unisoc.com>
---
 drivers/mmc/core/sd.c    | 12 ++++++++++++
 include/linux/mmc/host.h |  6 ++++++
 2 files changed, 18 insertions(+)

diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 246ce027ae0a..ac2da8f2fbce 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -1518,6 +1518,12 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
 		 */
 		mmc_set_clock(host, mmc_sd_get_max_clock(card));
 
+		if (host->ops->prepare_hs_tuning) {
+			err = host->ops->prepare_hs_tuning(host, card);
+			if (err)
+				goto free_card;
+		}
+
 		/*
 		 * Switch to wider bus (if supported).
 		 */
@@ -1529,6 +1535,12 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
 
 			mmc_set_bus_width(host, MMC_BUS_WIDTH_4);
 		}
+
+		if (host->ops->execute_hs_tuning) {
+			err = host->ops->execute_hs_tuning(host, card);
+			if (err)
+				goto free_card;
+		}
 	}
 cont:
 	if (!oldcard) {
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 461d1543893b..13cf894b9e3c 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -184,6 +184,12 @@ struct mmc_host_ops {
 	/* Execute HS400 tuning depending host driver */
 	int	(*execute_hs400_tuning)(struct mmc_host *host, struct mmc_card *card);
 
+	/* Prepare HS tuning depending host driver */
+	int	(*prepare_hs_tuning)(struct mmc_host *host, struct mmc_card *card);
+
+	/* Execute HS tuning depending host driver */
+	int	(*execute_hs_tuning)(struct mmc_host *host, struct mmc_card *card);
+
 	/* Prepare switch to DDR during the HS400 init sequence */
 	int	(*hs400_prepare_ddr)(struct mmc_host *host);
 
-- 
2.17.1


  reply	other threads:[~2023-08-15  1:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-15  1:40 [PATCH V2 0/2] mmc: sdhci-sprd: Add SD HS mode online tuning Wenchao Chen
2023-08-15  1:40 ` Wenchao Chen [this message]
2023-08-24 10:11   ` [PATCH V2 1/2] mmc: core: Add host specific tuning support for SD HS mode Ulf Hansson
2023-08-15  1:40 ` [PATCH V2 2/2] mmc: sdhci-sprd: Add SD HS mode online tuning Wenchao Chen
2023-08-24  9:59   ` Ulf Hansson
2023-08-15  6:20 ` [PATCH V2 0/2] " Adrian Hunter
2023-08-15 10:29   ` Wenchao Chen
2023-08-15 10:37     ` Adrian Hunter
2023-08-15 10:55       ` Wenchao Chen
2023-08-15 11:19         ` Adrian Hunter
2023-08-16  2:33           ` Wenchao Chen

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=20230815014057.13589-2-wenchao.chen@unisoc.com \
    --to=wenchao.chen@unisoc.com \
    --cc=adrian.hunter@intel.com \
    --cc=chunyan.zhang@unisoc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    --cc=wenchao.chen666@gmail.com \
    --cc=yuelin.tang@unisoc.com \
    --cc=zhenxiong.lai@unisoc.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox