天嵌 ARM开发社区

 找回密码
 注册
查看: 3541|回复: 4

Step Buy Step_V4.2 linux2.6.30.4之LCD驱动移植问题!

[复制链接]
hai8108 发表于 2010-4-17 11:46:18 | 显示全部楼层 |阅读模式
最近在移植linux内核过程中碰到这个问题:
yaffs Mar 24 2010 14:56:32 Installing.
msgmni has been set to 118
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Failed to allocate video RAM: -12
s3c2410-lcd: probe of s3c2410-lcd failed with error -12

backlight initialized
一直不知道是怎么回事,我把移植步骤说下(其实我是一步一步按照手册移植的,但是总是出现这个问题,不知道哪里错了),望大虾能够解答:
1、修改 drivers/video/s3c2410fb.c文件
static void s3c2410fb_activate_var(struct fb_info *info)
{
        struct s3c2410fb_info *fbi = info->par;
        void __iomem *regs = fbi->io;
        int type = fbi->regs.lcdcon1 & S3C2410_LCDCON1_TFT;
        struct fb_var_screeninfo *var = &info->var;       
        struct s3c2410fb_mach_info *mach_info = fbi->dev->platform_data;
        struct s3c2410fb_display *default_display = mach_info->displays +
                                      mach_info->default_display;

        int clkdiv = s3c2410fb_calc_pixclk(fbi, var->pixclock) / 2;
        dprintk("%s: var->xres  = %d\n",__FUNCTION__, var->xres);
        dprintk("%s: var->yres  = %d\n",__FUNCTION__, var->yres);
        dprintk("%s: var->bpp   = %d\n",__FUNCTION__, var->bits_per_pixel);
               

        fbi->regs.lcdcon1 |=  S3C2410_LCDCON1_CLKVAL(default_display->setclkval);

2、修改arch/arm/mach-s3c2410/include/mach/fb.h文件
/* LCD description */
struct s3c2410fb_display {
        /* LCD type */
        unsigned type;

        /* Screen size */
        unsigned short width;
        unsigned short height;

        /* Screen info */
        unsigned short xres;
        unsigned short yres;
        unsigned short bpp;

        unsigned pixclock;                /* pixclock in picoseconds */

        unsigned setclkval;                /* clkval */修改这个地方

        unsigned short left_margin;          /* value in pixels (TFT) or HCLKs (STN) */
        unsigned short right_margin;         /* value in pixels (TFT) or HCLKs (STN) */
        unsigned short hsync_len;            /* value in pixels (TFT) or HCLKs (STN) */
        unsigned short upper_margin;        /* value in lines (TFT) or 0 (STN) */
        unsigned short lower_margin;        /* value in lines (TFT) or 0 (STN) */
        unsigned short vsync_len;        /* value in lines (TFT) or 0 (STN) */

        /* lcd configuration registers */
        unsigned long        lcdcon5;
};

3、修改LCD参数设置文件:arch/arm/mach-s3c2440/mach-smdk2440.c如下
/* 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,

#if defined(CONFIG_FB_S3C24X0_T240320)
        .width                = 240,
        .height                = 320,

        .pixclock                = 100000, /* HCLK 100 MHz, divisor 4 */
        .setclkval                = 0x4,
        .xres                = 240,
        .yres                = 320,
        .bpp                = 16,
        .left_margin        = 3,        /* for HFPD*/
        .right_margin        = 6,        /* for HBPD*/
        .hsync_len        = 1,        /* for HSPW*/
        .upper_margin        = 2,        /* for VFPD*/
        .lower_margin        = 1,        /* for VBPD*/
        .vsync_len        = 1,        /* for VSPW*/

#elif        defined(CONFIG_FB_S3C24X0_S320240)
        .width                = 320,
        .height                = 240,

        .pixclock                = 80000, /* HCLK 100 MHz, divisor 3 */
        .setclkval                = 0x3,
        .xres                = 320,
        .yres                = 240,
        .bpp                = 16,
        .left_margin        = 15,        /* for HFPD*/
        .right_margin        = 5,        /* for HBPD*/
        .hsync_len        = 8,        /* for HSPW*/
        .upper_margin        = 5,        /* for VFPD*/
        .lower_margin        = 3,        /* for VBPD*/
        .vsync_len        = 15,        /* for VSPW*/

#elif        defined(CONFIG_FB_S3C24X0_W320240)
        .width                = 320,
        .height                = 240,

        .pixclock                = 80000, /* HCLK 100 MHz, divisor 3 */
        .setclkval                = 0x3,
        .xres                = 320,
        .yres                = 240,
        .bpp                = 16,
        .left_margin        = 28,        /* for HFPD*/
        .right_margin        = 24,        /* for HBPD*/
        .hsync_len        = 42,        /* for HSPW*/
        .upper_margin        = 6,        /* for VFPD*/
        .lower_margin        = 2,        /* for VBPD*/
        .vsync_len        = 12,        /* for VSPW*/

#elif        defined(CONFIG_FB_S3C24X0_LCD480272)
        .width                = 480,
        .height                = 272,

        .pixclock                = 40000, /* HCLK 100 MHz, divisor 1 */
        .setclkval                = 0x4,
        .xres                = 480,
        .yres                = 272,
        .bpp                = 16,
        .left_margin        = 19,        /* for HFPD*/
        .right_margin        = 10,        /* for HBPD*/
        .hsync_len        = 30,        /* for HSPW*/
        .upper_margin        = 4,        /* for VFPD*/
        .lower_margin        = 2,        /* for VBPD*/
        .vsync_len        = 8,        /* for VSPW*/

#elif        defined(CONFIG_FB_S3C24X0_TFT640480)
        .width                = 640,
        .height                = 480,

        .pixclock                = 40000, /* HCLK 100 MHz, divisor 1 */
        .setclkval                = 0x1,
        .xres                = 640,
        .yres                = 480,
        .bpp                = 16,
        .left_margin        = 40,        /* for HFPD*/
        .right_margin        = 67,        /* for HBPD*/
        .hsync_len        = 31,        /* for HSPW*/
        .upper_margin        = 5,        /* for VFPD*/
        .lower_margin        = 25,        /* for VBPD*/
        .vsync_len        = 1,        /* for VSPW*/

#elif        defined(CONFIG_FB_S3C24X0_TFT800480)
        .width                = 800,
        .height                = 480,

        .pixclock                = 40000, /* HCLK 100 MHz, divisor 1 */
        .setclkval                = 0x1,
        .xres                = 800,
        .yres                = 480,
        .bpp                = 16,
        .left_margin        = 15,        /* for HFPD*/
        .right_margin        = 47,        /* for HBPD*/
        .hsync_len        = 95,        /* for HSPW*/
        .upper_margin        = 9,        /* for VFPD*/
        .lower_margin        = 5,        /* for VBPD*/
        .vsync_len        = 1,        /* for VSPW*/

#elif        defined(CONFIG_FB_S3C24X0_TFT800600)
        .width                = 800,
        .height                = 600,

        .pixclock                = 40000, /* HCLK 100 MHz, divisor 1 */
        .setclkval                = 0x1,
        .xres                = 800,
        .yres                = 600,
        .bpp                = 16,
        .left_margin        = 15,        /* for HFPD*/
        .right_margin        = 47,        /* for HBPD*/
        .hsync_len        = 95,        /* for HSPW*/
        .upper_margin        = 9,        /* for VFPD*/
        .lower_margin        = 5,        /* for VBPD*/
        .vsync_len        = 1,        /* for VSPW*/

#endif
};
4、修改drives/video/Kconfig 文件如下:
config FB_S3C24X0
        tristate "S3C24X0 LCD framebuffer support"
        depends on FB && ARCH_S3C2410
        select FB_CFB_FILLRECT
        select FB_CFB_COPYAREA
        select FB_CFB_IMAGEBLIT
        ---help---
          Frame buffer driver for the built-in LCD controller in the Samsung
          S3C2410 processor.

          This driver is also available as a module ( = code which can be
          inserted and removed from the running kernel whenever you want). The
          module will be called s3c2410fb. If you want to compile it as a module,
          say M here and read <file:Documentation/kbuild/modules.txt>.

          If unsure, say N.
