Re: [PATCH 2/4] mci: dwcmshc-sdhci: Fix f_max computation

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

 



On 29.02.24 16:56, Yann Sionneau wrote:
> f_max was possibly set from max-frequency DT property
> by mci_of_parse() and then overwritten few lines later
> with the clock frequency, making it impossible to
> reduce the clock frequency from DT.
> 
> Move the call to mci_of_parse() after the first assignment
> to f_max.
> 
> Signed-off-by: Yann Sionneau <ysionneau@xxxxxxxxxxxxx>

Reviewed-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>

> 
> ---
>  drivers/mci/dwcmshc-sdhci.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mci/dwcmshc-sdhci.c b/drivers/mci/dwcmshc-sdhci.c
> index 7cc6fe3f18..d9c51752db 100644
> --- a/drivers/mci/dwcmshc-sdhci.c
> +++ b/drivers/mci/dwcmshc-sdhci.c
> @@ -316,12 +316,17 @@ static int dwcmshc_probe(struct device *dev)
>  	mci->send_cmd = dwcmshc_mci_send_cmd;
>  	mci->card_present = dwcmshc_mci_card_present;
>  
> -	mci_of_parse(&host->mci);
> -
>  	sdhci_setup_host(&host->sdhci);
>  
>  	mci->max_req_size = 0x8000;
> +	/*
> +	 * Let's first initialize f_max to the DT clock freq
> +	 * Then mci_of_parse can override if with the content
> +	 * of the 'max-frequency' DT property if it is present.
> +	 * Then we can finish by computing the f_min.
> +	 */
>  	mci->f_max = clk_get_rate(clk);
> +	mci_of_parse(&host->mci);
>  	mci->f_min = mci->f_max / SDHCI_MAX_DIV_SPEC_300;
>  
>  	dev->priv = host;

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux