Chinaunix首页 | 论坛 | 博客
  • 博客访问: 188167
  • 博文数量: 20
  • 博客积分: 2010
  • 博客等级: 大尉
  • 技术积分: 405
  • 用 户 组: 普通用户
  • 注册时间: 2007-07-19 13:00
文章分类
文章存档

2011年(1)

2009年(18)

2008年(1)

我的朋友

分类: LINUX

2009-03-23 10:51:20

    之前的开发板提供的系统比较老,是2.4.18的内核,为了使用2.6的内核,就将2.6的内核移植到开发板上了,因为刚移植了2.6.22的新内核,程序都没有加上,只是开始将CS8900的驱动程序移植上去了,因为那样通过NFS调试程序比较方便。现在要用到MiniGUI,所以就开始移植LCD的驱动,开始在网上搜索移植的方法,开始移植的过程。

本次移植主要参考了http://blog.chinaunix.net/u1/34474/showart.php?id=396609这篇文章,感谢这位大侠提供了宝贵的经验。

 

移植的主要步骤如下:

一、修改/arch/arm/mach-s3c2410/mach-smdk2410.c文件

1、             添加头文件
#include

2、          定义初始化S3C2410LCD控制器的结构体,文件全部内容如下:

 

#include <linux/kernel.h>

#include <linux/types.h>

#include <linux/interrupt.h>

#include <linux/list.h>

#include <linux/timer.h>

#include <linux/init.h>

#include <linux/serial_core.h>

#include <linux/platform_device.h>

#include "asm-arm/arch-s3c2410/regs-cs8900.h"

#include <asm/mach/arch.h>

#include <asm/mach/map.h>

#include <asm/mach/irq.h>

 

#include <asm/hardware.h>

#include <asm/io.h>

#include <asm/irq.h>

#include <asm/mach-types.h>

 

#include <asm/arch/regs-serial.h>

#include <asm/arch/fb.h>

 

#include <asm/plat-s3c24xx/devs.h>

#include <asm/plat-s3c24xx/cpu.h>

 

#include <asm/plat-s3c24xx/common-smdk.h>

 

 

 

static struct map_desc smdk2410_iodesc[] __initdata = {

  /* nothing here yet */

 {vSMDK2410_ETH_IO,pSMDK2410_ETH_IO,SZ_1M,MT_DEVICE}

};

 

#define UCON S3C2410_UCON_DEFAULT

#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB

#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE

 

static struct s3c2410_uartcfg smdk2410_uartcfgs[] __initdata = {

       [0] = {

              .hwport = 0,

              .flags = 0,

              .ucon = UCON,

              .ulcon = ULCON,

              .ufcon = UFCON,

       },

       [1] = {

              .hwport = 1,

              .flags = 0,

              .ucon = UCON,

              .ulcon = ULCON,

              .ufcon = UFCON,

       },

       [2] = {

              .hwport = 2,

              .flags = 0,

              .ucon = UCON,

              .ulcon = ULCON,

              .ufcon = UFCON,

       }

};

 

//nick LCD Driver 2009.3.22


/* LCD driver info */

 

/* Configuration for 800*480 */

static struct s3c2410fb_mach_info ljd2410_tft_cfg __initdata = {

    .type = S3C2410_LCDCON1_TFT,

    .regs = {

 

        .lcdcon1 = S3C2410_LCDCON1_TFT16BPP |

                  S3C2410_LCDCON1_TFT |

                  S3C2410_LCDCON1_CLKVAL(0x01),

 

        .lcdcon2 = S3C2410_LCDCON2_VBPD(39) |

                  S3C2410_LCDCON2_LINEVAL(479) | /*480*/

                  S3C2410_LCDCON2_VFPD(19) |

                  S3C2410_LCDCON2_VSPW(3),

 

        .lcdcon3 = S3C2410_LCDCON3_HBPD(49) |

                  S3C2410_LCDCON3_HOZVAL(799) | /* 800 */

                  S3C2410_LCDCON3_HFPD(19),

 

        .lcdcon4 = S3C2410_LCDCON4_MVAL(13) |

                  S3C2410_LCDCON4_HSPW(99),

 

        .lcdcon5 = S3C2410_LCDCON5_FRM565 |

                  S3C2410_LCDCON5_INVVLINE |

                  S3C2410_LCDCON5_INVVFRAME |

                  S3C2410_LCDCON5_PWREN |

                  S3C2410_LCDCON5_HWSWP,

 

    },

 

    .lpcsel = 0x00,

              

    .gpccon= 0xaaaaaaaa,

    .gpccon_mask= 0xffffffff,

    .gpcup= 0xffffffff,

    .gpcup_mask= 0xffffffff,

    .gpdcon= 0xaaaaaaaa,

    .gpdcon_mask= 0xffffffff,

    .gpdup= 0xffffffff,

    .gpdup_mask= 0xffffffff,

 

 

    .width =800,

    .height = 480,

 

    .xres = {

        .min = 800,

        .max = 800,

        .defval = 800,

    },

 

    .yres = {

        .min = 480,

        .max = 480,

        .defval = 480,

    },

 

    .bpp = {

        .min = 16,

        .max = 16,

        .defval = 16,

    },

};

 

//nick LCD


 

static struct platform_device *smdk2410_devices[] __initdata = {

       &s3c_device_usb,

       &s3c_device_lcd,

       &s3c_device_wdt,

       &s3c_device_i2c,

       &s3c_device_iis,

};

 

static void __init smdk2410_map_io(void)

{

       s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc));

       s3c24xx_init_clocks(0);

       s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));

       

}

 

static void __init smdk2410_init(void)

{

    s3c24xx_fb_set_platdata(&ljd2410_tft_cfg);

       platform_add_devices(smdk2410_devices, ARRAY_SIZE(smdk2410_devices));

       smdk_machine_init();

}

 

MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switch

                                * to SMDK2410 */


       /* Maintainer: Jonas Dietsche */

       .phys_io = S3C2410_PA_UART,

       .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,

       .boot_params = S3C2410_SDRAM_PA + 0x100,

       .map_io = smdk2410_map_io,

       .init_irq = s3c24xx_init_irq,

       .init_machine = smdk2410_init,

       .timer = &s3c24xx_timer,

MACHINE_END

其中,static void __init smdk2410_init(void)

函数中的  s3c24xx_fb_set_platdata(&ljd2410_tft_cfg)用来添加LCD控制器的寄存器参数设置函数

 

二、配置内核
Device Drivers  ---> 
    Graphics support  --->
        Display device support  --->
            <*> Display panel/monitor support
        <*> Support for frame buffer devices
        <*> S3C2410 LCD framebuffer support 
        Console display driver support  --->
            <*> Framebuffer Console support
            [*]   Framebuffer Console Rotation
            [*] Select compiled-in fonts
            [*]   VGA 8x8 font
            [*]   VGA 8x16 font
            [*]   Mini 4x6 font
            [*] Sparc console 8x16 font          
        [*] Bootup logo  --->
            --- Bootup logo
            [*]   Standard 224-color Linux logo  

 

编译内核

#make zImage

将编译好的内核下载到开发板的SDRAM中运行,启动后就可以看到可爱的企鹅~~~~~

阅读(1320) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~