All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] mmc: sdhci: Remove SDHCI_QUIRK_MISSING_CAPS
@ 2023-01-13 11:00 Adrian Hunter
  2023-01-13 11:00 ` [PATCH 1/6] mmc: sdhci-pci: Replace SDHCI_QUIRK_MISSING_CAPS for Ricoh controller Adrian Hunter
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Adrian Hunter @ 2023-01-13 11:00 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Kamal Dasu, Al Cooper, Florian Fainelli, Orson Zhai, Baolin Wang,
	Chunyan Zhang, Ray Jui, Scott Branden, Jisheng Zhang,
	Marek Vasut, linux-mmc

Hi

This patch set is to remove SDHCI_QUIRK_MISSING_CAPS.

SDHCI_QUIRK_MISSING_CAPS is not needed because __sdhci_read_caps() can be
called instead.

__sdhci_read_caps() is also called from sdhci_setup_host() via
sdhci_read_caps(), however only the first call to __sdhci_read_caps() does
anything because after that host->read_caps has been set to true.

Note, __sdhci_read_caps() does more than just set host->caps, such as do a
reset, so calling __sdhci_read_caps() earlier could have unforeseen
side-effects. However code flow has been reviewed with that in mind.


Adrian Hunter (6):
      mmc: sdhci-pci: Replace SDHCI_QUIRK_MISSING_CAPS for Ricoh controller
      mmc: sdhci-brcmstb: Replace SDHCI_QUIRK_MISSING_CAPS
      mmc: sdhci-sprd: Replace SDHCI_QUIRK_MISSING_CAPS
      mmc: sdhci-pxav3: Replace SDHCI_QUIRK_MISSING_CAPS
      mmc: sdhci-iproc: Replace SDHCI_QUIRK_MISSING_CAPS
      mmc: sdhci: Remove SDHCI_QUIRK_MISSING_CAPS

 drivers/mmc/host/sdhci-brcmstb.c  |  4 +---
 drivers/mmc/host/sdhci-iproc.c    | 14 ++++++++------
 drivers/mmc/host/sdhci-pci-core.c |  8 +++++---
 drivers/mmc/host/sdhci-pxav3.c    |  4 +---
 drivers/mmc/host/sdhci-sprd.c     |  6 ++----
 drivers/mmc/host/sdhci.c          |  3 ---
 drivers/mmc/host/sdhci.h          |  2 --
 7 files changed, 17 insertions(+), 24 deletions(-)


Regards
Adrian

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

* [PATCH 1/6] mmc: sdhci-pci: Replace SDHCI_QUIRK_MISSING_CAPS for Ricoh controller
  2023-01-13 11:00 [PATCH 0/6] mmc: sdhci: Remove SDHCI_QUIRK_MISSING_CAPS Adrian Hunter
@ 2023-01-13 11:00 ` Adrian Hunter
  2023-01-13 11:00 ` [PATCH 2/6] mmc: sdhci-brcmstb: Replace SDHCI_QUIRK_MISSING_CAPS Adrian Hunter
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Adrian Hunter @ 2023-01-13 11:00 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Kamal Dasu, Al Cooper, Florian Fainelli, Orson Zhai, Baolin Wang,
	Chunyan Zhang, Ray Jui, Scott Branden, Jisheng Zhang,
	Marek Vasut, linux-mmc

SDHCI_QUIRK_MISSING_CAPS is not needed because __sdhci_read_caps() can be
called instead.

In preparation to get rid of SDHCI_QUIRK_MISSING_CAPS, replace
SDHCI_QUIRK_MISSING_CAPS with __sdhci_read_caps() for Ricoh SDHCI
controller.

__sdhci_read_caps() is also called from sdhci_setup_host() via
sdhci_read_caps(), however only the first call to __sdhci_read_caps() does
anything because after that host->read_caps has been set to true.

Note, __sdhci_read_caps() does more than just set host->caps, such as do a
reset, so calling __sdhci_read_caps() earlier could have unforeseen
side-effects. However the code flow has been reviewed with that in mind.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 drivers/mmc/host/sdhci-pci-core.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
index c359f867df0a..01975d145200 100644
--- a/drivers/mmc/host/sdhci-pci-core.c
+++ b/drivers/mmc/host/sdhci-pci-core.c
@@ -251,13 +251,16 @@ static int ricoh_probe(struct sdhci_pci_chip *chip)
 
 static int ricoh_mmc_probe_slot(struct sdhci_pci_slot *slot)
 {
-	slot->host->caps =
+	u32 caps =
 		FIELD_PREP(SDHCI_TIMEOUT_CLK_MASK, 0x21) |
 		FIELD_PREP(SDHCI_CLOCK_BASE_MASK, 0x21) |
 		SDHCI_TIMEOUT_CLK_UNIT |
 		SDHCI_CAN_VDD_330 |
 		SDHCI_CAN_DO_HISPD |
 		SDHCI_CAN_DO_SDMA;
+	u32 caps1 = 0;
+
+	__sdhci_read_caps(slot->host, NULL, &caps, &caps1);
 	return 0;
 }
 
@@ -286,8 +289,7 @@ static const struct sdhci_pci_fixes sdhci_ricoh_mmc = {
 #endif
 	.quirks		= SDHCI_QUIRK_32BIT_DMA_ADDR |
 			  SDHCI_QUIRK_CLOCK_BEFORE_RESET |
-			  SDHCI_QUIRK_NO_CARD_NO_RESET |
-			  SDHCI_QUIRK_MISSING_CAPS
+			  SDHCI_QUIRK_NO_CARD_NO_RESET,
 };
 
 static void ene_714_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
-- 
2.34.1


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

* [PATCH 2/6] mmc: sdhci-brcmstb: Replace SDHCI_QUIRK_MISSING_CAPS
  2023-01-13 11:00 [PATCH 0/6] mmc: sdhci: Remove SDHCI_QUIRK_MISSING_CAPS Adrian Hunter
  2023-01-13 11:00 ` [PATCH 1/6] mmc: sdhci-pci: Replace SDHCI_QUIRK_MISSING_CAPS for Ricoh controller Adrian Hunter
