[V3,1/1] mmc: sdhci: Fix the SD tuning issue that the SDHCI_TRANSFER_MODE is cleared incorrectly

Message ID 20221111122314.307-1-charl.liu@bayhubtech.com
State New
Headers
Series [V3,1/1] mmc: sdhci: Fix the SD tuning issue that the SDHCI_TRANSFER_MODE is cleared incorrectly |

Commit Message

Charl Liu Nov. 11, 2022, 12:23 p.m. UTC
  When cmd->opcode == MMC_SEND_TUNING_BLOCK, the SDHCI_TRANSFER_MODE
should also be kept

Signed-off-by: Charl Liu <charl.liu@bayhubtech.com>
---
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(-)
  

Comments

Adrian Hunter Nov. 17, 2022, 7:15 a.m. UTC | #1
On 11/11/22 14:23, Charl Liu wrote:
> When cmd->opcode == MMC_SEND_TUNING_BLOCK, the SDHCI_TRANSFER_MODE
> should also be kept
> 
> Signed-off-by: Charl Liu <charl.liu@bayhubtech.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>


> ---
> 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(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index fef03de85b99..98ee688de50d 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -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 */
  
Ulf Hansson Nov. 18, 2022, 9:45 a.m. UTC | #2
On Fri, 11 Nov 2022 at 13:23, Charl Liu <charl.liu@bayhubtech.com> wrote:
>
> When cmd->opcode == MMC_SEND_TUNING_BLOCK, the SDHCI_TRANSFER_MODE
> should also be kept
>
> Signed-off-by: Charl Liu <charl.liu@bayhubtech.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
> 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(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index fef03de85b99..98ee688de50d 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -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
>
  

Patch

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index fef03de85b99..98ee688de50d 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -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 */