1.修改arch/arm/mach-s3c64xx/mach-ok6410.c中关于LCD的部分程序:
-
static struct s3c2410_platform_nand ok6410_nand_info = {
-
.tacls = 25,
-
.twrph0 = 55,
-
.twrph1 = 40,
-
.nr_sets = ARRAY_SIZE(ok6410_nand_sets),
-
.sets = ok6410_nand_sets,
-
};
-
-
static struct s3c_fb_pd_win ok6410_lcd_type0_fb_win = {
-
.max_bpp = 32,
-
.default_bpp = 16,
-
.xres = 480,
-
.yres = 272,
-
};
-
-
static struct fb_videomode ok6410_lcd_type0_timing = {
-
/* 4.3" 480x272 */
-
.left_margin = 3,
-
.right_margin = 5,
-
.upper_margin = 3,
-
.lower_margin = 3,
-
.hsync_len = 42,
-
.vsync_len = 12,
-
.xres = 480,
-
.yres = 272,
-
};
-
/*对于4.3寸屏 这部分没有用,所以屏蔽掉了
-
static struct s3c_fb_pd_win ok6410_lcd_type1_fb_win = {
-
.max_bpp = 32,
-
.default_bpp = 16,
-
.xres = 800,
-
.yres = 480,
-
};
-
-
static struct fb_videomode ok6410_lcd_type1_timing = {
-
//7.0" 800x480
-
.left_margin = 8,
-
.right_margin = 13,
-
.upper_margin = 7,
-
.lower_margin = 5,
-
.hsync_len = 3,
-
.vsync_len = 1,
-
.xres = 800,
-
.yres = 480,
-
};*/
-
-
static struct s3c_fb_platdata ok6410_lcd_pdata[] __initdata = {
-
{
-
.setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
-
.vtiming = &ok6410_lcd_type0_timing,
-
.win[0] = &ok6410_lcd_type0_fb_win,
-
.vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
-
.vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
-
}, /*{
-
.setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
-
.vtiming = &ok6410_lcd_type1_timing,
-
.win[0] = &ok6410_lcd_type1_fb_win,
-
.vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
-
.vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
-
},*/
-
{ },
-
};
-
-
static void ok6410_lcd_power_set(struct plat_lcd_data *pd,
-
unsigned int power)
-
{
-
/*if (power)
-
gpio_direction_output(S3C64XX_GPE(0), 1);
-
else
-
gpio_direction_output(S3C64XX_GPE(0), 0);*/
-
if (power) {
-
gpio_direction_output(S3C64XX_GPF(13), 1);
-
gpio_direction_output(S3C64XX_GPF(15), 1);
-
-
/* fire nRESET on power up */
-
gpio_direction_output(S3C64XX_GPN(5), 0);
-
//msleep(10);
-
gpio_direction_output(S3C64XX_GPN(5), 1);
-
//msleep(1);
-
}
-
else {
-
gpio_direction_output(S3C64XX_GPF(15), 0);
-
gpio_direction_output(S3C64XX_GPF(13), 0);
-
}
-
}
-
-
static struct plat_lcd_data ok6410_lcd_power_data = {
-
.set_power = ok6410_lcd_power_set,
-
};
-
-
static struct platform_device ok6410_lcd_powerdev = {
-
.name = "platform-lcd",
-
.dev.parent = &s3c_device_fb.dev,
-
.dev.platform_data = &ok6410_lcd_power_data,
-
};
-
-
static struct platform_device *ok6410_devices[] __initdata = {
-
&ok6410_device_eth,
-
&s3c_device_hsmmc0,
-
&s3c_device_hsmmc1,
-
&s3c_device_ohci,
-
&s3c_device_nand,
-
&s3c_device_fb,
-
&ok6410_lcd_powerdev,
-
&s3c_device_adc,
-
&s3c_device_ts,
-
};
-
-
static struct map_desc smdk6410_iodesc[] = {
-
{
-
/* LCD support */
-
.virtual = (unsigned long)S3C_VA_LCD,
-
.pfn = __phys_to_pfn(S3C_PA_FB),
-
.length = SZ_16K,
-
.type = MT_DEVICE,
-
},
-
};
-
-
static void __init ok6410_map_io(void)
-
{
-
u32 tmp;
-
-
s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc));
-
s3c24xx_init_clocks(12000000);
-
s3c24xx_init_uarts(ok6410_uartcfgs, ARRAY_SIZE(ok6410_uartcfgs));
-
-
/* set the LCD type */
-
tmp = __raw_readl(S3C64XX_SPCON);
-
tmp &= ~S3C64XX_SPCON_LCD_SEL_MASK;
-
tmp |= S3C64XX_SPCON_LCD_SEL_RGB;
-
__raw_writel(tmp, S3C64XX_SPCON);
-
-
/* remove the LCD bypass */
-
tmp = __raw_readl(S3C64XX_MODEM_MIFPCON);
-
tmp &= ~MIFPCON_LCD_BYPASS;
-
__raw_writel(tmp, S3C64XX_MODEM_MIFPCON);
-
}
-
-
/*
-
* ok6410_features string
-
*
-
* 0-9 LCD configuration
-
*
-
*/
-
static char ok6410_features_str[12] __initdata = "0";
-
-
static int __init ok6410_features_setup(char *str)
-
{
-
if (str)
-
strlcpy(ok6410_features_str, str,
-
sizeof(ok6410_features_str));
-
return 1;
-
}
-
-
__setup("ok6410=", ok6410_features_setup);
-
-
#define FEATURE_SCREEN (1 << 0)
-
-
struct ok6410_features_t {
-
int done;
-
int lcd_index;
-
};
-
-
static void ok6410_parse_features(
-
struct ok6410_features_t *features,
-
const char *features_str)
-
{
-
const char *fp = features_str;
-
-
features->done = 0;
-
features->lcd_index = 0;
-
-
while (*fp) {
-
char f = *fp++;
-
-
switch (f) {
-
case '0'...'9': /* tft screen */
-
if (features->done & FEATURE_SCREEN) {
-
printk(KERN_INFO "OK6410: '%c' ignored, "
-
"screen type already set\n", f);
-
} else {
-
int li = f - '0';
-
if (li >= ARRAY_SIZE(ok6410_lcd_pdata))
-
printk(KERN_INFO "OK6410: '%c' out "
-
"of range LCD mode\n", f);
-
else {
-
features->lcd_index = li;
-
}
-
}
-
features->done |= FEATURE_SCREEN;
-
break;
-
}
-
}
-
}
-
-
static void __init ok6410_machine_init(void)
-
{
-
u32 cs1;
-
struct ok6410_features_t features = { 0 };
-
-
printk(KERN_INFO "OK6410: Option string ok6410=%s\n",
-
ok6410_features_str);
-
-
/* Parse the feature string */
-
ok6410_parse_features(&features, ok6410_features_str);
-
-
printk(KERN_INFO "OK6410: selected LCD display is %dx%d\n",
-
ok6410_lcd_pdata[features.lcd_index].win[0]->xres,
-
ok6410_lcd_pdata[features.lcd_index].win[0]->yres);
-
-
s3c_nand_set_platdata(&ok6410_nand_info);
-
s3c_fb_set_platdata(&ok6410_lcd_pdata[features.lcd_index]);
-
s3c24xx_ts_set_platdata(NULL);
-
-
-
s3c_sdhci0_set_platdata(&ok6410_hsmmc0_pdata);
-
s3c_sdhci1_set_platdata(&ok6410_hsmmc1_pdata);
-
-
/* configure nCS1 width to 16 bits */
-
-
cs1 = __raw_readl(S3C64XX_SROM_BW) &
-
~(S3C64XX_SROM_BW__CS_MASK << S3C64XX_SROM_BW__NCS1__SHIFT);
-
cs1 |= ((1 << S3C64XX_SROM_BW__DATAWIDTH__SHIFT) |
-
(1 << S3C64XX_SROM_BW__WAITENABLE__SHIFT) |
-
(1 << S3C64XX_SROM_BW__BYTEENABLE__SHIFT)) <<
-
S3C64XX_SROM_BW__NCS1__SHIFT;
-
__raw_writel(cs1, S3C64XX_SROM_BW);
-
-
/* set timing for nCS1 suitable for ethernet chip */
-
-
__raw_writel((0 << S3C64XX_SROM_BCX__PMC__SHIFT) |
-
(6 << S3C64XX_SROM_BCX__TACP__SHIFT) |
-
(4 << S3C64XX_SROM_BCX__TCAH__SHIFT) |
-
(1 << S3C64XX_SROM_BCX__TCOH__SHIFT) |
-
(13 << S3C64XX_SROM_BCX__TACC__SHIFT) |
-
(4 << S3C64XX_SROM_BCX__TCOS__SHIFT) |
-
(0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1);
-
-
gpio_request(S3C64XX_GPF(15), "LCD power");
-
gpio_request(S3C64XX_GPE(0), "LCD power");
-
-
platform_add_devices(ok6410_devices, ARRAY_SIZE(ok6410_devices));
-
}
2.添加lcd的驱动
2.1将厂家提供的源代码linux3.0.1中的drviers/video/samsung拷贝到drviers/video/目录下
2.2将厂家提供的源代码linux3.0.1中的arch/arm/plat-samsung/include/plat文件夹中的regs-fb-v4.h和regs-fb.h拷贝到arch/arm/plat-samsung/include/plat目录下
2.3将厂家提供的源代码linux3.0.1中的arch/arm/mach-s3c64xx/include/mach文件夹中的regs-fb.h和regs-lcd.h拷贝到arch/arm/mach-s3c64xx/include/mach目录下
2.4修改drviers/video/samsung/s3cfb.c,把996行的int __devinit s3cfb_init(void)修改为int __init s3cfb_init(void)。(原因不知,不改要报错)
3.修改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里面的
s3c6410_pm_do_save(s3c_lcd_save, ARRAY_SIZE(s3c_lcd_save));改成s3c_pm_do_save(s3c_lcd_save, ARRAY_SIZE(s3c_lcd_save));
s3c6410_pm_do_restore(s3c_lcd_save, ARRAY_SIZE(s3c_lcd_save));改成s3c_pm_do_restore(s3c_lcd_save, ARRAY_SIZE(s3c_lcd_save));
4.配置内核:
Device Drivers --->
Graphics 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
<*> Support for frame buffer devices ---> (里面的都空选)
[ ] Backlight & LCD device support --->
Console display driver support --->
<*> Framebuffer Console support
[*] Bootup logo --->(显示小企鹅)
[*] Standard 224-color Linux logo
5.重新make uImage烧写后,可以看到如下信息,并且屏幕上显示出了小企鹅的图片
-
io scheduler noop registered
-
io scheduler deadline registered
-
io scheduler cfq registered (default)
-
S3C_LCD clock got enabled :: 133.250 Mhz
-
LCD TYPE :: LTE480WV will be initialized
-
failed to request GPE for lcd reset control
-
Window[0] - FB1: map_video_memory: clear d0856000:0007f800
-
FB1: map_video_memory: dma=5f980000 cpu=d0856000 size=0007f800
-
Window[0] - FB2: map_video_memory: clear d0895c00:0003fc00
-
FB2: map_video_memory: dma=5f9bfc00 cpu=d0895c00 size=0003fc00
-
Console: switching to colour frame buffer device 60x34
-
fb0: s3cfb frame buffer device
-
Window[1] - FB1: map_video_memory: clear d08d7000:0007f800
-
FB1: map_video_memory: dma=5fa00000 cpu=d08d7000 size=0007f800
-
Window[1] - FB2: map_video_memory: clear d0916c00:0003fc00
-
FB2: map_video_memory: dma=5fa3fc00 cpu=d0916c00 size=0003fc00
-
fb1: s3cfb frame buffer device
-
Window[2] - FB1: map_video_memory: clear d0958000:0003fc00
-
FB1: map_video_memory: dma=5fa80000 cpu=d0958000 size=0003fc00
-
fb2: s3cfb frame buffer device
-
Window[3] - FB1: map_video_memory: clear d0999000:0003fc00
-
FB1: map_video_memory: dma=5fac0000 cpu=d0999000 size=0003fc00
-
fb3: s3cfb frame buffer device
-
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
-
s3c6400-uart.0: ttySAC0 at MMIO 0x7f005000 (irq = 69) is a S3C6400/10
-
console [ttySAC0] enabled
6.TS的移植参考http://blog.chinaunix.net/uid-28382924-id-3485011.html
另外,还要修改两个地方,在/include/linux/interruput.h文件中添加#define IRQF_SAMPLE_RANDOM 0x00000040
为防止在后期的tslib移植中不出现selected device is not a touchscreen I understand问题,把/include/uapl/linux/input.h中的#define EV_VERSION 0x010001改为#define EV_VERSION 0x010001
阅读(1298) | 评论(0) | 转发(0) |