All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: "Ivan T. Ivanov" <ivan.ivanov@linaro.org>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
	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 14:09:35 +0300	[thread overview]
Message-ID: <558D32EF.8020708@intel.com> (raw)
In-Reply-To: <1435316413.32171.4.camel@linaro.org>

On 26/06/15 14:00, Ivan T. Ivanov wrote:
> 
> On Fri, 2015-06-26 at 13:19 +0300, Adrian Hunter wrote:
>> 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 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.
>>
> 
> Probably, but what are the chances that this is valid GIO for non-removable cards.
> I could rework it if you insist.

It is nicer not to have to think "what are the chances", and nicer that the
logic is strictly correct, so yes please.

> 
> Thank you,
> Ivan
> 
>>>         /* 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 11:09 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
2015-06-26 11:00     ` Ivan T. Ivanov
2015-06-26 11:09       ` Adrian Hunter [this message]
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=558D32EF.8020708@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.