* [PATCH v2 0/2] Add mtk-sd support for ignoring cmd response CRC
@ 2024-11-26 12:48 Andy-ld Lu
2024-11-26 12:48 ` [PATCH v2 1/2] mmc: core: Introduce the MMC_RSP_R1B_NO_CRC response Andy-ld Lu
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Andy-ld Lu @ 2024-11-26 12:48 UTC (permalink / raw)
To: ulf.hansson, angelogioacchino.delregno, matthias.bgg,
avri.altman, adrian.hunter, wenbin.mei
Cc: linux-mmc, linux-kernel, linux-arm-kernel, linux-mediatek, Andy-ld Lu
Add the process flow in the host driver to handle the R1B cmd response
type with ignoring CRC, which comes from mmc_cqe_recovery() in the mmc
core. Additionally, the response type 'MMC_RSP_R1B_NO_CRC' is introduced
to simplify code.
---
Changes in v2:
- Change mmc_cqe_recovery() to use MMC_RSP_R1B_NO_CRC response type.
- Remove MMC_RSP_R1_NO_CRC in the host driver after it is dropped.
Link to v1:
https://patchwork.kernel.org/patch/13883787
---
Andy-ld Lu (2):
mmc: core: Introduce the MMC_RSP_R1B_NO_CRC response
mmc: mtk-sd: Add support for ignoring cmd response CRC
drivers/mmc/core/core.c | 6 ++----
drivers/mmc/host/mtk-sd.c | 6 ++++--
include/linux/mmc/core.h | 2 ++
3 files changed, 8 insertions(+), 6 deletions(-)
--
2.46.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/2] mmc: core: Introduce the MMC_RSP_R1B_NO_CRC response
2024-11-26 12:48 [PATCH v2 0/2] Add mtk-sd support for ignoring cmd response CRC Andy-ld Lu
@ 2024-11-26 12:48 ` Andy-ld Lu
2024-11-26 12:48 ` [PATCH v2 2/2] mmc: mtk-sd: Add support for ignoring cmd response CRC Andy-ld Lu
2024-12-02 15:23 ` [PATCH v2 0/2] Add mtk-sd " Ulf Hansson
2 siblings, 0 replies; 4+ messages in thread
From: Andy-ld Lu @ 2024-11-26 12:48 UTC (permalink / raw)
To: ulf.hansson, angelogioacchino.delregno, matthias.bgg,
avri.altman, adrian.hunter, wenbin.mei
Cc: linux-mmc, linux-kernel, linux-arm-kernel, linux-mediatek, Andy-ld Lu
The R1B response type with ignoring CRC is used in the mmc_cqe_recovery(),
introduce the MMC_RSP_R1B_NO_CRC response type to simplify the code.
Signed-off-by: Andy-ld Lu <andy-ld.lu@mediatek.com>
---
This patch dependents on "mmc: core: Drop the MMC_RSP_R1_NO_CRC response".
https://patchwork.kernel.org/patch/13884886
---
drivers/mmc/core/core.c | 6 ++----
include/linux/mmc/core.h | 2 ++
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index a499f3c59de5..4603224bafb9 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -557,8 +557,7 @@ int mmc_cqe_recovery(struct mmc_host *host)
memset(&cmd, 0, sizeof(cmd));
cmd.opcode = MMC_STOP_TRANSMISSION;
- cmd.flags = MMC_RSP_R1B | MMC_CMD_AC;
- cmd.flags &= ~MMC_RSP_CRC; /* Ignore CRC */
+ cmd.flags = MMC_RSP_R1B_NO_CRC | MMC_CMD_AC; /* Ignore CRC */
cmd.busy_timeout = MMC_CQE_RECOVERY_TIMEOUT;
mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES);
@@ -567,8 +566,7 @@ int mmc_cqe_recovery(struct mmc_host *host)
memset(&cmd, 0, sizeof(cmd));
cmd.opcode = MMC_CMDQ_TASK_MGMT;
cmd.arg = 1; /* Discard entire queue */
- cmd.flags = MMC_RSP_R1B | MMC_CMD_AC;
- cmd.flags &= ~MMC_RSP_CRC; /* Ignore CRC */
+ cmd.flags = MMC_RSP_R1B_NO_CRC | MMC_CMD_AC; /* Ignore CRC */
cmd.busy_timeout = MMC_CQE_RECOVERY_TIMEOUT;
err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES);
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index e13856ab6ad0..4aeab326ed9d 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -64,6 +64,8 @@ struct mmc_command {
#define MMC_RSP_R6 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
#define MMC_RSP_R7 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
+#define MMC_RSP_R1B_NO_CRC (MMC_RSP_PRESENT|MMC_RSP_OPCODE|MMC_RSP_BUSY)
+
#define mmc_resp_type(cmd) ((cmd)->flags & (MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC|MMC_RSP_BUSY|MMC_RSP_OPCODE))
/*
--
2.46.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] mmc: mtk-sd: Add support for ignoring cmd response CRC
2024-11-26 12:48 [PATCH v2 0/2] Add mtk-sd support for ignoring cmd response CRC Andy-ld Lu
2024-11-26 12:48 ` [PATCH v2 1/2] mmc: core: Introduce the MMC_RSP_R1B_NO_CRC response Andy-ld Lu
@ 2024-11-26 12:48 ` Andy-ld Lu
2024-12-02 15:23 ` [PATCH v2 0/2] Add mtk-sd " Ulf Hansson
2 siblings, 0 replies; 4+ messages in thread
From: Andy-ld Lu @ 2024-11-26 12:48 UTC (permalink / raw)
To: ulf.hansson, angelogioacchino.delregno, matthias.bgg,
avri.altman, adrian.hunter, wenbin.mei
Cc: linux-mmc, linux-kernel, linux-arm-kernel, linux-mediatek, Andy-ld Lu
The current process flow does not handle MMC requests that are indicated
to ignore the command response CRC. For instance, cmd12 and cmd48 from
mmc_cqe_recovery() are marked to ignore CRC, but they are not matched to
the appropriate response type in msdc_cmd_find_resp(). As a result, they
are defaulted to 'MMC_RSP_NONE', which means no response is expected.
This commit applies the flag 'MMC_RSP_R1B_NO_CRC' to fix the response type
setting in msdc_cmd_find_resp() and adds the logic to ignore CRC in
msdc_cmd_done().
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Andy-ld Lu <andy-ld.lu@mediatek.com>
---
drivers/mmc/host/mtk-sd.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
index efb0d2d5716b..e2c385853eef 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -1097,11 +1097,12 @@ static inline u32 msdc_cmd_find_resp(struct msdc_host *host,
u32 resp;
switch (mmc_resp_type(cmd)) {
- /* Actually, R1, R5, R6, R7 are the same */
+ /* Actually, R1, R5, R6, R7 are the same */
case MMC_RSP_R1:
resp = 0x1;
break;
case MMC_RSP_R1B:
+ case MMC_RSP_R1B_NO_CRC:
resp = 0x7;
break;
case MMC_RSP_R2:
@@ -1351,7 +1352,8 @@ static bool msdc_cmd_done(struct msdc_host *host, int events,
* CRC error.
*/
msdc_reset_hw(host);
- if (events & MSDC_INT_RSPCRCERR) {
+ if (events & MSDC_INT_RSPCRCERR &&
+ mmc_resp_type(cmd) != MMC_RSP_R1B_NO_CRC) {
cmd->error = -EILSEQ;
host->error |= REQ_CMD_EIO;
} else if (events & MSDC_INT_CMDTMO) {
--
2.46.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 0/2] Add mtk-sd support for ignoring cmd response CRC
2024-11-26 12:48 [PATCH v2 0/2] Add mtk-sd support for ignoring cmd response CRC Andy-ld Lu
2024-11-26 12:48 ` [PATCH v2 1/2] mmc: core: Introduce the MMC_RSP_R1B_NO_CRC response Andy-ld Lu
2024-11-26 12:48 ` [PATCH v2 2/2] mmc: mtk-sd: Add support for ignoring cmd response CRC Andy-ld Lu
@ 2024-12-02 15:23 ` Ulf Hansson
2 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2024-12-02 15:23 UTC (permalink / raw)
To: Andy-ld Lu
Cc: angelogioacchino.delregno, matthias.bgg, avri.altman,
adrian.hunter, wenbin.mei, linux-mmc, linux-kernel,
linux-arm-kernel, linux-mediatek
On Tue, 26 Nov 2024 at 13:50, Andy-ld Lu <andy-ld.lu@mediatek.com> wrote:
>
> Add the process flow in the host driver to handle the R1B cmd response
> type with ignoring CRC, which comes from mmc_cqe_recovery() in the mmc
> core. Additionally, the response type 'MMC_RSP_R1B_NO_CRC' is introduced
> to simplify code.
>
> ---
> Changes in v2:
> - Change mmc_cqe_recovery() to use MMC_RSP_R1B_NO_CRC response type.
> - Remove MMC_RSP_R1_NO_CRC in the host driver after it is dropped.
>
> Link to v1:
> https://patchwork.kernel.org/patch/13883787
>
> ---
> Andy-ld Lu (2):
> mmc: core: Introduce the MMC_RSP_R1B_NO_CRC response
> mmc: mtk-sd: Add support for ignoring cmd response CRC
>
> drivers/mmc/core/core.c | 6 ++----
> drivers/mmc/host/mtk-sd.c | 6 ++++--
> include/linux/mmc/core.h | 2 ++
> 3 files changed, 8 insertions(+), 6 deletions(-)
>
> --
> 2.46.0
>
The series applied for next, thanks!
Kind regards
Uffe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-12-02 15:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-26 12:48 [PATCH v2 0/2] Add mtk-sd support for ignoring cmd response CRC Andy-ld Lu
2024-11-26 12:48 ` [PATCH v2 1/2] mmc: core: Introduce the MMC_RSP_R1B_NO_CRC response Andy-ld Lu
2024-11-26 12:48 ` [PATCH v2 2/2] mmc: mtk-sd: Add support for ignoring cmd response CRC Andy-ld Lu
2024-12-02 15:23 ` [PATCH v2 0/2] Add mtk-sd " Ulf Hansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®