choice
        prompt "LCD select"
        depends on FB_S3C24X0
        help
           S3C24X0 LCD size select
config FB_S3C24X0_S320340
        boolean "3.5 inch 320x240 Samsung LCD"
        depends on FB_S3C24X0
        help
           3.5 inch 320x240 Samgsung LCD
config FB_S3C24X0_W320340
        boolean "3.5 inch 320x240 WanXin LCD"
        depends on FB_S3C24X0
        help
           3.5 inch 320x240 WanXin LCD
config FB_S3C24X0_T240320
        boolean "3.5 inch 240x320 Toshiba LCD"
        depends on FB_S3C24X0
        help
           3.5 inch 240x320 Toshiba LCD
config FB_S3C24X0_TFT480272
        boolean "4.3 inch 480x272 TFT LCD"
        depends on FB_S3C24X0
        help
           4.3 inch 480x272 TFT LCD
config FB_S3C24X0_TFT640480
        boolean "VGA 640x480"
        depends on FB_S3C24X0
        help
           VGA 640x480
config FB_S3C24X0_TFT800480
        boolean "7 inch 800x480 LCD"
        depends on FB_S3C24X0
        help
           7.0 inch 800x480 LCD
config FB_S3C24X0_TFT800600
        boolean "10.4 inch 800x600 TFT LCD"
        depends on FB_S3C24X0
        help
           10.4 inch 800x600 TFT LCD
