linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Eric Biggers <ebiggers@google.com>,
	Raul E Rangel <rrangel@chromium.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-mmc <linux-mmc@vger.kernel.org>
Subject: Re: [PATCH v2 1/6] mmc: sdhci-pci: Read card detect from ACPI for Intel Merrifield
Date: Thu, 14 Oct 2021 13:23:44 +0200	[thread overview]
Message-ID: <CAPDyKFrGv1OhnXhzq9KmjktcfLwuD=k8BU+aYqbJHCOiv-a5PA@mail.gmail.com> (raw)
In-Reply-To: <20211013201723.52212-2-andriy.shevchenko@linux.intel.com>

On Wed, 13 Oct 2021 at 22:17, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> Intel Merrifield platform had been converted to use ACPI enumeration.
> However, the driver missed an update to retrieve card detect GPIO.
> Fix it here.
>
> Unfortunately we can't rely on CD GPIO state because there are two
> different PCB designs in the wild that are using the opposite card
> detection sense and there is no way to distinguish those platforms,
> that's why ignore CD GPIO completely and use it only as an event.
>
> Fixes: 4590d98f5a4f ("sfi: Remove framework for deprecated firmware")
> BugLink: https://github.com/edison-fw/meta-intel-edison/issues/135
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Applied for fixes and by adding a stable tag, thanks!

Note that, I am expecting yet another version of the remaining patches
in the series, allowing you to address the final comments from Adrian.

Kind regards
Uffe

> ---
>  drivers/mmc/host/sdhci-pci-core.c | 29 ++++++++++++++++++++++++-----
>  1 file changed, 24 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
> index be19785227fe..d0f2edfe296c 100644
> --- a/drivers/mmc/host/sdhci-pci-core.c
> +++ b/drivers/mmc/host/sdhci-pci-core.c
> @@ -616,16 +616,12 @@ static int intel_select_drive_strength(struct mmc_card *card,
>         return intel_host->drv_strength;
>  }
>
> -static int bxt_get_cd(struct mmc_host *mmc)
> +static int sdhci_get_cd_nogpio(struct mmc_host *mmc)
>  {
> -       int gpio_cd = mmc_gpio_get_cd(mmc);
>         struct sdhci_host *host = mmc_priv(mmc);
>         unsigned long flags;
>         int ret = 0;
>
> -       if (!gpio_cd)
> -               return 0;
> -
>         spin_lock_irqsave(&host->lock, flags);
>
>         if (host->flags & SDHCI_DEVICE_DEAD)
> @@ -638,6 +634,21 @@ static int bxt_get_cd(struct mmc_host *mmc)
>         return ret;
>  }
>
> +static int bxt_get_cd(struct mmc_host *mmc)
> +{
> +       int gpio_cd = mmc_gpio_get_cd(mmc);
> +
> +       if (!gpio_cd)
> +               return 0;
> +
> +       return sdhci_get_cd_nogpio(mmc);
> +}
> +
> +static int mrfld_get_cd(struct mmc_host *mmc)
> +{
> +       return sdhci_get_cd_nogpio(mmc);
> +}
> +
>  #define SDHCI_INTEL_PWR_TIMEOUT_CNT    20
>  #define SDHCI_INTEL_PWR_TIMEOUT_UDELAY 100
>
> @@ -1341,6 +1352,14 @@ static int intel_mrfld_mmc_probe_slot(struct sdhci_pci_slot *slot)
>                                          MMC_CAP_1_8V_DDR;
>                 break;
>         case INTEL_MRFLD_SD:
> +               slot->cd_idx = 0;
> +               slot->cd_override_level = true;
> +               /*
> +                * There are two PCB designs of SD card slot with the opposite
> +                * card detection sense. Quirk this out by ignoring GPIO state
> +                * completely in the custom ->get_cd() callback.
> +                */
> +               slot->host->mmc_host_ops.get_cd = mrfld_get_cd;
>                 slot->host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
>                 break;
>         case INTEL_MRFLD_SDIO:
> --
> 2.33.0
>

  parent reply	other threads:[~2021-10-14 11:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-13 20:17 [PATCH v2 0/6] mmc: sdhci-pci: Add some CD GPIO related quirks Andy Shevchenko
2021-10-13 20:17 ` [PATCH v2 1/6] mmc: sdhci-pci: Read card detect from ACPI for Intel Merrifield Andy Shevchenko
2021-10-14  9:54   ` Adrian Hunter
2021-10-14 11:23   ` Ulf Hansson [this message]
2021-10-13 20:17 ` [PATCH v2 2/6] mmc: sdhci: Deduplicate sdhci_get_cd_nogpio() Andy Shevchenko
2021-10-14  9:58   ` Adrian Hunter
2021-10-13 20:17 ` [PATCH v2 3/6] mmc: sdhci: Remove unused prototype declaration in the header Andy Shevchenko
2021-10-14  9:59   ` Adrian Hunter
2021-10-13 20:17 ` [PATCH v2 4/6] mmc: sdhci-pci: Remove dead code (struct sdhci_pci_data et al) Andy Shevchenko
2021-10-14 10:01   ` Adrian Hunter
2021-10-13 20:17 ` [PATCH v2 5/6] mmc: sdhci-pci: Remove dead code (cd_gpio, cd_irq " Andy Shevchenko
2021-10-14 10:02   ` Adrian Hunter
2021-10-13 20:17 ` [PATCH v2 6/6] mmc: sdhci-pci: Remove dead code (rst_n_gpio " Andy Shevchenko
2021-10-14 10:04   ` Adrian Hunter

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='CAPDyKFrGv1OhnXhzq9KmjktcfLwuD=k8BU+aYqbJHCOiv-a5PA@mail.gmail.com' \
    --to=ulf.hansson@linaro.org \
    --cc=adrian.hunter@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=ebiggers@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=rrangel@chromium.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).