[ 558.956332] mmc0: Re-init card rc = -123 (retries = 5)
[ 559.057076] mmc0: Re-init card rc = -123 (retries = 4)
[ 559.174989] mmc0: Re-init card rc = -123 (retries = 3)
[ 559.273596] mmc0: Re-init card rc = -123 (retries = 2)
[ 559.374437] mmc0: Re-init card rc = -123 (retries = 1)
[ 559.478705] mmc_sd_detect(mmc0): Unable to re-detect card (-123)
[ 559.489688] mmc0: card 0001 removed
情况2:
----------------------------------------------------------------------------------------------------
[ 8.682295] mmcblk0: mmc0:0260 SD 120 MiB
[ 8.684970] mmc0: data txfr (0x00200000) error: -84 after 0 ms
[ 8.684977] sdhci: =========== REGISTER DUMP (mmc0)===========
[ 8.684987] sdhci: Sys addr: 0x00000000 | Version: 0x00004902
[ 8.684997] sdhci: Blk size: 0x00004200 | Blk cnt: 0x00000007
[ 8.685010] sdhci: Argument: 0x00000000 | Trn mode: 0x00000033
[ 8.685019] sdhci: Present: 0x01f80206 | Host ctl: 0x0000001e
[ 8.685028] sdhci: Power: 0x0000000d | Blk gap: 0x00000000
[ 8.685037] sdhci: Wake-up: 0x00000000 | Clock: 0x00000007
[ 8.685045] sdhci: Timeout: 0x00000008 | Int stat: 0x00000000
[ 8.685054] sdhci: Int enab: 0x03ff800b | Sig enab: 0x03ff000b
[ 8.685061] sdhci: AC12 err: 0x00000000 | Slot int: 0x00000000
[ 8.685070] sdhci: Caps: 0x362dc8b2 | Caps_1: 0x00008007
[ 8.685079] sdhci: Cmd: 0x0000123a | Max curr: 0x00000000
[ 8.685088] sdhci: Resp 1: 0x5b5983c3 | Resp 0: 0x00000900
[ 8.685097] sdhci: Resp 3: 0x16400026 | Resp 2: 0xfffe4f80
情况3:
-----------------------------------------------------------------------------------------------------
[ 495.242170] mmc0: data txfr (0x00100000) error: -110 after 171 ms
[ 495.248239] sdhci: =========== REGISTER DUMP (mmc0)===========
[ 495.254058] sdhci: Sys addr: 0x00000008 | Version: 0x00004902
[ 495.259874] sdhci: Blk size: 0x00004200 | Blk cnt: 0x00000008
[ 495.265688] sdhci: Argument: 0x00000000 | Trn mode: 0x0000003b
[ 495.271507] sdhci: Present: 0x01f80206 | Host ctl: 0x0000001e
[ 495.277323] sdhci: Power: 0x0000000d | Blk gap: 0x00000000
[ 495.283136] sdhci: Wake-up: 0x00000000 | Clock: 0x00000007
[ 495.288951] sdhci: Timeout: 0x00000008 | Int stat: 0x00000000
[ 495.294769] sdhci: Int enab: 0x03ff800b | Sig enab: 0x03ff000b
[ 495.300589] sdhci: AC12 err: 0x00000000 | Slot int: 0x00000000
[ 495.306402] sdhci: Caps: 0x362dc8b2 | Caps_1: 0x00008007
[ 495.312216] sdhci: Cmd: 0x0000123a | Max curr: 0x00000000
[ 495.318034] sdhci: Resp 1: 0x5b590000 | Resp 0: 0x00000900
[ 495.323848] sdhci: Resp 3: 0x00000900 | Resp 2: 0x1fff7f80
2.分析log可以知道,软件配置设备树及其GPIO,驱动都已经起来了,因此通过错误分析SD卡的问题。
1.Error -123, 无卡,卡可能损坏,不产生中断,读不到SD卡信息。
2.Error -84, 卡传输错误,可能难以识别内容,或者识别卡
3.Error -110, 卡难以识别内容,可能是SD卡晶块坏了。
3.通过分析问题,得到以下的测试方法和解决思路
情况一: Error -123,用电脑读卡器读取卡,识别该卡是否已损坏,换取新卡插入手机检测;软件查看该卡类型是否是board支持,若该工程或芯片支持,则加入板级代码中。
情况二: Error -84,硬件下一版本做好SD卡的等长处理,以及SD卡信号质量检测,该错误主要由于PCB走线问题;软件延长中断的去抖动时间有提高信号质量的效果,代码修改如下,经过测试,此外,需要提case给芯片厂商获得增加传输质量的patch。
Index: kernel/drivers/mmc/core/core.c
===================================================================
--- kernel/drivers/mmc/core/core.c (revision 509)
+++ kernel/drivers/mmc/core/core.c (working copy)
@@ -3650,7 +3650,7 @@
* detect work 200ms later for this case.
*/
if (!ret && host->ops->get_cd && !host->ops->get_cd(host)) {
- mmc_detect_change(host, msecs_to_jiffies(200));
+ mmc_detect_change(host, msecs_to_jiffies(1000)); //200
pr_debug("%s: card removed too slowly\n", mmc_hostname(host));
}
Index: kernel/drivers/mmc/core/slot-gpio.c
===================================================================
--- kernel/drivers/mmc/core/slot-gpio.c (revision 509)
+++ kernel/drivers/mmc/core/slot-gpio.c (working copy)
@@ -33,7 +33,7 @@
struct mmc_host *host = dev_id;
host->trigger_card_event = true;
- mmc_detect_change(host, msecs_to_jiffies(200));
+ mmc_detect_change(host, msecs_to_jiffies(1000)); //200 For sd card Type Error: 84
return IRQ_HANDLED;
}
Index: kernel/drivers/mmc/host/sdhci.c
===================================================================
--- kernel/drivers/mmc/host/sdhci.c (revision 509)
+++ kernel/drivers/mmc/host/sdhci.c (working copy)
@@ -3269,7 +3269,7 @@
if (isr & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE)) {
sdhci_card_event(host->mmc);
- mmc_detect_change(host->mmc, msecs_to_jiffies(200));
+ mmc_detect_change(host->mmc, msecs_to_jiffies(1000)); //200
}
情况三: Error -110,软件提高驱动能力,或者处理坏块检测那部分代码。
sdc1_clk_on: sdc1_clk_on {
config {
pins = "sdc1_clk";
bias-disable; /* NO pull */
drive-strength = <16>; /* 16 MA */
};
};
sdc1_clk_off: sdc1_clk_off {
config {
pins = "sdc1_clk";
bias-disable; /* NO pull */