git: 6b3071c70e64 - stable/13 - mmc_da: create disk(9) for pre-2.0 SD cards

From: Andriy Gapon <avg_at_FreeBSD.org>
Date: Thu, 17 Feb 2022 06:57:34 UTC
The branch stable/13 has been updated by avg:

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

commit 6b3071c70e64650313b851024c70b828b1bedecf
Author:     Andriy Gapon <avg@FreeBSD.org>
AuthorDate: 2022-01-27 16:49:27 +0000
Commit:     Andriy Gapon <avg@FreeBSD.org>
CommitDate: 2022-02-17 06:56:56 +0000

    mmc_da: create disk(9) for pre-2.0 SD cards
    
    It does not look like there is anything in mmc_da code that actually
    requires protocol 2.0 or later.  dev/mmc code also does not have such a
    restriction.
    
    Tested with a very old 2GB mini-SD card.  Prior to this change mmc_da
    would claim the card but would not expose it to GEOM.
    
    Without MMCCAM:
     mmc0: <MMC/SD bus> on sdhci_pci0
     mmc0: Probing bus
     mmc0: SD probe: OK (OCR: 0x00ff8000)
     mmc0: Current OCR: 0x00ff8000
     mmc0: CMD8 failed, RESULT: 1
     mmc0: Probing cards
     mmc0: New card detected (CID 1c53565344432020100002982e007600)
     mmc0: New card detected (CSD 005e00325f5a83d02db7ffbf96800000)
     mmc0: Card at relative address 0xb368 added:
     mmc0:  card: SD SDC   1.0 SN 0002982E MFG 06/2007 by 28 SV
     mmc0:  quirks: 0
     mmc0:  bus: 4bit, 50MHz (high speed timing)
     mmc0:  memory: 3998720 blocks, erase sector 256 blocks
     mmc0: setting transfer rate to 50.000MHz (high speed timing)
     GEOM: new disk mmcsd0
     mmcsd0: 2GB <SD SDC   1.0 SN 0002982E MFG 06/2007 by 28 SV> at mmc0 50.0MHz/4bit/65535-block
     mmc0: setting bus width to 4 bits high speed timing
    
    With MMCCAM and this change:
     sdda0 at sdhci_slot0 bus 0 scbus2 target 0 lun 0
     sdda0: Relative addr: 0000b368
     Card features: <Memory>
     sdda0: Serial Number 0002982E
     sdda0: SD SDC   1.0 SN 0002982E MFG 06/2007 by 28 SV
     GEOM: new disk sdda0
    
    (cherry picked from commit 6fd84a627fa066a98777c7ab1e65bdd885407516)
---
 sys/cam/mmc/mmc_da.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/cam/mmc/mmc_da.c b/sys/cam/mmc/mmc_da.c
index 15e80fe879c9..e13bee75c216 100644
--- a/sys/cam/mmc/mmc_da.c
+++ b/sys/cam/mmc/mmc_da.c
@@ -1478,7 +1478,7 @@ finish_hs_tests:
 	/* MMC partitions support */
 	if (mmcp->card_features & CARD_FEATURE_MMC && mmc_get_spec_vers(periph) >= 4) {
 		sdda_process_mmc_partitions(periph, start_ccb);
-	} else if (mmcp->card_features & CARD_FEATURE_SD20) {
+	} else if (mmcp->card_features & CARD_FEATURE_MEMORY) {
 		/* For SD[HC] cards, just add one partition that is the whole card */
 		if (sdda_add_part(periph, 0, "sdda",
 		    periph->unit_number,