All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alper Nebi Yasak <alpernebiyasak@gmail.com>
To: u-boot@lists.denx.de
Cc: Faiz Abbas <faiz_abbas@ti.com>,
	Jaehoon Chung <jh80.chung@samsung.com>,
	Philipp Tomsich <philipp.tomsich@vrull.eu>,
	Peter Robinson <pbrobinson@gmail.com>,
	Peng Fan <peng.fan@nxp.com>, Peter Geis <pgwipeout@gmail.com>,
	Jagan Teki <jagan@amarulasolutions.com>,
	Samuel Dionne-Riel <samuel@dionne-riel.com>,
	Simon Glass <sjg@chromium.org>,
	Kever Yang <kever.yang@rock-chips.com>,
	Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>,
	Aswath Govindraju <a-govindraju@ti.com>,
	Jack Mitchell <ml@embed.me.uk>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Yifeng Zhao <yifeng.zhao@rock-chips.com>,
	Michal Simek <michal.simek@xilinx.com>,
	Stephen Carlson <stcarlso@linux.microsoft.com>,
	Alper Nebi Yasak <alpernebiyasak@gmail.com>
Subject: [PATCH v5 1/3] mmc: sdhci: Add HS400 Enhanced Strobe support
Date: Tue, 15 Mar 2022 20:46:26 +0300	[thread overview]
Message-ID: <20220315174629.7467-2-alpernebiyasak@gmail.com> (raw)
In-Reply-To: <20220315174629.7467-1-alpernebiyasak@gmail.com>

Delegate setting the Enhanced Strobe configuration to individual drivers
if they set a function for it. Return -ENOTSUPP if they do not, like
what the MMC uclass does.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
---

(no changes since v4)

Changes in v4:
- Add comment for SDHCI set_enhanced_strobe() operation

Changes in v2:
- Add tag: "Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>"

 drivers/mmc/sdhci.c | 18 ++++++++++++++++++
 include/sdhci.h     | 12 ++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 766e4a6b0c5e..bf989a594f7e 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -513,6 +513,7 @@ void sdhci_set_uhs_timing(struct sdhci_host *host)
 		reg |= SDHCI_CTRL_UHS_SDR104;
 		break;
 	case MMC_HS_400:
+	case MMC_HS_400_ES:
 		reg |= SDHCI_CTRL_HS400;
 		break;
 	default:
@@ -666,6 +667,7 @@ static int sdhci_set_ios(struct mmc *mmc)
 		    mmc->selected_mode == MMC_DDR_52 ||
 		    mmc->selected_mode == MMC_HS_200 ||
 		    mmc->selected_mode == MMC_HS_400 ||
+		    mmc->selected_mode == MMC_HS_400_ES ||
 		    mmc->selected_mode == UHS_SDR25 ||
 		    mmc->selected_mode == UHS_SDR50 ||
 		    mmc->selected_mode == UHS_SDR104 ||
@@ -799,6 +801,19 @@ static int sdhci_wait_dat0(struct udevice *dev, int state,
 	return -ETIMEDOUT;
 }
 
+#if CONFIG_IS_ENABLED(MMC_HS400_ES_SUPPORT)
+static int sdhci_set_enhanced_strobe(struct udevice *dev)
+{
+	struct mmc *mmc = mmc_get_mmc_dev(dev);
+	struct sdhci_host *host = mmc->priv;
+
+	if (host->ops && host->ops->set_enhanced_strobe)
+		return host->ops->set_enhanced_strobe(host);
+
+	return -ENOTSUPP;
+}
+#endif
+
 const struct dm_mmc_ops sdhci_ops = {
 	.send_cmd	= sdhci_send_command,
 	.set_ios	= sdhci_set_ios,
@@ -808,6 +823,9 @@ const struct dm_mmc_ops sdhci_ops = {
 	.execute_tuning	= sdhci_execute_tuning,
 #endif
 	.wait_dat0	= sdhci_wait_dat0,
+#if CONFIG_IS_ENABLED(MMC_HS400_ES_SUPPORT)
+	.set_enhanced_strobe = sdhci_set_enhanced_strobe,
+#endif
 };
 #else
 static const struct mmc_ops sdhci_ops = {
diff --git a/include/sdhci.h b/include/sdhci.h
index c8d69f5a63f7..88f1917480b6 100644
--- a/include/sdhci.h
+++ b/include/sdhci.h
@@ -272,6 +272,18 @@ struct sdhci_ops {
 	int (*platform_execute_tuning)(struct mmc *host, u8 opcode);
 	int (*set_delay)(struct sdhci_host *host);
 	int	(*deferred_probe)(struct sdhci_host *host);
+
+	/**
+	 * set_enhanced_strobe() - Set HS400 Enhanced Strobe config
+	 *
+	 * This is called after setting the card speed and mode to
+	 * HS400 ES, and should set any host-specific configuration
+	 * necessary for it.
+	 *
+	 * @host: SDHCI host structure
+	 * Return: 0 if successful, -ve on error
+	 */
+	int	(*set_enhanced_strobe)(struct sdhci_host *host);
 };
 
 #define ADMA_MAX_LEN	65532
-- 
2.35.1


  reply	other threads:[~2022-03-15 17:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20220315174657epcas1p23089ad47a1f6fac2017f8ac2f4802765@epcas1p2.samsung.com>
2022-03-15 17:46 ` [PATCH v5 0/3] rockchip: sdhci: Add HS400 Enhanced Strobe support Alper Nebi Yasak
2022-03-15 17:46   ` Alper Nebi Yasak [this message]
2022-03-16  1:26     ` [PATCH v5 1/3] mmc: " Kever Yang
2022-03-15 17:46   ` [PATCH v5 2/3] rockchip: sdhci: Add HS400 Enhanced Strobe support for RK3399 Alper Nebi Yasak
2022-03-16  1:26     ` Kever Yang
2022-03-15 17:46   ` [PATCH v5 3/3] rockchip: sdhci: Add HS400 Enhanced Strobe support for RK3568 Alper Nebi Yasak
2022-03-16  1:12     ` zyf
2022-03-16  1:56     ` Kever Yang
2022-03-16 10:25   ` [PATCH v5 0/3] rockchip: sdhci: Add HS400 Enhanced Strobe support Jaehoon Chung

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=20220315174629.7467-2-alpernebiyasak@gmail.com \
    --to=alpernebiyasak@gmail.com \
    --cc=a-govindraju@ti.com \
    --cc=ashok.reddy.soma@xilinx.com \
    --cc=faiz_abbas@ti.com \
    --cc=jagan@amarulasolutions.com \
    --cc=jh80.chung@samsung.com \
    --cc=kever.yang@rock-chips.com \
    --cc=michal.simek@xilinx.com \
    --cc=ml@embed.me.uk \
    --cc=pbrobinson@gmail.com \
    --cc=peng.fan@nxp.com \
    --cc=pgwipeout@gmail.com \
    --cc=philipp.tomsich@vrull.eu \
    --cc=samuel@dionne-riel.com \
    --cc=sjg@chromium.org \
    --cc=stcarlso@linux.microsoft.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    --cc=yifeng.zhao@rock-chips.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.