difos/target/linux/ramips/patches-6.12/831-02-mmc-mtk-sd-disable-auto-CMD23-support-for-mt7620.patch
Shiji Yang 57aa05e8e5 kernel: bump 6.12 to 6.12.37
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.12.37

Manually rebased patch:
  generic/hack-6.12/902-debloat_proc.patch[1]

New Kconfig symbol:
  x86: enable MITIGATION_TSA[2]

All other patches are automatically refreshed.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.37&id=ead91de35d9cd5c4f80ec51e6020f342079170af
[2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.37&id=7a0395f6607a5d01e2b2a86355596b3f1224acbd

Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/19317
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2025-07-12 16:47:58 +02:00

137 lines
4.7 KiB
Diff

From: Shiji Yang <yangshiji66@outlook.com>
Date: Fri, 13 Jun 2025 20:12:55 +0800
Subject: [PATCH 2/3] mmc: mtk-sd: disable auto CMD23 support for mt7620
MT7628 ProgrammingGuide indicates that the host controller version
3.0 and later support auto CMD23 function. However, it doesn't
define SD command register BIT[29](Auto CMD23 enable bit). I guess
the legacy MIPS MT762x series SoCs don't support this feature at
all. The experiment on JDCloud RE-SP-01B(MT7621 + 128 GiB EMMC)
shows that disabling auto CMD23 can fix the following IO errors:
[ 143.344604] mtk-msdc 1e130000.mmc: msdc_track_cmd_data: cmd=6 arg=03B30101; host->error=0x00000002
[ 143.353661] mtk-msdc 1e130000.mmc: msdc_track_cmd_data: cmd=6 arg=03B30101; host->error=0x00000002
[ 143.362662] mtk-msdc 1e130000.mmc: msdc_track_cmd_data: cmd=6 arg=03B30101; host->error=0x00000002
[ 143.371684] mtk-msdc 1e130000.mmc: msdc_track_cmd_data: cmd=6 arg=03B30101; host->error=0x00000002
[ 143.380684] I/O error, dev mmcblk0boot0, sector 0 op 0x0:(READ) flags 0x80700 phys_seg 4 prio class 0
[ 143.390414] mtk-msdc 1e130000.mmc: msdc_track_cmd_data: cmd=6 arg=03B30101; host->error=0x00000002
[ 143.399468] mtk-msdc 1e130000.mmc: msdc_track_cmd_data: cmd=6 arg=03B30101; host->error=0x00000002
[ 143.408516] mtk-msdc 1e130000.mmc: msdc_track_cmd_data: cmd=6 arg=03B30101; host->error=0x00000002
[ 143.417556] mtk-msdc 1e130000.mmc: msdc_track_cmd_data: cmd=6 arg=03B30101; host->error=0x00000002
[ 143.426590] I/O error, dev mmcblk0boot0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[ 143.435585] Buffer I/O error on dev mmcblk0boot0, logical block 0, async page read
Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
---
drivers/mmc/host/mtk-sd.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -412,6 +412,7 @@ struct mtk_mmc_compatible {
bool stop_clk_fix;
bool enhance_rx;
bool support_64g;
+ bool support_cmd23;
bool use_internal_cd;
bool mips_mt762x;
};
@@ -501,6 +502,7 @@ static const struct mtk_mmc_compatible m
.stop_clk_fix = false,
.enhance_rx = false,
.support_64g = false,
+ .support_cmd23 = true,
};
static const struct mtk_mmc_compatible mt2712_compat = {
@@ -514,6 +516,7 @@ static const struct mtk_mmc_compatible m
.stop_clk_fix = true,
.enhance_rx = true,
.support_64g = true,
+ .support_cmd23 = true,
};
static const struct mtk_mmc_compatible mt6779_compat = {
@@ -527,6 +530,7 @@ static const struct mtk_mmc_compatible m
.stop_clk_fix = true,
.enhance_rx = true,
.support_64g = true,
+ .support_cmd23 = true,
};
static const struct mtk_mmc_compatible mt6795_compat = {
@@ -540,6 +544,7 @@ static const struct mtk_mmc_compatible m
.stop_clk_fix = false,
.enhance_rx = false,
.support_64g = false,
+ .support_cmd23 = true,
};
static const struct mtk_mmc_compatible mt7620_compat = {
@@ -552,6 +557,7 @@ static const struct mtk_mmc_compatible m
.busy_check = false,
.stop_clk_fix = false,
.enhance_rx = false,
+ .support_cmd23 = false,
.use_internal_cd = true,
.mips_mt762x = true,
};
@@ -567,6 +573,7 @@ static const struct mtk_mmc_compatible m
.stop_clk_fix = true,
.enhance_rx = true,
.support_64g = false,
+ .support_cmd23 = true,
};
static const struct mtk_mmc_compatible mt7986_compat = {
@@ -580,6 +587,7 @@ static const struct mtk_mmc_compatible m
.stop_clk_fix = true,
.enhance_rx = true,
.support_64g = true,
+ .support_cmd23 = true,
};
static const struct mtk_mmc_compatible mt8135_compat = {
@@ -593,6 +601,7 @@ static const struct mtk_mmc_compatible m
.stop_clk_fix = false,
.enhance_rx = false,
.support_64g = false,
+ .support_cmd23 = true,
};
static const struct mtk_mmc_compatible mt8173_compat = {
@@ -606,6 +615,7 @@ static const struct mtk_mmc_compatible m
.stop_clk_fix = false,
.enhance_rx = false,
.support_64g = false,
+ .support_cmd23 = true,
};
static const struct mtk_mmc_compatible mt8183_compat = {
@@ -619,6 +629,7 @@ static const struct mtk_mmc_compatible m
.stop_clk_fix = true,
.enhance_rx = true,
.support_64g = true,
+ .support_cmd23 = true,
};
static const struct mtk_mmc_compatible mt8516_compat = {
@@ -630,6 +641,7 @@ static const struct mtk_mmc_compatible m
.data_tune = true,
.busy_check = true,
.stop_clk_fix = true,
+ .support_cmd23 = true,
};
static const struct of_device_id msdc_of_ids[] = {
@@ -2913,7 +2925,9 @@ static int msdc_drv_probe(struct platfor
if (mmc->caps & MMC_CAP_SDIO_IRQ)
mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD;
- mmc->caps |= MMC_CAP_CMD23;
+ if (host->dev_comp->support_cmd23)
+ mmc->caps |= MMC_CAP_CMD23;
+
if (host->cqhci)
mmc->caps2 |= MMC_CAP2_CQE | MMC_CAP2_CQE_DCMD;
/* MMC core transfer sizes tunable parameters */