Chinaunix首页 | 论坛 | 博客
  • 博客访问: 279985
  • 博文数量: 95
  • 博客积分: 2047
  • 博客等级: 大尉
  • 技术积分: 1022
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-14 16:18
文章分类

全部博文(95)

文章存档

2013年(1)

2011年(94)

我的朋友

分类: 嵌入式

2011-08-13 17:04:15

(1)移植framebuffer
drivers/video
复制samsung文件夹到cupcake内核

line236 增加
config FB_S3C
tristate "S3C Framebuffer Support"
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
depends on FB && (ARCH_S3C64XX || ARCH_S5PC1XX)

default n
---help---
TBA

choice
depends on FB_S3C
prompt "Select LCD Type"
default FB_S3C_LTE480WV
config FB_S3C_LTE480WV
bool "LTE480WV/LTP700WV"
---help---
TBA

config FB_URBETTER_INNOLUX430
bool "Urbetter INNOLUX430"
---help---
TBA

config FB_S3C_LW500
bool "LW500"
---help---
TBA

config FB_S3C_LTV350QV
bool "LTV350QV"
---help---
TBA

config FB_S3C_LTS222QV
bool "LTS222QV"
---help---
TBA

endchoice

config FB_S3C_BPP
tristate "Advanced options for S3C Framebuffer"
depends on FB_S3C
default n
---help---
TBA

choice
depends on FB_S3C_BPP
prompt "Select BPP(Bits Per Pixel)"
default FB_S3C_BPP_16
config FB_S3C_BPP_8
bool "8 BPP"
---help---
TBA

config FB_S3C_BPP_16
bool "16 BPP"
---help---
TBA

config FB_S3C_BPP_24
bool "24 BPP"
---help---
TBA

config FB_S3C_BPP_32
bool "32 BPP"
---help---
TBA
endchoice

config FB_S3C_NUM
int "Number of Framebuffers"
depends on FB_S3C_BPP && (ARCH_S3C64XX || ARCH_S5PC1XX)
default "1"
---help---
TBA

config FB_S3C_VIRTUAL_SCREEN
bool "Enable Virtual Screen"
depends on FB_S3C_BPP

default n
---help---
TBA

config FB_S3C_DOUBLE_BUFFERING
bool "Enable Double Buffering"
depends on FB_S3C_BPP

default n
---help---
TBA

修改Makefile
add
obj-$(CONFIG_FB_S3C)              += samsung/

makemenuconfig
        *** Frame buffer hardware drivers ***                                                         │ │  
  │ │                             <*>   S3C Framebuffer Support                                                                       │ │  
  │ │                                     Select LCD Type (Urbetter INNOLUX430)  --->                                                 │ │  
  │ │                             <*>     Advanced options for S3C Framebuffer                                                        │ │  
  │ │                                       Select BPP(Bits Per Pixel) (16 BPP)  --->                                                 │ │  
  │ │                             (1)       Number of Framebuffers (NEW)                                                              │ │  
  │ │                             [*]       Enable Virtual Screen                                                                     │ │  
  │ │                             [*]       Enable Double Buffering 

 ( ) LTE480WV/LTP700WV                       │ │  
                                   │ │                    (X) Urbetter INNOLUX430                     │ │  
                                   │ │                    ( ) LW500                                   │ │  
                                   │ │                    ( ) LTV350QV                                │ │  
                                   │ │                    ( ) LTS222QV    

OK

(2)移植nand驱动
复制s3c_nand.c

修改Kconfig
config MTD_NAND_S3C
tristate "NAND Flash support for S3C SoC"
depends on ARCH_S3C64XX && MTD_NAND
help
 This enables the NAND flash controller on the S3C.

 No board specfic support is done by this driver, each board
 must advertise a platform_device for the driver to attach.

config MTD_NAND_S3C_DEBUG
bool "S3C NAND driver debug"
depends on MTD_NAND_S3C
help
 Enable debugging of the S3C NAND driver

config MTD_NAND_S3C_HWECC
bool "S3C NAND Hardware ECC"
depends on MTD_NAND_S3C
help
 Enable the use of the S3C's internal ECC generator when
 using NAND. Early versions of the chip have had problems with
 incorrect ECC generation, and if using these, the default of
 software ECC is preferable.

 If you lay down a device with the hardware ECC, then you will
 currently not be able to switch to software, as there is no
 implementation for ECC method used by the S3C

