mmc: do not overwrite cfg->f_max if "max-frequency" if missing
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 29 Dec 2017 17:00:06 +0000 (02:00 +0900)
committerJaehoon Chung <jh80.chung@samsung.com>
Mon, 22 Jan 2018 05:11:58 +0000 (14:11 +0900)
mmc_of_parse() in U-Boot is a pussy helper; it sets cfg->f_max to
52MHz even if DT does not provide "max-frequency" at all.  This can
overwrite cfg->f_max that may have been set to a reasonable default.

As the DT binding says, "max-frequency" is an optional property.
Do nothing if DT does not specify it.  This is the behavior of
mmc_of_parse() in Linux.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
drivers/mmc/mmc-uclass.c

index 26c6ab7ad1fde014f6680e594ba62abc6ab9c238..7910a3e278da785c6b53b0819742112d98fd0de8 100644 (file)
@@ -146,7 +146,8 @@ int mmc_of_parse(struct udevice *dev, struct mmc_config *cfg)
                break;
        }
 
-       cfg->f_max = dev_read_u32_default(dev, "max-frequency", 52000000);
+       /* f_max is obtained from the optional "max-frequency" property */
+       dev_read_u32(dev, "max-frequency", &cfg->f_max);
 
        if (dev_read_bool(dev, "cap-sd-highspeed"))
                cfg->host_caps |= MMC_CAP(SD_HS);