U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Othacehe <othacehe@gnu.org>
To: Peng Fan <peng.fan@nxp.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>,
	Tom Rini <trini@konsulko.com>,
	Marek Vasut <marek.vasut+renesas@mailbox.org>,
	Jonas Karlman <jonas@kwiboo.se>, Simon Glass <sjg@chromium.org>,
	Tim Harvey <tharvey@gateworks.com>,
	Jean-Jacques Hiblot <jjhiblot@ti.com>,
	u-boot@lists.denx.de, regis.ray@landisgyr.com,
	pascal.dupuis@landisgyr.com
Subject: [PATCH 1/2] mmc: Add a new callback function to perform the 74 clocks cycle sequence
Date: Thu, 10 Apr 2025 11:00:20 +0200	[thread overview]
Message-ID: <20250410090021.14446-2-othacehe@gnu.org> (raw)
In-Reply-To: <20250410090021.14446-1-othacehe@gnu.org>

From: Jean-Jacques Hiblot <jjhiblot@ti.com>

Add a new callback function *send_init_stream* which start a sequence of
at least 74 clock cycles.
The mmc core uses *mmc_send_init_stream* in order to invoke the callback
function. This will be used during power cycle where the specification
requires such a sequence after power up.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
---
 drivers/mmc/mmc-uclass.c | 13 +++++++++++++
 drivers/mmc/mmc.c        |  6 ++++++
 include/mmc.h            |  9 +++++++++
 3 files changed, 28 insertions(+)

diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index c8db4f811c2..ca5bf1d11e6 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -83,6 +83,19 @@ int mmc_wait_dat0(struct mmc *mmc, int state, int timeout_us)
 	return dm_mmc_wait_dat0(mmc->dev, state, timeout_us);
 }
 
+void dm_mmc_send_init_stream(struct udevice *dev)
+{
+	struct dm_mmc_ops *ops = mmc_get_ops(dev);
+
+	if (ops->send_init_stream)
+		ops->send_init_stream(dev);
+}
+
+void mmc_send_init_stream(struct mmc *mmc)
+{
+	dm_mmc_send_init_stream(mmc->dev);
+}
+
 static int dm_mmc_get_wp(struct udevice *dev)
 {
 	struct dm_mmc_ops *ops = mmc_get_ops(dev);
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 31a72366206..086826c668c 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1663,6 +1663,10 @@ static int mmc_execute_tuning(struct mmc *mmc, uint opcode)
 }
 #endif
 
+static void mmc_send_init_stream(struct mmc *mmc)
+{
+}
+
 static int mmc_set_ios(struct mmc *mmc)
 {
 	int ret = 0;
@@ -2929,6 +2933,8 @@ int mmc_get_op_cond(struct mmc *mmc, bool quiet)
 retry:
 	mmc_set_initial_state(mmc);
 
+	mmc_send_init_stream(mmc);
+
 	/* Reset the Card */
 	err = mmc_go_idle(mmc);
 
diff --git a/include/mmc.h b/include/mmc.h
index 81bccb4cf12..c2d275cdc3e 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -487,6 +487,14 @@ struct dm_mmc_ops {
 	 */
 	int (*set_ios)(struct udevice *dev);
 
+	/**
+	 * send_init_stream() - send the initialization stream: 74 clock cycles
+	 * This is used after power up before sending the first command
+	 *
+	 * @dev:	Device to update
+	 */
+	void (*send_init_stream)(struct udevice *dev);
+
 	/**
 	 * get_cd() - See whether a card is present
 	 *
@@ -566,6 +574,7 @@ struct dm_mmc_ops {
 
 /* Transition functions for compatibility */
 int mmc_set_ios(struct mmc *mmc);
+void mmc_send_init_stream(struct mmc *mmc);
 int mmc_getcd(struct mmc *mmc);
 int mmc_getwp(struct mmc *mmc);
 int mmc_execute_tuning(struct mmc *mmc, uint opcode);
-- 
2.47.1


  reply	other threads:[~2025-04-10  9:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-10  9:00 [PATCH 0/2] mmc: omap_hsmmc: Restore the init_stream sequence Mathieu Othacehe
2025-04-10  9:00 ` Mathieu Othacehe [this message]
2025-04-10  9:00 ` [PATCH 2/2] mmc: omap_hsmmc: implement send_init_stream callback Mathieu Othacehe
2025-04-18  2:43 ` [PATCH 0/2] mmc: omap_hsmmc: Restore the init_stream sequence Peng Fan
2025-04-23 16:05 ` Peng Fan (OSS)

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=20250410090021.14446-2-othacehe@gnu.org \
    --to=othacehe@gnu.org \
    --cc=jh80.chung@samsung.com \
    --cc=jjhiblot@ti.com \
    --cc=jonas@kwiboo.se \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=pascal.dupuis@landisgyr.com \
    --cc=peng.fan@nxp.com \
    --cc=regis.ray@landisgyr.com \
    --cc=sjg@chromium.org \
    --cc=tharvey@gateworks.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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