Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Sep 2021 12:59:40 GMT
From:      Jessica Clarke <jrtc27@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 4a331971d2f1 - main - mmc: Fix regression in 8a8166e5bcfb breaking Stratix 10 boot
Message-ID:  <202109291259.18TCxeJP035491@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jrtc27:

URL: https://cgit.FreeBSD.org/src/commit/?id=4a331971d2f1083f35b87197da0614fa3e0e53cb

commit 4a331971d2f1083f35b87197da0614fa3e0e53cb
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2021-09-29 12:59:13 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2021-09-29 12:59:13 +0000

    mmc: Fix regression in 8a8166e5bcfb breaking Stratix 10 boot
    
    The refactoring in 8a8166e5bcfb 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:  8a8166e5bcfb ("mmc: switch mmc_helper to device_ api")
    Reviewed by:    manu, mw
    Differential Revision:  https://reviews.freebsd.org/D32209
---
 sys/dev/mmc/mmc_helpers.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/dev/mmc/mmc_helpers.c b/sys/dev/mmc/mmc_helpers.c
index 0e1e16666367..1a90f291fc47 100644
--- a/sys/dev/mmc/mmc_helpers.c
+++ b/sys/dev/mmc/mmc_helpers.c
@@ -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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109291259.18TCxeJP035491>