为了直观的显示东西,所以先移植LCD 和 LED
1. 先修改mach-ok6410.c
- #include
- #include
- /* leds */
- static struct gpio_led ok6410_leds[] = {
- [0] = {
- .name = "led1",
- .gpio = S3C64XX_GPM(0),
- },
- [1] = {
- .name = "led2",
- .gpio = S3C64XX_GPM(1),
- },
- [2] = {
- .name = "led3",
- .gpio = S3C64XX_GPM(2),
- },
- [3] = {
- .name = "led4",
- .gpio = S3C64XX_GPM(3),
- },
- };
- static struct gpio_led_platform_data ok6410_gpio_led_pdata = {
- .num_leds = ARRAY_SIZE(ok6410_leds),
- .leds = ok6410_leds,
- };
- static struct platform_device ok6410_device_led = {
- .name = "leds-gpio",
- .id = -1,
- .dev = {
- .platform_data = &ok6410_gpio_led_pdata,
- },
- };
- static struct fb_videomode ok6410_lcd_type0_timing = {
- /* 4.3" 480x272 */
- #if 0
- .left_margin = 3,
- .right_margin = 2,
- .upper_margin = 1,
- .lower_margin = 1,
- .hsync_len = 40,
- .vsync_len = 1,
- .xres = 480,
- .yres = 272,
- #else
- .left_margin = 2,
- .right_margin = 2,
- .upper_margin = 2,
- .lower_margin = 2,
- .hsync_len = 41,
- .vsync_len = 10,
- .xres = 480,
- .yres = 272,
- #endif
- };
- #if 0
- 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,
- };
- #endif
- 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,
- },
- #if 0
- {
- .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,
- },
- #endif
- { },
- };
- static void ok6410_lcd_power_set(struct plat_lcd_data *pd,
- unsigned int power)
- {
- #if 0
- if (power)
- gpio_direction_output(S3C64XX_GPE(0), 1);
- else
- gpio_direction_output(S3C64XX_GPE(0), 0);
- #else
- 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);
- }
- #endif
- }
- 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,
- &ok6410_device_led,
- };
- static struct map_desc ok6410_iodesc[] = {
- [0] = {
- /* 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(NULL, 0);
- s3c64xx_init_io(ok6410_iodesc, ARRAY_SIZE(ok6410_iodesc));
- s3c24xx_init_clocks(12000000);
- s3c24xx_init_uarts(ok6410_uartcfgs, ARRAY_SIZE(ok6410_uartcfgs));
- samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
- /* 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);
- }
复制代码
2. 拷贝video驱动
将厂家提供的源代码linux3.0.1中的drviers/video/samsung拷贝到drviers/video/目录下
修改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));
上面这段来自:http://blog.chinaunix.net/uid-28382924-id-3484385.html
3. 接下来解决一些会产生编译错误的方法
drivers/video/samsung/s3cfb.c
- //static int __init s3cfb_probe(struct platform_device *pdev)
- static int s3cfb_probe(struct platform_device *pdev)
复制代码
- //int __devinit s3cfb_init(void)
- int __init s3cfb_init(void)
复制代码
拷贝原厂的arch/arm/plat-samsung/include/plat/regs-fb.h, regs-fb-v4.h到现在内核对应的位置
拷贝原厂的arch/arm/mach-s3c64xx/include/mach/regs-fb.h, regs-lcd.h到现在内核对应的位置
4. 内核配置
LED
LCD
0
评分
-
查看全部评分
|
|
|
|
最后发现,其实LCD移植是不用拷贝文件的,直接打开S3C FB选项就好了,这个在内核里已经存在,不用三星的驱动
|
|
|
|
|
- make modules_install INSTALL_MOD_PATH=/home/zhanlei/nfs/mouldes
复制代码
模块安装
|
|
|
|
|
- Eclipse 插入内核裁剪的宏配置
- cat autoconf.h |grep define |awk '{print "" $2 "" $
- 3 "
"}' > symbol.xml
复制代码
|
|
|
|
|
头像被屏蔽
· 2016-9-11 15:39:00
|
|
|
|
|