All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC v3 0/6] mmc: core: extend mmc_fixup_device and transplant ti,wl1251 quirks from to be retired omap_hsmmc
@ 2021-11-03 13:00 H. Nikolaus Schaller
  2021-11-03 13:00 ` [RFC v3 1/6] mmc: core: rewrite mmc_fixup_device() H. Nikolaus Schaller
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: H. Nikolaus Schaller @ 2021-11-03 13:00 UTC (permalink / raw)
  To: Ulf Hansson, Jérôme Pouiller, Avri Altman, Shawn Lin,
	Linus Walleij, Tony Lindgren, Bean Huo
  Cc: notasas, linux-mmc, linux-kernel, letux-kernel, kernel,
	H. Nikolaus Schaller

RFC V3 2021-11-03 14:00:13:
* patches have been split into smaller ones a little further
* propose a new macro for setup of device tree compatible quirks
* directly include patches by jerome.pouiller@silabs.com
  in this series

RFC V2 2021-11-01 10:24:26:
* reworked to not misuse mmc_select_card() but add a call to
  mmc_fixup_device() right after where host->ops->init_card
  was called before to apply the wl1251 specific quirks.
  Device tree matching is done by a new table passed to mmc_fixup_device().
  suggested by: ulf.hansson@linaro.org
  based on patches by: jerome.pouiller@silabs.com

RFC V1 2021-10-06 13:24:13:


H. Nikolaus Schaller (4):
  mmc: core: provide macro and table to match the device tree to apply
    quirks
  mmc: core: add new calls to mmc_fixup_device(sdio_card_init_methods)
  mmc: core: transplant ti,wl1251 quirks from to be retired omap_hsmmc
  mmc: host: omap_hsmmc: revert special init for wl1251

Jérôme Pouiller (2):
  mmc: core: rewrite mmc_fixup_device()
  mmc: core: allow to match the device tree to apply quirks

 drivers/mmc/core/card.h       | 37 ++++++++++++++++++
 drivers/mmc/core/mmc.c        |  1 +
 drivers/mmc/core/quirks.h     | 70 ++++++++++++++++++++++++++---------
 drivers/mmc/core/sd.c         |  2 +
 drivers/mmc/core/sdio.c       |  1 +
 drivers/mmc/host/omap_hsmmc.c | 36 ------------------
 6 files changed, 94 insertions(+), 53 deletions(-)

-- 
2.33.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [RFC v3 1/6] mmc: core: rewrite mmc_fixup_device()
  2021-11-03 13:00 [RFC v3 0/6] mmc: core: extend mmc_fixup_device and transplant ti,wl1251 quirks from to be retired omap_hsmmc H. Nikolaus Schaller
@ 2021-11-03 13:00 ` H. Nikolaus Schaller
  2021-11-09 11:15   ` Linus Walleij
  2021-11-03 13:00 ` [RFC v3 2/6] mmc: core: allow to match the device tree to apply quirks H. Nikolaus Schaller
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: H. Nikolaus Schaller @ 2021-11-03 13:00 UTC (permalink / raw)
  To: Ulf Hansson, Jérôme Pouiller, Avri Altman, Shawn Lin,
	Linus Walleij, Tony Lindgren, Bean Huo
  Cc: notasas, linux-mmc, linux-kernel, letux-kernel, kernel

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

Currently, mmc_fixup_device() is a bit difficult to read because of
particularly long condition.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/mmc/core/quirks.h | 41 +++++++++++++++++++++++----------------
 1 file changed, 24 insertions(+), 17 deletions(-)

diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h
index d68e6e513a4f4..c7ef2d14b359f 100644
--- a/drivers/mmc/core/quirks.h
+++ b/drivers/mmc/core/quirks.h
@@ -152,22 +152,29 @@ static inline void mmc_fixup_device(struct mmc_card *card,
 	u64 rev = cid_rev_card(card);
 
 	for (f = table; f->vendor_fixup; f++) {
-		if ((f->manfid == CID_MANFID_ANY ||
-		     f->manfid == card->cid.manfid) &&
-		    (f->oemid == CID_OEMID_ANY ||
-		     f->oemid == card->cid.oemid) &&
-		    (f->name == CID_NAME_ANY ||
-		     !strncmp(f->name, card->cid.prod_name,
-			      sizeof(card->cid.prod_name))) &&
-		    (f->cis_vendor == card->cis.vendor ||
-		     f->cis_vendor == (u16) SDIO_ANY_ID) &&
-		    (f->cis_device == card->cis.device ||
-		     f->cis_device == (u16) SDIO_ANY_ID) &&
-		    (f->ext_csd_rev == EXT_CSD_REV_ANY ||
-		     f->ext_csd_rev == card->ext_csd.rev) &&
-		    rev >= f->rev_start && rev <= f->rev_end) {
-			dev_dbg(&card->dev, "calling %ps\n", f->vendor_fixup);
-			f->vendor_fixup(card, f->data);
-		}
+		if (f->manfid != CID_MANFID_ANY &&
+		    f->manfid != card->cid.manfid)
+			continue;
+		if (f->oemid != CID_OEMID_ANY &&
+		    f->oemid != card->cid.oemid)
+			continue;
+		if (f->name != CID_NAME_ANY &&
+		    strncmp(f->name, card->cid.prod_name,
+			    sizeof(card->cid.prod_name)))
+			continue;
+		if (f->cis_vendor != (u16)SDIO_ANY_ID &&
+		    f->cis_vendor != card->cis.vendor)
+			continue;
+		if (f->cis_device != (u16)SDIO_ANY_ID &&
+		    f->cis_device != card->cis.device)
+			continue;
+		if (f->ext_csd_rev != EXT_CSD_REV_ANY &&
+		    f->ext_csd_rev != card->ext_csd.rev)
+			continue;
+		if (rev < f->rev_start || rev > f->rev_end)
+			continue;
+
+		dev_dbg(&card->dev, "calling %ps\n", f->vendor_fixup);
+		f->vendor_fixup(card, f->data);
 	}
 }
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [RFC v3 2/6] mmc: core: allow to match the device tree to apply quirks
  2021-11-03 13:00 [RFC v3 0/6] mmc: core: extend mmc_fixup_device and transplant ti,wl1251 quirks from to be retired omap_hsmmc H. Nikolaus Schaller
  2021-11-03 13:00 ` [RFC v3 1/6] mmc: core: rewrite mmc_fixup_device() H. Nikolaus Schaller
@ 2021-11-03 13:00 ` H. Nikolaus Schaller
  2021-11-03 13:24   ` Jérôme Pouiller
                     ` (2 more replies)
  2021-11-03 13:00 ` [RFC v3 3/6] mmc: core: provide macro and table " H. Nikolaus Schaller
                   ` (3 subsequent siblings)
  5 siblings, 3 replies; 16+ messages in thread
From: H. Nikolaus Schaller @ 2021-11-03 13:00 UTC (permalink / raw)
  To: Ulf Hansson, Jérôme Pouiller, Avri Altman, Shawn Lin,
	Linus Walleij, Tony Lindgren, Bean Huo
  Cc: notasas, linux-mmc, linux-kernel, letux-kernel, kernel

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

MMC subsystem provides a way to apply quirks when a device match some
properties (VID, PID, etc...) Unfortunately, some SDIO devices does not
comply with the SDIO specification and does not provide reliable VID/PID
(eg. Silabs WF200).

So, the drivers for these devices rely on device tree to identify the
device.

This patch allows the MMC to also rely on the device tree to apply a
quirk.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/mmc/core/card.h   |  3 +++
 drivers/mmc/core/quirks.h | 18 ++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/drivers/mmc/core/card.h b/drivers/mmc/core/card.h
index 7bd392d55cfa5..2f73f8567e14f 100644
--- a/drivers/mmc/core/card.h
+++ b/drivers/mmc/core/card.h
@@ -59,6 +59,9 @@ struct mmc_fixup {
 	/* for MMC cards */
 	unsigned int ext_csd_rev;
 
+	/* Match against functions declared in device tree */
+	const char *const *of_compatible;
+
 	void (*vendor_fixup)(struct mmc_card *card, int data);
 	int data;
 };
diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h
index c7ef2d14b359f..a8b82b34dcfd2 100644
--- a/drivers/mmc/core/quirks.h
+++ b/drivers/mmc/core/quirks.h
@@ -10,6 +10,7 @@
  *
  */
 
+#include <linux/of.h>
 #include <linux/mmc/sdio_ids.h>
 
 #include "card.h"
@@ -145,6 +146,20 @@ static const struct mmc_fixup __maybe_unused sdio_fixup_methods[] = {
 	END_FIXUP
 };
 
