diff mbox series

[4/6] mmc: sdhci-pxav3: Replace SDHCI_QUIRK_MISSING_CAPS

Message ID 20230113110011.129835-5-adrian.hunter@intel.com (mailing list archive)
State New, archived
Headers show
Series mmc: sdhci: Remove SDHCI_QUIRK_MISSING_CAPS | expand

Commit Message

Adrian Hunter Jan. 13, 2023, 11 a.m. UTC
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(-)

Comments

Jisheng Zhang Jan. 15, 2023, 1:03 p.m. UTC | #1
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
>
diff mbox series

Patch

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");