Use dev_read_u32_default() instead of dev_read_u32() to read the
"max-frequency" property from device tree. This preserves the driver-set
cfg->f_max value when the optional "max-frequency" property is not
present, ensuring the controller's default frequency is used as fallback
rather than being overwritten.
Suggested-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Tanmay Kathpalia <tanmay.kathpalia@altera.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
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" DT property.
+ * Use dev_read_u32_default() to preserve the driver-set f_max value when
+ * "max-frequency" is not present, ensuring the controller's default is used.
+ */
+ cfg->f_max = dev_read_u32_default(dev, "max-frequency", cfg->f_max);
if (dev_read_bool(dev, "cap-sd-highspeed"))
cfg->host_caps |= MMC_CAP(SD_HS);