Linux下SD卡驱动移植
时间:10-02
整理:3721RD
点击:
作者:信盈达嵌入式培训高级讲师 陈工
Linux中对SD卡的支持非常完善了,我们只需要按照以下修改即可完成SD卡的初始化
1、arch/arm/mach-s3c2440/mach-smdk2440.c platform结构中增加&s3c_device_sdi语句。
static struct platform_device*smdk2440_devices[] __initdata =
{
&s3c_device_usb,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c,
&s3c_device_iis,
&s3c_device_nand,
&s3c_device_sdi, //add here
};
2、添加和开发板相关的 SD 卡插拔引发的中断:
#vi drivers/mmc/host/s3cmci.c +1335
在1335行,添加如下内容:
host->irq_cd = IRQ_EINT16;
s3c2410_gpio_cfgpin(S3C2410_GPG8, S3C2410_GPG8_EINT16);
注:SD卡中断管脚需根据硬件连接图实际情况修改
3、在makemenuconfig时选上所有关于sd卡的信息,要想支持中文还得选上:
Device Drivers --->
<*> MMC/SD/SDIO card support --->
--- MMC/SD/SDIO card support
[ ] MMC debugging
[ ] Allow unsafe resume (DANGEROUS)
*** MMC/SD/SDIO Card Drivers ***
<*> MMC block device driver
Use bounce buffer for simple hosts
< > SDIO UART/GPS class support
< > MMC host test driver
*** MMC/SD/SDIO Host Controller Drivers ***
< > Secure Digital Host Controller Interface support
< > MMC/SD/SDIO over SPI
<*> Samsung S3CSD/MMC Card Interface support
File system--》
DOS/FAT/NT Filesystems--》
VFAT(Windows-95)fs support
(437)Default codepage for FAT
**把437改为936
Native language support -->
Simplified Chinese charset
NLS UTF-8
4、测试
这样就可直接挂载了 mount -t vfat /dev/mmcblk0 /mnt
如果sd卡分区了 mount -t vfat /dev/mmcblk0p1 /mnt
直接读写sd就可以了
Linux中对SD卡的支持非常完善了,我们只需要按照以下修改即可完成SD卡的初始化
1、arch/arm/mach-s3c2440/mach-smdk2440.c platform结构中增加&s3c_device_sdi语句。
static struct platform_device*smdk2440_devices[] __initdata =
{
&s3c_device_usb,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c,
&s3c_device_iis,
&s3c_device_nand,
&s3c_device_sdi, //add here
};
2、添加和开发板相关的 SD 卡插拔引发的中断:
#vi drivers/mmc/host/s3cmci.c +1335
在1335行,添加如下内容:
host->irq_cd = IRQ_EINT16;
s3c2410_gpio_cfgpin(S3C2410_GPG8, S3C2410_GPG8_EINT16);
注:SD卡中断管脚需根据硬件连接图实际情况修改
3、在makemenuconfig时选上所有关于sd卡的信息,要想支持中文还得选上:
Device Drivers --->
<*> MMC/SD/SDIO card support --->
--- MMC/SD/SDIO card support
[ ] MMC debugging
[ ] Allow unsafe resume (DANGEROUS)
*** MMC/SD/SDIO Card Drivers ***
<*> MMC block device driver
< > SDIO UART/GPS class support
< > MMC host test driver
*** MMC/SD/SDIO Host Controller Drivers ***
< > Secure Digital Host Controller Interface support
< > MMC/SD/SDIO over SPI
<*> Samsung S3CSD/MMC Card Interface support
File system--》
DOS/FAT/NT Filesystems--》
VFAT(Windows-95)fs support
(437)Default codepage for FAT
**把437改为936
Native language support -->
4、测试
这样就可直接挂载了 mount -t vfat /dev/mmcblk0 /mnt
如果sd卡分区了 mount -t vfat /dev/mmcblk0p1 /mnt
直接读写sd就可以了
111111111111111111111111111