linux SD CARD 调试总结
2020-04-26 本文已影响0人
jackniu_ae28
1.先看电路图
image.png2.再看设备树
&usdhc2 {
pinctrl-names = "default", "state_100mhz", "state_200mhz";
pinctrl-0 = <&pinctrl_usdhc2>, <&pinctrl_usdhc2_gpio>;
pinctrl-1 = <&pinctrl_usdhc2_100mhz>, <&pinctrl_usdhc2_gpio>;
pinctrl-2 = <&pinctrl_usdhc2_200mhz>, <&pinctrl_usdhc2_gpio>;
bus-width = <4>; /*位宽配置*/
cd-gpios = <&gpio4 22 GPIO_ACTIVE_HIGH>; /*cd 管脚*/
/*wp-gpios = <&gpio4 21 GPIO_ACTIVE_HIGH>; wp 管脚 */
/*vmmc-supply = <®_usdhc2_vmmc>; 电源控制管脚配置*/
status = "okay";
};
3. WP
管脚配置不正确或(电路没接)出现如下问题:
3.1 无法存储环境变量
image.png
3.2 无法挂载当前root 分区
处理办法:先注释掉
wp
代码
4.CD
管脚软件配置不正确或者没有配置(硬件没有接)kernel 出现如下log
一直处于要挂载的状态
处理办法(电路设计就是悬空的):
修改代码:
cd-gpios = <&gpio4 22 GPIO_ACTIVE_LOW>;
为:
cd-gpios = <&gpio4 22 GPIO_ACTIVE_HIGH>;
5.cd
管脚硬件没有接uboot 出现如下log
image.png
处理代码如下:
#if !defined(CONFIG_MMC_BROKEN_CD)
/* we pretend there's no card when init is NULL */
no_card = mmc_getcd(mmc) == 0;
#else
no_card = 0;
#endif
#if !CONFIG_IS_ENABLED(DM_MMC)
no_card = no_card || (mmc->cfg->ops->init == NULL);
#endif
if (no_card) {
mmc->has_init = 0;
#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
pr_err("MMC: no card present\n");
#endif
return -ENOMEDIUM;
}
处理办法: 定义宏 CONFIG_MMC_BROKEN_CD