mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Lucas Stach <l.stach@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] mci: imx-esdhc: send required clock pulses to card on init
Date: Wed, 8 Aug 2018 08:35:44 +0200	[thread overview]
Message-ID: <20180808063544.poxqd77tcskhzgaa@pengutronix.de> (raw)
In-Reply-To: <20180725095728.16369-1-l.stach@pengutronix.de>

On Wed, Jul 25, 2018 at 11:57:28AM +0200, Lucas Stach wrote:
> MMC cards need at least 74 clock pulses before any bus communication
> can occur. The i.MX SDHC controller auto-gates the clock when inactive,
> so if the SD enumeration is skipped for slots where we know that only a
> MMC card can be present (which is possible since
> b5289b742a89 "mmc: allow skipping SD card initialization") those
> inititialization clock pulses won't be sent out, resulting in command
> timeouts when trying to enumerate the card.
> 
> Luckily the eSDHC controller has a hardware feature to send out 80
> clock pulses. This has been validated to be available by checking the
> reference manual back to i.MX25.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  drivers/mci/imx-esdhc.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c
> index c4daa9d12136..db96a813971a 100644
> --- a/drivers/mci/imx-esdhc.c
> +++ b/drivers/mci/imx-esdhc.c
> @@ -455,10 +455,13 @@ static void set_sysctl(struct mci_host *mci, u32 clock)
>  	wait_on_timeout(10 * MSECOND,
>  			esdhc_read32(regs + SDHCI_PRESENT_STATE) & PRSSTAT_SDSTB);
>  
> -	clk = SYSCTL_PEREN | SYSCTL_CKEN;
> +	clk = SYSCTL_PEREN | SYSCTL_CKEN | SYSCTL_INITA;
>  
>  	esdhc_setbits32(regs + SDHCI_CLOCK_CONTROL__TIMEOUT_CONTROL__SOFTWARE_RESET,
>  			clk);
> +
> +	wait_on_timeout(1 * MSECOND,
> +			!(esdhc_read32(regs + SDHCI_CLOCK_CONTROL) & SYSCTL_INITA));
>  }
>  
>  static void esdhc_set_ios(struct mci_host *mci, struct mci_ios *ios)
> -- 
> 2.18.0
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2018-08-08  6:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-25  9:57 Lucas Stach
2018-08-08  6:35 ` Sascha Hauer [this message]

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=20180808063544.poxqd77tcskhzgaa@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=l.stach@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