修改makefile
obj-$(CONFIG_MTD_NAND_S3C) += s3c_nand.o


启动后

S3C NAND Driver, (c) 2008 Samsung Electronics
S3C NAND Driver is using hardware ECC.
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)
Creating 4 MTD partitions on "NAND 256MiB 3,3V 8-bit":
0x00000000-0x00080000 : "Bootloader"
0x00080000-0x00880000 : "Kernel"
0x00880000-0x08880000 : "File System"
0x08880000-0x10000000 : "User"
mice: PS/2 mouse device common for all mice
TCP cubic registered
NET: Registered protocol family 17
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
VFS: Cannot open root device "mtdblock2" or unknown-block(31,2)
Please append a correct "root=" boot option; here are the available partitions:
1f00        512 mtdblock0 (driver?)
1f01       8192 mtdblock1 (driver?)
1f02     131072 mtdblock2 (driver?)
1f03     122368 mtdblock3 (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2)

还是不能加载mtdblock2 ???

原来是没有选上yaffs2支持,重新编译内核,已经可以加载原先烧录在板子上的android0.09内核

NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)
Creating 4 MTD partitions on "NAND 256MiB 3,3V 8-bit":
0x00000000-0x00080000 : "Bootloader"
0x00080000-0x00880000 : "Kernel"
0x00880000-0x08880000 : "File System"
0x08880000-0x10000000 : "User"
mice: PS/2 mouse device common for all mice
TCP cubic registered
NET: Registered protocol family 17
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
yaffs: dev is 32505858 name is "mtdblock2"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.2, "mtdblock2"
s3c-nand: ECC uncorrectable error detected
block 791 is bad
yaffs_read_super: isCheckpointed 0
VFS: Mounted root (yaffs2 filesystem).
Freeing init memory: 128K
init: HOW ARE YOU GENTLEMEN
init: reading config file
init: device init
init: mtd partition -1, 
init: mtd partition 0, "Bootloade
init: mtd partition 1, "Kernel"
init: mtd partition 2, "File
init: mtd partition 3, "User"
sh: can't access tty; job control turned off

(3)移植触摸屏驱动
复制/drivers/input/touchscreen
s3c-ts.c

Kconfig中添加
config TOUCHSCREEN_S3C
        tristate "S3C touchscreen driver"
        depends on ARCH_S3C2410 || ARCH_S3C64XX || ARCH_S5PC1XX
        default y
        help
          Say Y here to enable the driver for the touchscreen on the
          S3C SMDK board.

          If unsure, say N.

          To compile this driver as a module, choose M here: the
          module will be called s3c_ts.

config TOUCHSCREEN_NEW
        bool "new flip touch"
        depends on TOUCHSCREEN_S3C
        default y
        help
          Say Y here to enable the driver for the new version touchscreen on the
          S3C SMDK board.

          Say N here to enable the driver for the old version touchscreen on the
          S3C SMDK board.

Makefile中添加
obj-$(CONFIG_TOUCHSCREEN_S3C) += s3c-ts.o

make menuconfig中添加
  --- Touchscreens                                                                                    │ │  
  │ │                             <*>   S3C touchscreen driver                                                                        │ │  
  │ │                             [*]     new flip touch   

开机提示:
S3C Touchscreen driver, (c) 2008 Samsung Electronics
S3C TouchScreen got loaded successfully : 12 bits
input: S3C TouchScreen as /class/input/input0

测试OK

(4)移植DM9000网卡驱动,这是最痛苦的部分!因为2.6.29内核没有做,得从开发板提供的2.6.24内核中移植,但是开发板这一块写的很不标准,用了很多24xx的头文件,导致移植非常痛苦。

1)这是正确的加载内容,参考
dm9000 Ethernet Driver
eth%d: con201 Invalid ethernet MAC address. using default config,  Please set using ifconfig
eth0: dm9000 at f7200300,f7200304 IRQ 71 MAC: 00:e0:4a:bc:15:e7

2)从开发板提供的2.6.24内核中将dm9000_con201.c提出,编译,发现问题

  CHK     include/linux/compile.h
  CC      drivers/net/dm9000_con201.o
