S3C2410 LCD驱动的移植(基于linux-2.6.15.4内核)

在linux-2.6.15.4的内核代码中已经含有LCD屏的驱动代码,只需作少量的修改,把你的LCD屏的参数加入即可.以东华3.5LCD为例作说明.

1. 在内核配置中把以下选项选上:

Device Drivers->

Graphics support-> (除了VGA text console将其及其子项全选上)

2. 修改linux-2.6.15.4/arch/arm/mach-s3c2410/mach-smdk2410.c文件:

加入头文件:

#include
#include

static struct platform_device *smdk2410_devices[] __initdata = {
&s3c_device_usb,
&s3c_device_lcd, //加入这一句
&s3c_device_wdt,
&s3c_device_i2c,
&s3c_device_iis,
&s3c_device_nand,
};

//添加如下代码,这些参数要参考屏的手册,如果未写正确则屏不会有反应,这是关键,以下为东华LCD屏的参数配置.

static struct s3c2410fb_mach_info s3c2410_lcd_info __initdata = {
.fixed_syncs = 1,
.regs = {
.lcdcon1 = S3C2410_LCDCON1_TFT16BPP|S3C2410_LCDCON1_TFT|S3C2410_LCDCON1_CLKVAL(6),
.lcdcon2 = S3C2410_LCDCON2_VBPD(14)|S3C2410_LCDCON2_VFPD(11)|S3C2410_LCDCON2_VSPW(2)|
S3C2410_LCDCON2_LINEVAL(239),
.lcdcon3 = S3C2410_LCDCON3_HBPD(37)|S3C2410_LCDCON3_HFPD(15)|S3C2410_LCDCON3_HOZVAL(319),
.lcdcon4 = S3C2410_LCDCON4_MVAL(13)|S3C2410_LCDCON4_HSPW(13),
.lcdcon5 = S3C2410_LCDCON5_FRM565|S3C2410_LCDCON5_INVVLINE|S3C2410_LCDCON5_HWSWP|
S3C2410_LCDCON5_PWREN|S3C2410_LCDCON5_INVVFRAME|S3C2410_LCDCON5_INVVCLK,
},
.lpcsel = 0x0,
.gpccon = 0xaaaaaaaa,
.gpccon_mask = 0xffffffff,
.gpcup = 0xffffffff,
.gpcup_mask = 0xffffffff,
.gpdcon = 0xaaaaaaaa,
.gpdcon_mask = 0x0,
.gpdup = 0xffffffff,
.gpdup_mask = 0xffffffff,
.width = 320,
.height = 240,
.xres = {320,320,320},
.yres = {240,240,240},
.bpp = {16,16,16},

};

//定义初始化函数

static void __init smdk2410_init_lcd(void)
{
s3c24xx_fb_set_platdata(&s3c2410_lcd_info);
}

//将上面函数加入以下结构:

MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switch
* to SMDK2410 */
/* Maintainer: Jonas Dietsche */
.phys_ram = S3C2410_SDRAM_PA,
.phys_io = S3C2410_PA_UART,
.io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
.boot_params = S3C2410_SDRAM_PA + 0x100,
.fixup = smdk2410_fixup,
.map_io = smdk2410_map_io,
.init_irq = smdk2410_init_irq,
.timer = &s3c24xx_timer,
.init_machine = smdk2410_init_lcd,
MACHINE_END

//编译内核,系统启动后如果移植正确,则会在屏的左上角显示一个小企鹅的图标,如果不正确则存细查看一下参数配置。

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8318835/viewspace-1016253/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/8318835/viewspace-1016253/

你可能感兴趣的:(S3C2410 LCD驱动的移植(基于linux-2.6.15.4内核))