手把手教你移植linux内核---------OK6410(三)

OK6410--LCD液晶驱动移植:

        下面来移植一个4.3寸LCD液晶。

首先打开我们的板级BSP文件,修改里面的fb部分代码,即液晶配置部分代码

root@ubuntu:/forlinx/linux-3.3.5/arch/arm/mach-s3c64xx# gedit mach-ok6410.c
找到static struct s3c_fb_pd_win ok6410_fb_win0这个结构体

修改成

static struct s3c_fb_pd_win ok6410_fb_win0 = {
    /* this is to ensure we use win0 */
    .win_mode    = {
        .left_margin    = 2,
        .right_margin    = 2,
        .upper_margin    = 2,
        .lower_margin    = 2,
        .hsync_len    = 41,
        .vsync_len    = 10,
        .xres        = 480,
        .yres        = 272,
    },
    .max_bpp    = 32,
    .default_bpp    = 16,
}; 
不同的液晶对应的配置会不同,具体查看对应液晶的手册。
继续寻找,找到
static struct map_desc ok6410_iodesc[] = {};
上面这个结构体是空的,我们修改为
static struct map_desc ok6410_iodesc[] = {
    {
        .virtual = (unsigned long)S3C_VA_LCD,
        .pfn = __phys_to_pfn(S3C_PA_FB),
        .length = SZ_16K,
        .type = MT_DEVICE,
    },
}; 
##################################################################################################

将飞凌3.0.1内核(或其它内核)中的drviers/video/下的samsung目录拷贝我们对应的目录中来。

修改drviers/video/的Kconfig文件,在文件的最后添加

source "drivers/video/samsung/Kconfig"

修改drviers/video/的Makefie文件,把我们添加进来的文件进行内核编译时同时编译,再最后一行添加:

obj-$(CONFIG_FB_S3C_EXT) += samsung/
#################################################################################################

在arch/arm/plat-samsung/include/plat/map-base.h里面添加

#define S3C_VA_LCD 	S3C_ADDR(0x01100000)     /* LCD */
在include/generated/atuoconfig.h文件最后添加

#define CONFIG_FB_S3C_EXT_NUM 4
在drivers/video/samsung/s3cfb_fimd4x.c文件中的

3.0中的对应1438行

s3c6410_pm_do_save(s3c_lcd_save, ARRAY_SIZE(s3c_lcd_save));
修改成

s3c_pm_do_save(s3c_lcd_save, ARRAY_SIZE(s3c_lcd_save));

把1459行,

s3c6410_pm_do_restore(s3c_lcd_save, ARRAY_SIZE(s3c_lcd_save));
修改成
s3c_pm_do_restore(s3c_lcd_save, ARRAY_SIZE(s3c_lcd_save));
保存。

#################################################################################################

飞凌linux源码中的arch\arm\mach-s3c64xx\include\mach下的regs-fb.h和regs-lcd.h拷贝到我们对应的目录。
配置内核

Device Drivers --->

Graphics support --->

<*> Support for frame buffer devices ---> (里面的都空选)

<*> Support for frame buffer devices --->

[ ] Backlight & LCD device support --->

<*> S3C Framebuffer Support (eXtended)(修改Kconfig之后才有这个选)

Select LCD Type (4.3 inch 480x272 TFT LCD) --->

(X) 4.3 inch 480x272 TFT LCD

<*> Advanced options for S3C Framebuffer

Select BPP(Bits Per Pixel) (16 BPP) --->

(4) Number of Framebuffers

[ ] Enable Virtual Screen

[*] Enable Double Buffering

Console display driver support --->

<*> Framebuffer Console support

[*] Bootup logo --->(显示小企鹅)

[*] Standard 224-color Linux logo

#################################################################################

又可以开始编译了把内核下载到开发板后,启动的时候会出现一只企鹅就是linux。

启动部分出现

S3C_LCD clock got enabled :: 133.000 Mhz
LCD TYPE :: LTE480WV will be initialized
Window[0] - FB1: map_video_memory: clear ffd80000:0007f800
            FB1: map_video_memory: dma=5f900000 cpu=ffd80000 size=0007f800
Window[0] - FB2: map_video_memory: clear ffdbfc00:0003fc00
            FB2: map_video_memory: dma=5f93fc00 cpu=ffdbfc00 size=0003fc00
Console: switching to colour frame buffer device 60x34
fb0: s3cfb frame buffer device
Window[1] - FB1: map_video_memory: clear ffd00000:0007f800
            FB1: map_video_memory: dma=5f980000 cpu=ffd00000 size=0007f800
Window[1] - FB2: map_video_memory: clear ffd3fc00:0003fc00
            FB2: map_video_memory: dma=5f9bfc00 cpu=ffd3fc00 size=0003fc00
fb1: s3cfb frame buffer device
Window[2] - FB1: map_video_memory: clear ffcc0000:0003fc00
            FB1: map_video_memory: dma=5fa00000 cpu=ffcc0000 size=0003fc00
fb2: s3cfb frame buffer device
Window[3] - FB1: map_video_memory: clear ffc80000:0003fc00
            FB1: map_video_memory: dma=5fa40000 cpu=ffc80000 size=0003fc00
fb3: s3cfb frame buffer device

证明你的LCD驱动已经成功移植了




你可能感兴趣的:(linux)