[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <b13fd8b3eebc3c23b6816b254a518c224cbdcfd4.1636455548.git.hns@goldelico.com>
Date: Tue, 9 Nov 2021 11:59:06 +0100
From: "H. Nikolaus Schaller" <hns@...delico.com>
To: Ulf Hansson <ulf.hansson@...aro.org>,
Jérôme Pouiller
<jerome.pouiller@...abs.com>, Avri Altman <avri.altman@....com>,
Shawn Lin <shawn.lin@...k-chips.com>,
Linus Walleij <linus.walleij@...aro.org>,
Tony Lindgren <tony@...mide.com>,
Bean Huo <beanhuo@...ron.com>,
"H. Nikolaus Schaller" <hns@...delico.com>,
Kiwoong Kim <kwmad.kim@...sung.com>,
Tian Tao <tiantao6@...ilicon.com>,
Andreas Kemnade <andreas@...nade.info>,
Yang Li <abaci-bugfix@...ux.alibaba.com>
Cc: notasas@...il.com, linux-mmc@...r.kernel.org,
linux-kernel@...r.kernel.org, letux-kernel@...nphoenux.org,
kernel@...a-handheld.com, linux-omap@...r.kernel.org
Subject: [PATCH 3/5] mmc: core: provide macro and table to match the device tree to apply quirks
This (initially empty) table allows to match quirks early based
on .compatible of the child node of some mmc/sdio interface.
This allows to add quirks based on device tree instead of having
card specific code in the host ops.
A new macro SDIO_FIXUP_COMPATIBLE makes the definition readable.
And we call mmc_fixup_device(sdio_card_init_methods) just after
where host->ops->init_card() can be optionally called.
Signed-off-by: H. Nikolaus Schaller <hns@...delico.com>
---
drivers/mmc/core/card.h | 15 +++++++++++++++
drivers/mmc/core/quirks.h | 4 ++++
drivers/mmc/core/sdio.c | 1 +
3 files changed, 20 insertions(+)
diff --git a/drivers/mmc/core/card.h b/drivers/mmc/core/card.h
index 483e7f2f1039e..216faf5ad1021 100644
--- a/drivers/mmc/core/card.h
+++ b/drivers/mmc/core/card.h
@@ -122,6 +122,21 @@ struct mmc_fixup {
_vendor, _device, \
_fixup, _data, EXT_CSD_REV_ANY) \
+#define SDIO_FIXUP_COMPATIBLE(_compatible, _fixup, _data) \
+ { \
+ .name = CID_NAME_ANY, \
+ .manfid = CID_MANFID_ANY, \
+ .oemid = CID_OEMID_ANY, \
+ .rev_start = 0, \
+ .rev_end = -1ull, \
+ .cis_vendor = SDIO_ANY_ID, \
+ .cis_device = SDIO_ANY_ID, \
+ .vendor_fixup = (_fixup), \
+ .data = (_data), \
+ .ext_csd_rev = EXT_CSD_REV_ANY, \
+ .of_compatible = _compatible, \
+ }
+
#define cid_rev(hwrev, fwrev, year, month) \
(((u64) hwrev) << 40 | \
((u64) fwrev) << 32 | \
diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h
index 4a767f2fbaaaa..a23df65332cdf 100644
--- a/drivers/mmc/core/quirks.h
+++ b/drivers/mmc/core/quirks.h
@@ -146,6 +146,10 @@ static const struct mmc_fixup __maybe_unused sdio_fixup_methods[] = {
END_FIXUP
};
+static const struct mmc_fixup __maybe_unused sdio_card_init_methods[] = {
+ END_FIXUP
+};
+
static inline bool mmc_fixup_of_compatible_match(struct mmc_card *card,
const char *compatible)
{
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 68edf7a615be5..cf8ee66990508 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -707,6 +707,7 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
*/
if (host->ops->init_card)
host->ops->init_card(host, card);
+ mmc_fixup_device(card, sdio_card_init_methods);
/*
* If the host and card support UHS-I mode request the card
--
2.33.0
Powered by blists - more mailing lists