分类: 嵌入式
2010-08-14 09:37:02
嵌入式学习入门 http://blog.chinaunix.net/u3/117680/showart.php?id=2300212
, 文章——>嵌入式学习入门 全面的讲述学习嵌入式linux中的每个步骤
内核自带SD卡驱动,在drivers/mmc/目录下
在arch/arm/mach-s3c2440/mach-smdk2440.c plat_device结构体中加入:
&s3c_device_sdi,
修改drivers/mmc/host/s3cmci.c 在1335行加入
host->irq_cd = IRQ_EINT16;
s3c2410_gpio_cfgpin(S3C2410_GPG(8), S3C2410_GPG8_EINT16);
这两句指定SD的中断为EINT16
修改同文件,屏蔽掉1358-1359行:
if (s3c2410_dma_request(S3CMCI_DMA, &s3cmci_dma_client, NULL) < 0) {
dev_err(&pdev->dev, "unable to get DMA channel.\n");
// ret = -EBUSY;
// goto probe_free_irq_cd;
}
再将1147-1148行输出的多余信息屏蔽掉:
if ((ios->power_mode == MMC_POWER_ON) ||
(ios->power_mode == MMC_POWER_UP)) {
// dbg(host, dbg_conf, "running at %lukHz (requested: %ukHz).\n",
// host->real_rate/1000, ios->clock/1000);
} else {
dbg(host, dbg_conf, "powered down.\n");
}
配置内核,支持SD:
Device Drivers --->
<*> MMC/SD/SDIO card support --->
<*> MMC block device driver
<*> Use bounce buffer for simple hosts
<*> Sumsung S3C SD/MMC Card Interface support
启动时输出:
s3c2440-sdi s3c2440-sdi: powered down.
s3c2440-sdi s3c2440-sdi: initialisation done.
s3c2440-sdi s3c2440-sdi: powered down.
插入SD卡。当系统启动后插入SD卡就会出现一些信息,还可以看到mmcblk0就是SD设备了