drivers/net/dm9000_con201.c:74:31: error: asm/arch/regs-irq.h: No such file or directory
drivers/net/dm9000_con201.c:75:31: error: asm/arch/regs-mem.h: No such file or directory
drivers/net/dm9000_con201.c:76:32: error: asm/arch/regs-gpio.h: No such file or directory
drivers/net/dm9000_con201.c: In function 'dm9000_probe':
drivers/net/dm9000_con201.c:417: error: 'S3C_SROM_BW' undeclared (first use in this function)
drivers/net/dm9000_con201.c:417: error: (Each undeclared identifier is reported only once
drivers/net/dm9000_con201.c:417: error: for each function it appears in.)
drivers/net/dm9000_con201.c:422: error: 'S3C_SROM_BC1' undeclared (first use in this function)
drivers/net/dm9000_con201.c:425: error: 'S3C_GPNCON' undeclared (first use in this function)
drivers/net/dm9000_con201.c:426: error: 'S3C_GPNPU' undeclared (first use in this function)
drivers/net/dm9000_con201.c:428: error: 'S3C_EINT0CON0' undeclared (first use in this function)
drivers/net/dm9000_con201.c:430: error: 'S3C_EINTFLTCON0' undeclared (first use in this function)
drivers/net/dm9000_con201.c:432: error: 'S3C_EINTPEND' undeclared (first use in this function)
drivers/net/dm9000_con201.c:433: error: 'S3C_EINT0MASK' undeclared (first use in this function)
make[2]: *** [drivers/net/dm9000_con201.o] 错误 1
make[1]: *** [drivers/net] 错误 2
make: *** [drivers] 错误 2
[kyon@SEP4020 kernel-6410]$ 

需要这3个头文件
drivers/net/dm9000_con201.c:74:31: error: asm/arch/regs-irq.h: No such file or directory
drivers/net/dm9000_con201.c:75:31: error: asm/arch/regs-mem.h: No such file or directory
drivers/net/dm9000_con201.c:76:32: error: asm/arch/regs-gpio.h: No such file or directory

3)继续出现问题

CHK     include/linux/compile.h
  CC      drivers/net/dm9000_con201.o
drivers/net/dm9000_con201.c: In function 'dm9000_probe':
drivers/net/dm9000_con201.c:419: error: 'S3C24XX_VA_SROMC' undeclared (first use in this function)
drivers/net/dm9000_con201.c:419: error: (Each undeclared identifier is reported only once
drivers/net/dm9000_con201.c:419: error: for each function it appears in.)
drivers/net/dm9000_con201.c:427: error: 'S3C24XX_VA_GPIO' undeclared (first use in this function)
make[2]: *** [drivers/net/dm9000_con201.o] 错误 1
make[1]: *** [drivers/net] 错误 2
make: *** [drivers] 错误 2
[kyon@SEP4020 kernel-6410]$ 

这里有问题,经过测试要添加如下内容
//add by kyon
#define S3C24XX_VA_SROMC S3C_VA_SROMC
#define S3C24XX_VA_GPIO   S3C64XX_VA_GPIO//S3C_VA_GPIO
//add end


4)发现需要在arch/arm中添加启动信息
plat-smdk64xx目录的dev.
c
//add by kyon
#include

#define S3C_VA_DM9000nc1 S3C_ADDR(0x03200300)
#define S3C24XX_VA_DM9000CS1 S3C_VA_DM9000nc1
#define S3C24XX_SZ_DM9000CS1 SZ_1M

#define DM9000_ETH_IRQ_EINT0 S3C_EINT(7)//IRQ_EINT7 //这儿要注意!原来的IRQ_EINT7一定要改掉!

static struct resource dm9000_resources_cs1[] = {
    [0] = {
        .start  = S3C24XX_VA_DM9000CS1,
        .end    = (S3C24XX_VA_DM9000CS1+  S3C24XX_SZ_DM9000CS1),
        .flags  = IORESOURCE_MEM,
    },
    [1] = {
        .start  = (DM9000_ETH_IRQ_EINT0),
        .end    = (DM9000_ETH_IRQ_EINT0),
        .flags  = IORESOURCE_IRQ,
    },
};

static struct dm9000_plat_data dm9000_setup_cs1 = {
    .flags          = DM9000_PLATF_16BITONLY
};

 struct platform_device s3c_device_dm9000_cs1 = {
    .name           = "dm9000_con201",
    .id             = 0,
    .num_resources  = ARRAY_SIZE(dm9000_resources_cs1),
    .resource       = dm9000_resources_cs1,
    .dev            = {
        .platform_data = &dm9000_setup_cs1,
    }
};

