Module Name: src Committed By: macallan Date: Sat Mar 7 00:51:10 UTC 2020
Modified Files: src/sys/arch/arm/sunxi: sunxi_mmc.c Log Message: enable DDR and HS200 modes only on boards which claim to support them with this eMMC works on libretech,all-h3-cc-h5 also tested on pinebook ok jmcneill@ To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/sys/arch/arm/sunxi/sunxi_mmc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/arm/sunxi/sunxi_mmc.c diff -u src/sys/arch/arm/sunxi/sunxi_mmc.c:1.40 src/sys/arch/arm/sunxi/sunxi_mmc.c:1.41 --- src/sys/arch/arm/sunxi/sunxi_mmc.c:1.40 Sat Oct 5 12:09:01 2019 +++ src/sys/arch/arm/sunxi/sunxi_mmc.c Sat Mar 7 00:51:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_mmc.c,v 1.40 2019/10/05 12:09:01 jmcneill Exp $ */ +/* $NetBSD: sunxi_mmc.c,v 1.41 2020/03/07 00:51:10 macallan Exp $ */ /*- * Copyright (c) 2014-2017 Jared McNeill <jmcne...@invisible.ca> @@ -29,7 +29,7 @@ #include "opt_sunximmc.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.40 2019/10/05 12:09:01 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.41 2020/03/07 00:51:10 macallan Exp $"); #include <sys/param.h> #include <sys/bus.h> @@ -547,6 +547,14 @@ sunxi_mmc_attach_i(device_t self) const u_int flags = sc->sc_config->flags; struct sdmmcbus_attach_args saa; uint32_t width; + const bool supports_hs200 = + of_hasprop(sc->sc_phandle, "mmc-hs200-1_2v") | + of_hasprop(sc->sc_phandle, "mmc-hs200-1_8v"); + + const bool supports_ddr = + of_hasprop(sc->sc_phandle, "mmc-ddr-1_2v") | + of_hasprop(sc->sc_phandle, "mmc-ddr-1_8v") | + of_hasprop(sc->sc_phandle, "mmc-ddr-3_3v"); if (sc->sc_pwrseq) fdtbus_mmc_pwrseq_pre_power_on(sc->sc_pwrseq); @@ -577,10 +585,11 @@ sunxi_mmc_attach_i(device_t self) SMC_CAPS_SD_HIGHSPEED | SMC_CAPS_MMC_HIGHSPEED; - if (sc->sc_config->delays || (flags & SUNXI_MMC_FLAG_NEW_TIMINGS)) + if ((sc->sc_config->delays || (flags & SUNXI_MMC_FLAG_NEW_TIMINGS)) && + supports_ddr) saa.saa_caps |= SMC_CAPS_MMC_DDR52; - if (flags & SUNXI_MMC_FLAG_HS200) + if ((flags & SUNXI_MMC_FLAG_HS200) != 0 && supports_hs200) saa.saa_caps |= SMC_CAPS_MMC_HS200; if (width == 4)