public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/4] mmc: fsl_esdhc: Implement card-detect hook.
Date: Mon, 05 Dec 2011 11:47:48 +0100	[thread overview]
Message-ID: <4EDCA154.5070000@denx.de> (raw)
In-Reply-To: <1323073424-16656-3-git-send-email-thierry.reding@avionic-design.de>

On 05/12/2011 09:23, Thierry Reding wrote:
> This card-detect hook probably doesn't work. Perhaps somebody with more
> knowledge about the hardware can comment on this. I think that perhaps
> even the complete code from esdhc_init() could go into the getcd()

The reason was only that the SDHC controller returns (up now) if the car
is inserted or not. However, there is no hardware related reason to make
this function called by the esdhc_init().

> function instead or mmc_getcd() needs to be called at some later time
> after mmc_init(), which, however, would require many other drivers to
> change.
> 
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> ---
>  drivers/mmc/fsl_esdhc.c |   29 ++++++++++++-----------------
>  1 files changed, 12 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
> index f719afd..b46bf9f 100644
> --- a/drivers/mmc/fsl_esdhc.c
> +++ b/drivers/mmc/fsl_esdhc.c
> @@ -412,7 +412,6 @@ static int esdhc_init(struct mmc *mmc)
>  	struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
>  	struct fsl_esdhc *regs = (struct fsl_esdhc *)cfg->esdhc_base;
>  	int timeout = 1000;
> -	int ret = 0;
>  
>  	/* Reset the entire host controller */
>  	esdhc_write32(&regs->sysctl, SYSCTL_RSTA);
> @@ -439,24 +438,19 @@ static int esdhc_init(struct mmc *mmc)
>  	/* Set timout to the maximum value */
>  	esdhc_clrsetbits32(&regs->sysctl, SYSCTL_TIMEOUT_MASK, 14 << 16);
>  
> -	/* Check if there is a callback for detecting the card */
> -	ret = board_mmc_getcd(mmc);
> -	if (ret < 0) {
> -		timeout = 1000;
> -		while (!(esdhc_read32(&regs->prsstat) & PRSSTAT_CINS) &&
> -				--timeout)
> -			udelay(1000);
> +	return 0;
> +}

This is wrong, we have on fsl_esdhc.c at least two cases:
- the Card Detect is executed directly by the controller reading the
prsstat register - this happens for most (or all) PowerPC SOC haveing a
ESDHC controller.

- The Card Detect is done via GPIOs, as most of MX5 boards are doing
now, and as you implemented for Tegra (next patch).

You drop the way via GPIOs, breaking several boards.

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

  reply	other threads:[~2011-12-05 10:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-05  8:23 [U-Boot] [PATCH 1/4] mmc: Change board_mmc_getcd() signature Thierry Reding
2011-12-05  8:23 ` [U-Boot] [PATCH 2/4] mmc: Implement card detection Thierry Reding
2011-12-05  8:23 ` [U-Boot] [PATCH 3/4] mmc: fsl_esdhc: Implement card-detect hook Thierry Reding
2011-12-05 10:47   ` Stefano Babic [this message]
2011-12-05 12:49     ` Thierry Reding
2011-12-05  8:23 ` [U-Boot] [PATCH 4/4] mmc: tegra2: " Thierry Reding
2011-12-05  9:53 ` [U-Boot] [PATCH 1/4] mmc: Change board_mmc_getcd() signature Marek Vasut
2011-12-05 10:00   ` Thierry Reding
2011-12-05 10:54     ` Stefano Babic
2011-12-05 11:02       ` Marek Vasut
2011-12-05 10:40 ` Stefano Babic
2011-12-05 12:53   ` Thierry Reding

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=4EDCA154.5070000@denx.de \
    --to=sbabic@denx.de \
    --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