[PATCH v9 01/24] mmc: sdio: add SDIO IDs for Silabs WF200 chip

Jerome Pouiller
2022-01-11T17:14:57Z

From: Jérôme Pouiller <jerome.pouiller@silabs.com>

Note that the values used by Silabs are uncommon. A driver cannot fully
rely on the SDIO PnP. It should also check if the device is declared in
the DT.

So, to apply the quirks necessary for the Silabs WF200, we rely on the
DT rather than on the SDIO VID/PID.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
drivers/mmc/core/quirks.h | 5 +++++
include/linux/mmc/sdio_ids.h | 7 +++++++
2 files changed, 12 insertions(+)

diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h
index 20f568727277..f879dc63d936 100644
--- a/drivers/mmc/core/quirks.h
+++ b/drivers/mmc/core/quirks.h
@@ -149,6 +149,11 @@ static const struct mmc_fixup __maybe_unused sdio_fixup_methods[] = {
static const struct mmc_fixup __maybe_unused sdio_card_init_methods[] = {
SDIO_FIXUP_COMPATIBLE("ti,wl1251", wl1251_quirk, 0),

+ SDIO_FIXUP_COMPATIBLE("silabs,wf200", add_quirk,
+ MMC_QUIRK_BROKEN_BYTE_MODE_512 |
+ MMC_QUIRK_LENIENT_FN0 |
+ MMC_QUIRK_BLKSZ_FOR_BYTE_MODE),
+
END_FIXUP
};

diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h
index a85c9f0bd470..483692f3002a 100644
--- a/include/linux/mmc/sdio_ids.h
+++ b/include/linux/mmc/sdio_ids.h
@@ -25,6 +25,13 @@
* Vendors and devices. Sort key: vendor first, device next.
*/

+/*
+ * Silabs does not use a reliable vendor ID. To avoid conflicts, the driver
+ * won't probe the device if it is not also declared in the DT.
+ */
+#define SDIO_VENDOR_ID_SILABS 0x0000
+#define SDIO_DEVICE_ID_SILABS_WF200 0x1000
+
#define SDIO_VENDOR_ID_STE 0x0020
#define SDIO_DEVICE_ID_STE_CW1200 0x2280

--
2.34.1