linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "H. Nikolaus Schaller" <hns@goldelico.com>
To: "Ulf Hansson" <ulf.hansson@linaro.org>,
	"Jérôme Pouiller" <jerome.pouiller@silabs.com>,
	"Avri Altman" <avri.altman@wdc.com>,
	"Shawn Lin" <shawn.lin@rock-chips.com>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Tony Lindgren" <tony@atomide.com>,
	"Bean Huo" <beanhuo@micron.com>
Cc: notasas@gmail.com, linux-mmc@vger.kernel.org,
	linux-kernel@vger.kernel.org, letux-kernel@openphoenux.org,
	kernel@pyra-handheld.com,
	"H. Nikolaus Schaller" <hns@goldelico.com>
Subject: [RFC v4 5/6] mmc: core: transplant ti,wl1251 quirks from to be retired omap_hsmmc
Date: Fri,  5 Nov 2021 10:05:50 +0100	[thread overview]
Message-ID: <3ca9a3099d86d631235b6c03ae260bc581cc8d60.1636103151.git.hns@goldelico.com> (raw)
In-Reply-To: <cover.1636103151.git.hns@goldelico.com>

The TiWi WL1251 WiFi chip needs special setup of the sdio
interface before it can be probed.

So far, this is done in omap_hsmmc_init_card() in omap_hsmmc.c
which makes it useable only if connected to omap devices
which use the omap_hsmmc. The OpenPandora is the most promient
example.

There are plans to switch to a newer sdhci-omap driver and
retire omap_hsmmc. Hence this quirk must be reworked or moved
somewhere else. Ideally to some location that is not dependent
on the specific SoC mmc host driver.

This is achieved by the new mmc_fixup_device() option introduced
by ("mmc: allow to match the device tree to apply quirks") to match
through device tree compatible string.

This quirk will be called early right after where host->ops->init_card()
and thus omap_hsmmc_init_card() was previously called.

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
 drivers/mmc/core/card.h   | 19 +++++++++++++++++++
 drivers/mmc/core/quirks.h |  7 +++++++
 2 files changed, 26 insertions(+)

diff --git a/drivers/mmc/core/card.h b/drivers/mmc/core/card.h
index 089ede71d3150..20c8dfd6831cf 100644
--- a/drivers/mmc/core/card.h
+++ b/drivers/mmc/core/card.h
@@ -168,6 +168,25 @@ static inline void __maybe_unused add_limit_rate_quirk(struct mmc_card *card,
 	card->quirk_max_rate = data;
 }
 
+static inline void __maybe_unused wl1251_quirk(struct mmc_card *card,
+					       int data)
+{
+	/*
+	 * We have TI wl1251 attached to this mmc. Pass this
+	 * information to the SDIO core because it can't be
+	 * probed by normal methods.
+	 */
+
+	dev_info(card->host->parent, "found wl1251\n");
+	card->quirks |= MMC_QUIRK_NONSTD_SDIO;
+	card->cccr.wide_bus = 1;
+	card->cis.vendor = 0x104c;
+	card->cis.device = 0x9066;
+	card->cis.blksize = 512;
+	card->cis.max_dtr = 24000000;
+	card->ocr = 0x80;
+}
+
 /*
  * Quirk add/remove for MMC products.
  */
diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h
index 41c418527199c..e9813f1f8b23c 100644
--- a/drivers/mmc/core/quirks.h
+++ b/drivers/mmc/core/quirks.h
@@ -146,7 +146,14 @@ static const struct mmc_fixup __maybe_unused sdio_fixup_methods[] = {
 	END_FIXUP
 };
 
+static const char *__maybe_unused wl1251_compatible_list[] = {
+	"ti,wl1251",
+	NULL
+};
+
 static const struct mmc_fixup __maybe_unused sdio_card_init_methods[] = {
+	SDIO_FIXUP_COMPATIBLE(wl1251_compatible_list, wl1251_quirk, 0),
+
 	END_FIXUP
 };
 
-- 
2.33.0


  parent reply	other threads:[~2021-11-05  9:06 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05  9:05 [RFC v4 0/6] mmc: core: extend mmc_fixup_device and transplant ti,wl1251 quirks from to be retired omap_hsmmc H. Nikolaus Schaller
2021-11-05  9:05 ` [RFC v4 1/6] mmc: core: rewrite mmc_fixup_device() H. Nikolaus Schaller
2021-11-05  9:05 ` [RFC v4 2/6] mmc: core: allow to match the device tree to apply quirks H. Nikolaus Schaller
2021-11-05 14:27   ` Jérôme Pouiller
2021-11-06 14:31     ` H. Nikolaus Schaller
2021-11-08 15:00       ` Ulf Hansson
2021-11-08 15:34         ` Jérôme Pouiller
2021-11-08 16:01           ` H. Nikolaus Schaller
2021-11-05  9:05 ` [RFC v4 3/6] mmc: core: provide macro and table " H. Nikolaus Schaller
2021-11-05  9:05 ` [RFC v4 4/6] mmc: core: add new calls to mmc_fixup_device(sdio_card_init_methods) H. Nikolaus Schaller
2021-11-08 15:08   ` Ulf Hansson
2021-11-08 16:07     ` H. Nikolaus Schaller
2021-11-08 15:39   ` Jérôme Pouiller
2021-11-08 16:04     ` H. Nikolaus Schaller
2021-11-05  9:05 ` H. Nikolaus Schaller [this message]
2021-11-08 15:33   ` [RFC v4 5/6] mmc: core: transplant ti,wl1251 quirks from to be retired omap_hsmmc Ulf Hansson
2021-11-08 16:08     ` H. Nikolaus Schaller
2021-11-09 10:58     ` H. Nikolaus Schaller
2021-11-09 20:01       ` Ulf Hansson
2021-11-10 16:36         ` H. Nikolaus Schaller
2021-11-10 17:03           ` Ulf Hansson
2021-11-10 17:09             ` H. Nikolaus Schaller
2021-11-05  9:05 ` [RFC v4 6/6] mmc: host: omap_hsmmc: revert special init for wl1251 H. Nikolaus Schaller

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=3ca9a3099d86d631235b6c03ae260bc581cc8d60.1636103151.git.hns@goldelico.com \
    --to=hns@goldelico.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=jerome.pouiller@silabs.com \
    --cc=kernel@pyra-handheld.com \
    --cc=letux-kernel@openphoenux.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=notasas@gmail.com \
    --cc=shawn.lin@rock-chips.com \
    --cc=tony@atomide.com \
    --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).