首先在include/configs/zhaocj2440.h文件内注释掉下列语句:
#define CONFIG_CS8900 /* we have a CS8900 on-board */
#define CONFIG_CS8900_BASE 0x19000300
#define CONFIG_CS8900_BUS16 /* the Linux driver does accesses asshorts */
再添加下列语句:
#define CONFIG_DRIVER_DM9000
#define CONFIG_DM9000_NO_SROM
#define CONFIG_DM9000_BASE 0x20000300
#define DM9000_IO CONFIG_DM9000_BASE
#define DM9000_DATA (CONFIG_DM9000_BASE + 4)
然后定义缺省的环境变量,先添加MAC地址,再修改开发板以及宿主机的IP地址:
#define CONFIG_ETHADDR 00:01:02:03:04:05
#define CONFIG_IPADDR 192.168.1.126
#define CONFIG_SERVERIP 192.168.1.125
环境变量的设置也可以通过u-boot的setenv命令来完成。
最后修改board/sumsung/zhaocj/zhaocj2440.c文件中的board_eth_init函数:
int board_eth_init(bd_t *bis)
{
intrc = 0;
#ifdef CONFIG_DRIVER_DM9000
rc= dm9000_initialize(bis);
#endif
returnrc;
}
完成上述步骤,开发板就能正常的使用网络功能了。
开机显示下面内容:
U-Boot 2011.06 (Dec 18 2011 - 20:23:37)
DRAM: 64 MiB
Flash: 2 MiB
NAND: 256 MiB
*** Warning - bad CRC, using defaultenvironment
In: serial
Out: serial
Err: serial
Net: dm9000
系统已经识别出DM9000,我们再来ping主机:
ZHAOCJ2440 # ping 192.168.1.125
dm9000 i/o: 0x20000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 00:01:02:03:04:05
could not establish link
Using dm9000 device
host 192.168.1.125 is alive
当看到最后一行“host192.168.1.125 is alive”时,说明网络功能已能正常使用。如果为了去掉“could not establish link”字样,并加快运行速度,可以注释掉drivers/net/dm9000x.c文件中的dm9000_init函数内的下面语句:
i= 0;
while(!(dm9000_phy_read(1) & 0x20)) { /*autonegation complete bit */
udelay(1000);
i++;
if(i == 10000) {
printf("couldnot establish link\n");
return0;
}
}
/*see what we've got */
lnk= dm9000_phy_read(17) >> 12;
printf("operatingat ");
switch(lnk) {
case1:
printf("10M half duplex ");
break;
case2:
printf("10M full duplex ");
break;
case4:
printf("100M half duplex ");
break;
case8:
printf("100M full duplex ");
break;
default:
printf("unknown:%d ", lnk);
break;
}