Skip to contentSkip to conversation

mmc: sdhci: Fix the SD tuning issue that the SDHCI_TRANSFER_MODE is cleared incorrectly

PATCH In review Charl Liu 3 participants 3 messages Nov 11, 2022 – Nov 18, 2022

Subsystems (2)
lore
Share & tools
lore

Charl Liu

author
#0 lore raw

PATCH v3 1/1 mmc: sdhci: Fix the SD tuning issue that the SDHCI_TRANSFER_MODE is cleared incorrectly

When cmd->opcode == MMC_SEND_TUNING_BLOCK, the SDHCI_TRANSFER_MODE should also be kept

---
change in V1:
Keeping the SDHCI_TRANSFER_MODE when cmd->opcode == MMC_END_TUNING_BLOCK

change in V2:
add the mmc_op_tuning interface to judge if the opcode is tuning CMD

change in V3:
cancel the redundant code

---
 drivers/mmc/host/sdhci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/sdhci.c +1 -1
index fef03de85b99..98ee688de50d 100644
@@ -1465,7 +1465,7 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host,
 		if (host->quirks2 &
 			SDHCI_QUIRK2_CLEAR_TRANSFERMODE_REG_BEFORE_CMD) {
 			/* must not clear SDHCI_TRANSFER_MODE when tuning */
-			if (cmd->opcode != MMC_SEND_TUNING_BLOCK_HS200)
+			if (!mmc_op_tuning(cmd->opcode))
 				sdhci_writew(host, 0x0, SDHCI_TRANSFER_MODE);
 		} else {
 		/* clear Auto CMD settings for no data CMDs */
Signature · 1 line
2.32.0
maintainer Acked-by on v3 1/1
#1 lore raw
Quoted 4 lines · Charl Liu

When cmd->opcode == MMC_SEND_TUNING_BLOCK, the SDHCI_TRANSFER_MODE should also be kept

Quoted 26 lines

---
change in V1:
Keeping the SDHCI_TRANSFER_MODE when cmd->opcode == MMC_END_TUNING_BLOCK

change in V2:
add the mmc_op_tuning interface to judge if the opcode is tuning CMD

change in V3:
cancel the redundant code

---
 drivers/mmc/host/sdhci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/sdhci.c +1 -1
index fef03de85b99..98ee688de50d 100644
@@ -1465,7 +1465,7 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host,
 		if (host->quirks2 &
 			SDHCI_QUIRK2_CLEAR_TRANSFERMODE_REG_BEFORE_CMD) {
 			/* must not clear SDHCI_TRANSFER_MODE when tuning */
-			if (cmd->opcode != MMC_SEND_TUNING_BLOCK_HS200)
+			if (!mmc_op_tuning(cmd->opcode))
 				sdhci_writew(host, 0x0, SDHCI_TRANSFER_MODE);
 		} else {
 		/* clear Auto CMD settings for no data CMDs */
#2 lore raw
In reply to Charl Liu
Quoted 5 lines · Charl Liu

When cmd->opcode == MMC_SEND_TUNING_BLOCK, the SDHCI_TRANSFER_MODE should also be kept

Applied for next, thanks!

Kind regards
Uffe

Quoted 29 lines

---
change in V1:
Keeping the SDHCI_TRANSFER_MODE when cmd->opcode == MMC_END_TUNING_BLOCK

change in V2:
add the mmc_op_tuning interface to judge if the opcode is tuning CMD

change in V3:
cancel the redundant code

---
 drivers/mmc/host/sdhci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/sdhci.c +1 -2
index fef03de85b99..98ee688de50d 100644
@@ -1465,7 +1465,7 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host,
                if (host->quirks2 &
                        SDHCI_QUIRK2_CLEAR_TRANSFERMODE_REG_BEFORE_CMD) {
                        /* must not clear SDHCI_TRANSFER_MODE when tuning */
-                       if (cmd->opcode != MMC_SEND_TUNING_BLOCK_HS200)
+                       if (!mmc_op_tuning(cmd->opcode))
                                sdhci_writew(host, 0x0, SDHCI_TRANSFER_MODE);
                } else {
                /* clear Auto CMD settings for no data CMDs */
--

2.32.0