配置DM9000
搜索drivers/net/Makefile,发现COBJS-$(CONFIG_DRIVER_DM9000) += dm9000x.o
在mini2440.h中用的是cs8900,去掉cs8900的宏,添加上我们的
#define CONFIG_DM9000_BASE 0x20000000
#define DM9000_IO CONFIG_DM9000_BASE
#define DM9000_DATA (CONFIG_DM9000_BASE + 4)
在source insight中搜索“No ethernet found.”找出原因
eth_initialize (board.c)
board_eth_init (mini2440/smdk2410.c)
cs8900_initialize此处不合适,添加DM9000的函数
#ifdef CONFIG_CS8900
rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
#endif
#ifdef CONFIG_DRIVER_DM9000
rc = dm9000_initialize(bis);
#endif
set ipaddr 192.168.124.4 (连上网线同自己要ping的机器在一个网段)
set serverip 192.168.124.3
set gatewayip 255.255.0.0 (同自己要ping的机器一致)
set ethaddr 08:00:27:71:89:bb
ping 192.168.124.3
出现一个错误could not establish link 解决错误并加快速度 修改drivers\net\dm9000x.c #if 0 i = 0; while (!(dm9000_phy_read(1) & 0x20)) { /* autonegation complete bit */ udelay(1000); i++; if (i == 10000) { printf("could not establish link\n"); return 0; } } /* see what we've got */ lnk = dm9000_phy_read(17) >> 12; printf("operating at "); switch (lnk) { case 1: printf("10M half duplex "); break; case 2: printf("10M full duplex "); break; case 4: printf("100M half duplex "); break; case 8: printf("100M full duplex "); break; default: printf("unknown: %d ", lnk); break; } printf("mode\n"); #endif
如果出现not alive
打开drivers/net/dm9000x.c ,定位到456行附近,屏蔽掉dm9000_halt函数中的内容: /* Stop the interface. The interface is stopped when it is brought. */ static void dm9000_halt(struct eth_device *netdev) { #if 0 DM9000_DBG("%s\n", __func__); /* RESET devie */ phy_write(0, 0x8000); /* PHY RESET */ DM9000_iow(DM9000_GPR, 0x01); /* Power-Down PHY */ DM9000_iow(DM9000_IMR, 0x80); /* Disable all interrupt */ DM9000_iow(DM9000_RCR, 0x00); /* Disable RX */ #endif }
--------------------------------------------------------------------------------------------------
修改环境变量
在mini2440.h中加上
#define CONFIG_BOOTARGS "console=ttySAC0 root=/dev/mtdblock3"
#define CONFIG_BOOTCOMMAND "nand read 30000000 0x60000 0x500000;bootm 30000000"
修改
#define CONFIG_NETMASK 255.255.0.0
#define CONFIG_IPADDR 169.254.252.201
#define CONFIG_SERVERIP 169.254.252.200
加上
#define CONFIG_ETHADDR 08:00:27:71:89:bb