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> --- 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; -- 2.43.0