mmc: Fix regression in 8a8166e5bc breaking Stratix 10 boot

The refactoring in 8a8166e5bc introduced a functional change that
breaks booting on the Stratix 10, hanging when it should be attaching
da0. Previously OF_getencprop was called with a pointer to host->f_max,
so if it wasn't present then the existing value was left untouched, but
after that commit it will instead clobber the value with 0. The dwmmc
driver, as used on the Stratix 10, sets a default value before calling
mmc_fdt_parse and so was broken by this functional change. It appears
that aw_mmc also does the same thing, so was presumably also broken on
some boards.

Fixes:	8a8166e5bc ("mmc: switch mmc_helper to device_ api")
Reviewed by:	manu, mw
Differential Revision:	https://reviews.freebsd.org/D32209
This commit is contained in:
Jessica Clarke 2021-09-29 13:59:13 +01:00
parent c39eefe715
commit 4a331971d2

View file

@ -105,9 +105,9 @@ mmc_parse(device_t dev, struct mmc_helper *helper, struct mmc_host *host)
* if it's not present based on the clock that the mmc controller
* operates on
*/
max_freq = 0;
device_get_property(dev, "max-frequency", &max_freq, sizeof(uint64_t));
host->f_max = max_freq;
if (device_get_property(dev, "max-frequency", &max_freq,
sizeof(uint64_t)) > 0)
host->f_max = max_freq;
if (device_has_property(dev, "broken-cd"))
helper->props |= MMC_PROP_BROKEN_CD;