]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
mmc: mmc-uclass: Use max-frequency from device tree with default handling
authorTanmay Kathpalia <tanmay.kathpalia@altera.com>
Wed, 3 Dec 2025 12:21:32 +0000 (04:21 -0800)
committerPeng Fan <peng.fan@nxp.com>
Thu, 11 Dec 2025 12:53:50 +0000 (20:53 +0800)
When the max-frequency property is not specified in the device tree,
the function now explicitly defaults to 0 instead of leaving cfg->f_max
uninitialized. This allows sdhci_setup_cfg() to properly detect the
absence of a device tree specified frequency and fall back to using
the host controller's maximum base clock frequency from the capabilities
register.

Signed-off-by: Tanmay Kathpalia <tanmay.kathpalia@altera.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
drivers/mmc/mmc-uclass.c

index 2f4dc5bd8872305129fcc192ba26bee60e764cd3..bf0bea9385322232e20fa524309f79840a9aa242 100644 (file)
@@ -243,8 +243,13 @@ int mmc_of_parse(struct udevice *dev, struct mmc_config *cfg)
                return -EINVAL;
        }
 
-       /* f_max is obtained from the optional "max-frequency" property */
-       dev_read_u32(dev, "max-frequency", &cfg->f_max);
+       /*
+        * Maximum frequency is obtained from the optional "max-frequency" property.
+        * If not specified in device tree, defaults to 0 and sdhci_setup_cfg()
+        * will set the MMC configuration maximum frequency to the host controller's
+        * maximum base clock frequency from capabilities register.
+        */
+       cfg->f_max = dev_read_u32_default(dev, "max-frequency", 0);
 
        if (dev_read_bool(dev, "cap-sd-highspeed"))
                cfg->host_caps |= MMC_CAP(SD_HS);