]> git.itanic.dy.fi Git - linux-stable/commitdiff
mmc: sdhci-iproc: Replace SDHCI_QUIRK_MISSING_CAPS
authorAdrian Hunter <adrian.hunter@intel.com>
Fri, 13 Jan 2023 11:00:10 +0000 (13:00 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 23 Jan 2023 14:51:38 +0000 (15:51 +0100)
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>
Link: https://lore.kernel.org/r/20230113110011.129835-6-adrian.hunter@intel.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sdhci-iproc.c

index 6db35b1b8557aee29c14f6337df8d525ed13c265..86eb0045515e09cee68ba5f347d8a9c1e910288a 100644 (file)
@@ -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);