git: 6b649b145231 - stable/15 - sdhci: don't infer a non-removable slot on Apollo Lake SDXC

From: Abdelkader Boudih <seuros_at_FreeBSD.org>
Date: Sun, 01 Nov 2026 18:35:45 UTC
The branch stable/15 has been updated by seuros:

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

commit 6b649b145231cedc29519a322f3dfa9dcc725e03
Author:     Abdelkader Boudih <seuros@FreeBSD.org>
AuthorDate: 2026-07-29 19:24:46 +0000
Commit:     Abdelkader Boudih <seuros@FreeBSD.org>
CommitDate: 2026-11-01 17:01:42 +0000

    sdhci: don't infer a non-removable slot on Apollo Lake SDXC
    
    Intel Apollo Lake SDXC controller reports a Slot Type of
    "Embedded Slot for One Device" in SDHCI_CAPABILITIES bits, even
    when the slot is a removable card reader.
    This caused 48 timeouts before the boot sequence resumed.
    
    Reviewed by:    imp
    Differential Revision:  https://reviews.freebsd.org/D58467
    
    (cherry picked from commit 248d537e4ca7295a08bab60e82633d332d36e525)
---
 sys/dev/sdhci/sdhci.c     | 3 ++-
 sys/dev/sdhci/sdhci.h     | 2 ++
 sys/dev/sdhci/sdhci_pci.c | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c
index b53b85bf44c2..a4d13a8cdeee 100644
--- a/sys/dev/sdhci/sdhci.c
+++ b/sys/dev/sdhci/sdhci.c
@@ -901,7 +901,8 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, int num)
 			SDHCI_LOCK_DESTROY(slot);
 			return (ENXIO);
 		} else if ((caps & SDHCI_SLOTTYPE_MASK) ==
-		    SDHCI_SLOTTYPE_EMBEDDED) {
+		    SDHCI_SLOTTYPE_EMBEDDED &&
+		    !(slot->quirks & SDHCI_QUIRK_SLOTTYPE_BROKEN)) {
 			slot->opt |= SDHCI_SLOT_EMBEDDED | SDHCI_NON_REMOVABLE;
 		}
 	}
diff --git a/sys/dev/sdhci/sdhci.h b/sys/dev/sdhci/sdhci.h
index c5b2f24061ae..7f18ce2325c3 100644
--- a/sys/dev/sdhci/sdhci.h
+++ b/sys/dev/sdhci/sdhci.h
@@ -95,6 +95,8 @@
 #define	SDHCI_QUIRK_MMC_HS400_IF_CAN_SDR104		(1 << 29)
 /* SDMA boundary in SDHCI_BLOCK_SIZE broken - use front-end supplied value. */
 #define	SDHCI_QUIRK_BROKEN_SDMA_BOUNDARY		(1 << 30)
+/* Slot type in SDHCI_CAPABILITIES reads as embedded, but slot is removable. */
+#define	SDHCI_QUIRK_SLOTTYPE_BROKEN			(1U << 31)
 
 /*
  * Controller registers
diff --git a/sys/dev/sdhci/sdhci_pci.c b/sys/dev/sdhci/sdhci_pci.c
index 4cd007db904a..9d57df49681a 100644
--- a/sys/dev/sdhci/sdhci_pci.c
+++ b/sys/dev/sdhci/sdhci_pci.c
@@ -142,6 +142,7 @@ static const struct sdhci_device {
 	{ 0x5aca8086,	0xffff,	"Intel Apollo Lake SDXC Controller",
 	    SDHCI_QUIRK_BROKEN_DMA |	/* APL18 erratum */
 	    SDHCI_QUIRK_WAIT_WHILE_BUSY |
+	    SDHCI_QUIRK_SLOTTYPE_BROKEN |
 	    SDHCI_QUIRK_PRESET_VALUE_BROKEN },
 	{ 0x5acc8086,	0xffff,	"Intel Apollo Lake eMMC 5.0 Controller",
 	    SDHCI_QUIRK_BROKEN_DMA |	/* APL18 erratum */