endchoice

config FB_S3C2410_DEBUG
        bool "S3C24X0 lcd debug messages"
        depends on FB_S3C24X0
        help
          Turn on debugging messages. Note that you can set/unset at run time
          through sysfs
5、再修改drivers/video/Makefile文件:
obj-$(CONFIG_FB_BROADSHEET)       += broadsheetfb.o
obj-$(CONFIG_FB_S1D13XXX)          += s1d13xxxfb.o
obj-$(CONFIG_FB_SH7760)                  += sh7760fb.o
obj-$(CONFIG_FB_IMX)              += imxfb.o
obj-$(CONFIG_FB_S3C)                  += s3c-fb.o

obj-$(CONFIG_FB_S3C24X0)          += s3c2410fb.o        //这是根据要求修改的

obj-$(CONFIG_TQ2440_BACKLIGHT)          +=EmbedSky_backlight.o
obj-$(CONFIG_FB_FSL_DIU)          += fsl-diu-fb.o
obj-$(CONFIG_FB_COBALT)           += cobalt_lcdfb.o
obj-$(CONFIG_FB_PNX4008_DUM)          += pnx4008/
obj-$(CONFIG_FB_PNX4008_DUM_RGB)  += pnx4008/
obj-$(CONFIG_FB_IBM_GXT4500)          += gxt4500.o
obj-$(CONFIG_FB_PS3)                  += ps3fb.o
obj-$(CONFIG_FB_SM501)            += sm501fb.o
obj-$(CONFIG_FB_XILINX)           += xilinxfb.o

6、制作Linux开机logo之1--图片处理
        这个肯定没问题!

7、制作Linux开机logo之2--支持更多LCD设置

        这个也肯定没问题
8、内核配置:(手册上是15.6步,对照了好几遍,应该没有错误)
  选择:3.5inch 320x240 WanXin LCD
        Standard 224-color Linux logo
然后编译出镜像,烧写进开发板(TQ2440)启动系统,LCD首先是同时显示各种颜色,过会儿,系统启动完就变成纯白色,然后一直这样子!!这是怎么回事呢?后来我用光盘内核源码镜像写进开发板,能够顺利地进入LCD触摸屏校正程序,最终能够出现操作界面!yaffs文件系统是我自己建立的,仅有的区别是linux内核不同!用我自己移植内核什么都进不了,超级终端能够操作,LCD一直显示纯白色!!!
 楼主| hai8108 发表于 2010-4-17 11:49:31 | 显示全部楼层
下面是启动过程信息:
Enter your selection: 8
Start Linux ...
Copy linux kernel from 0x00200000 to 0x30008000, size = 0x00200000 ... Copy Kernel to SDRAM done,NOW, Booting Linux......
Uncompressing Linux................................................................................................................................. done, booting the kernel.
Linux version 2.6.30.4-EmbedSky (root@EmbedSky) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203) ) #26 Fri Apr 16 08:53:52 CST 2010
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: SMDK2440
ATAG_INITRD is deprecated; please update your bootloader.
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C24XX Clocks, (c) 2004 Simtec Electronics
S3C244X: core 400.000 MHz, memory 100.000 MHz, peripheral 50.000 MHz
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
Kernel command line: noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0
NR_IRQS:85
irq: clearing pending ext status 00080000
irq: clearing subpending status 00000003
irq: clearing subpending status 00000002
PID hash table entries: 256 (order: 8, 1024 bytes)
Console: colour dummy device 80x30
console [ttySAC0] enabled
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 60572KB available (3592K code, 388K data, 196K init, 0K highmem)
SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Calibrating delay loop... 199.47 BogoMIPS (lpj=498688)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 936 bytes
NET: Registered protocol family 16
S3C Power Management, Copyright 2004 Simtec Electronics
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4808000, irq 33
DMA channel 1 at c4808040, irq 34
DMA channel 2 at c4808080, irq 35
DMA channel 3 at c48080c0, irq 36
S3C244X: Clock Support, DVS off
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
s3c2440-i2c s3c2440-i2c: slave address 0x10
s3c2440-i2c s3c2440-i2c: bus frequency set to 97 KHz
s3c2440-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
NET: Registered protocol family 1
NetWinder Floating Point Emulator V0.97 (extended precision)
JFFS2 version 2.2. (NAND) (SUMMARY)  漏 2001-2006 Red Hat, Inc.
ROMFS MTD (C) 2007 Red Hat, Inc.
yaffs Mar 24 2010 14:56:32 Installing.
msgmni has been set to 118
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Failed to allocate video RAM: -12
s3c2410-lcd: probe of s3c2410-lcd failed with error -12