@ 2023-01-13 11:00 ` Adrian Hunter
  2023-01-13 18:35   ` Florian Fainelli
  2023-01-13 11:00 ` [PATCH 3/6] mmc: sdhci-sprd: " Adrian Hunter
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: Adrian Hunter @ 2023-01-13 11:00 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Kamal Dasu, Al Cooper, Florian Fainelli, Orson Zhai, Baolin Wang,
	Chunyan Zhang, Ray Jui, Scott Branden, Jisheng Zhang,
	Marek Vasut, linux-mmc

SDHCI_QUIRK_MISSING_CAPS is not needed because sdhci_read_caps() can be
called instead.

In preparation to get rid of SDHCI_QUIRK_MISSING_CAPS, replace
SDHCI_QUIRK_MISSING_CAPS with sdhci_read_caps().

__sdhci_read_caps() is also called from sdhci_setup_host() via
sdhci_read_caps(), however only the first call to __sdhci_read_caps() does
anything because after that host->read_caps has been set to true.

Note, __sdhci_read_caps() does more than just set host->caps, such as do a
reset, so calling __sdhci_read_caps() earlier could have unforeseen
side-effects. However the code flow has been reviewed with that in mind.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 drivers/mmc/host/sdhci-brcmstb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c
index f2cf3d70db79..0a19b7af1d41 100644
--- a/drivers/mmc/host/sdhci-brcmstb.c
+++ b/drivers/mmc/host/sdhci-brcmstb.c
@@ -324,13 +324,11 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev)
 	 * will allow these modes to be specified by device tree
 	 * properties through mmc_of_parse().
 	 */
-	host->caps = sdhci_readl(host, SDHCI_CAPABILITIES);
+	sdhci_read_caps(host);
 	if (match_priv->flags & BRCMSTB_MATCH_FLAGS_NO_64BIT)
 		host->caps &= ~SDHCI_CAN_64BIT;
-	host->caps1 = sdhci_readl(host, SDHCI_CAPABILITIES_1);
 	host->caps1 &= ~(SDHCI_SUPPORT_SDR50 | SDHCI_SUPPORT_SDR104 |
 			 SDHCI_SUPPORT_DDR50);
-	host->quirks |= SDHCI_QUIRK_MISSING_CAPS;
 
 	if (match_priv->flags & BRCMSTB_MATCH_FLAGS_BROKEN_TIMEOUT)
 		host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
-- 
2.34.1


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

* [PATCH 3/6] mmc: sdhci-sprd: Replace SDHCI_QUIRK_MISSING_CAPS
  2023-01-13 11:00 [PATCH 0/6] mmc: sdhci: Remove SDHCI_QUIRK_MISSING_CAPS Adrian Hunter
  2023-01-13 11:00 ` [PATCH 1/6] mmc: sdhci-pci: Replace SDHCI_QUIRK_MISSING_CAPS for Ricoh controller Adrian Hunter
  2023-01-13 11:00 ` [PATCH 2/6] mmc: sdhci-brcmstb: Replace SDHCI_QUIRK_MISSING_CAPS Adrian Hunter
@ 2023-01-13 11:00 ` Adrian Hunter
  2023-01-16  1:48   ` Chunyan Zhang
  2023-01-13 11:00 ` [PATCH 4/6] mmc: sdhci-pxav3: " Adrian Hunter
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: Adrian Hunter @ 2023-01-13 11:00 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Kamal Dasu, Al Cooper, Florian Fainelli, Orson Zhai, Baolin Wang,
	Chunyan Zhang, Ray Jui, Scott Branden, Jisheng Zhang,
	Marek Vasut, linux-mmc

