b6a2229170796f2d4c72bc4f128d7ee7e0e85ed2
[openwrt/staging/jow.git] /
1 From 793bed29e78cc54d989333d756fef51efaca4e56 Mon Sep 17 00:00:00 2001
2 From: Weijie Gao <weijie.gao@mediatek.com>
3 Date: Tue, 26 Jul 2022 09:29:18 +0800
4 Subject: [PATCH 58/71] mmc: mtk-sd: add support to display verbose error log
5
6 Add an option to enable debug log, and also display verbose error log for
7 both command and data.
8
9 Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
10 ---
11 drivers/mmc/Kconfig | 8 ++++++++
12 drivers/mmc/Makefile | 4 ++++
13 drivers/mmc/mtk-sd.c | 24 +++++++++++++++---------
14 3 files changed, 27 insertions(+), 9 deletions(-)
15
16 --- a/drivers/mmc/Kconfig
17 +++ b/drivers/mmc/Kconfig
18 @@ -789,6 +789,14 @@ config MMC_MTK
19 This is needed if support for any SD/SDIO/MMC devices is required.
20 If unsure, say N.
21
22 +config MMC_MTK_DEBUG
23 + bool "Display verbose error log"
24 + default n
25 + depends on MMC_MTK
26 + help
27 + Enable this option to allow verbose error log being displayed for
28 + debugging.
29 +
30 endif
31
32 config FSL_ESDHC
33 --- a/drivers/mmc/Makefile
34 +++ b/drivers/mmc/Makefile
35 @@ -84,3 +84,7 @@ obj-$(CONFIG_RENESAS_SDHI) += tmio-comm
36 obj-$(CONFIG_MMC_BCM2835) += bcm2835_sdhost.o
37 obj-$(CONFIG_MMC_MTK) += mtk-sd.o
38 obj-$(CONFIG_MMC_SDHCI_F_SDH30) += f_sdh30.o
39 +
40 +ifdef CONFIG_MMC_MTK_DEBUG
41 +CFLAGS_mtk-sd.o += -DDEBUG
42 +endif
43 --- a/drivers/mmc/mtk-sd.c
44 +++ b/drivers/mmc/mtk-sd.c
45 @@ -778,18 +778,24 @@ static int msdc_ops_send_cmd(struct udev
46 if (cmd_ret &&
47 !(cmd_ret == -EIO &&
48 (cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK ||
49 - cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK_HS200)))
50 + cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK_HS200))) {
51 + dev_dbg(dev, "MSDC start command failure with %d, cmd=%d, arg=0x%x\n",
52 + cmd_ret, cmd->cmdidx, cmd->cmdarg);
53 return cmd_ret;
54 -
55 - if (data) {
56 - data_ret = msdc_start_data(host, data);
57 - if (cmd_ret)
58 - return cmd_ret;
59 - else
60 - return data_ret;
61 }
62
63 - return 0;
64 + if (!data)
65 + return cmd_ret;
66 +
67 + data_ret = msdc_start_data(host, data);
68 + if (cmd_ret)
69 + return cmd_ret;
70 +
71 + if (data_ret)
72 + dev_dbg(dev, "MSDC start data failure with %d, cmd=%d, arg=0x%x\n",
73 + data_ret, cmd->cmdidx, cmd->cmdarg);
74 +
75 + return data_ret;
76 }
77
78 static void msdc_set_timeout(struct msdc_host *host, u32 ns, u32 clks)