这几天分别把内核,根文件系统分别移植制作完成了,虽然遇到很多问题但是最终都解决了。
所以觉得做点东西,如何更直观呢?我想一定是要使用到屏幕的显示的。
像这种很共性的东西,我想肯定是有人已经写好了驱动了,我们只需要添加到我们的内核中就够了。
接下来就讲一讲具体的移植方法。
打开 arch/arm/mach-s3c2440/mach-smdk2440.c,先删除之前的 LCD 设备平台代码,如
下:
/* LCD driver info */
static struct s3c2410fb_display smdk2440_lcd_cfg __initdata = {
.lcdcon5 = S3C2410_LCDCON5_FRM565 |
S3C2410_LCDCON5_INVVLINE |
S3C2410_LCDCON5_INVVFRAME |
S3C2410_LCDCON5_PWREN |
S3C2410_LCDCON5_HWSWP,
.type = S3C2410_LCDCON1_TFT,
.width = 240,
.height = 320,
.pixclock = 166667, /* HCLK 60 MHz, divisor 10 */
.xres = 240,
.yres = 320,
.bpp = 16,
.left_margin = 20,
.right_margin = 8,
.hsync_len = 4,
.upper_margin = 8,
.lower_margin = 7,
.vsync_len = 4,
};
static struct s3c2410fb_mach_info smdk2440_fb_info __initdata = {
.displays = &smdk2440_lcd_cfg,
.num_displays = 1,
.default_display = 0,
#if 0
/* currently setup by downloader */
.gpccon = 0xaa940659,
.gpccon_mask = 0xffffffff,
.gpcup = 0x0000ffff,
.gpcup_mask = 0xffffffff,
.gpdcon = 0xaa84aaa0,
.gpdcon_mask = 0xffffffff,
.gpdup = 0x0000faff,
.gpdup_mask = 0xffffffff,
#endif
.lpcsel = ((0xCE6) & ~7) | 1<<4,
再把别人已经移植好的代码加入,如下:
/* LCD driver info */
;NEC 3.5”LCD 的配置和参数设置
#if defined(CONFIG_FB_S3C2410_N240320)
#define LCD_WIDTH 240
#define LCD_HEIGHT 320
#define LCD_PIXCLOCK 100000
#define LCD_RIGHT_MARGIN 36
#define LCD_LEFT_MARGIN 19
#define LCD_HSYNC_LEN 5
#define LCD_UPPER_MARGIN 1
#define LCD_LOWER_MARGIN 5
#define LCD_VSYNC_LEN 1
#endif
#if defined (LCD_WIDTH)
#endif
static struct s3c2410fb_display smdk2440_lcd_cfg __initdata = {
#if !defined (LCD_CON5)
.lcdcon5 = S3C2410_LCDCON5_FRM565 |
S3C2410_LCDCON5_INVVLINE |
S3C2410_LCDCON5_INVVFRAME |
S3C2410_LCDCON5_PWREN |
S3C2410_LCDCON5_HWSWP,
#else
.lcdcon5 = LCD_CON5,
#endif
.type = S3C2410_LCDCON1_TFT,
.width = LCD_WIDTH,
.height = LCD_HEIGHT,
.pixclock = LCD_PIXCLOCK,
.xres = LCD_WIDTH,
.yres = LCD_HEIGHT,
.bpp = 16,
.left_margin = LCD_LEFT_MARGIN + 1,
.right_margin = LCD_RIGHT_MARGIN + 1,
.hsync_len = LCD_HSYNC_LEN + 1,
.upper_margin = LCD_UPPER_MARGIN + 1,
.lower_margin = LCD_LOWER_MARGIN + 1,
.vsync_len = LCD_VSYNC_LEN + 1,
};
static struct s3c2410fb_mach_info smdk2440_fb_info __initdata = {
.displays = &smdk2440_lcd_cfg,
.num_displays = 1,
.default_display = 0,
default_display = 0,
.gpccon = 0xaa955699,
.gpccon_mask = 0xffc003cc,
.gpcup = 0x0000ffff,
.gpcup_mask = 0xffffffff,
.gpdcon = 0xaa95aaa1,
.gpdcon_mask = 0xffc0fff0,
.gpdup = 0x0000faff,
.gpdup_mask = 0xffffffff,
.lpcsel = 0xf82,
};
然后打开drivers/video/Kconfig,在大概 1935 行加入以下配置信息:
config FB_S3C2410_DEBUG
bool "S3C2410 lcd debug messages"
depends on FB_S3C2410
help
Turn on debugging messages. Note that you can set/unset at run time
through sysfs
choice
prompt "LCD select"
depends on FB_S3C2410
help
S3C24x0 LCD size select
config FB_S3C2410_T240320
boolean "3.5 inch 240X320 Toppoly LCD"
depends on FB_S3C2410
help
3.5 inch 240X320 Toppoly LCD
endchoice
由于我用的是mini2440的LCD的移植,他有好几种屏,但是我只有一种,所以我只移植了一部分
为了减少内核的大小。但是由于KConfig,中的配置关系我没有整太明白所以,编译的时候
产生了这样一个打印信息
Support for frame buffer devices
*
Support for frame buffer devices (FB) [Y/n/m/?] y
Enable firmware EDID (FIRMWARE_EDID) [Y/n/?] y
Enable Video Mode Handling Helpers (FB_MODE_HELPERS) [Y/n/?] y
Enable Tile Blitting Support (FB_TILEBLITTING) [N/y/?] n
*
* Frame buffer hardware drivers
*
Epson S1D13XXX framebuffer support (FB_S1D13XXX) [N/m/y/?] n
S3C2410 LCD framebuffer support (FB_S3C2410) [Y/n/m/?] y
S3C2410 lcd debug messages (FB_S3C2410_DEBUG) [N/y/?] n
S3C2410 lcd debug messages (FB_S3C2410_DEBUG) [N/y/?] n
LCD select
> 1. 3.5 inch 240X320 Toppoly LCD (FB_S3C2410_T240320) (NEW)
2. 3.5 inch 240X320 NEC LCD (FB_S3C2410_N240320) (NEW)
choice[1-2?]: 2
Silicon Motion SM501 framebuffer support (FB_SM501) [Y/n/m/?] y
Virtual Frame Buffer support (ONLY FOR TESTING!) (FB_VIRTUAL) [N/m/y/?] n
E-Ink Metronome/8track controller support (FB_METRONOME) [N/m/y/?] n
Fujitsu MB862xx GDC support (FB_MB862XX) [N/m/y/?] n
E-Ink Broadsheet/Epson S1D13521 controller support (FB_BROADSHEET) [N/m/y/?] n
#
我选择了2,编译通过,在make menuconfig
Device Drivers --->
Graphics support --->
<*> Support for frame buffer devices --->
LCD select (3.5 inch 240X320 Toppoly LCD) --->
里面有两个选项,
选择3.5 inch 240*320 NEC LCD
如果编译不能通过的话,就选择另一个。