Re: [PATCH] mmc/host: Re-enable card en only after UHS mode changed for spreadtrum chipset.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/03/2022 04:34, Zhenxiong Lai wrote:
> From: Zhenxiong Lai <zhenxiong.lai@xxxxxxxxxx>
> 
> DLL locked status probably couldn't come out in a certain time on
> Sharkl3 platform sometimes.
> It can be workaround if re-anable card en bit only
> rather than calling ->set_clock() after UHS timing changed.
> 
> Signed-off-by: Zhenxiong Lai <zhenxiong.lai@xxxxxxxxxx>
> ---
>  drivers/mmc/host/sdhci.c | 7 ++++++-
>  drivers/mmc/host/sdhci.h | 2 ++

This is an SDHCI patch so it would be better if the subject
begins with "mmc: sdhci: "

>  2 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 07c6da1f2f0f..c415d00304fe 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -2396,7 +2396,12 @@ void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>  		}
>  
>  		/* Re-enable SD Clock */
> -		host->ops->set_clock(host, host->clock);
> +		if (host->quirks2 & SDHCI_QUIRK2_RE_ENABLE_CARD_EN) {
> +			clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
> +			clk |= SDHCI_CLOCK_CARD_EN;
> +			sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);

We like to try and avoid quirks whenever possible.
Why can't this be done in the driver's ->set_clock() callback?

> +		} else
> +			host->ops->set_clock(host, host->clock);
>  	} else
>  		sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
>  
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index d7929d725730..3d4ab68f133f 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -477,6 +477,8 @@ struct sdhci_host {
>   * block count.
>   */
>  #define SDHCI_QUIRK2_USE_32BIT_BLK_CNT			(1<<18)
> +/* controller only need to enable card en again after UHS timing was changed */
> +#define SDHCI_QUIRK2_RE_ENABLE_CARD_EN			(1<<19)

A quirk without any users is not useful.  Please also send the driver
change that uses this quirk, although as I wrote above, the ->set_clock()
callback should be used instead.

>  
>  	int irq;		/* Device IRQ */
>  	void __iomem *ioaddr;	/* Mapped address */




[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux