lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
 <OSBPR01MB16701142441CAA0F2D12A843BC7DA@OSBPR01MB1670.jpnprd01.prod.outlook.com>
Date: Thu, 19 Jun 2025 13:35:09 +0800
From: Shiji Yang <yangshiji66@...look.com>
To: linux-mmc@...r.kernel.org
Cc: Chaotian Jing <chaotian.jing@...iatek.com>,
	Ulf Hansson <ulf.hansson@...aro.org>,
	Matthias Brugger <matthias.bgg@...il.com>,
	AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
	linux-kernel@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org,
	linux-mediatek@...ts.infradead.org,
	Shiji Yang <yangshiji66@...look.com>
Subject: [PATCH 1/4] 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 the 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@...look.com>
---
 drivers/mmc/host/mtk-sd.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
index 31eb90536..53d63bb4e 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -445,6 +445,7 @@ struct mtk_mmc_compatible {
 	u8 pop_en_cnt;
 	bool enhance_rx;
 	bool support_64g;
+	bool support_cmd23;
 	bool use_internal_cd;
 	bool support_new_tx;
 	bool support_new_rx;
@@ -535,6 +536,7 @@ static const struct mtk_mmc_compatible mt2701_compat = {
 	.stop_clk_fix = false,
 	.enhance_rx = false,
 	.support_64g = false,
+	.support_cmd23 = true,
 };
 
 static const struct mtk_mmc_compatible mt2712_compat = {
@@ -549,6 +551,7 @@ static const struct mtk_mmc_compatible mt2712_compat = {
 	.stop_dly_sel = 3,
 	.enhance_rx = true,
 	.support_64g = true,
+	.support_cmd23 = true,
 };
 
 static const struct mtk_mmc_compatible mt6779_compat = {
@@ -563,6 +566,7 @@ static const struct mtk_mmc_compatible mt6779_compat = {
 	.stop_dly_sel = 3,
 	.enhance_rx = true,
 	.support_64g = true,
+	.support_cmd23 = true,
 };
 
 static const struct mtk_mmc_compatible mt6795_compat = {
@@ -576,6 +580,7 @@ static const struct mtk_mmc_compatible mt6795_compat = {
 	.stop_clk_fix = false,
 	.enhance_rx = false,
 	.support_64g = false,
+	.support_cmd23 = true,
 };
 
 static const struct mtk_mmc_compatible mt7620_compat = {
@@ -588,6 +593,7 @@ static const struct mtk_mmc_compatible mt7620_compat = {
 	.busy_check = false,
 	.stop_clk_fix = false,
 	.enhance_rx = false,
+	.support_cmd23 = false,
 	.use_internal_cd = true,
 };
 
@@ -603,6 +609,7 @@ static const struct mtk_mmc_compatible mt7622_compat = {
 	.stop_dly_sel = 3,
 	.enhance_rx = true,
 	.support_64g = false,
+	.support_cmd23 = true,
 };
 
 static const struct mtk_mmc_compatible mt7986_compat = {
@@ -618,6 +625,7 @@ static const struct mtk_mmc_compatible mt7986_compat = {
 	.stop_dly_sel = 3,
 	.enhance_rx = true,
 	.support_64g = true,
+	.support_cmd23 = true,
 };
 
 static const struct mtk_mmc_compatible mt8135_compat = {
@@ -631,6 +639,7 @@ static const struct mtk_mmc_compatible mt8135_compat = {
 	.stop_clk_fix = false,
 	.enhance_rx = false,
 	.support_64g = false,
+	.support_cmd23 = true,
 };
 
 static const struct mtk_mmc_compatible mt8173_compat = {
@@ -644,6 +653,7 @@ static const struct mtk_mmc_compatible mt8173_compat = {
 	.stop_clk_fix = false,
 	.enhance_rx = false,
 	.support_64g = false,
+	.support_cmd23 = true,
 };
 
 static const struct mtk_mmc_compatible mt8183_compat = {
@@ -659,6 +669,7 @@ static const struct mtk_mmc_compatible mt8183_compat = {
 	.stop_dly_sel = 3,
 	.enhance_rx = true,
 	.support_64g = true,
+	.support_cmd23 = true,
 };
 
 static const struct mtk_mmc_compatible mt8516_compat = {
@@ -671,6 +682,7 @@ static const struct mtk_mmc_compatible mt8516_compat = {
 	.busy_check = true,
 	.stop_clk_fix = true,
 	.stop_dly_sel = 3,
+	.support_cmd23 = true,
 };
 
 static const struct mtk_mmc_compatible mt8196_compat = {
@@ -687,6 +699,7 @@ static const struct mtk_mmc_compatible mt8196_compat = {
 	.pop_en_cnt = 2,
 	.enhance_rx = true,
 	.support_64g = true,
+	.support_cmd23 = true,
 	.support_new_tx = true,
 	.support_new_rx = true,
 };
@@ -3054,7 +3067,9 @@ static int msdc_drv_probe(struct platform_device *pdev)
 	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 */
-- 
2.50.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