高级会员
- 积分
- 563
- 金钱
- 563
- 注册时间
- 2016-9-28
- 在线时间
- 158 小时
|
硬件: mini2440
编译环境: ubuntu-12.04
linux 内核: linux-2.6.32.2
编译器版本: gcc version 4.3.2
Step 1:
在mach-mini2440.c 添加头文件 ,文件路径: arch/arm/mach-s3c2440/mach-mini2440.c
#include <linux/mmc/host.h>
#include <plat/mci.h>
Step 2:
添加SD相关硬件操作
/* MMC/SD */
static struct s3c24xx_mci_pdata mini2440_mmc_cfg = {
.gpio_detect = S3C2410_GPG(8),
.gpio_wprotect = S3C2410_GPH(8),
.set_power = NULL,
.ocr_avail = MMC_VDD_32_33|MMC_VDD_33_34,
};
/* devices we initialise */
static struct platform_device *mini2440_devices[] __initdata = {
&s3c_device_usb,
//&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c0,
&s3c_device_iis,
&s3c_device_nand,
&mini2440_device_eth,
&s3c_device_rtc,
&s3c_device_sdi,
};
static void __init mini2440_machine_init(void)
{
#if defined (LCD_WIDTH)
s3c24xx_fb_set_platdata(&mini2440_fb_info);
#endif
s3c_i2c0_set_platdata(NULL);
s3c2410_gpio_cfgpin(S3C2410_GPG(4), S3C2410_GPIO_OUTPUT);
s3c2410_gpio_setpin(S3C2410_GPG(4), 1);
s3c2410_gpio_cfgpin(S3C2410_GPC(0), S3C2410_GPC0_LEND);
s3c_device_sdi.dev.platform_data = &mini2440_mmc_cfg;
platform_add_devices(mini2440_devices, ARRAY_SIZE(mini2440_devices));
//smdk_machine_init();
s3c_pm_init();
/*
调用nand flash 信息
*/
s3c_device_nand.dev.platform_data = &mini2440_nand_info;
}
Step 3:
在 linux-2.6.32.2/drivers/mmc/host/s3cmci.c 文件中添加如下代码:
#include <linux/delay.h>
在 static void pio_tasklet(unsigned long data) 中添加delay函数:
static void pio_tasklet(unsigned long data)
{
struct s3cmci_host *host = (struct s3cmci_host *) data;
s3cmci_disable_irq(host, true);
udelay(50);
if (host->pio_active == XFER_WRITE)
do_pio_write(host);
if (host->pio_active == XFER_READ)
do_pio_read(host);
if (host->complete_what == COMPLETION_FINALIZE) {
clear_imask(host);
if (host->pio_active != XFER_NONE) {
dbg(host, dbg_err, "unfinished %s "
"- pio_count:[%u] pio_bytes:[%u]\n",
(host->pio_active == XFER_READ) ? "read" : "write",
host->pio_count, host->pio_bytes);
if (host->mrq->data)
host->mrq->data->error = -EINVAL;
}
s3cmci_enable_irq(host, false);
finalize_request(host);
} else
s3cmci_enable_irq(host, true);
}
Step 4:
添加驱动到内核
Step 5:
测试
s3cmci.zip
(11.77 KB, 下载次数: 292)
|
|