2. 删除s3c2410mci.c中以下几句:
if(host->mrq->cmd->flags & MMC_RSP_CRC) {
host->mrq->cmd->error = MMC_ERR_BADCRC;
goto transfer_closed;
}
&s3c_device_usb,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c,
&s3c_device_iis,
&s3c_device_nand,
&s3c_device_sdi,//add here
};
tristate "MMC support"
help
MMC is the "multi-media card" bus protocol.
to the specific driver for your MMC interface.
obj-$(CONFIG_MMC_PXA) += pxamci.o
obj-$(CONFIG_MMC_WBSD) += wbsd.o
obj-$(CONFIG_SD) +=s3c2410mci.o
5. 添加内核的支持。
通常的驱动还不支持热插拔,因此在内核启动前先将sd卡插上。移植成功后,在启动信息中会显示:
host->irq_cd=57
mmci-s3c2410: probe: mapped sdi_base=c4c80000 irq=37 irq_cd=57 dma=0.
mmci-s3c2410: initialisation done.
NET: Registered protocol family 1
NET: Registered protocol family 17
NET: Registered protocol family 15
mmc0: host does not support reading read-only switch. assuming write-enable.
mmcblk0: mmc0:cf99 S256R 244224KiB
进入内核后:
#cat proc/partitions
major minor #blocks name
31 0 64 mtdblock0
31 1 1984 mtdblock1
31 2 30720 mtdblock2
31 3 32768 mtdblock3
254 0 244224 mmcblk0
254 1 244172 mmcblk0p1
#mount /dev/mmc/blk0/part1 /mnt
可以在/mnt中看到sd卡中的内容。
可能的问题,启动时会显示:
mmci-s3c2410: failed to request card detect interrupt.
s3c2410-sdi: probe of s3c2410-sdi failed with error -2
这是由于中断冲突引起的。通常的驱动根据Sumsung官方开发板的设置会把s3c2410的EINT18脚连接到sd卡的cd脚上,用于插上sd卡后的中断检测。如果EINT18被用于其他的中断的话,sd卡的驱动将申请不到相应的中断。为此,需要将s3c2410mci.c中s3c2410_mmc_defplat的gpio_detect变量由gpg10改为自己设计中的cd脚,如果没有连接该脚的话,可以设为一个闲置的中断管脚。