diff options
| author | Tanmay Kathpalia <[email protected]> | 2026-01-16 04:50:31 -0800 |
|---|---|---|
| committer | Peng Fan <[email protected]> | 2026-01-22 10:38:48 +0800 |
| commit | efc26685682987e1bea06bd821d7960501326edf (patch) | |
| tree | 8db929d9a522fcd666c1338c619ad59c5a6b217b /drivers | |
| parent | dab2c154f605b2f6742aa107dab2b55b9824fdf5 (diff) | |
mmc: mmc-uclass: Use max-frequency from device tree with driver default fallback
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 <[email protected]>
Signed-off-by: Tanmay Kathpalia <[email protected]>
Signed-off-by: Peng Fan <[email protected]>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/mmc/mmc-uclass.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c index 2f4dc5bd887..698530088fe 100644 --- a/drivers/mmc/mmc-uclass.c +++ b/drivers/mmc/mmc-uclass.c @@ -243,8 +243,12 @@ 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" 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); |
