mmc:sdhci:Fix the SD tuning CMD parameter issue that the SDHCI_TRANSFER_MODE is cleared from read direction to write direction incorrectly
PATCH 1/1 mmc:sdhci:Fix the SD tuning CMD parameter issue that the SDHCI_TRANSFER_MODE is cleared from read direction to write direction 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
--- drivers/mmc/host/sdhci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci.c +2 -1
@@ -1430,7 +1430,8 @@ 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 ((cmd->opcode !=MMC_SEND_TUNING_BLOCK_HS200 ) && + (cmd->opcode !=MMC_SEND_TUNING_BLOCK ))sdhci_writew (host,0x0 ,SDHCI_TRANSFER_MODE ); }else {/* clear Auto CMD settings for no data CMDs */
Signature · 1 line
2.32.0
Adrian Hunter
maintainerQuoted 17 lines · Charl Liu
When
cmd->opcode==MMC_SEND_TUNING_BLOCK, theSDHCI_TRANSFER_MODEshould also be keptSigned-off-by Charl Liu <[email protected]>---
Change in V1:
Keeping theSDHCI_TRANSFER_MODEwhencmd->opcode==MMC_END_TUNING_BLOCK--- drivers/mmc/host/sdhci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/mmc/host/sdhci.c +0
-0
drivers/mmc/host/sdhci.c static void sdhci_set_transfer_mode(struct sdhci_host *host, · line 1434
Quoted 6 lines
drivers/mmc/host/sdhci.c +2
-1@@ -1430,7 +1430,8 @@ 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 ((cmd->opcode !=MMC_SEND_TUNING_BLOCK_HS200 ) && + (cmd->opcode !=MMC_SEND_TUNING_BLOCK ))
mmc_op_tuning() could be used here
Quoted 3 lines
drivers/mmc/host/sdhci.c +0
-0sdhci_writew (host,0x0 ,SDHCI_TRANSFER_MODE ); }else {/* clear Auto CMD settings for no data CMDs */
Hi, Adrian,
Sorry response you so late.
Does your comment "mmc_op_tuning() could be used here" means that we should use mmc_send_tuning() instead of sdhci_send_tuning?
If yes, I think we need add below patch commit by Charl Liu for those reasons:
1.Bayhub host tuning command does not have a data payload and our hardware does it automatically, so mmc_send_tuning() will return -EIO. 2.Bayhub host can be used for both SD and eMMC cards.
3.Both MMC_SEND_TUNING_BLOCK and MMC_SEND_TUNING_BLOCK_HS200 are tuning command opcode, maybe the same logical at here is better?
BR,
Chevron
-----邮件原件-----
发件人: Adrian Hunter <[email protected]>
发送时间: Sunday, July 24, 2022 15:22
收件人: Charl Liu (WH) <[email protected]>; [email protected]; [email protected]; [email protected]
抄送: Shaper Liu (WH) <[email protected]>; Chevron Li (WH) <[email protected]>; Thomas Hu(WH) <[email protected]>; XiaoGuang Yu (WH) <[email protected]>; Shirley Her(SC) <[email protected]> 主题: Re: [PATCH V1 1/1] mmc:sdhci:Fix the SD tuning CMD parameter issue that the SDHCI_TRANSFER_MODE is cleared from read direction to write direction incorrectly
Quoted 17 lines · Charl Liu
When
cmd->opcode==MMC_SEND_TUNING_BLOCK, theSDHCI_TRANSFER_MODEshould also be keptSigned-off-by Charl Liu <[email protected]>---
Change in V1:
Keeping theSDHCI_TRANSFER_MODEwhencmd->opcode==MMC_END_TUNING_BLOCK--- drivers/mmc/host/sdhci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/mmc/host/sdhci.c index renamed from drivers/mmc/host/sdhci.c +0
-0
22152029e14c..6a0f6725dadb100644
drivers/mmc/host/sdhci.c static void sdhci_set_transfer_mode(struct sdhci_host *host, · line 1434
Quoted 6 lines
drivers/mmc/host/sdhci.c +2
-1@@ -1430,7 +1430,8 @@ 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 ((cmd->opcode !=MMC_SEND_TUNING_BLOCK_HS200 ) && + (cmd->opcode !=MMC_SEND_TUNING_BLOCK ))
mmc_op_tuning() could be used here
Quoted 3 lines
drivers/mmc/host/sdhci.c +0
-0sdhci_writew (host,0x0 ,SDHCI_TRANSFER_MODE ); }else {/* clear Auto CMD settings for no data CMDs */
Adrian Hunter
maintainerQuoted 5 lines · Chevron Li (WH)
Hi, Adrian,
Sorry response you so late.
Does your comment "
mmc_op_tuning()could be used here" means that we should usemmc_send_tuning()instead ofsdhci_send_tuning?
I just meant, instead of:
- if (cmd->opcode != MMC_SEND_TUNING_BLOCK_HS200)
+ if ((cmd->opcode != MMC_SEND_TUNING_BLOCK_HS200) &&
+ (cmd->opcode != MMC_SEND_TUNING_BLOCK))
this is simpler:
- if (cmd->opcode != MMC_SEND_TUNING_BLOCK_HS200)
+ if (!mmc_op_tuning(cmd->opcode))
Quoted 47 lines
If yes, I think we need add below patch commit by Charl Liu for those reasons:
1.Bayhub host tuning command does not have a data payload and our hardware does it automatically, sommc_send_tuning()will return-EIO. 2.Bayhub host can be used for both SD and eMMC cards.
3.BothMMC_SEND_TUNING_BLOCKandMMC_SEND_TUNING_BLOCK_HS200are tuning command opcode, maybe the same logical at here is better?BR,
Chevron-----邮件原件-----
发件人: Adrian Hunter <[email protected]>
发送时间: Sunday, July 24, 2022 15:22
收件人: Charl Liu (WH) <[email protected]>; [email protected]; [email protected]; [email protected]
抄送: Shaper Liu (WH) <[email protected]>; Chevron Li (WH) <[email protected]>; Thomas Hu(WH) <[email protected]>; XiaoGuang Yu (WH) <[email protected]>; Shirley Her(SC) <[email protected]> 主题: Re: [PATCH V1 1/1] mmc:sdhci:Fix the SD tuning CMD parameter issue that theSDHCI_TRANSFER_MODEis cleared from read direction to write direction incorrectlyQuoted 17 lines · Charl Liu
When
cmd->opcode==MMC_SEND_TUNING_BLOCK, theSDHCI_TRANSFER_MODEshould also be keptSigned-off-by Charl Liu <[email protected]>---
Change in V1:
Keeping theSDHCI_TRANSFER_MODEwhencmd->opcode==MMC_END_TUNING_BLOCK--- drivers/mmc/host/sdhci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/mmc/host/sdhci.c index renamed from drivers/mmc/host/sdhci.c +0
-0
22152029e14c..6a0f6725dadb100644drivers/mmc/host/sdhci.c static void sdhci_set_transfer_mode(struct sdhci_host *host, · line 1434
Quoted 6 lines
drivers/mmc/host/sdhci.c +2
-1@@ -1430,7 +1430,8 @@ 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 ((cmd->opcode !=MMC_SEND_TUNING_BLOCK_HS200 ) && + (cmd->opcode !=MMC_SEND_TUNING_BLOCK ))
mmc_op_tuning()could be used hereQuoted 3 lines
drivers/mmc/host/sdhci.c +0
-0sdhci_writew (host,0x0 ,SDHCI_TRANSFER_MODE ); }else {/* clear Auto CMD settings for no data CMDs */