linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: "Ivan T. Ivanov" <ivan.ivanov@linaro.org>,
	Ulf Hansson <ulf.hansson@linaro.org>
Cc: Tim Kryger <tim.kryger@gmail.com>,
	Aisheng Dong <b29396@freescale.com>,
	linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH 1/3] mmc: sdhci: let GPIO based card detection have higher precedence
Date: Fri, 26 Jun 2015 13:19:43 +0300	[thread overview]
Message-ID: <558D273F.8020108@intel.com> (raw)
In-Reply-To: <1435312810-23957-2-git-send-email-ivan.ivanov@linaro.org>

On 26/06/15 13:00, Ivan T. Ivanov wrote:
> Controller could have BROKEN_CARD_DETECTION quirk set, but drivers
> could use GPIO to detect card present state. Let, when defined, GPIO
> take precedence, so drivers could properly detect card state and not
> use polling.
> 
> Signed-off-by: Ivan T. Ivanov <ivan.ivanov@linaro.org>
> ---
>  drivers/mmc/host/sdhci.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index bc14452..8bafb9f 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1601,15 +1601,18 @@ static int sdhci_do_get_cd(struct sdhci_host *host)
>  	if (host->flags & SDHCI_DEVICE_DEAD)
>  		return 0;
> 
> +	/*
> +	 * Try slot gpio detect, if defined it take precedence
> +	 * over build in controller functionality
> +	 */
> +	if (!IS_ERR_VALUE(gpio_cd))
> +		return !!gpio_cd;
> +

You've also put it above the MMC_CAP_NONREMOVABLE check which doesn't seem
right.

>  	/* If polling/nonremovable, assume that the card is always present. */
>  	if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) ||
>  	    (host->mmc->caps & MMC_CAP_NONREMOVABLE))
>  		return 1;
> 
> -	/* Try slot gpio detect */
> -	if (!IS_ERR_VALUE(gpio_cd))
> -		return !!gpio_cd;
> -
>  	/* Host native card detect */
>  	return !!(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT);
>  }
> --
> 1.9.1
> 
> 
> 

  reply	other threads:[~2015-06-26 10:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-26 10:00 [PATCH 0/3] mmc: sdhci: Card detection fixes Ivan T. Ivanov
2015-06-26 10:00 ` [PATCH 1/3] mmc: sdhci: let GPIO based card detection have higher precedence Ivan T. Ivanov
2015-06-26 10:19   ` Adrian Hunter [this message]
2015-06-26 11:00     ` Ivan T. Ivanov
2015-06-26 11:09       ` Adrian Hunter
2015-06-26 11:12         ` Ivan T. Ivanov
2015-06-26 10:00 ` [PATCH 2/3] mmc: sdhci: don't use card state polling when CD GPIO is defined Ivan T. Ivanov
2015-06-26 10:00 ` [PATCH 3/3] mmc: sdhci: properly check card present state when quirk NO_CARD_NO_RESET is set Ivan T. Ivanov
2015-06-26 10:31 ` [PATCH 0/3] mmc: sdhci: Card detection fixes Jaehoon Chung
2015-06-26 11:05   ` Ivan T. Ivanov

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=558D273F.8020108@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=b29396@freescale.com \
    --cc=ivan.ivanov@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=tim.kryger@gmail.com \
    --cc=ulf.hansson@linaro.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;
as well as URLs for NNTP newsgroup(s).