EXPORT_SYMBOL(s3c_device_dm9000_cs1);


还要修改文件mach-smdk6410.c
一些定义,又重复定义了,应该放在一个通用的头文件中
//kyon
extern struct platform_device s3c_device_dm9000_cs1;

#define S3C_VA_DM9000nc1 S3C_ADDR(0x03200300)

#define S3C24XX_VA_DM9000CS1 S3C_VA_DM9000nc1
#define S3C6400_PA_DM9000CS1 (0x18000300)
#define S3C24XX_SZ_DM9000CS1 SZ_1M


在启动结构体中添加
static struct platform_device *smdk6410_devices[] __initdata = 
&s3c_device_dm9000_cs1,


还要添加地址映射:
static struct map_desc smdk6410_iodesc[] __initdata = {
.virtual = (u32)S3C24XX_VA_DM9000CS1,
.pfn = __phys_to_pfn(S3C6400_PA_DM9000CS1),
.length = S3C24XX_SZ_DM9000CS1,
.type = MT_DEVICE,
},
};


前面没进行地址映射,开机不断内核崩溃,做到这里终于不内核内核崩溃

dm9000 Ethernet Driver
dm9000: dm9000_probe()dm9000: dm9000x: resetting
eth%d: con201 Invalid ethernet MAC address. using default config,  Please set using ifconfig
eth0: dm9000 at f7200300,f7200304 IRQ 71 MAC: 00:e0:4a:bc:15:e7

可惜还是不能挂载NFS
dm9000: entering dm9000_open
IP-Config: Failed to open eth0
IP-Config: No network devices available.
VFS: Cannot open root device "nfs" or unknown-block(0,255)

最后正确的配置中断号,网卡终于通了!
dm9000 Ethernet Driver
eth%d: con201 Invalid ethernet MAC address. using default config,  Please set using ifconfig
eth0: dm9000 at f7200300,f7200304 IRQ 108 MAC: 00:e0:4a:bc:15:e7


dm9000 Ethernet Driver
eth%d: con201 Invalid ethernet MAC address. using default config,  Please set using ifconfig
eth0: dm9000 at f7200300,f7200304 IRQ 108 MAC: 00:e0:4a:bc:15:e7
Driver 'sd' needs updating - please use bus_type methods
S3C NAND Driver, (c) 2008 Samsung Electronics
S3C NAND Driver is using hardware ECC.
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)
Creating 4 MTD partitions on "NAND 256MiB 3,3V 8-bit":
0x00000000-0x00080000 : "Bootloader"
0x00080000-0x00880000 : "Kernel"
0x00880000-0x08880000 : "File System"
0x08880000-0x10000000 : "User"
mice: PS/2 mouse device common for all mice
S3C Touchscreen driver, (c) 2008 Samsung Electronics
S3C TouchScreen got loaded successfully : 12 bits
input: S3C TouchScreen as /class/input/input0
TCP cubic registered
NET: Registered protocol family 17
NET: Registered protocol family 15
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
VFS: Mounted root (cramfs filesystem) readonly.
Freeing init memory: 136K
init started: BusyBox v1.10.4 (2009-05-18 19:40:33 CST)
starting pid 236, tty '': '/etc/init.d/rcS'

**********************************************
   SEP4020 ARM Linux-2.6.16(VERSION4.0)     
            busybox1.10.4                   
**********************************************
# mount all...........
# Starting mdev.........
starting pid 244, tty '': '-/bin/sh'
/ # ifconfig eth0 192.168.0.4
eth0: link up, 100Mbps, full-duplex, lpa 0x41E1
/ # ping 192.168.0.1
PING 192.168.0.1 (192.168.0.1): 56 data bytes
64 bytes from 192.168.0.1: seq=0 ttl=128 time=6.160 ms
64 bytes from 192.168.0.1: seq=1 ttl=128 time=0.348 ms
64 bytes from 192.168.0.1: seq=2 ttl=128 time=0.344 ms
64 bytes from 192.168.0.1: seq=3 ttl=128 time=0.349 ms
64 bytes from 192.168.0.1: seq=4 ttl=128 time=0.338 ms
64 bytes from 192.168.0.1: seq=5 ttl=128 time=0.345 ms
64 bytes from 192.168.0.1: seq=6 ttl=128 time=0.305 ms
阅读(840) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~