[PATCH 2/8] mmc: sdhci-cadence: Use max-frequency property from device tree
Peng Fan
peng.fan at oss.nxp.com
Tue Nov 18 07:13:46 CET 2025
On Mon, Nov 10, 2025 at 09:37:31AM -0800, Tanmay Kathpalia wrote:
>When f_max parameter is 0 in sdhci_setup_cfg(), the function defaults
>to using the maximum frequency from host controller capabilities register
>instead of the max-frequency property parsed from device tree.
>
>The max-frequency property from device tree is parsed by mmc_of_parse()
>and stored in plat->cfg.f_max, but sdhci_setup_cfg() was being called
>with f_max=0, causing it to ignore the device tree value and use the
>host capabilities register value instead.
>
>Fix this by passing plat->cfg.f_max to sdhci_setup_cfg() to ensure
>the device tree specified maximum frequency is respected over the
>hardware default.
>
>Signed-off-by: Tanmay Kathpalia <tanmay.kathpalia at altera.com>
>Reviewed-by: Balsundar Ponnusamy <balsundar.ponnusamy at altera.com>
>---
> drivers/mmc/sdhci-cadence.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/mmc/sdhci-cadence.c b/drivers/mmc/sdhci-cadence.c
>index d9fda902076..f31437e5eeb 100644
>--- a/drivers/mmc/sdhci-cadence.c
>+++ b/drivers/mmc/sdhci-cadence.c
>@@ -255,7 +255,7 @@ static int sdhci_cdns_probe(struct udevice *dev)
>
> host->mmc = &plat->mmc;
> host->mmc->dev = dev;
>- ret = sdhci_setup_cfg(&plat->cfg, host, 0, 0);
>+ ret = sdhci_setup_cfg(&plat->cfg, host, plat->cfg.f_max, 0);
plat is allocated by setting plat_auto in U_BOOT_DRIVER, but it is not
zeroed. So f_max maybe a random value if max frequency is not set in
device tree. You need clear it before mmc_of_parse or
change to use dev_read_u32_default for parsing max frequency in mmc_of_parse.
Regards
Peng
> if (ret)
> return ret;
>
>--
>2.43.7
>
>
More information about the U-Boot
mailing list