@@ -949,15 +949,16 @@ int mmc_sd_setup_card(struct mmc_host *host, struct mmc_card *card,
949949
950950 /* Erase init depends on CSD and SSR */
951951 mmc_init_erase (card );
952-
953- /*
954- * Fetch switch information from card.
955- */
956- err = mmc_read_switch (card );
957- if (err )
958- return err ;
959952 }
960953
954+ /*
955+ * Fetch switch information from card. Note, sd3_bus_mode can change if
956+ * voltage switch outcome changes, so do this always.
957+ */
958+ err = mmc_read_switch (card );
959+ if (err )
960+ return err ;
961+
961962 /*
962963 * For SPI, enable CRC as appropriate.
963964 * This CRC enable is located AFTER the reading of the
@@ -1480,26 +1481,15 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
14801481 if (!v18_fixup_failed && !mmc_host_is_spi (host ) && mmc_host_uhs (host ) &&
14811482 mmc_sd_card_using_v18 (card ) &&
14821483 host -> ios .signal_voltage != MMC_SIGNAL_VOLTAGE_180 ) {
1483- /*
1484- * Re-read switch information in case it has changed since
1485- * oldcard was initialized.
1486- */
1487- if (oldcard ) {
1488- err = mmc_read_switch (card );
1489- if (err )
1490- goto free_card ;
1491- }
1492- if (mmc_sd_card_using_v18 (card )) {
1493- if (mmc_host_set_uhs_voltage (host ) ||
1494- mmc_sd_init_uhs_card (card )) {
1495- v18_fixup_failed = true;
1496- mmc_power_cycle (host , ocr );
1497- if (!oldcard )
1498- mmc_remove_card (card );
1499- goto retry ;
1500- }
1501- goto done ;
1484+ if (mmc_host_set_uhs_voltage (host ) ||
1485+ mmc_sd_init_uhs_card (card )) {
1486+ v18_fixup_failed = true;
1487+ mmc_power_cycle (host , ocr );
1488+ if (!oldcard )
1489+ mmc_remove_card (card );
1490+ goto retry ;
15021491 }
1492+ goto cont ;
15031493 }
15041494
15051495 /* Initialization sequence for UHS-I cards */
@@ -1534,7 +1524,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
15341524 mmc_set_bus_width (host , MMC_BUS_WIDTH_4 );
15351525 }
15361526 }
1537-
1527+ cont :
15381528 if (!oldcard ) {
15391529 /* Read/parse the extension registers. */
15401530 err = sd_read_ext_regs (card );
@@ -1566,7 +1556,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
15661556 err = - EINVAL ;
15671557 goto free_card ;
15681558 }
1569- done :
1559+
15701560 host -> card = card ;
15711561 return 0 ;
15721562
0 commit comments