git: e70868afa99d - main - mmc: Allow HS400ES with HS400 at a single I/O voltage

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Thu, 26 Nov 2026 16:26:24 UTC
The branch main has been updated by mhorne:

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

commit e70868afa99d40087363d6478488a9904459be71
Author:     Han Gao <gaohan@iscas.ac.cn>
AuthorDate: 2026-10-29 22:01:58 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2026-11-26 16:24:11 +0000

    mmc: Allow HS400ES with HS400 at a single I/O voltage
    
    mmc_host_timing() allows HS400ES only if the host supports HS400 at
    both 1.2 V and 1.8 V.  A host with only 1.8 V I/O, such as the Zhihe
    A210, gets plain HS400 instead, which needs tuning in HS200 first.
    
    Accept HS400 at either voltage, as the plain HS400 check does, and use
    the same rule in the sdhci capability printout.
    
    Signed-off-by:  Han Gao <gaohan@iscas.ac.cn>
    Reviewed by:    imp
    MFC after:      1 week
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/2523
---
 sys/dev/mmc/mmc.c     | 5 +++--
 sys/dev/sdhci/sdhci.c | 6 ++----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/sys/dev/mmc/mmc.c b/sys/dev/mmc/mmc.c
index f4ea8faca35c..969fd7b537b9 100644
--- a/sys/dev/mmc/mmc.c
+++ b/sys/dev/mmc/mmc.c
@@ -1554,8 +1554,9 @@ mmc_host_timing(device_t dev, enum mmc_bus_timing timing)
 		return (HOST_TIMING_CAP(host_caps, MMC_CAP_MMC_HS400_120) ||
 			HOST_TIMING_CAP(host_caps, MMC_CAP_MMC_HS400_180));
 	case bus_timing_mmc_hs400es:
-		return (HOST_TIMING_CAP(host_caps, MMC_CAP_MMC_HS400 |
-		    MMC_CAP_MMC_ENH_STROBE));
+		return (HOST_TIMING_CAP(host_caps, MMC_CAP_MMC_ENH_STROBE) &&
+		    (HOST_TIMING_CAP(host_caps, MMC_CAP_MMC_HS400_120) ||
+		    HOST_TIMING_CAP(host_caps, MMC_CAP_MMC_HS400_180)));
 	}
 
 #undef HOST_TIMING_CAP
diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c
index 4de70fcd1393..5d43dab81f14 100644
--- a/sys/dev/sdhci/sdhci.c
+++ b/sys/dev/sdhci/sdhci.c
@@ -319,10 +319,8 @@ sdhci_dumpcaps_buf(struct sdhci_slot *slot, struct sbuf *s)
 		    (host_caps & MMC_CAP_MMC_DDR52) ? " DDR52" : "",
 		    (host_caps & MMC_CAP_MMC_HS200) ? " HS200" : "",
 		    (host_caps & MMC_CAP_MMC_HS400) ? " HS400" : "",
-		    ((host_caps &
-		    (MMC_CAP_MMC_HS400 | MMC_CAP_MMC_ENH_STROBE)) ==
-		    (MMC_CAP_MMC_HS400 | MMC_CAP_MMC_ENH_STROBE)) ?
-		    " HS400ES" : "");
+		    ((host_caps & MMC_CAP_MMC_HS400) &&
+		    (host_caps & MMC_CAP_MMC_ENH_STROBE)) ? " HS400ES" : "");
 	if (host_caps & (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
 	    MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104))
 		slot_sprintf(slot, s, "UHS-I:%s%s%s%s%s\n",