Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/sunxi enable DDR and HS200 modes only on boards...



details:   https://anonhg.NetBSD.org/src/rev/76212c43f983
branches:  trunk
changeset: 969944:76212c43f983
user:      macallan <macallan%NetBSD.org@localhost>
date:      Sat Mar 07 00:51:10 2020 +0000

description:
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@

diffstat:

 sys/arch/arm/sunxi/sunxi_mmc.c |  17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diffs (47 lines):

diff -r 80ddee11dac6 -r 76212c43f983 sys/arch/arm/sunxi/sunxi_mmc.c
--- a/sys/arch/arm/sunxi/sunxi_mmc.c    Fri Mar 06 20:46:12 2020 +0000
+++ b/sys/arch/arm/sunxi/sunxi_mmc.c    Sat Mar 07 00:51:10 2020 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 @@
        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 @@
                       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)



Home | Main Index | Thread Index | Old Index