* [PATCH V2 1/1] mmc:sdhci:Fix the SD tuning issue that the SDHCI_TRANSFER_MODE is cleared incorrectly
@ 2022-11-04 6:42 Charl Liu
2022-11-04 7:22 ` Adrian Hunter
0 siblings, 1 reply; 2+ messages in thread
From: Charl Liu @ 2022-11-04 6:42 UTC (permalink / raw)
To: adrian.hunter, ulf.hansson, linux-mmc, linux-kernel
Cc: shaper.liu, chevron.li, thomas.hu, xiaoguang.yu, shirley.her
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
---
drivers/mmc/host/sdhci.c | 2 +-
include/linux/mmc/mmc.h | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 22152029e14c..9388628215ca 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1430,7 +1430,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 */
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index d9a65c6a8816..d809bdfcc59b 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -99,6 +99,12 @@ static inline bool mmc_op_multi(u32 opcode)
opcode == MMC_READ_MULTIPLE_BLOCK;
}
+static inline bool mmc_op_tuning(u32 opcode)
+{
+ return opcode == MMC_SEND_TUNING_BLOCK ||
+ opcode == MMC_SEND_TUNING_BLOCK_HS200;
+}
+
/*
* MMC_SWITCH argument format:
*
--
2.32.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH V2 1/1] mmc:sdhci:Fix the SD tuning issue that the SDHCI_TRANSFER_MODE is cleared incorrectly
2022-11-04 6:42 [PATCH V2 1/1] mmc:sdhci:Fix the SD tuning issue that the SDHCI_TRANSFER_MODE is cleared incorrectly Charl Liu
@ 2022-11-04 7:22 ` Adrian Hunter
0 siblings, 0 replies; 2+ messages in thread
From: Adrian Hunter @ 2022-11-04 7:22 UTC (permalink / raw)
To: Charl Liu, ulf.hansson, linux-mmc, linux-kernel
Cc: shaper.liu, chevron.li, thomas.hu, xiaoguang.yu, shirley.her
On 4/11/22 08:42, 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>
> ---
> 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
> ---
> drivers/mmc/host/sdhci.c | 2 +-
> include/linux/mmc/mmc.h | 6 ++++++
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 22152029e14c..9388628215ca 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1430,7 +1430,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 */
> diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
> index d9a65c6a8816..d809bdfcc59b 100644
> --- a/include/linux/mmc/mmc.h
> +++ b/include/linux/mmc/mmc.h
> @@ -99,6 +99,12 @@ static inline bool mmc_op_multi(u32 opcode)
> opcode == MMC_READ_MULTIPLE_BLOCK;
> }
>
> +static inline bool mmc_op_tuning(u32 opcode)
> +{
> + return opcode == MMC_SEND_TUNING_BLOCK ||
> + opcode == MMC_SEND_TUNING_BLOCK_HS200;
> +}
> +
Patches for mmc should be based on Ulf's next branch:
https://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git/log/?h=next
which already has mmc_op_tuning()
> /*
> * MMC_SWITCH argument format:
> *
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-04 7:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04 6:42 [PATCH V2 1/1] mmc:sdhci:Fix the SD tuning issue that the SDHCI_TRANSFER_MODE is cleared incorrectly Charl Liu
2022-11-04 7:22 ` Adrian Hunter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.