public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Ulf Hansson <ulf.hansson@linaro.org>,
	Eric Biggers <ebiggers@google.com>,
	Raul E Rangel <rrangel@chromium.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org
Subject: [PATCH v1 3/6] mmc: sdhci: Replace bxt_get_cd() with SDHCI_QUIRK_CARD_DETECTION_IF_GPIO_HIGH
Date: Tue,  5 Oct 2021 13:24:27 +0300	[thread overview]
Message-ID: <20211005102430.63716-4-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20211005102430.63716-1-andriy.shevchenko@linux.intel.com>

The bxt_get_cd() repeats the functionality of sdhci_get_cd() when
SDHCI_QUIRK_CARD_DETECTION_IF_GPIO_HIGH is set. Thus, replace the
method with the setting of the quirk.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/mmc/host/sdhci-acpi.c     | 24 +-----------------------
 drivers/mmc/host/sdhci-pci-core.c | 24 +-----------------------
 2 files changed, 2 insertions(+), 46 deletions(-)

diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
index 8fe65f172a61..126c3afaf21b 100644
--- a/drivers/mmc/host/sdhci-acpi.c
+++ b/drivers/mmc/host/sdhci-acpi.c
@@ -359,28 +359,6 @@ static inline bool sdhci_acpi_no_fixup_child_power(struct acpi_device *adev)
 
 #endif
 
-static int bxt_get_cd(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)
-		goto out;
-
-	ret = !!(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT);
-out:
-	spin_unlock_irqrestore(&host->lock, flags);
-
-	return ret;
-}
-
 static int intel_probe_slot(struct platform_device *pdev, struct acpi_device *adev)
 {
 	struct sdhci_acpi_host *c = platform_get_drvdata(pdev);
@@ -393,7 +371,7 @@ static int intel_probe_slot(struct platform_device *pdev, struct acpi_device *ad
 		host->timeout_clk = 1000; /* 1000 kHz i.e. 1 MHz */
 
 	if (acpi_dev_hid_uid_match(adev, "80865ACA", NULL))
-		host->mmc_host_ops.get_cd = bxt_get_cd;
+		host->quirks2 |= SDHCI_QUIRK_CARD_DETECTION_IF_GPIO_HIGH;
 
 	intel_dsm_init(intel_host, &pdev->dev, host->mmc);
 
diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
index 70ab0a7a3de8..30caa0b325de 100644
--- a/drivers/mmc/host/sdhci-pci-core.c
+++ b/drivers/mmc/host/sdhci-pci-core.c
@@ -616,28 +616,6 @@ static int intel_select_drive_strength(struct mmc_card *card,
 	return intel_host->drv_strength;
 }
 
-static int bxt_get_cd(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)
-		goto out;
-
-	ret = !!(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT);
-out:
-	spin_unlock_irqrestore(&host->lock, flags);
-
-	return ret;
-}
-
 #define SDHCI_INTEL_PWR_TIMEOUT_CNT	20
 #define SDHCI_INTEL_PWR_TIMEOUT_UDELAY	100
 
@@ -1171,7 +1149,7 @@ static int byt_sd_probe_slot(struct sdhci_pci_slot *slot)
 	    slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_BXTM_SD ||
 	    slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_APL_SD ||
 	    slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_GLK_SD)
-		slot->host->mmc_host_ops.get_cd = bxt_get_cd;
+		slot->host->quirks2 |= SDHCI_QUIRK_CARD_DETECTION_IF_GPIO_HIGH;
 
 	if (slot->chip->pdev->subsystem_vendor == PCI_VENDOR_ID_NI &&
 	    slot->chip->pdev->subsystem_device == PCI_SUBDEVICE_ID_NI_78E3)
-- 
2.33.0


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

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-05 10:24 [PATCH v1 0/6] mmc: sdhci-pci: Add some CD GPIO related quirks Andy Shevchenko
2021-10-05 10:24 ` [PATCH v1 1/6] mmc: sdhci: Introduce couple of quirks to ignore particular state of CD GPIO Andy Shevchenko
2021-10-08  9:38   ` Adrian Hunter
2021-10-05 10:24 ` [PATCH v1 2/6] mmc: sdhci-pci: Read card detect from ACPI for Intel Merrifield Andy Shevchenko
2021-10-05 10:24 ` Andy Shevchenko [this message]
2021-10-05 10:24 ` [PATCH v1 4/6] mmc: sdhci-pci: Remove dead code (struct sdhci_pci_data et al) Andy Shevchenko
2021-10-08  9:42   ` Adrian Hunter
2021-10-05 10:24 ` [PATCH v1 5/6] mmc: sdhci-pci: Remove dead code (cd_gpio, cd_irq " Andy Shevchenko
2021-10-08  9:45   ` Adrian Hunter
2021-10-05 10:24 ` [PATCH v1 6/6] mmc: sdhci-pci: Remove dead code (rst_n_gpio " Andy Shevchenko
2021-10-08  9:45   ` Adrian Hunter
2021-10-07 16:42 ` [PATCH v1 0/6] mmc: sdhci-pci: Add some CD GPIO related quirks Andy Shevchenko
2021-10-07 18:03   ` Adrian Hunter
2021-10-12 20:37     ` Andy Shevchenko
2021-10-07 21:39   ` Raul Rangel
2021-10-12 20:41     ` Andy Shevchenko

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=20211005102430.63716-4-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=adrian.hunter@intel.com \
    --cc=ebiggers@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=rrangel@chromium.org \
    --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