git: 7aa6014fb16f - stable/13 - mmc: Fix HS200/HS400 capability check

From: Marcin Wojtas <mw_at_FreeBSD.org>
Date: Mon, 07 Mar 2022 11:19:56 UTC
The branch stable/13 has been updated by mw:

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

commit 7aa6014fb16f68f8966a5155a968c6611d7cce72
Author:     Kornel Duleba <mindal@semihalf.com>
AuthorDate: 2021-11-28 11:24:07 +0000
Commit:     Marcin Wojtas <mw@FreeBSD.org>
CommitDate: 2022-03-07 11:19:28 +0000

    mmc: Fix HS200/HS400 capability check
    
    HS200 and HS400 speeds can be enabled either with 1.2, or 1.8V signaling voltage.
    Because of that we have four cabability flags: MMC_CAP_MMC_HS200_120,
    MMC_CAP_MMC_HS200_180, MMC_CAP_MMC_HS400_120, MMC_CAP_MMC_HS400_180.
    
    MMC logic only enables HS200/HS400 mode if both flags are set for the corresponding speed.
    Fix that by being more permissive in host timing cap check.
    
    Reviewed by: manu, mw
    MFC after: 2 weeks
    Obtained from: Semihalf
    Sponsored by: Alstom Group
    Differential revision: https://reviews.freebsd.org/D33130
    
    (cherry picked from commit 8661e085fb953855dbc7059f21a64a05ae61b22c)
---
 sys/dev/mmc/mmc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys/dev/mmc/mmc.c b/sys/dev/mmc/mmc.c
index 6e1d55639284..24501080a971 100644
--- a/sys/dev/mmc/mmc.c
+++ b/sys/dev/mmc/mmc.c
@@ -1549,9 +1549,11 @@ mmc_host_timing(device_t dev, enum mmc_bus_timing timing)
 	case bus_timing_mmc_ddr52:
 		return (HOST_TIMING_CAP(host_caps, MMC_CAP_MMC_DDR52));
 	case bus_timing_mmc_hs200:
-		return (HOST_TIMING_CAP(host_caps, MMC_CAP_MMC_HS200));
+		return (HOST_TIMING_CAP(host_caps, MMC_CAP_MMC_HS200_120) ||
+			HOST_TIMING_CAP(host_caps, MMC_CAP_MMC_HS200_180));
 	case bus_timing_mmc_hs400:
-		return (HOST_TIMING_CAP(host_caps, MMC_CAP_MMC_HS400));
+		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));