全部博文(1493)
分类: LINUX
2013-01-31 17:21:40
原文地址:Linux3.6.7在OK6410平台的移植(十一)LCD 作者:STANzxd
本次移植大部分内容参考网上这篇文章:http://www.cnblogs.com/zuobaozhu/archive/2012/05/13/2498092.html#_Toc324535492
1.mach-ok6410.c关于LCD的部分程序:
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 = 2,//3,
.right_margin = 2,
.upper_margin = 2,//1,
.lower_margin = 2,//1,
.hsync_len = 41,//40,
.vsync_len = 10,//1,
.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_usb_hsotg,
&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);
}
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);
s3c_hsotg_phy_config(1);
/* 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.将厂家提供的源代码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));
3.配置内核:
Device Drivers --->
Graphics support --->
<*> Support for frame buffer devices ---> (里面的都空选)
[ ] Backlight & LCD device 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
Console display driver support --->
<*> Framebuffer Console support
[*] Bootup logo --->(显示小企鹅)
[*] Standard 224-color Linux logo
主要的移植过程基本上就这些,有些小错误很容易就能修改过来了。好了,最后启动系统如下:
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0
Linux version 3.6.7 (root@ubuntu) (gcc version 4.5.1 (ctng-1.8.1-FA) ) #39 Sun J
an 27 23:34:53 CST 2013
CPU: ARMv6-compatible processor [410fb766] revision 6 (ARMv7), cr=00c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
Machine: OK6410
Memory policy: ECC disabled, Data cache writeback
CPU S3C6410 (id 0x36410101)
S3C24XX Clocks, Copyright 2004 Simtec Electronics
camera: no parent clock specified
S3C64XX: PLL settings, A=533000000, M=533000000, E=24000000
S3C64XX: HCLK2=266500000, HCLK=133250000, PCLK=66625000
mout_apll: source is fout_apll (1), rate is 533000000
mout_epll: source is epll (1), rate is 24000000
mout_mpll: source is mpll (1), rate is 533000000
usb-bus-host: source is clk_48m (0), rate is 48000000
audio-bus: source is mout_epll (0), rate is 24000000
audio-bus: source is mout_epll (0), rate is 24000000
audio-bus: source is mout_epll (0), rate is 24000000
irda-bus: source is mout_epll (0), rate is 24000000
camera: no parent clock specified
CPU: found DTCM0 8k @ 00000000, not enabled
CPU: moved DTCM0 8k to fffe8000, enabled
CPU: found DTCM1 8k @ 00000000, not enabled
CPU: moved DTCM1 8k to fffea000, enabled
CPU: found ITCM0 8k @ 00000000, not enabled
CPU: moved ITCM0 8k to fffe0000, enabled
CPU: found ITCM1 8k @ 00000000, not enabled
CPU: moved ITCM1 8k to fffe2000, enabled
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65024
Kernel command line: noinitrd root=/dev/mtdblock2 rootfstype=yaffs2 init=/linuxr
c console=ttySAC0,115200
PID hash table entries: 1024 (order: 0, 4096 bytes)
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 256MB = 256MB total
Memory: 255128k/255128k available, 7016k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
DTCM : 0xfffe8000 - 0xfffec000 ( 16 kB)
ITCM : 0xfffe0000 - 0xfffe4000 ( 16 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
vmalloc : 0xd0800000 - 0xff000000 ( 744 MB)
lowmem : 0xc0000000 - 0xd0000000 ( 256 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.text : 0xc0008000 - 0xc03fb458 (4046 kB)
.init : 0xc03fc000 - 0xc041cb5c ( 131 kB)
.data : 0xc041e000 - 0xc0459660 ( 238 kB)
.bss : 0xc045a024 - 0xc04975a0 ( 246 kB)
NR_IRQS:246
VIC @f6000000: id 0x00041192, vendor 0x41
VIC @f6010000: id 0x00041192, vendor 0x41
sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 4294967286ms
Console: colour dummy device 80x30
Calibrating delay loop... 353.89 BogoMIPS (lpj=1769472)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x50303288 - 0x503032e4
devtmpfs: initialized
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
OK6410: Option string ok6410=0
OK6410: selected LCD display is 480x272
s3c64xx_dma_init: Registering DMA channels
PL080: IRQ 73, at d0846000, channels 0..8
PL080: IRQ 74, at d0848000, channels 8..16
S3C6410: Initialising architecture
bio: create slab
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
NET: Registered protocol family 2
TCP established hash table entries: 8192 (order: 4, 65536 bytes)
TCP bind hash table entries: 8192 (order: 5, 163840 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
TCP: reno registered
UDP hash table entries: 256 (order: 1, 12288 bytes)
UDP-Lite hash table entries: 256 (order: 1, 12288 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
NFS: Registering the id_resolver key type
Key type id_resolver registered
Key type id_legacy registered
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
ROMFS MTD (C) 2007 Red Hat, Inc.
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
start plist test
end plist test
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=5fa00000 cpu=d0856000 size=0007f800
Window[0] - FB2: map_video_memory: clear d0895c00:0003fc00
FB2: map_video_memory: dma=5fa3fc00 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=5fa80000 cpu=d08d7000 size=0007f800
Window[1] - FB2: map_video_memory: clear d0916c00:0003fc00
FB2: map_video_memory: dma=5fabfc00 cpu=d0916c00 size=0003fc00
fb1: s3cfb frame buffer device
Window[2] - FB1: map_video_memory: clear d0958000:0003fc00
FB1: map_video_memory: dma=5f9c0000 cpu=d0958000 size=0003fc00
fb2: s3cfb frame buffer device
Window[3] - FB1: map_video_memory: clear d0999000:0003fc00
FB1: map_video_memory: dma=5fb00000 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
s3c6400-uart.1: ttySAC1 at MMIO 0x7f005400 (irq = 70) is a S3C6400/10
s3c6400-uart.2: ttySAC2 at MMIO 0x7f005800 (irq = 71) is a S3C6400/10
s3c6400-uart.3: ttySAC3 at MMIO 0x7f005c00 (irq = 72) is a S3C6400/10
brd: module loaded
loop: module loaded
S3C NAND Driver, (c) 2008 Samsung Electronics
NandFlash is busying.........
forlinx nandflash dev_id=d5
forlinx****Nandflash:ChipType= MLC ChipName=samsung-K9GAG08U0D************
S3C NAND Driver is using hardware ECC.
NAND device: Manufacturer ID: 0xec, Chip ID: 0xd5 (Samsung NAND 2GiB 3,3V 8-bit)
, page size: 4096, OOB size: 218
Driver must set ecc.strength when using hardware ECC
Creating 4 MTD partitions on "NAND 2GiB 3,3V 8-bit":
0x000000000000-0x000000200000 : "Bootloader"
0x000000200000-0x000000700000 : "Kernel"
0x000000700000-0x00000cf00000 : "File System"
0x00000cf00000-0x000080000000 : "User"
dm9000 Ethernet Driver, V1.31
dm9000 dm9000: eth%d: Invalid ethernet MAC address. Please set using ifconfig
eth0: dm9000a at d09da000,d09dc004 IRQ 108 MAC: 9e:5e:ab:91:73:13 (random)
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 79, io mem 0x74300000
usb usb1: New USB device found, idVendor=1d6b, idProduct=0001
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: S3C24XX OHCI
usb usb1: Manufacturer: Linux 3.6.7 ohci_hcd
usb usb1: SerialNumber: s3c24xx
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.
dummy_hcd dummy_hcd: USB Host+Gadget Emulator, driver 02 May 2005
dummy_hcd dummy_hcd: Dummy host controller
dummy_hcd dummy_hcd: new USB bus registered, assigned bus number 2
usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb2: Product: Dummy host controller
usb usb2: Manufacturer: Linux 3.6.7 dummy_hcd
usb usb2: SerialNumber: dummy_hcd
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
mousedev: PS/2 mouse device common for all mice
i2c /dev entries driver
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
s3c-sdhci s3c-sdhci.0: clock source 0: mmc_busclk.0 (133250000 Hz)
s3c-sdhci s3c-sdhci.0: clock source 2: mmc_busclk.2 (24000000 Hz)
mmc0: SDHCI controller on samsung-hsmmc [s3c-sdhci.0] using ADMA
s3c-sdhci s3c-sdhci.1: clock source 0: mmc_busclk.0 (133250000 Hz)
s3c-sdhci s3c-sdhci.1: clock source 2: mmc_busclk.2 (24000000 Hz)
mmc0: mmc_rescan_try_freq: trying to init card at 400000 Hz
mmc1: SDHCI controller on samsung-hsmmc [s3c-sdhci.1] using ADMA
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
TCP: cubic registered
NET: Registered protocol family 17
Key type dns_resolver registered
VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
yaffs: dev is 32505858 name is "mtdblock2" rw
yaffs: passed flags ""
mmc0: new high speed SD card at address c7b6
mmcblk0: mmc0:c7b6 SD02G 1.83 GiB
mmcblk0:
mmc1: mmc_rescan_try_freq: trying to init card at 400000 Hz
VFS: Mounted root (yaffs2 filesystem) on device 31:2.
devtmpfs: mounted the root filesystem.
Freeing init memory: 128K
mmc1: mmc_rescan_try_freq: trying to init card at 300000 Hz
mmc1: mmc_rescan_try_freq: trying to init card at 200000 Hz
mmc1: mmc_rescan_try_freq: trying to init card at 100000 Hz
mount: mounting none on /proc/bus/usb failed: No such file or directory
/etc/init.d/rcS: line 21: /bin/hotplug: not found
hwclock: can't open '/dev/rtc': No such file or directory
/etc/init.d/rcS: line 38: /etc/rc.d/netd: Permission denied
*************************************
Welcome to Root FileSystem!
http://write.blog.csdn.net/postlist
*************************************
mkdir: can't create directory '/mnt/disk': File exists
yaffs: dev is 32505859 name is "mtdblock3" rw
yaffs: passed flags ""
Try to bring eth0 interface up......dm9000 dm9000: eth0: link down
Done
Starting Qtopia, please waiting...
/etc/init.d/rcS: line 67: /bin/qtopia: not found
Please press Enter to activate this console.
[root@STANzxd /]# ls
bin fs.sh lib mdev.conf root sys var
dev fs.sh~ linuxrc mnt sbin tmp
etc home lost+found proc sdcard usr
[root@STANzxd /]# usb 1-2: new full-speed USB device number 2 using s3c2410-ohci