git: 0f684b5aec50 - main - Disable HS200 on rockchip_dwmmc in attach

From: Stephen Hurd <shurd_at_FreeBSD.org>
Date: Tue, 18 Mar 2025 17:03:56 UTC
The branch main has been updated by shurd:

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

commit 0f684b5aec50b4766dc2a8f010fd7b9568af5063
Author:     Stephen Hurd <shurd@FreeBSD.org>
AuthorDate: 2025-03-17 07:16:53 +0000
Commit:     Stephen Hurd <shurd@FreeBSD.org>
CommitDate: 2025-03-18 17:01:21 +0000

    Disable HS200 on rockchip_dwmmc in attach
    
    HS200 mode requires tuning, and there is no code to perform this
    tuning at present.  Until there is, leave HS200 mode disabled.
    
    Reviewed by:    manu
    Differential Revision:  https://reviews.freebsd.org/D49400
---
 sys/dev/mmc/host/dwmmc_rockchip.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/sys/dev/mmc/host/dwmmc_rockchip.c b/sys/dev/mmc/host/dwmmc_rockchip.c
index c4b07ac3290e..656e9a9cf09d 100644
--- a/sys/dev/mmc/host/dwmmc_rockchip.c
+++ b/sys/dev/mmc/host/dwmmc_rockchip.c
@@ -78,6 +78,7 @@ rockchip_dwmmc_attach(device_t dev)
 {
 	struct dwmmc_softc *sc;
 	int type;
+	int rc;
 
 	sc = device_get_softc(dev);
 	sc->hwtype = HWTYPE_ROCKCHIP;
@@ -90,8 +91,17 @@ rockchip_dwmmc_attach(device_t dev)
 	}
 
 	sc->update_ios = &dwmmc_rockchip_update_ios;
+	rc = dwmmc_attach(dev);
 
-	return (dwmmc_attach(dev));
+	/*
+	 * Note: It's not that the controller doesn't support HS200,
+	 *       it's that FreeBSD doesn't support tuning.
+	 *       If someone implemented tuning, this could work.
+	 */
+	device_printf(dev, "Disabling HS200+ (tuning code not written)\n");
+	sc->host.caps &= ~(MMC_CAP_MMC_HS200 | MMC_CAP_MMC_HS400);
+
+	return (rc);
 }
 
 static int