Patch "mmc: core: Fix inconsistent sd3_bus_mode at UHS-I SD voltage switch failure" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    mmc: core: Fix inconsistent sd3_bus_mode at UHS-I SD voltage switch failure

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mmc-core-fix-inconsistent-sd3_bus_mode-at-uhs-i-sd-v.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 4eee75815be102dbe98bf33711acd23769cee62e
Author: Adrian Hunter <adrian.hunter@xxxxxxxxx>
Date:   Mon Aug 15 10:33:21 2022 +0300

    mmc: core: Fix inconsistent sd3_bus_mode at UHS-I SD voltage switch failure
    
    [ Upstream commit 63f1560930e4e1c4f6279b8ae715c9841fe1a6d3 ]
    
    If re-initialization results is a different signal voltage, because the
    voltage switch failed previously, but not this time (or vice versa), then
    sd3_bus_mode will be inconsistent with the card because the SD_SWITCH
    command is done only upon first initialization.
    
    Fix by always reading SD_SWITCH information during re-initialization, which
    also means it does not need to be re-read later for the 1.8V fixup
    workaround.
    
    Note, brief testing showed SD_SWITCH took about 1.8ms to 2ms which added
    about 1% to 1.5% to the re-initialization time, so it's not particularly
    significant.
    
    Reported-by: Seunghui Lee <sh043.lee@xxxxxxxxxxx>
    Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>
    Reviewed-by: Seunghui Lee <sh043.lee@xxxxxxxxxxx>
    Tested-by: Seunghui Lee <sh043.lee@xxxxxxxxxxx>
    Cc: stable@xxxxxxxxxxxxxxx
    Link: https://lore.kernel.org/r/20220815073321.63382-3-adrian.hunter@xxxxxxxxx
    Signed-off-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 0b09cdaaeb6c..899768ed1688 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -932,15 +932,16 @@ int mmc_sd_setup_card(struct mmc_host *host, struct mmc_card *card,
 
 		/* Erase init depends on CSD and SSR */
 		mmc_init_erase(card);
-
-		/*
-		 * Fetch switch information from card.
-		 */
-		err = mmc_read_switch(card);
-		if (err)
-			return err;
 	}
 
+	/*
+	 * Fetch switch information from card. Note, sd3_bus_mode can change if
+	 * voltage switch outcome changes, so do this always.
+	 */
+	err = mmc_read_switch(card);
+	if (err)
+		return err;
+
 	/*
 	 * For SPI, enable CRC as appropriate.
 	 * This CRC enable is located AFTER the reading of the
@@ -1089,26 +1090,15 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
 	if (!v18_fixup_failed && !mmc_host_is_spi(host) && mmc_host_uhs(host) &&
 	    mmc_sd_card_using_v18(card) &&
 	    host->ios.signal_voltage != MMC_SIGNAL_VOLTAGE_180) {
-		/*
-		 * Re-read switch information in case it has changed since
-		 * oldcard was initialized.
-		 */
-		if (oldcard) {
-			err = mmc_read_switch(card);
-			if (err)
-				goto free_card;
-		}
-		if (mmc_sd_card_using_v18(card)) {
-			if (mmc_host_set_uhs_voltage(host) ||
-			    mmc_sd_init_uhs_card(card)) {
-				v18_fixup_failed = true;
-				mmc_power_cycle(host, ocr);
-				if (!oldcard)
-					mmc_remove_card(card);
-				goto retry;
-			}
-			goto cont;
+		if (mmc_host_set_uhs_voltage(host) ||
+		    mmc_sd_init_uhs_card(card)) {
+			v18_fixup_failed = true;
+			mmc_power_cycle(host, ocr);
+			if (!oldcard)
+				mmc_remove_card(card);
+			goto retry;
 		}
+		goto cont;
 	}
 
 	/* Initialization sequence for UHS-I cards */



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux