继ok6410 u-boot-2012.04.01移植四后,开发板基本已支持MLC NAND,但还有一些细节地方修改,这节增加DM9000支持,通过网卡tftp程序到内存,接着通过NAND命令写到NAND,这一过程肯定会遇到很多问题,遇到后再一个个解决。
开发环境:
系统:ubuntu 10.04.4
单板:ok6410
NAND FLASH:K9GAG08U0D 2048MB
NOR Flash:EN29LV160AB 2MB
DDR:K4X1G163PCX2 256MB
NET:DM9000AEP
编译器:arm-linux-gcc-4.3.2
搭建开发环境详见ubuntu 10.04.4开发环境配置。
目标:
1.板级初始化,支持单板ok6410
2.修改u-boot,支持NAND启动
3.增加菜单update功能
4.增加MLC NAND支持
5.支持DM9000,网卡下载程序
6.修改环境变量以及mtdpart分区
7.u-boot裁剪及制作补丁
一、修改源码支持DM9000
增加dm9000aep_init设置内存控制器
void dm9000aep_init(void)
{
SROM_BW |= (0XFF<<4);
}
在start.S增加bldm9000aep_init,其实在以前支持单板是已添加。
分析eth_initialize(gd->bd);->board_eth_init在board/samsung/smdk6410/smdk6410.c修改board_eth_init(bd_t *bis),改成如下:
#ifdef CONFIG_CMD_NET
int board_eth_init(bd_t *bis)
{
int rc = 0;
#ifdef CONFIG_CS8900
rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
#endif
#ifdef CONFIG_DRIVER_DM9000
rc = dm9000_initialize(bis);
#endif
return rc;
}
#endif
接着头文件include/configs/smdk6410.h增加DM9000网卡支持
/*
* Hardware drivers
*/
#if 0
#define CONFIG_CS8900
/* we have a CS8900 on-board
*/
#define CONFIG_CS8900_BASE
0x18800300
#define CONFIG_CS8900_BUS16
/* follow the Linux driver
*/
#else
#define CONFIG_DRIVER_DM9000
1
#define CONFIG_DM9000_BASE
0x18000000 //0x20000300
#define DM9000_IO
CONFIG_DM9000_BASE
#define DM9000_DATA
(CONFIG_DM9000_BASE+4)
#define CONFIG_DM9000_USE_16BIT
1
//#define CONFIG_DM9000_DEBUG 1
#endif
#define CONFIG_NETMASK255.255.255.0
#define CONFIG_IPADDR172.16.1.111
#define CONFIG_SERVERIP 172.16.1.114
#define CONFIG_ETHADDR 00:0c:29:4d:e4:f4
编译试试看网卡是否OK
change@change:/si/OK6410/u-boot-2012.04.01$ make
二、编译测试网卡
刚刚编译的程序,烧写OK,重启下面测试网卡
U-Boot 2012.04.01 (Jul 01 2013 - 21:27:53) for SMDK6400
CPU: S3C6400@532MHz
Fclk = 532MHz, Hclk = 133MHz, Pclk = 66MHz (ASYNC Mode)
Board: SMDK6400
DRAM: 128 MiB
WARNING: Caches not enabled
Flash: 0 KB
NAND: select s3c_nand_oob_mlc_64
NAND_ECC_NONE selected by board driver. This is not recommended !!
2048 MiB
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
Net: dm9000
Hit any key to stop autoboot: 0
##### Update menu for ok6410 #####
[g] get file, and write to nand flash 0 block
[b] Boot the system
[r] Reset the u-boot
[q] Quit from menu
Enter your selection: q
SMDK6410 # ping 172.16.1.134
dm9000 i/o: 0x18000000, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 00:0c:29:4d:e4:f4
operating at 100M full duplex mode
Using dm9000 device
host 172.16.1.134 is alive
SMDK6410 #
可以ping通,可以根据自己情况设置网关,ping自己的主机。下面测试看能否用NAND烧写程序,当然是不行的,测试就是为了找问题
SMDK6410 # set serverip 172.16.1.134
SMDK6410 # tftp 0x50000000 u-boot.bin
dm9000 i/o: 0x18000000, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 00:0c:29:4d:e4:f4
operating at 100M full duplex mode
Using dm9000 device
TFTP from server 172.16.1.134; our IP address is 172.16.1.111
Filename 'u-boot.bin'.
Load address: 0x50000000
Loading: ################
done
Bytes transferred = 228796 (37dbc hex)
SMDK6410 # nand erase 0 0x80000
NAND erase: device 0 offset 0x0, size 0x80000
Erasing at 0x0 -- 100% complete.
OK
SMDK6410 # nand write 0x50000000 0x80000
NAND write: device 0 offset 0x80000, size 0x7ff80000
Attempt to write outside the flash area
0 bytes written: ERROR
SMDK6410 # nand write 0x50000000 0 0x80000
NAND write: device 0 offset 0x0, size 0x80000
524288 bytes written: OK
SMDK6410 # reset
resetting ...
data abort
pc : [<e5951008>] lr : [<000000d0>]
sp : 0c001f90 ip : 12345678 fp : 00000000
r10: 57e380ec r9 : 57cfae38 r8 : 57cf7f64
r7 : 00000001 r6 : 1a000005 r5 : e3500000 r4 : eb006faa
r3 : 00500000 r2 : e5eff014 r1 : 00000000 r0 : 00000000
Flags: nZCv IRQs off FIQs off Mode SVC_32
Resetting CPU ...
看看reset果然就挂了,程序就是用的刚刚烧写OK的程序,看来程序没有烧进对的地方,下面针对nand write 0x50000000 0 0x80000烧写命令进一步跟踪,待续