From: Steffen Trumtrar <s.trumtrar@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 12/12] mci: arasan: use sdhci_wait_idle2
Date: Fri, 08 Mar 2024 12:17:10 +0100 [thread overview]
Message-ID: <20240308-v2024-02-0-topic-arasan-hs200-support-v1-12-6d50c90485f3@pengutronix.de> (raw)
In-Reply-To: <20240308-v2024-02-0-topic-arasan-hs200-support-v1-0-6d50c90485f3@pengutronix.de>
To support HS200 mode, the arasan needs a differernt sdhci_wait_idle
function. Remove the default CMD_INHIBIT_DATA, otherwise the sdhci hs200
tuning will timeout.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
drivers/mci/arasan-sdhci.c | 2 +-
drivers/mci/sdhci.c | 25 +++++++++++++++++++++++++
drivers/mci/sdhci.h | 1 +
3 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/drivers/mci/arasan-sdhci.c b/drivers/mci/arasan-sdhci.c
index c20d901c3f..afddf19de7 100644
--- a/drivers/mci/arasan-sdhci.c
+++ b/drivers/mci/arasan-sdhci.c
@@ -250,7 +250,7 @@ static int arasan_sdhci_send_cmd(struct mci_host *mci, struct mci_cmd *cmd,
u32 mask, command, xfer;
int ret;
- ret = sdhci_wait_idle(&host->sdhci, cmd);
+ ret = sdhci_wait_idle2(&host->sdhci, cmd, data);
if (ret)
return ret;
diff --git a/drivers/mci/sdhci.c b/drivers/mci/sdhci.c
index 62e6443e64..0f7e3cc193 100644
--- a/drivers/mci/sdhci.c
+++ b/drivers/mci/sdhci.c
@@ -757,6 +757,31 @@ void sdhci_enable_clk(struct sdhci *host, u16 clk)
sdhci_write16(host, SDHCI_CLOCK_CONTROL, clk);
}
+int sdhci_wait_idle2(struct sdhci *host, struct mci_cmd *cmd, struct mci_data *data)
+{
+ u32 mask;
+ int ret;
+
+ mask = SDHCI_CMD_INHIBIT_CMD;
+
+ if (data || (cmd->resp_type & MMC_RSP_BUSY))
+ mask |= SDHCI_CMD_INHIBIT_DATA;
+
+ if (cmd && cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION)
+ mask &= ~SDHCI_CMD_INHIBIT_DATA;
+
+ ret = wait_on_timeout(10 * MSECOND,
+ !(sdhci_read32(host, SDHCI_PRESENT_STATE) & mask));
+
+ if (ret) {
+ dev_err(host->mci->hw_dev,
+ "SDHCI timeout while waiting for idle\n");
+ return -EBUSY;
+ }
+
+ return 0;
+}
+
int sdhci_wait_idle(struct sdhci *host, struct mci_cmd *cmd)
{
u32 mask;
diff --git a/drivers/mci/sdhci.h b/drivers/mci/sdhci.h
index 80916e670f..80c3f98c9c 100644
--- a/drivers/mci/sdhci.h
+++ b/drivers/mci/sdhci.h
@@ -307,6 +307,7 @@ static inline void sdhci_write8(struct sdhci *host, int reg, u32 val)
#define SDHCI_NO_DMA DMA_ERROR_CODE
int sdhci_execute_tuning(struct sdhci *sdhci, u32 opcode);
int sdhci_wait_idle(struct sdhci *host, struct mci_cmd *cmd);
+int sdhci_wait_idle2(struct sdhci *host, struct mci_cmd *cmd, struct mci_data *data);
int sdhci_wait_for_done(struct sdhci *host, u32 mask);
void sdhci_read_response(struct sdhci *host, struct mci_cmd *cmd);
void sdhci_set_cmd_xfer_mode(struct sdhci *host, struct mci_cmd *cmd,
--
2.40.1
next prev parent reply other threads:[~2024-03-08 11:19 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-08 11:16 [PATCH 00/12] mci: add HS200 support for eMMCs Steffen Trumtrar
2024-03-08 11:16 ` [PATCH 01/12] ARM: zynqmp: add sd_dll_reset call Steffen Trumtrar
2024-03-11 8:43 ` Ahmad Fatoum
2024-03-08 11:17 ` [PATCH 02/12] zynqmp: firmware: add functions to set tap delay Steffen Trumtrar
2024-03-11 8:43 ` Ahmad Fatoum
2024-03-08 11:17 ` [PATCH 03/12] mci: arasan: implement 25MHz quirk for zynqmp Steffen Trumtrar
2024-03-12 8:34 ` Ahmad Fatoum
2024-03-08 11:17 ` [PATCH 04/12] mci: arasan: read clk phases from DT Steffen Trumtrar
2024-03-11 8:16 ` Ahmad Fatoum
2024-03-11 8:44 ` Ahmad Fatoum
2024-03-08 11:17 ` [PATCH 05/12] mci: arasan: register sdcard/sampleclk Steffen Trumtrar
2024-03-11 8:14 ` Ahmad Fatoum
2024-03-08 11:17 ` [PATCH 06/12] include: mci: sync mci_timing with linux Steffen Trumtrar
2024-03-11 8:11 ` Ahmad Fatoum
2024-03-08 11:17 ` [PATCH 07/12] include: mci: add more EXT_CSD_CARD_TYPE_* Steffen Trumtrar
2024-03-11 8:17 ` Ahmad Fatoum
2024-03-08 11:17 ` [PATCH 08/12] mci: core: parse more host capabilities from DT Steffen Trumtrar
2024-03-11 8:23 ` Ahmad Fatoum
2024-03-08 11:17 ` [PATCH 09/12] mci: mci-core: add HS200 support Steffen Trumtrar
2024-03-12 8:20 ` Ahmad Fatoum
2024-03-08 11:17 ` [PATCH 10/12] mci: sdhci: add tuning support Steffen Trumtrar
2024-03-12 8:32 ` Ahmad Fatoum
2024-03-08 11:17 ` [PATCH 11/12] mci: arasan-sdhci: add HS200 tuning support on ZynqMP Steffen Trumtrar
2024-03-12 8:33 ` Ahmad Fatoum
2024-03-08 11:17 ` Steffen Trumtrar [this message]
2024-03-11 8:42 ` [PATCH 12/12] mci: arasan: use sdhci_wait_idle2 Ahmad Fatoum
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=20240308-v2024-02-0-topic-arasan-hs200-support-v1-12-6d50c90485f3@pengutronix.de \
--to=s.trumtrar@pengutronix.de \
--cc=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.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