mbox series

[0/6] mmc: sdhci: Remove SDHCI_QUIRK_MISSING_CAPS

Message ID 20230113110011.129835-1-adrian.hunter@intel.com
Headers show
Series mmc: sdhci: Remove SDHCI_QUIRK_MISSING_CAPS | expand

Message

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

Comments

Scott Branden Jan. 13, 2023, 5:34 p.m. UTC | #1
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);
Ulf Hansson Jan. 16, 2023, 12:16 p.m. UTC | #2
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