All of lore.kernel.org
 help / color / mirror / Atom feed
From: Judith Mendez <jm@ti.com>
To: Tom Rini <trini@konsulko.com>, Peng Fan <peng.fan@nxp.com>,
	Jaehoon Chung <jh80.chung@samsung.com>
Cc: Vignesh Raghavendra <vigneshr@ti.com>, Bryan Brattlof <bb@ti.com>,
	open list <u-boot@lists.denx.de>
Subject: [PATCH v2 3/5] mmc: am654_sdhci: Add am654_sdhci_set_control_reg
Date: Mon, 14 Apr 2025 17:43:55 -0500	[thread overview]
Message-ID: <20250414224357.1555064-4-jm@ti.com> (raw)
In-Reply-To: <20250414224357.1555064-1-jm@ti.com>

This patch adds am654_sdhci_set_control_reg to am654_sdhci.

This is required to fix UHS_MODE_SELECT for TI K3 boards.

If any of HIGH_SPEED_ENA, V1P8_SIGNAL_ENA, UHS_MODE_SELECT
are set, then data will be launched on the pos-edge of the
clock.

Since K3 SoCs did not meet timing requirements for High Speed
SDR mode at rising clock edge, none of these three should be
set, therefore limit UHS_MODE_SELECT to only be set for modes
above MMC_HS_52.

This fixes MMC write issue on am64x evm at mode High Speed
SDR.

Signed-off-by: Judith Mendez <jm@ti.com>
Reviewed-by: Bryan Brattlof <bb@ti.com>
---
 drivers/mmc/am654_sdhci.c | 15 +++++++++++++--
 drivers/mmc/sdhci.c       |  2 +-
 include/sdhci.h           |  1 +
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/am654_sdhci.c b/drivers/mmc/am654_sdhci.c
index 28d82afd012..0df3568f073 100644
--- a/drivers/mmc/am654_sdhci.c
+++ b/drivers/mmc/am654_sdhci.c
@@ -523,13 +523,24 @@ static int am654_sdhci_execute_tuning(struct mmc *mmc, u8 opcode)
 	return 0;
 }
 #endif
+
+void am654_sdhci_set_control_reg(struct sdhci_host *host)
+{
+	struct mmc *mmc = host->mmc;
+
+	sdhci_set_voltage(host);
+
+	if (mmc->selected_mode > MMC_HS_52)
+		sdhci_set_uhs_timing(host);
+}
+
 const struct sdhci_ops am654_sdhci_ops = {
 #if CONFIG_IS_ENABLED(MMC_SUPPORTS_TUNING)
 	.platform_execute_tuning = am654_sdhci_execute_tuning,
 #endif
 	.deferred_probe		= am654_sdhci_deferred_probe,
 	.set_ios_post		= &am654_sdhci_set_ios_post,
-	.set_control_reg	= sdhci_set_control_reg,
+	.set_control_reg	= am654_sdhci_set_control_reg,
 	.write_b		= am654_sdhci_write_b,
 };
 
@@ -589,7 +600,7 @@ const struct sdhci_ops j721e_4bit_sdhci_ops = {
 #endif
 	.deferred_probe		= am654_sdhci_deferred_probe,
 	.set_ios_post		= &j721e_4bit_sdhci_set_ios_post,
-	.set_control_reg	= sdhci_set_control_reg,
+	.set_control_reg	= am654_sdhci_set_control_reg,
 	.write_b		= am654_sdhci_write_b,
 };
 
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index dc7f0724a7b..648dfa4b5ef 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -549,7 +549,7 @@ void sdhci_set_uhs_timing(struct sdhci_host *host)
 	sdhci_writew(host, reg, SDHCI_HOST_CONTROL2);
 }
 
-static void sdhci_set_voltage(struct sdhci_host *host)
+void sdhci_set_voltage(struct sdhci_host *host)
 {
 	if (IS_ENABLED(CONFIG_MMC_IO_VOLTAGE)) {
 		struct mmc *mmc = (struct mmc *)host->mmc;
diff --git a/include/sdhci.h b/include/sdhci.h
index 31a49ca6a2f..2372697b743 100644
--- a/include/sdhci.h
+++ b/include/sdhci.h
@@ -518,6 +518,7 @@ void sdhci_set_uhs_timing(struct sdhci_host *host);
 /* Export the operations to drivers */
 int sdhci_probe(struct udevice *dev);
 int sdhci_set_clock(struct mmc *mmc, unsigned int clock);
+void sdhci_set_voltage(struct sdhci_host *host);
 
 /**
  * sdhci_set_control_reg - Set control registers
-- 
2.49.0


  parent reply	other threads:[~2025-04-14 22:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-14 22:43 [PATCH v2 0/5] More MMC fixes Judith Mendez
2025-04-14 22:43 ` [PATCH v2 1/5] mmc: am654_sdhci: Add MMC_HS_52 to timing data Judith Mendez
2025-04-14 22:43 ` [PATCH v2 2/5] mmc: am654_sdhci: Fix HIGH_SPEED_ENA Judith Mendez
2025-04-14 22:43 ` Judith Mendez [this message]
2025-04-14 22:43 ` [PATCH v2 4/5] configs: am62px_evm_r5/a53_defconfig: Disable eMMC HS400 Judith Mendez
2025-04-14 22:43 ` [PATCH v2 5/5] configs: am62*_evm_a53_defconfig: Add TI_COMMON_CMD_OPTIONS Judith Mendez
2025-04-17 20:11 ` [PATCH v2 0/5] More MMC fixes Judith Mendez
2025-04-17 21:41   ` Tom Rini

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=20250414224357.1555064-4-jm@ti.com \
    --to=jm@ti.com \
    --cc=bb@ti.com \
    --cc=jh80.chung@samsung.com \
    --cc=peng.fan@nxp.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=vigneshr@ti.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.