+static inline bool mmc_fixup_of_compatible_match(struct mmc_card *card,
+						 const char *const *compat_list)
+{
+	struct device_node *of_node;
+	int i;
+
+	for (i = 0; i < 7; i++) {
+		of_node = mmc_of_find_child_device(card->host, i);
+		if (of_node && of_device_compatible_match(of_node, compat_list))
+			return true;
+	}
+	return false;
+}
+
 static inline void mmc_fixup_device(struct mmc_card *card,
 				    const struct mmc_fixup *table)
 {
@@ -173,6 +188,9 @@ static inline void mmc_fixup_device(struct mmc_card *card,
 			continue;
 		if (rev < f->rev_start || rev > f->rev_end)
 			continue;
+		if (f->of_compatible &&
+		    !mmc_fixup_of_compatible_match(card, f->of_compatible))
+			continue;
 
 		dev_dbg(&card->dev, "calling %ps\n", f->vendor_fixup);
 		f->vendor_fixup(card, f->data);
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [RFC v3 3/6] mmc: core: provide macro and table to match the device tree to apply quirks
  2021-11-03 13:00 [RFC v3 0/6] mmc: core: extend mmc_fixup_device and transplant ti,wl1251 quirks from to be retired omap_hsmmc H. Nikolaus Schaller
  2021-11-03 13:00 ` [RFC v3 1/6] mmc: core: rewrite mmc_fixup_device() H. Nikolaus Schaller
  2021-11-03 13:00 ` [RFC v3 2/6] mmc: core: allow to match the device tree to apply quirks H. Nikolaus Schaller
@ 2021-11-03 13:00 ` H. Nikolaus Schaller
  2021-11-09 11:17   ` Linus Walleij
  2021-11-03 13:00 ` [RFC v3 4/6] mmc: core: add new calls to mmc_fixup_device(sdio_card_init_methods) H. Nikolaus Schaller
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: H. Nikolaus Schaller @ 2021-11-03 13:00 UTC (permalink / raw)
  To: Ulf Hansson, Jérôme Pouiller, Avri Altman, Shawn Lin,
	Linus Walleij, Tony Lindgren, Bean Huo
  Cc: notasas, linux-mmc, linux-kernel, letux-kernel, kernel,
	H. Nikolaus Schaller

This (initially empty) table allows to match quirks early based
on .compatible of the child node of some mmc/sdio interface.

A new macro SDIO_FIXUP_COMPATIBLE makes the definition readable.

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

diff --git a/drivers/mmc/core/card.h b/drivers/mmc/core/card.h
index 2f73f8567e14f..c7a61e74c02ea 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_list, _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_list,\
+	}
+
 #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 a8b82b34dcfd2..619504b78bf46 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 *const *compat_list)
 {
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [RFC v3 4/6] mmc: core: add new calls to mmc_fixup_device(sdio_card_init_methods)
  2021-11-03 13:00 [RFC v3 0/6] mmc: core: extend mmc_fixup_device and transplant ti,wl1251 quirks from to be retired omap_hsmmc H. Nikolaus Schaller
                   ` (2 preceding siblings ...)
  2021-11-03 13:00 ` [RFC v3 3/6] mmc: core: provide macro and table " H. Nikolaus Schaller
@ 2021-11-03 13:00 ` H. Nikolaus Schaller
  2021-11-09 11:18   ` Linus Walleij
  2021-11-03 13:00 ` [RFC v3 5/6] mmc: core: transplant ti,wl1251 quirks from to be retired omap_hsmmc H. Nikolaus Schaller
  2021-11-03 13:00 ` [RFC v3 6/6] mmc: host: omap_hsmmc: revert special init for wl1251 H. Nikolaus Schaller
  5 siblings, 1 reply; 16+ messages in thread
From: H. Nikolaus Schaller @ 2021-11-03 13:00 UTC (permalink / raw)
  To: Ulf Hansson, Jérôme Pouiller, Avri Altman, Shawn Lin,
	Linus Walleij, Tony Lindgren, Bean Huo
  Cc: notasas, linux-mmc, linux-kernel, letux-kernel, kernel,
	H. Nikolaus Schaller

This allows to add quirks based on device tree instead of having
card specific code in the host ops.

We call it just after where host->ops->init_card() can be optionally
called.

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
 drivers/mmc/core/mmc.c  | 1 +
 drivers/mmc/core/sd.c   | 2 ++
 drivers/mmc/core/sdio.c | 1 +
 3 files changed, 4 insertions(+)

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 29e58ffae3797..19cd138acaec9 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1634,6 +1634,7 @@ static int mmc_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);
 
 	/*
 	 * For native busses:  set card RCA and quit open drain mode.
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 4646b7a03db6b..0d174fdf47164 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -23,6 +23,7 @@
 #include "host.h"
 #include "bus.h"
 #include "mmc_ops.h"
+#include "quirks.h"
 #include "sd.h"
 #include "sd_ops.h"
 
@@ -1427,6 +1428,7 @@ static int mmc_sd_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);
 
 	/*
 	 * For native busses:  get card RCA and quit open drain mode.
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


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [RFC v3 5/6] mmc: core: transplant ti,wl1251 quirks from to be retired omap_hsmmc
  2021-11-03 13:00 [RFC v3 0/6] mmc: core: extend mmc_fixup_device and transplant ti,wl1251 quirks from to be retired omap_hsmmc H. Nikolaus Schaller
                   ` (3 preceding siblings ...)
  2021-11-03 13:00 ` [RFC v3 4/6] mmc: core: add new calls to mmc_fixup_device(sdio_card_init_methods) H. Nikolaus Schaller
@ 2021-11-03 13:00 ` H. Nikolaus Schaller
  2021-11-09 11:19   ` Linus Walleij
  2021-11-03 13:00 ` [RFC v3 6/6] mmc: host: omap_hsmmc: revert special init for wl1251 H. Nikolaus Schaller
  5 siblings, 1 reply; 16+ messages in thread
From: H. Nikolaus Schaller @ 2021-11-03 13:00 UTC (permalink / raw)
  To: Ulf Hansson, Jérôme Pouiller, Avri Altman, Shawn Lin,
	Linus Walleij, Tony Lindgren, Bean Huo
  Cc: notasas, linux-mmc, linux-kernel, letux-kernel, kernel,
	H. Nikolaus Schaller

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 c7a61e74c02ea..f4ec33a94b0b2 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 619504b78bf46..66fcd64b5bc7a 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 *const __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


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [RFC v3 6/6] mmc: host: omap_hsmmc: revert special init for wl1251
  2021-11-03 13:00 [RFC v3 0/6] mmc: core: extend mmc_fixup_device and transplant ti,wl1251 quirks from to be retired omap_hsmmc H. Nikolaus Schaller
                   ` (4 preceding siblings ...)
  2021-11-03 13:00 ` [RFC v3 5/6] mmc: core: transplant ti,wl1251 quirks from to be retired omap_hsmmc H. Nikolaus Schaller
@ 2021-11-03 13:00 ` H. Nikolaus Schaller
  2021-11-09 11:20   ` Linus Walleij
  5 siblings, 1 reply; 16+ messages in thread
From: H. Nikolaus Schaller @ 2021-11-03 13:00 UTC (permalink / raw)
  To: Ulf Hansson, Jérôme Pouiller, Avri Altman, Shawn Lin,
	Linus Walleij, Tony Lindgren, Bean Huo
  Cc: notasas, linux-mmc, linux-kernel, letux-kernel, kernel,
	H. Nikolaus Schaller

Replaces: commit f6498b922e57 ("mmc: host: omap_hsmmc: add code for special init of wl1251 to get rid of pandora_wl1251_init_card")
Requires: commit ("mmc: core: transplant ti,wl1251 quirks from to be retired omap_hsmmc")

After moving the wl1251 quirks from omap_hsmmc_init_card() to wl1251_quirk()
and sdio_card_init_methods[] we can remove omap_hsmmc_init_card() completely.

This also removes the specialization on the combination of omap_hsmmc and wl1251.

Related-to: commit f6498b922e57 ("mmc: host: omap_hsmmc: add code for special init of wl1251 to get rid of pandora_wl1251_init_card")
Related-to: commit 2398c41d6432 ("omap: pdata-quirks: remove openpandora quirks for mmc3 and wl1251")
Related-to: commit f9d50fef4b64 ("ARM: OMAP2+: omap3-pandora: add wifi support")
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
 drivers/mmc/host/omap_hsmmc.c | 36 -----------------------------------
 1 file changed, 36 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 6960e305e0a39..9749639ea8977 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1504,41 +1504,6 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 	omap_hsmmc_set_bus_mode(host);
 }
 
-static void omap_hsmmc_init_card(struct mmc_host *mmc, struct mmc_card *card)
-{
-	struct omap_hsmmc_host *host = mmc_priv(mmc);
-
-	if (card->type == MMC_TYPE_SDIO || card->type == MMC_TYPE_SD_COMBO) {
-		struct device_node *np = mmc_dev(mmc)->of_node;
-
-		/*
-		 * REVISIT: should be moved to sdio core and made more
-		 * general e.g. by expanding the DT bindings of child nodes
-		 * to provide a mechanism to provide this information:
-		 * Documentation/devicetree/bindings/mmc/mmc-card.txt
-		 */
-
-		np = of_get_compatible_child(np, "ti,wl1251");
-		if (np) {
-			/*
-			 * We have TI wl1251 attached to MMC3. Pass this
-			 * information to the SDIO core because it can't be
-			 * probed by normal methods.
-			 */
-
-			dev_info(host->dev, "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;
-			of_node_put(np);
-		}
-	}
-}
-
 static void omap_hsmmc_enable_sdio_irq(struct mmc_host *mmc, int enable)
 {
 	struct omap_hsmmc_host *host = mmc_priv(mmc);
@@ -1667,7 +1632,6 @@ static struct mmc_host_ops omap_hsmmc_ops = {
 	.set_ios = omap_hsmmc_set_ios,
 	.get_cd = mmc_gpio_get_cd,
 	.get_ro = mmc_gpio_get_ro,
-	.init_card = omap_hsmmc_init_card,
 	.enable_sdio_irq = omap_hsmmc_enable_sdio_irq,
 };
 
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [RFC v3 2/6] mmc: core: allow to match the device tree to apply quirks
  2021-11-03 13:00 ` [RFC v3 2/6] mmc: core: allow to match the device tree to apply quirks H. Nikolaus Schaller
@ 2021-11-03 13:24   ` Jérôme Pouiller
  2021-11-03 13:36     ` H. Nikolaus Schaller
  2021-11-03 17:57   ` kernel test robot
  2021-11-09 11:16   ` Linus Walleij
  2 siblings, 1 reply; 16+ messages in thread
From: Jérôme Pouiller @ 2021-11-03 13:24 UTC (permalink / raw)
  To: Ulf Hansson, Avri Altman, Shawn Lin, Linus Walleij,
	Tony Lindgren, Bean Huo, H. Nikolaus Schaller
  Cc: notasas, linux-mmc, linux-kernel, letux-kernel, kernel

Hi Nikolaus,

On Wednesday 3 November 2021 14:00:10 CET H. Nikolaus Schaller wrote:
> From: Jérôme Pouiller <jerome.pouiller@silabs.com>
> 
> MMC subsystem provides a way to apply quirks when a device match some
> properties (VID, PID, etc...) Unfortunately, some SDIO devices does not
> comply with the SDIO specification and does not provide reliable VID/PID
> (eg. Silabs WF200).
> 
> So, the drivers for these devices rely on device tree to identify the
> device.
> 
> This patch allows the MMC to also rely on the device tree to apply a
> quirk.
> 
> Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
> ---
>  drivers/mmc/core/card.h   |  3 +++
>  drivers/mmc/core/quirks.h | 18 ++++++++++++++++++
>  2 files changed, 21 insertions(+)
> 
> diff --git a/drivers/mmc/core/card.h b/drivers/mmc/core/card.h
> index 7bd392d55cfa5..2f73f8567e14f 100644
> --- a/drivers/mmc/core/card.h
> +++ b/drivers/mmc/core/card.h
> @@ -59,6 +59,9 @@ struct mmc_fixup {
>         /* for MMC cards */
>         unsigned int ext_csd_rev;
> 
> +       /* Match against functions declared in device tree */
> +       const char *const *of_compatible;
> +
>         void (*vendor_fixup)(struct mmc_card *card, int data);
>         int data;
>  };
> diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h
> index c7ef2d14b359f..a8b82b34dcfd2 100644
> --- a/drivers/mmc/core/quirks.h
> +++ b/drivers/mmc/core/quirks.h
> @@ -10,6 +10,7 @@
>   *
>   */
> 
> +#include <linux/of.h>
>  #include <linux/mmc/sdio_ids.h>
> 
>  #include "card.h"
> @@ -145,6 +146,20 @@ static const struct mmc_fixup __maybe_unused sdio_fixup_methods[] = {
>         END_FIXUP
>  };
> 
> +static inline bool mmc_fixup_of_compatible_match(struct mmc_card *card,
> +                                                const char *const *compat_list)
> +{
> +       struct device_node *of_node;
> +       int i;
> +
> +       for (i = 0; i < 7; i++) {
> +               of_node = mmc_of_find_child_device(card->host, i);
> +               if (of_node && of_device_compatible_match(of_node, compat_list))
> +                       return true;
> +       }
> +       return false;
> +}
> +
>  static inline void mmc_fixup_device(struct mmc_card *card,
>                                     const struct mmc_fixup *table)
>  {
> @@ -173,6 +188,9 @@ static inline void mmc_fixup_device(struct mmc_card *card,
>                         continue;
>                 if (rev < f->rev_start || rev > f->rev_end)
>                         continue;
> +               if (f->of_compatible &&
> +                   !mmc_fixup_of_compatible_match(card, f->of_compatible))
> +                       continue;
> 
>                 dev_dbg(&card->dev, "calling %ps\n", f->vendor_fixup);
>                 f->vendor_fixup(card, f->data);
> --
> 2.33.0
> 
> 

Thanks to take care of this. Do you know if the comments for Ulf[1]
are still relevant?

[1]: https://lore.kernel.org/lkml/CAPDyKFpr0kpRXoUACNNSwe8pL1S9wJPjnX+GFGS1PNezKCDYzQ@mail.gmail.com/

-- 
Jérôme Pouiller



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [RFC v3 2/6] mmc: core: allow to match the device tree to apply quirks
  2021-11-03 13:24   ` Jérôme Pouiller
@ 2021-11-03 13:36     ` H. Nikolaus Schaller
  0 siblings, 0 replies; 16+ messages in thread
From: H. Nikolaus Schaller @ 2021-11-03 13:36 UTC (permalink / raw)
  To: Jérôme Pouiller
  Cc: Ulf Hansson, Avri Altman, Shawn Lin, Linus Walleij,
	Tony Lindgren, Bean Huo, notasas, linux-mmc, linux-kernel,
	letux-kernel, kernel

Hi jerome,


> Am 03.11.2021 um 14:24 schrieb Jérôme Pouiller <jerome.pouiller@silabs.com>:
> 
> Hi Nikolaus,
> 
> On Wednesday 3 November 2021 14:00:10 CET H. Nikolaus Schaller wrote:
>> From: Jérôme Pouiller <jerome.pouiller@silabs.com>
>> 
>> MMC subsystem provides a way to apply quirks when a device match some
>> properties (VID, PID, etc...) Unfortunately, some SDIO devices does not
>> comply with the SDIO specification and does not provide reliable VID/PID
>> (eg. Silabs WF200).
>> 
>> So, the drivers for these devices rely on device tree to identify the
>> device.
>> 
>> This patch allows the MMC to also rely on the device tree to apply a
>> quirk.
>> 
>> Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
>> ---
>> drivers/mmc/core/card.h   |  3 +++
>> drivers/mmc/core/quirks.h | 18 ++++++++++++++++++
>> 2 files changed, 21 insertions(+)
>> 
>> diff --git a/drivers/mmc/core/card.h b/drivers/mmc/core/card.h
>> index 7bd392d55cfa5..2f73f8567e14f 100644
>> --- a/drivers/mmc/core/card.h
>> +++ b/drivers/mmc/core/card.h
>> @@ -59,6 +59,9 @@ struct mmc_fixup {
>>        /* for MMC cards */
>>        unsigned int ext_csd_rev;
>> 
>> +       /* Match against functions declared in device tree */
>> +       const char *const *of_compatible;
>> +
>>        void (*vendor_fixup)(struct mmc_card *card, int data);
>>        int data;
>> };
>> diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h
>> index c7ef2d14b359f..a8b82b34dcfd2 100644
>> --- a/drivers/mmc/core/quirks.h
>> +++ b/drivers/mmc/core/quirks.h
>> @@ -10,6 +10,7 @@
>>  *
>>  */
>> 
>> +#include <linux/of.h>
>> #include <linux/mmc/sdio_ids.h>
>> 
>> #include "card.h"
>> @@ -145,6 +146,20 @@ static const struct mmc_fixup __maybe_unused sdio_fixup_methods[] = {
>>        END_FIXUP
>> };
>> 
>> +static inline bool mmc_fixup_of_compatible_match(struct mmc_card *card,
>> +                                                const char *const *compat_list)
>> +{
>> +       struct device_node *of_node;
>> +       int i;
>> +
>> +       for (i = 0; i < 7; i++) {
>> +               of_node = mmc_of_find_child_device(card->host, i);
>> +               if (of_node && of_device_compatible_match(of_node, compat_list))
>> +                       return true;
>> +       }
>> +       return false;
>> +}
>> +
>> static inline void mmc_fixup_device(struct mmc_card *card,
>>                                    const struct mmc_fixup *table)
>> {
>> @@ -173,6 +188,9 @@ static inline void mmc_fixup_device(struct mmc_card *card,
>>                        continue;
>>                if (rev < f->rev_start || rev > f->rev_end)
>>                        continue;
>> +               if (f->of_compatible &&
>> +                   !mmc_fixup_of_compatible_match(card, f->of_compatible))
>> +                       continue;
>> 
>>                dev_dbg(&card->dev, "calling %ps\n", f->vendor_fixup);
>>                f->vendor_fixup(card, f->data);
>> --
>> 2.33.0
>> 
>> 
> 
> Thanks to take care of this. Do you know if the comments for Ulf[1]
> are still relevant?
> 
> [1]: https://lore.kernel.org/lkml/CAPDyKFpr0kpRXoUACNNSwe8pL1S9wJPjnX+GFGS1PNezKCDYzQ@mail.gmail.com/

Ah yes. I think so.

Especially the comment about doing the loop over the child nodes...

I'll make a note for v4.

BR and thanks,
Nikolaus


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [RFC v3 2/6] mmc: core: allow to match the device tree to apply quirks
  2021-11-03 13:00 ` [RFC v3 2/6] mmc: core: allow to match the device tree to apply quirks H. Nikolaus Schaller
  2021-11-03 13:24   ` Jérôme Pouiller
@ 2021-11-03 17:57   ` kernel test robot
  2021-11-09 11:16   ` Linus Walleij
  2 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2021-11-03 17:57 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1753 bytes --]

Hi Nikolaus,

[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on ulf-hansson-mmc-mirror/next]
[also build test ERROR on v5.15 next-20211103]
[cannot apply to linus/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/H-Nikolaus-Schaller/mmc-core-extend-mmc_fixup_device-and-transplant-ti-wl1251-quirks-from-to-be-retired-omap_hsmmc/20211103-210343
base:   https://git.linaro.org/people/ulf.hansson/mmc-mirror.git next
config: i386-randconfig-c001-20211103 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/e34268c772dc58fd4126815d1a0ce277b6ecc4f9
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review H-Nikolaus-Schaller/mmc-core-extend-mmc_fixup_device-and-transplant-ti-wl1251-quirks-from-to-be-retired-omap_hsmmc/20211103-210343
        git checkout e34268c772dc58fd4126815d1a0ce277b6ecc4f9
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> ERROR: modpost: "of_device_compatible_match" [drivers/mmc/core/mmc_block.ko] undefined!
>> ERROR: modpost: "mmc_of_find_child_device" [drivers/mmc/core/mmc_block.ko] undefined!

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32367 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [RFC v3 1/6] mmc: core: rewrite mmc_fixup_device()
  2021-11-03 13:00 ` [RFC v3 1/6] mmc: core: rewrite mmc_fixup_device() H. Nikolaus Schaller
@ 2021-11-09 11:15   ` Linus Walleij
  0 siblings, 0 replies; 16+ messages in thread
From: Linus Walleij @ 2021-11-09 11:15 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Ulf Hansson, Jérôme Pouiller, Avri Altman, Shawn Lin,
	Tony Lindgren, Bean Huo, notasas, linux-mmc, linux-kernel,
	letux-kernel, kernel

On Wed, Nov 3, 2021 at 2:01 PM H. Nikolaus Schaller <hns@goldelico.com> wrote:

> From: Jérôme Pouiller <jerome.pouiller@silabs.com>
>
> Currently, mmc_fixup_device() is a bit difficult to read because of
> particularly long condition.
>
> Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>

That's more readable!
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [RFC v3 2/6] mmc: core: allow to match the device tree to apply quirks
  2021-11-03 13:00 ` [RFC v3 2/6] mmc: core: allow to match the device tree to apply quirks H. Nikolaus Schaller
  2021-11-03 13:24   ` Jérôme Pouiller
  2021-11-03 17:57   ` kernel test robot
@ 2021-11-09 11:16   ` Linus Walleij
  2 siblings, 0 replies; 16+ messages in thread
From: Linus Walleij @ 2021-11-09 11:16 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Ulf Hansson, Jérôme Pouiller, Avri Altman, Shawn Lin,
	Tony Lindgren, Bean Huo, notasas, linux-mmc, linux-kernel,
	letux-kernel, kernel

On Wed, Nov 3, 2021 at 2:01 PM H. Nikolaus Schaller <hns@goldelico.com> wrote:

> From: Jérôme Pouiller <jerome.pouiller@silabs.com>
>
> MMC subsystem provides a way to apply quirks when a device match some
> properties (VID, PID, etc...) Unfortunately, some SDIO devices does not
> comply with the SDIO specification and does not provide reliable VID/PID
> (eg. Silabs WF200).
>
> So, the drivers for these devices rely on device tree to identify the
> device.
>
> This patch allows the MMC to also rely on the device tree to apply a
> quirk.
>
> Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>

Looks like the right solution.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [RFC v3 3/6] mmc: core: provide macro and table to match the device tree to apply quirks
  2021-11-03 13:00 ` [RFC v3 3/6] mmc: core: provide macro and table " H. Nikolaus Schaller
@ 2021-11-09 11:17   ` Linus Walleij
  0 siblings, 0 replies; 16+ messages in thread
From: Linus Walleij @ 2021-11-09 11:17 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Ulf Hansson, Jérôme Pouiller, Avri Altman, Shawn Lin,
	Tony Lindgren, Bean Huo, notasas, linux-mmc, linux-kernel,
	letux-kernel, kernel

On Wed, Nov 3, 2021 at 2:01 PM H. Nikolaus Schaller <hns@goldelico.com> wrote:

> This (initially empty) table allows to match quirks early based
> on .compatible of the child node of some mmc/sdio interface.
>
> A new macro SDIO_FIXUP_COMPATIBLE makes the definition readable.
>
> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [RFC v3 4/6] mmc: core: add new calls to mmc_fixup_device(sdio_card_init_methods)
  2021-11-03 13:00 ` [RFC v3 4/6] mmc: core: add new calls to mmc_fixup_device(sdio_card_init_methods) H. Nikolaus Schaller
@ 2021-11-09 11:18   ` Linus Walleij
  0 siblings, 0 replies; 16+ messages in thread
From: Linus Walleij @ 2021-11-09 11:18 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Ulf Hansson, Jérôme Pouiller, Avri Altman, Shawn Lin,
	Tony Lindgren, Bean Huo, notasas, linux-mmc, linux-kernel,
	letux-kernel, kernel

On Wed, Nov 3, 2021 at 2:01 PM H. Nikolaus Schaller <hns@goldelico.com> wrote:

> This allows to add quirks based on device tree instead of having
> card specific code in the host ops.
>
> We call it just after where host->ops->init_card() can be optionally
> called.
>
> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [RFC v3 5/6] mmc: core: transplant ti,wl1251 quirks from to be retired omap_hsmmc
  2021-11-03 13:00 ` [RFC v3 5/6] mmc: core: transplant ti,wl1251 quirks from to be retired omap_hsmmc H. Nikolaus Schaller
@ 2021-11-09 11:19   ` Linus Walleij
  0 siblings, 0 replies; 16+ messages in thread
From: Linus Walleij @ 2021-11-09 11:19 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Ulf Hansson, Jérôme Pouiller, Avri Altman, Shawn Lin,
	Tony Lindgren, Bean Huo, notasas, linux-mmc, linux-kernel,
	letux-kernel, kernel

On Wed, Nov 3, 2021 at 2:01 PM H. Nikolaus Schaller <hns@goldelico.com> wrote:

> 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>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [RFC v3 6/6] mmc: host: omap_hsmmc: revert special init for wl1251
  2021-11-03 13:00 ` [RFC v3 6/6] mmc: host: omap_hsmmc: revert special init for wl1251 H. Nikolaus Schaller
@ 2021-11-09 11:20   ` Linus Walleij
  0 siblings, 0 replies; 16+ messages in thread
From: Linus Walleij @ 2021-11-09 11:20 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Ulf Hansson, Jérôme Pouiller, Avri Altman, Shawn Lin,
	Tony Lindgren, Bean Huo, notasas, linux-mmc, linux-kernel,
	letux-kernel, kernel

On Wed, Nov 3, 2021 at 2:01 PM H. Nikolaus Schaller <hns@goldelico.com> wrote:

> Replaces: commit f6498b922e57 ("mmc: host: omap_hsmmc: add code for special init of wl1251 to get rid of pandora_wl1251_init_card")
> Requires: commit ("mmc: core: transplant ti,wl1251 quirks from to be retired omap_hsmmc")
>
> After moving the wl1251 quirks from omap_hsmmc_init_card() to wl1251_quirk()
> and sdio_card_init_methods[] we can remove omap_hsmmc_init_card() completely.
>
> This also removes the specialization on the combination of omap_hsmmc and wl1251.
>
> Related-to: commit f6498b922e57 ("mmc: host: omap_hsmmc: add code for special init of wl1251 to get rid of pandora_wl1251_init_card")
> Related-to: commit 2398c41d6432 ("omap: pdata-quirks: remove openpandora quirks for mmc3 and wl1251")
> Related-to: commit f9d50fef4b64 ("ARM: OMAP2+: omap3-pandora: add wifi support")
> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-11-09 11:20 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-03 13:00 [RFC v3 0/6] mmc: core: extend mmc_fixup_device and transplant ti,wl1251 quirks from to be retired omap_hsmmc H. Nikolaus Schaller
2021-11-03 13:00 ` [RFC v3 1/6] mmc: core: rewrite mmc_fixup_device() H. Nikolaus Schaller
2021-11-09 11:15   ` Linus Walleij
2021-11-03 13:00 ` [RFC v3 2/6] mmc: core: allow to match the device tree to apply quirks H. Nikolaus Schaller
2021-11-03 13:24   ` Jérôme Pouiller
2021-11-03 13:36     ` H. Nikolaus Schaller
2021-11-03 17:57   ` kernel test robot
2021-11-09 11:16   ` Linus Walleij
2021-11-03 13:00 ` [RFC v3 3/6] mmc: core: provide macro and table " H. Nikolaus Schaller
2021-11-09 11:17   ` Linus Walleij
2021-11-03 13:00 ` [RFC v3 4/6] mmc: core: add new calls to mmc_fixup_device(sdio_card_init_methods) H. Nikolaus Schaller
2021-11-09 11:18   ` Linus Walleij
2021-11-03 13:00 ` [RFC v3 5/6] mmc: core: transplant ti,wl1251 quirks from to be retired omap_hsmmc H. Nikolaus Schaller
2021-11-09 11:19   ` Linus Walleij
2021-11-03 13:00 ` [RFC v3 6/6] mmc: host: omap_hsmmc: revert special init for wl1251 H. Nikolaus Schaller
2021-11-09 11:20   ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.