CONFIG_MMC_PARANOID_SD_INIT
static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
static void mmc_sd_detect(struct mmc_host *host)
int mmc_attach_sd(struct mmc_host *host, u32 ocr)
static const struct mmc_bus_ops mmc_sd_ops = {
.remove = mmc_sd_remove,
.detect = mmc_sd_detect,
void mmc_rescan(struct work_struct *work)
INIT_DELAYED_WORK(&host->detect, mmc_rescan);
struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
struct sdhci_host *sdhci_alloc_host(struct device *dev,
size_t priv_size)
static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
struct s3c_sdhci_platdata *pdata = pdev->dev.platform_data;
struct platform_device s3c_device_hsmmc2 = {
.name = "s3c-sdhci",
.id = 2,
mmc_sd_detect(mmc2): Unable to re-detect card (-84)
void mmc_detect_change(struct mmc_host *host, unsigned long delay)
static void sdhci_tasklet_card(unsigned long param)
void mmc_start_host(struct mmc_host *host)
{
mmc_power_off(host);
mmc_detect_change(host, 0);
}
int mmc_add_host(struct mmc_host *host)
int sdhci_add_host(struct sdhci_host *host)
解决方法:
打开选项:CONFIG_MMC_PARANOID_SD_INIT,在插入SD卡时重试几次。
drivers/mmc/core/sd.c
int mmc_attach_sd(struct mmc_host *host, u32 ocr)
{
#ifdef CONFIG_MMC_PARANOID_SD_INIT
retries = 5;
while (retries) {
err = mmc_sd_init_card(host, host->ocr, NULL);
if (err) {
retries--;
msleep(50); //jeff.
continue;
}
break;
}
.....
}
drivers/mmc/host/sdhci.c
static void sdhci_tasklet_card(unsigned long param)
{
.....
//jeff. mmc_detect_change(host->mmc, msecs_to_jiffies(200));
mmc_detect_change(host->mmc, msecs_to_jiffies(500));
}
做这样的修改后,正常的插拔tf卡可以识别,但有一种情况是不行的,那就是:
快速将tf卡插到底,不弹起,过几秒后再松,这样不会再有一个识别的过程,
这是由于卡座在插到底时卡座与tf卡没有接触。