Chinaunix首页 | 论坛 | 博客
  • 博客访问: 23631
  • 博文数量: 4
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 70
  • 用 户 组: 普通用户
  • 注册时间: 2015-05-28 08:55
个人简介

大海中的白桦树

文章分类

全部博文(4)

文章存档

2018年(1)

2017年(3)

最近访客

分类: Android平台

2018-01-11 15:16:22

/*****************************************************************************
 * Author : Elvins Fu    yeyecheng_93@163.com
 *
 * Info : xxx Inc,(C) 2018-01-11, All rights revseved.
 *
 * Description : This document is summed up by the author for that the company of xxxs  
 * R&D debug SD card on the android platform。
 *
 * This context describes that sd card problem and methods to analysis.
****************************************************************************/


1.在调试SD卡的过程中,遇到了卡识别或者读取不稳定的情况,抓取log进行分析。

情况1:
--------------------------------------------------------------------------------------
[  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 */
                                  drive-strength = <2>;   /* 2 MA */
                        };
                };


备注:流程图如下

识别过程:

上电检测:


传输过程:


阅读(2165) | 评论(0) | 转发(0) |
0

上一篇:ubuntu 14.04 安装虚拟机12.1.0

下一篇:没有了

给主人留下些什么吧!~~