配置管脚和电源
sd.c
static u32 msdc_sd1_power(u32 on, MT65XX_POWER_VOLTAGE powerVolt)
{
//libin modify for M1-21 on 20120907
#ifdef MTK_EMMC_SUPPORT // sd1 change to VGP
//msdc_ldo_power(on, MT65XX_POWER_LDO_VGP, powerVolt, &g_vgp);
msdc_ldo_power(on, MT65XX_POWER_LDO_VMC, powerVolt, &g_vmc);
#else // VMC
msdc_ldo_power(on, MT65XX_POWER_LDO_VGP, powerVolt, &g_vmc);
//msdc_ldo_power(on, MT65XX_POWER_LDO_VMC, powerVolt, &g_vmc);
#endif
msdc_ldo_power(on, MT65XX_POWER_LDO_VMCH, powerVolt, &g_vmch);
return 0;
}
更改board.c
struct msdc_hw msdc1_hw = {
.clk_src = 1,
.cmd_edge = MSDC_SMPL_FALLING,
.data_edge = MSDC_SMPL_FALLING,
.clk_drv = 0,
.cmd_drv = 0,
.dat_drv = 0,
.data_pins = 4,
.data_offset = 0,
.flags = MSDC_SYS_SUSPEND | MSDC_HIGHSPEED, //libin add for M1-21 on 20120908
//.flags = MSDC_SYS_SUSPEND | MSDC_WP_PIN_EN | MSDC_CD_PIN_EN | MSDC_REMOVABLE| MSDC_HIGHSPEED, //libin del
};
参考如下:
1. 检查硬件设计是否按照参考设计进行;
2. 检查SD Host端供电,即DVDD_MC1的连接;
检查代码:\mediatek\platform\mt6575\kernel\drivers\mmc-host\sd.c
static u32 msdc_sd1_power(u32 on, MT65XX_POWER_VOLTAGE powerVolt)
{
#ifdef MTK_EMMC_SUPPORT // sd1 change to VGP
msdc_ldo_power(on, MT65XX_POWER_LDO_VGP, powerVolt, &g_vgp);
#else // VMC
msdc_ldo_power(on, MT65XX_POWER_LDO_VMC, powerVolt, &g_vmc);
#endif
msdc_ldo_power(on, MT65XX_POWER_LDO_VMCH, powerVolt, &g_vmch);
return 0;
}
3. SD卡是否支持热插拔
根据MSDC1_INSI的连接情况检查\mediatek\custom{project_name}\kernel\core\src\board.c中热插拔的标志(MSDC_CD_PIN_EN | MSDC_REMOVABLE);
支持热插拔,则添加标志,并配置对应的GPIO;
不支持热插拔,则去除标志,无需配置对应的GPIO。
struct msdc_hw msdc1_hw = {
.clk_src = 1, .cmd_edge = MSDC_SMPL_FALLING, .data_edge = MSDC_SMPL_FALLING, .clk_drv = 0, .cmd_drv = 0, .dat_drv = 0, .data_pins = 4, .data_offset = 0, .flags = MSDC_SYS_SUSPEND | MSDC_WP_PIN_EN | MSDC_HIGHSPEED|MSDC_SPE | MSDC_CD_PIN_EN | MSDC_REMOVABLE, };
mediatek\custom\benrui15_ics2\kernel\core\src\board.c
.flags = MSDC_EXT_SDIO_IRQ | MSDC_HIGHSPEED | MSDC_CD_PIN_EN | MSDC_REMOVABLE,//|MSDC_SYS_SUSPEND | MSDC_WP_PIN_EN ,//| MSDC_CD_PIN_EN | MSDC_REMOVABLE,