linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Adrian Hunter <adrian.hunter@intel.com>,
	Ulf Hansson <ulf.hansson@linaro.org>
Cc: Hans de Goede <hdegoede@redhat.com>,
	"russianneuromancer @ ya . ru" <russianneuromancer@ya.ru>,
	linux-mmc@vger.kernel.org
Subject: [PATCH 2/2] mmc: sdhci-acpi: Disable write protect detection on Acer Aspire Switch 10 (SW5-012)
Date: Wed,  8 Jan 2020 10:39:03 +0100	[thread overview]
Message-ID: <20200108093903.57620-3-hdegoede@redhat.com> (raw)
In-Reply-To: <20200108093903.57620-1-hdegoede@redhat.com>

On the Acer Aspire Switch 10 (SW5-012) microSD slot always reports the card
being write-protected even though microSD cards do not have a write-protect
switch at all.

Add a new SDHCI_ACPI_QUIRK_SD_NO_WRITE_PROTECT quirk which when set sets
the MMC_CAP2_NO_WRITE_PROTECT flag on the controller for the external SD
slot, and add a DMI quirk which enables this new quirk by default on the
Acer SW5-012.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/mmc/host/sdhci-acpi.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
index 9f150c73e958..69485d29b6bc 100644
--- a/drivers/mmc/host/sdhci-acpi.c
+++ b/drivers/mmc/host/sdhci-acpi.c
@@ -78,6 +78,7 @@ struct sdhci_acpi_host {
 
 enum {
 	SDHCI_ACPI_QUIRK_SD_NO_1_8V			= BIT(0),
+	SDHCI_ACPI_QUIRK_SD_NO_WRITE_PROTECT		= BIT(1),
 };
 
 static int quirks = -1;
@@ -671,6 +672,18 @@ static const struct dmi_system_id sdhci_acpi_quirks[] = {
 		},
 		.driver_data = (void *)SDHCI_ACPI_QUIRK_SD_NO_1_8V,
 	},
+	{
+		/*
+		 * The Acer Aspire Switch 10 (SW5-012) microSD slot always
+		 * reports the card being write-protected even though microSD
+		 * cards do not have a write-protect switch at all.
+		 */
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW5-012"),
+		},
+		.driver_data = (void *)SDHCI_ACPI_QUIRK_SD_NO_WRITE_PROTECT,
+	},
 	{} /* Terminating entry */
 };
 
@@ -798,6 +811,9 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
 
 		if (quirks & SDHCI_ACPI_QUIRK_SD_NO_1_8V)
 			host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
+
+		if (quirks & SDHCI_ACPI_QUIRK_SD_NO_WRITE_PROTECT)
+			host->mmc->caps2 |= MMC_CAP2_NO_WRITE_PROTECT;
 	}
 
 	err = sdhci_setup_host(host);
-- 
2.24.1


  parent reply	other threads:[~2020-01-08  9:39 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-08  9:39 [PATCH 0/2] mmc: sdhci-acpi: Introduce device specific quirks, fix issues on 2 device models Hans de Goede
2020-01-08  9:39 ` [PATCH 1/2] mmc: sdhci-acpi: Disable 1.8V modes on external microSD on Lenovo Miix 320 Hans de Goede
2020-01-15 12:57   ` Adrian Hunter
2020-01-15 13:31     ` Hans de Goede
2020-01-15 13:48       ` Adrian Hunter
2020-01-15 15:31         ` Hans de Goede
2020-01-16  7:59           ` Adrian Hunter
2020-01-16 11:05             ` [FSL P5020 P5040 PPC] Onboard SD card doesn't work anymore after the 'mmc-v5.4-2' updates Christian Zigotzky
2020-01-16 15:46               ` Ulf Hansson
2020-01-20  9:17                 ` Christian Zigotzky
2020-01-20 11:18                   ` Ulf Hansson
2020-01-24 11:42                 ` Michael Ellerman
2020-01-25 13:26                   ` Christian Zigotzky
2020-01-28 11:55                     ` Michael Ellerman
2020-01-28  7:58                   ` [PASEMI PA6T PPC] Onboard CF card device with new SanDisk High (>8G) CF cards Christian Zigotzky
2020-01-28  8:08                     ` Christoph Hellwig
2020-01-28 14:16                     ` Rob Herring
2020-01-28 14:48                       ` Christian Zigotzky
2020-01-16 13:26             ` [PATCH 1/2] mmc: sdhci-acpi: Disable 1.8V modes on external microSD on Lenovo Miix 320 Hans de Goede
2020-01-17  9:16               ` Adrian Hunter
2020-03-06 14:07                 ` Hans de Goede
2020-03-06 14:10         ` Hans de Goede
2020-01-08  9:39 ` Hans de Goede [this message]
2020-01-15 12:51 ` [PATCH 0/2] mmc: sdhci-acpi: Introduce device specific quirks, fix issues on 2 device models 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=20200108093903.57620-3-hdegoede@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=russianneuromancer@ya.ru \
    --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).