SDHCI_QUIRK_MISSING_CAPS is not needed because sdhci_read_caps() can be
called instead.

In preparation to get rid of SDHCI_QUIRK_MISSING_CAPS, replace
SDHCI_QUIRK_MISSING_CAPS with sdhci_read_caps().

__sdhci_read_caps() is also called from sdhci_setup_host() via
sdhci_read_caps(), however only the first call to __sdhci_read_caps() does
anything because after that host->read_caps has been set to true.

Note, __sdhci_read_caps() does more than just set host->caps, such as do a
reset, so calling __sdhci_read_caps() earlier could have unforeseen
side-effects. However the code flow has been reviewed with that in mind.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 drivers/mmc/host/sdhci-sprd.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/sdhci-sprd.c b/drivers/mmc/host/sdhci-sprd.c
index 525f979e2a97..7f4ee2e12735 100644
--- a/drivers/mmc/host/sdhci-sprd.c
+++ b/drivers/mmc/host/sdhci-sprd.c
@@ -553,8 +553,7 @@ static void sdhci_sprd_phy_param_parse(struct sdhci_sprd_host *sprd_host,
 
 static const struct sdhci_pltfm_data sdhci_sprd_pdata = {
 	.quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION |
-		  SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
-		  SDHCI_QUIRK_MISSING_CAPS,
+		  SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK,
 	.quirks2 = SDHCI_QUIRK2_BROKEN_HS200 |
 		   SDHCI_QUIRK2_USE_32BIT_BLK_CNT |
 		   SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
@@ -671,8 +670,7 @@ static int sdhci_sprd_probe(struct platform_device *pdev)
 	 * will allow these modes to be specified only by device
 	 * tree properties through mmc_of_parse().
 	 */
-	host->caps = sdhci_readl(host, SDHCI_CAPABILITIES);
-	host->caps1 = sdhci_readl(host, SDHCI_CAPABILITIES_1);
+	sdhci_read_caps(host);
 	host->caps1 &= ~(SDHCI_SUPPORT_SDR50 | SDHCI_SUPPORT_SDR104 |
 			 SDHCI_SUPPORT_DDR50);
 
-- 
2.34.1


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

* [PATCH 4/6] mmc: sdhci-pxav3: Replace SDHCI_QUIRK_MISSING_CAPS
  2023-01-13 11:00 [PATCH 0/6] mmc: sdhci: Remove SDHCI_QUIRK_MISSING_CAPS Adrian Hunter
                   ` (2 preceding siblings ...)
  2023-01-13 11:00 ` [PATCH 3/6] mmc: sdhci-sprd: " Adrian Hunter
@ 2023-01-13 11:00 ` Adrian Hunter
  2023-01-15 13:03   ` Jisheng Zhang
  2023-01-13 11:00 ` [PATCH 5/6] mmc: sdhci-iproc: " Adrian Hunter
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: Adrian Hunter @ 2023-01-13 11:00 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Kamal Dasu, Al Cooper, Florian Fainelli, Orson Zhai, Baolin Wang,
	Chunyan Zhang, Ray Jui, Scott Branden, Jisheng Zhang,
	Marek Vasut, linux-mmc

SDHCI_QUIRK_MISSING_CAPS is not needed because sdhci_read_caps() can be
called instead.

In preparation to get rid of SDHCI_QUIRK_MISSING_CAPS, replace
SDHCI_QUIRK_MISSING_CAPS with sdhci_read_caps().

__sdhci_read_caps() is also called from sdhci_setup_host() via
sdhci_read_caps(), however only the first call to __sdhci_read_caps() does
anything because after that host->read_caps has been set to true.

Note, __sdhci_read_caps() does more than just set host->caps, such as do a
reset, so calling __sdhci_read_caps() earlier could have unforeseen
side-effects. However the code flow has been reviewed with that in mind.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 drivers/mmc/host/sdhci-pxav3.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index a6d89a3f1946..e39dcc998772 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -124,10 +124,8 @@ static int armada_38x_quirks(struct platform_device *pdev,
 	struct resource *res;
 
 	host->quirks &= ~SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN;
-	host->quirks |= SDHCI_QUIRK_MISSING_CAPS;
 
-	host->caps = sdhci_readl(host, SDHCI_CAPABILITIES);
-	host->caps1 = sdhci_readl(host, SDHCI_CAPABILITIES_1);
+	sdhci_read_caps(host);
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
 					   "conf-sdio3");
-- 
2.34.1


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

* [PATCH 5/6] mmc: sdhci-iproc: Replace SDHCI_QUIRK_MISSING_CAPS
  2023-01-13 11:00 [PATCH 0/6] mmc: sdhci: Remove SDHCI_QUIRK_MISSING_CAPS Adrian Hunter
                   ` (3 preceding siblings ...)
  2023-01-13 11:00 ` [PATCH 4/6] mmc: sdhci-pxav3: " Adrian Hunter
@ 2023-01-13 11:00 ` Adrian Hunter
  2023-01-13 17:34   ` Scott Branden
  2023-01-13 11:00 ` [PATCH 6/6] mmc: sdhci: Remove SDHCI_QUIRK_MISSING_CAPS Adrian Hunter
  2023-01-16 12:16 ` [PATCH 0/6] " Ulf Hansson
  6 siblings, 1 reply; 12+ messages in thread
From: Adrian Hunter @ 2023-01-13 11:00 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Kamal Dasu, Al Cooper, Florian Fainelli, Orson Zhai, Baolin Wang,
	Chunyan Zhang, Ray Jui, Scott Branden, Jisheng Zhang,
	Marek Vasut, linux-mmc

SDHCI_QUIRK_MISSING_CAPS is not needed because __sdhci_read_caps() can be
called instead.

In preparation to get rid of SDHCI_QUIRK_MISSING_CAPS, replace
SDHCI_QUIRK_MISSING_CAPS with __sdhci_read_caps().

__sdhci_read_caps() is also called from sdhci_setup_host() via
sdhci_read_caps(), however only the first call to __sdhci_read_caps() does
anything because after that host->read_caps has been set to true.

Note, __sdhci_read_caps() does more than just set host->caps, such as do a
reset, so calling __sdhci_read_caps() earlier could have unforeseen
side-effects. However the code flow has been reviewed with that in mind.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 drivers/mmc/host/sdhci-iproc.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
index 6db35b1b8557..86eb0045515e 100644
--- a/drivers/mmc/host/sdhci-iproc.c
+++ b/drivers/mmc/host/sdhci-iproc.c
@@ -18,6 +18,7 @@ struct sdhci_iproc_data {
 	u32 caps;
 	u32 caps1;
 	u32 mmc_caps;
+	bool missing_caps;
 };
 
 struct sdhci_iproc_host {
@@ -251,7 +252,6 @@ static const struct sdhci_iproc_data iproc_data = {
 static const struct sdhci_pltfm_data sdhci_bcm2835_pltfm_data = {
 	.quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION |
 		  SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
-		  SDHCI_QUIRK_MISSING_CAPS |
 		  SDHCI_QUIRK_NO_HISPD_BIT,
 	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
 	.ops = &sdhci_iproc_32only_ops,
@@ -266,6 +266,7 @@ static const struct sdhci_iproc_data bcm2835_data = {
 	.caps1 = SDHCI_DRIVER_TYPE_A |
 		 SDHCI_DRIVER_TYPE_C,
 	.mmc_caps = 0x00000000,
+	.missing_caps = true,
 };
 
 static const struct sdhci_ops sdhci_iproc_bcm2711_ops = {
@@ -295,8 +296,7 @@ static const struct sdhci_iproc_data bcm2711_data = {
 };
 
 static const struct sdhci_pltfm_data sdhci_bcm7211a0_pltfm_data = {
-	.quirks = SDHCI_QUIRK_MISSING_CAPS |
-		SDHCI_QUIRK_BROKEN_TIMEOUT_VAL |
+	.quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL |
 		SDHCI_QUIRK_BROKEN_DMA |
 		SDHCI_QUIRK_BROKEN_ADMA,
 	.ops = &sdhci_iproc_ops,
@@ -315,6 +315,7 @@ static const struct sdhci_iproc_data bcm7211a0_data = {
 		SDHCI_CAN_DO_HISPD,
 	.caps1 = SDHCI_DRIVER_TYPE_C |
 		 SDHCI_DRIVER_TYPE_D,
+	.missing_caps = true,
 };
 
 static const struct of_device_id sdhci_iproc_of_match[] = {
@@ -397,9 +398,10 @@ static int sdhci_iproc_probe(struct platform_device *pdev)
 		}
 	}
 
-	if (iproc_host->data->pdata->quirks & SDHCI_QUIRK_MISSING_CAPS) {
-		host->caps = iproc_host->data->caps;
-		host->caps1 = iproc_host->data->caps1;
+	if (iproc_host->data->missing_caps) {
+		__sdhci_read_caps(host, NULL,
+				  &iproc_host->data->caps,
+				  &iproc_host->data->caps1);
 	}
 
 	ret = sdhci_add_host(host);
-- 
2.34.1


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

* [PATCH 6/6] mmc: sdhci: Remove SDHCI_QUIRK_MISSING_CAPS
  2023-01-13 11:00 [PATCH 0/6] mmc: sdhci: Remove SDHCI_QUIRK_MISSING_CAPS Adrian Hunter
                   ` (4 preceding siblings ...)
  2023-01-13 11:00 ` [PATCH 5/6] mmc: sdhci-iproc: " Adrian Hunter
@ 2023-01-13 11:00 ` Adrian Hunter
  2023-01-16 12:16 ` [PATCH 0/6] " Ulf Hansson
  6 siblings, 0 replies; 12+ messages in thread
From: Adrian Hunter @ 2023-01-13 11:00 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Kamal Dasu, Al Cooper, Florian Fainelli, Orson Zhai, Baolin Wang,
	Chunyan Zhang, Ray Jui, Scott Branden, Jisheng Zhang,
	Marek Vasut, linux-mmc

Now that it is no longer used, remove SDHCI_QUIRK_MISSING_CAPS.

Note, from now on, __sdhci_read_caps() should be used to provide missing
capability flags.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 drivers/mmc/host/sdhci.c | 3 ---
 drivers/mmc/host/sdhci.h | 2 --
 2 files changed, 5 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index f3af1bd0f7b9..3241916141d7 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -4121,9 +4121,6 @@ void __sdhci_read_caps(struct sdhci_host *host, const u16 *ver,
 	v = ver ? *ver : sdhci_readw(host, SDHCI_HOST_VERSION);
 	host->version = (v & SDHCI_SPEC_VER_MASK) >> SDHCI_SPEC_VER_SHIFT;
 
-	if (host->quirks & SDHCI_QUIRK_MISSING_CAPS)
-		return;
-
 	if (caps) {
 		host->caps = *caps;
 	} else {
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 605eaee805f7..f4f2085c274c 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -423,8 +423,6 @@ struct sdhci_host {
 #define SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN		(1<<25)
 /* Controller cannot support End Attribute in NOP ADMA descriptor */
 #define SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC		(1<<26)
-/* Controller is missing device caps. Use caps provided by host */
-#define SDHCI_QUIRK_MISSING_CAPS			(1<<27)
 /* Controller uses Auto CMD12 command to stop the transfer */
 #define SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12		(1<<28)
 /* Controller doesn't have HISPD bit field in HI-SPEED SD card */
-- 
2.34.1


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

* Re: [PATCH 5/6] mmc: sdhci-iproc: Replace SDHCI_QUIRK_MISSING_CAPS
  2023-01-13 11:00 ` [PATCH 5/6] mmc: sdhci-iproc: " Adrian Hunter
@ 2023-01-13 17:34   ` Scott Branden
  0 siblings, 0 replies; 12+ messages in thread
From: Scott Branden @ 2023-01-13 17:34 UTC (permalink / raw)
  To: Adrian Hunter, Ulf Hansson
  Cc: Kamal Dasu, Al Cooper, Florian Fainelli, Orson Zhai, Baolin Wang,
	Chunyan Zhang, Ray Jui, Scott Branden, Jisheng Zhang,
	Marek Vasut, linux-mmc

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



On 2023-01-13 03:00, Adrian Hunter wrote:
> SDHCI_QUIRK_MISSING_CAPS is not needed because __sdhci_read_caps() can be
> called instead.
> 
> In preparation to get rid of SDHCI_QUIRK_MISSING_CAPS, replace
> SDHCI_QUIRK_MISSING_CAPS with __sdhci_read_caps().
> 
> __sdhci_read_caps() is also called from sdhci_setup_host() via
> sdhci_read_caps(), however only the first call to __sdhci_read_caps() does
> anything because after that host->read_caps has been set to true.
> 
> Note, __sdhci_read_caps() does more than just set host->caps, such as do a
> reset, so calling __sdhci_read_caps() earlier could have unforeseen
> side-effects. However the code flow has been reviewed with that in mind.
> 
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Scott Branden <scott.branden@broadcom.com>
> ---
>   drivers/mmc/host/sdhci-iproc.c | 14 ++++++++------
>   1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
> index 6db35b1b8557..86eb0045515e 100644
> --- a/drivers/mmc/host/sdhci-iproc.c
> +++ b/drivers/mmc/host/sdhci-iproc.c
> @@ -18,6 +18,7 @@ struct sdhci_iproc_data {
>   	u32 caps;
>   	u32 caps1;
>   	u32 mmc_caps;
> +	bool missing_caps;
>   };
>   
>   struct sdhci_iproc_host {
> @@ -251,7 +252,6 @@ static const struct sdhci_iproc_data iproc_data = {
>   static const struct sdhci_pltfm_data sdhci_bcm2835_pltfm_data = {
>   	.quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION |
>   		  SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
> -		  SDHCI_QUIRK_MISSING_CAPS |
>   		  SDHCI_QUIRK_NO_HISPD_BIT,
>   	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
>   	.ops = &sdhci_iproc_32only_ops,
> @@ -266,6 +266,7 @@ static const struct sdhci_iproc_data bcm2835_data = {
>   	.caps1 = SDHCI_DRIVER_TYPE_A |
>   		 SDHCI_DRIVER_TYPE_C,
>   	.mmc_caps = 0x00000000,
> +	.missing_caps = true,
>   };
>   
>   static const struct sdhci_ops sdhci_iproc_bcm2711_ops = {
> @@ -295,8 +296,7 @@ static const struct sdhci_iproc_data bcm2711_data = {
>   };
>   
>   static const struct sdhci_pltfm_data sdhci_bcm7211a0_pltfm_data = {
> -	.quirks = SDHCI_QUIRK_MISSING_CAPS |
> -		SDHCI_QUIRK_BROKEN_TIMEOUT_VAL |
> +	.quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL |
>   		SDHCI_QUIRK_BROKEN_DMA |
>   		SDHCI_QUIRK_BROKEN_ADMA,
>   	.ops = &sdhci_iproc_ops,
> @@ -315,6 +315,7 @@ static const struct sdhci_iproc_data bcm7211a0_data = {
>   		SDHCI_CAN_DO_HISPD,
>   	.caps1 = SDHCI_DRIVER_TYPE_C |
>   		 SDHCI_DRIVER_TYPE_D,
> +	.missing_caps = true,
>   };
>   
>   static const struct of_device_id sdhci_iproc_of_match[] = {
> @@ -397,9 +398,10 @@ static int sdhci_iproc_probe(struct platform_device *pdev)
>   		}
>   	}
>   
> -	if (iproc_host->data->pdata->quirks & SDHCI_QUIRK_MISSING_CAPS) {
> -		host->caps = iproc_host->data->caps;
> -		host->caps1 = iproc_host->data->caps1;
> +	if (iproc_host->data->missing_caps) {
> +		__sdhci_read_caps(host, NULL,
> +				  &iproc_host->data->caps,
> +				  &iproc_host->data->caps1);
>   	}
>   
>   	ret = sdhci_add_host(host);

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4212 bytes --]

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

* Re: [PATCH 2/6] mmc: sdhci-brcmstb: Replace SDHCI_QUIRK_MISSING_CAPS
  2023-01-13 11:00 ` [PATCH 2/6] mmc: sdhci-brcmstb: Replace SDHCI_QUIRK_MISSING_CAPS Adrian Hunter
@ 2023-01-13 18:35   ` Florian Fainelli
  0 siblings, 0 replies; 12+ messages in thread
From: Florian Fainelli @ 2023-01-13 18:35 UTC (permalink / raw)
  To: Adrian Hunter, Ulf Hansson
  Cc: Kamal Dasu, Al Cooper, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Ray Jui, Scott Branden, Jisheng Zhang, Marek Vasut, linux-mmc

On 1/13/23 03:00, Adrian Hunter wrote:
> SDHCI_QUIRK_MISSING_CAPS is not needed because sdhci_read_caps() can be
> called instead.
> 
> In preparation to get rid of SDHCI_QUIRK_MISSING_CAPS, replace
> SDHCI_QUIRK_MISSING_CAPS with sdhci_read_caps().
> 
> __sdhci_read_caps() is also called from sdhci_setup_host() via
> sdhci_read_caps(), however only the first call to __sdhci_read_caps() does
> anything because after that host->read_caps has been set to true.
> 
> Note, __sdhci_read_caps() does more than just set host->caps, such as do a
> reset, so calling __sdhci_read_caps() earlier could have unforeseen
> side-effects. However the code flow has been reviewed with that in mind.
> 
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>

Reviwed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian


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

* Re: [PATCH 4/6] mmc: sdhci-pxav3: Replace SDHCI_QUIRK_MISSING_CAPS
  2023-01-13 11:00 ` [PATCH 4/6] mmc: sdhci-pxav3: " Adrian Hunter
@ 2023-01-15 13:03   ` Jisheng Zhang
  0 siblings, 0 replies; 12+ messages in thread
From: Jisheng Zhang @ 2023-01-15 13:03 UTC (permalink / raw)
  To: Adrian Hunter
  Cc: Ulf Hansson, Kamal Dasu, Al Cooper, Florian Fainelli, Orson Zhai,
	Baolin Wang, Chunyan Zhang, Ray Jui, Scott Branden, Marek Vasut,
	linux-mmc

On Fri, Jan 13, 2023 at 01:00:09PM +0200, Adrian Hunter wrote:
> SDHCI_QUIRK_MISSING_CAPS is not needed because sdhci_read_caps() can be
> called instead.
> 
> In preparation to get rid of SDHCI_QUIRK_MISSING_CAPS, replace
> SDHCI_QUIRK_MISSING_CAPS with sdhci_read_caps().
> 
> __sdhci_read_caps() is also called from sdhci_setup_host() via
> sdhci_read_caps(), however only the first call to __sdhci_read_caps() does
> anything because after that host->read_caps has been set to true.
> 
> Note, __sdhci_read_caps() does more than just set host->caps, such as do a
> reset, so calling __sdhci_read_caps() earlier could have unforeseen
> side-effects. However the code flow has been reviewed with that in mind.
> 
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>

Reviewed-by: Jisheng Zhang <jszhang@kernel.org>
> ---
>  drivers/mmc/host/sdhci-pxav3.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
> index a6d89a3f1946..e39dcc998772 100644
> --- a/drivers/mmc/host/sdhci-pxav3.c
> +++ b/drivers/mmc/host/sdhci-pxav3.c
> @@ -124,10 +124,8 @@ static int armada_38x_quirks(struct platform_device *pdev,
>  	struct resource *res;
>  
>  	host->quirks &= ~SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN;
> -	host->quirks |= SDHCI_QUIRK_MISSING_CAPS;
>  
> -	host->caps = sdhci_readl(host, SDHCI_CAPABILITIES);
> -	host->caps1 = sdhci_readl(host, SDHCI_CAPABILITIES_1);
> +	sdhci_read_caps(host);
>  
>  	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
>  					   "conf-sdio3");
> -- 
> 2.34.1
> 

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

* Re: [PATCH 3/6] mmc: sdhci-sprd: Replace SDHCI_QUIRK_MISSING_CAPS
  2023-01-13 11:00 ` [PATCH 3/6] mmc: sdhci-sprd: " Adrian Hunter
@ 2023-01-16  1:48   ` Chunyan Zhang
  0 siblings, 0 replies; 12+ messages in thread
From: Chunyan Zhang @ 2023-01-16  1:48 UTC (permalink / raw)
  To: Adrian Hunter
  Cc: Ulf Hansson, Kamal Dasu, Al Cooper, Florian Fainelli, Orson Zhai,
	Baolin Wang, Ray Jui, Scott Branden, Jisheng Zhang, Marek Vasut,
	linux-mmc

On Fri, 13 Jan 2023 at 19:00, Adrian Hunter <adrian.hunter@intel.com> wrote:
>
> SDHCI_QUIRK_MISSING_CAPS is not needed because sdhci_read_caps() can be
> called instead.
>
> In preparation to get rid of SDHCI_QUIRK_MISSING_CAPS, replace
> SDHCI_QUIRK_MISSING_CAPS with sdhci_read_caps().
>
> __sdhci_read_caps() is also called from sdhci_setup_host() via
> sdhci_read_caps(), however only the first call to __sdhci_read_caps() does
> anything because after that host->read_caps has been set to true.
>
> Note, __sdhci_read_caps() does more than just set host->caps, such as do a
> reset, so calling __sdhci_read_caps() earlier could have unforeseen
> side-effects. However the code flow has been reviewed with that in mind.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>

Acked-by: Chunyan Zhang <zhang.lyra@gmail.com>

Thanks,
Chunyan


> ---
>  drivers/mmc/host/sdhci-sprd.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-sprd.c b/drivers/mmc/host/sdhci-sprd.c
> index 525f979e2a97..7f4ee2e12735 100644
> --- a/drivers/mmc/host/sdhci-sprd.c
> +++ b/drivers/mmc/host/sdhci-sprd.c
> @@ -553,8 +553,7 @@ static void sdhci_sprd_phy_param_parse(struct sdhci_sprd_host *sprd_host,
>
>  static const struct sdhci_pltfm_data sdhci_sprd_pdata = {
>         .quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION |
> -                 SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
> -                 SDHCI_QUIRK_MISSING_CAPS,
> +                 SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK,
>         .quirks2 = SDHCI_QUIRK2_BROKEN_HS200 |
>                    SDHCI_QUIRK2_USE_32BIT_BLK_CNT |
>                    SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
> @@ -671,8 +670,7 @@ static int sdhci_sprd_probe(struct platform_device *pdev)
>          * will allow these modes to be specified only by device
>          * tree properties through mmc_of_parse().
>          */
> -       host->caps = sdhci_readl(host, SDHCI_CAPABILITIES);
> -       host->caps1 = sdhci_readl(host, SDHCI_CAPABILITIES_1);
> +       sdhci_read_caps(host);
>         host->caps1 &= ~(SDHCI_SUPPORT_SDR50 | SDHCI_SUPPORT_SDR104 |
>                          SDHCI_SUPPORT_DDR50);
>
> --
> 2.34.1
>

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

* Re: [PATCH 0/6] mmc: sdhci: Remove SDHCI_QUIRK_MISSING_CAPS
  2023-01-13 11:00 [PATCH 0/6] mmc: sdhci: Remove SDHCI_QUIRK_MISSING_CAPS Adrian Hunter
                   ` (5 preceding siblings ...)
  2023-01-13 11:00 ` [PATCH 6/6] mmc: sdhci: Remove SDHCI_QUIRK_MISSING_CAPS Adrian Hunter
@ 2023-01-16 12:16 ` Ulf Hansson
  6 siblings, 0 replies; 12+ messages in thread
From: Ulf Hansson @ 2023-01-16 12:16 UTC (permalink / raw)
  To: Adrian Hunter
  Cc: Kamal Dasu, Al Cooper, Florian Fainelli, Orson Zhai, Baolin Wang,
	Chunyan Zhang, Ray Jui, Scott Branden, Jisheng Zhang,
	Marek Vasut, linux-mmc

On Fri, 13 Jan 2023 at 12:00, Adrian Hunter <adrian.hunter@intel.com> wrote:
>
> Hi
>
> This patch set is to remove SDHCI_QUIRK_MISSING_CAPS.
>
> SDHCI_QUIRK_MISSING_CAPS is not needed because __sdhci_read_caps() can be
> called instead.
>
> __sdhci_read_caps() is also called from sdhci_setup_host() via
> sdhci_read_caps(), however only the first call to __sdhci_read_caps() does
> anything because after that host->read_caps has been set to true.
>
> Note, __sdhci_read_caps() does more than just set host->caps, such as do a
> reset, so calling __sdhci_read_caps() earlier could have unforeseen
> side-effects. However code flow has been reviewed with that in mind.
>
>
> Adrian Hunter (6):
>       mmc: sdhci-pci: Replace SDHCI_QUIRK_MISSING_CAPS for Ricoh controller
>       mmc: sdhci-brcmstb: Replace SDHCI_QUIRK_MISSING_CAPS
>       mmc: sdhci-sprd: Replace SDHCI_QUIRK_MISSING_CAPS
>       mmc: sdhci-pxav3: Replace SDHCI_QUIRK_MISSING_CAPS
>       mmc: sdhci-iproc: Replace SDHCI_QUIRK_MISSING_CAPS
>       mmc: sdhci: Remove SDHCI_QUIRK_MISSING_CAPS
>
>  drivers/mmc/host/sdhci-brcmstb.c  |  4 +---
>  drivers/mmc/host/sdhci-iproc.c    | 14 ++++++++------
>  drivers/mmc/host/sdhci-pci-core.c |  8 +++++---
>  drivers/mmc/host/sdhci-pxav3.c    |  4 +---
>  drivers/mmc/host/sdhci-sprd.c     |  6 ++----
>  drivers/mmc/host/sdhci.c          |  3 ---
>  drivers/mmc/host/sdhci.h          |  2 --
>  7 files changed, 17 insertions(+), 24 deletions(-)
>
>
> Regards
> Adrian

Applied for next, thanks!

Kind regards
Uffe

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

end of thread, other threads:[~2023-01-16 12:17 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-13 11:00 [PATCH 0/6] mmc: sdhci: Remove SDHCI_QUIRK_MISSING_CAPS Adrian Hunter
2023-01-13 11:00 ` [PATCH 1/6] mmc: sdhci-pci: Replace SDHCI_QUIRK_MISSING_CAPS for Ricoh controller Adrian Hunter
2023-01-13 11:00 ` [PATCH 2/6] mmc: sdhci-brcmstb: Replace SDHCI_QUIRK_MISSING_CAPS Adrian Hunter
2023-01-13 18:35   ` Florian Fainelli
2023-01-13 11:00 ` [PATCH 3/6] mmc: sdhci-sprd: " Adrian Hunter
2023-01-16  1:48   ` Chunyan Zhang
2023-01-13 11:00 ` [PATCH 4/6] mmc: sdhci-pxav3: " Adrian Hunter
2023-01-15 13:03   ` Jisheng Zhang
2023-01-13 11:00 ` [PATCH 5/6] mmc: sdhci-iproc: " Adrian Hunter
2023-01-13 17:34   ` Scott Branden
2023-01-13 11:00 ` [PATCH 6/6] mmc: sdhci: Remove SDHCI_QUIRK_MISSING_CAPS Adrian Hunter
2023-01-16 12:16 ` [PATCH 0/6] " Ulf Hansson

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.