backlight initialized
lp: driver loaded but no devices found
ppdev: user-space parallel port driver
s3c2440-uart.0: tq2440_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2440-uart.1: tq2440_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: tq2440_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440
brd: module loaded
loop: module loaded
Uniform Multi-Platform E-IDE driver
ide-gd driver 1.18
ide-cd driver 5.00
Driver 'sd' needs updating - please use bus_type methods
Driver 'sr' needs updating - please use bus_type methods
dm9000 Ethernet Driver, V1.31
Now use the default MAC address: 10:23:45:67:89:ab
eth0 (dm9000): not using net_device_ops yet
eth0: dm9000e at c486e000,c4872004 IRQ 51 MAC: 10:23:45:67:89:ab (EmbedSky)
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2440-nand s3c2440-nand: Tacls=3, 30ns Twrph0=7 70ns, Twrph1=3 30ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 611 at 0x000004c60000
Creating 3 MTD partitions on "NAND 256MiB 3,3V 8-bit":
0x000000000000-0x000000040000 : "EmbedSky_Board_uboot"
0x000000200000-0x000000400000 : "EmbedSky_Board_kernel"
0x000000400000-0x00000ff80000 : "EmbedSky_Board_yaffs2"
usbmon: debugfs is not available
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver libusual
usbcore: registered new interface driver usbserial
USB Serial support registered for generic
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial Driver core
USB Serial support registered for FTDI USB Serial Device
usbcore: registered new interface driver ftdi_sio
ftdi_sio: v1.4.3:USB FTDI Serial Converters Driver
USB Serial support registered for pl2303
usbcore: registered new interface driver pl2303
pl2303: Prolific PL2303 USB to serial adaptor driver
s3c2410_udc: debugfs dir creation failed -19
mice: PS/2 mouse device common for all mice
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c2410-rtc s3c2410-rtc: rtc disabled, re-enabling
s3c2410-rtc s3c2410-rtc: rtc core: registered s3c as rtc0
i2c /dev entries driver
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
usbcore: registered new interface driver hiddev
usbcore: registered new interface driver usbhid
usbhid: v2.6:USB HID core driver
Advanced Linux Sound Architecture Driver Version 1.0.18a.
No device for DAI UDA134X
No device for DAI s3c24xx-i2s
S3C24XX_UDA134X SoC Audio driver
UDA134X SoC Audio Codec
asoc: UDA134X <-> s3c24xx-i2s mapping ok
ALSA device list:
  #0: S3C24XX_UDA134X (UDA134X)
TCP cubic registered
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
s3c2410-rtc s3c2410-rtc: hctosys: invalid date/time
end_request: I/O error, dev mtdblock2, sector 256
isofs_fill_super: bread failed, dev=mtdblock2, iso_blknum=64, block=128
yaffs: dev is 32505858 name is "mtdblock2"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.2, "mtdblock2"
yaffs: auto selecting yaffs2
block 580 is bad
yaffs_read_super: isCheckpointed 0
VFS: Mounted root (yaffs filesystem) on device 31:2.
Freeing init memory: 196K
/etc/init.d/rcS: line 27: nsmod: not found
hwclock: settimeofday() failed: Invalid argument
Try to bring eth0 interface up ...
/etc/init.d/rcS: line 34: /etc/rc.d/init.d/leds: not found
ifconfig eth0 hw ether 10:23:45:67:89:ab
eth0: link down
ifconfig eth0 192.168.1.6 netmask 255.255.255.0 up
add default gw 192.168.1.2
Done
[01/Jan/1970:00:00:10 +0000] Start Qtopia-2.2.0
boa: server version Boa/0.94.13
[01/Jan/1970:00:00:10 +0000] boa: server built Jul 29 2009 at 14:27:34.
[01/Jan/1970:00:00:10 +0000] boa: starting server pid=1024, port 80

Please press Enter to activate this console. name=/dev/event0
ts_open: No such file or directory

[root@EmbedSky /]#
亚瑟王 发表于 2010-4-17 17:23:24 | 显示全部楼层
只支持1种LCD类型时是正常的吗?
 楼主| hai8108 发表于 2010-4-17 19:15:11 | 显示全部楼层
这个还没试呢,一会我试试!!!:)
zzcc209 发表于 2010-9-13 13:24:22 | 显示全部楼层
问题解决了吗?我也遇到这样的问题。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号-2 )

GMT+8, 2024-10-6 14:23 , Processed in 1.035196 second(s), 18 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表