mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH] mci: sdhci: Add and use common sdhci_wait_for_done()
Date: Tue, 28 Mar 2023 11:58:59 +0200	[thread overview]
Message-ID: <20230328095859.GK19113@pengutronix.de> (raw)
In-Reply-To: <4a513c3345155039e8dec995e1294f4dcc3e30a5.camel@pengutronix.de>

On Mon, Mar 27, 2023 at 03:01:31PM +0200, Rouven Czerwinski wrote:
> Hi,
> 
> On Tue, 2023-03-21 at 10:50 +0100, Sascha Hauer wrote:
> > We have different driver specific variants of functions polling for the
> > device ready in the tree. Add a common sdhci_wait_for_done() and use
> > it where appropriate. This fixes a few deficiencies with the driver
> > specific variants.
> > 
> > rk_sdhci_wait_for_done() didn't check the SDHCI_INT_TIMEOUT bit and
> > returned -EPERM instead when it ought to return -ETIMEDOUT. The core
> > tries to detect a SD card first and expects a -ETIMEDOUT for the setup
> > command when really a eMMC is connected. Only with a -ETIMEDOUT the core
> > tries to detect a eMMC next.
> > 
> > at91_sdhci_wait_for_done() returned the status instead of the expected
> > 0 value for success.
> 
> I had to revert this commit to run barebox_update on the CM3 RK3566.
> Otherwise writes to the boot partition would hang indefinitely.

Same here. The following fixes this.

At some point during MMC initialization we probe for a SDIO card. This
is expected to fail for non SDIO cards and we have to call sdhci_reset()
in the error path then. It's a bit weird that the effect is that
everything apparently works but writing to boot partitions does not.

Sascha

---------------------------8<---------------------------

>From db92d5c12080c0ad108bd1d8bb0481584a36ae4b Mon Sep 17 00:00:00 2001
From: Sascha Hauer <s.hauer@pengutronix.de>
Date: Tue, 28 Mar 2023 11:43:35 +0200
Subject: [PATCH] fixup! mci: sdhci: Add and use common sdhci_wait_for_done()

---
 drivers/mci/rockchip-dwcmshc-sdhci.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mci/rockchip-dwcmshc-sdhci.c b/drivers/mci/rockchip-dwcmshc-sdhci.c
index e055a8ea71..a98600cc4c 100644
--- a/drivers/mci/rockchip-dwcmshc-sdhci.c
+++ b/drivers/mci/rockchip-dwcmshc-sdhci.c
@@ -263,10 +263,8 @@ static int rk_sdhci_send_cmd(struct mci_host *mci, struct mci_cmd *cmd,
 	sdhci_write16(&host->sdhci, SDHCI_COMMAND, command);
 
 	ret = sdhci_wait_for_done(&host->sdhci, SDHCI_INT_CMD_COMPLETE);
-	if (ret == -EPERM)
+	if (ret)
 		goto error;
-	else if (ret)
-		return ret;
 
 	sdhci_read_response(&host->sdhci, cmd);
 	sdhci_write32(&host->sdhci, SDHCI_INT_STATUS, SDHCI_INT_CMD_COMPLETE);
-- 
2.39.2

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



  reply	other threads:[~2023-03-28 10:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-21  9:50 Sascha Hauer
2023-03-27 13:01 ` Rouven Czerwinski
2023-03-28  9:58   ` Sascha Hauer [this message]
2023-03-28 12:33     ` Rouven Czerwinski

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=20230328095859.GK19113@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=r.czerwinski@pengutronix.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