还是利用 mini2440移植uboot-2008.10 (一) 修改好的代码
通过观察可以发现,mini2400使用的网卡芯片是DM9000,在uboot-2008.10源码中已经支持该芯片的驱动(drivers/net/dm9000.c),但是并不完善
具体原理还不是很清楚,现在只是做一下移植步骤的记录
1、修改uboot配置文件(include/configs/mini2440.h)
53 /* 54 * Hardware drivers 55 */ 56 #if 0 57 #define CONFIG_DRIVER_CS8900 1 /* we have a CS8900 on-board */ 58 #define CS8900_BASE 0x19000300 59 #define CS8900_BUS16 1 /* the Linux driver does accesses as shorts */ 60 #endif 61 62 #define CONFIG_DRIVER_DM9000 1 63 #define CONFIG_DM9000_USE_16BIT 1 64 #define CONFIG_DM9000_BASE 0x20000300 65 #define DM9000_IO 0x20000300 66 #define DM9000_DATA 0x20000304
2、添加对ping命令的支持
98 #define CONFIG_CMD_CACHE 99 #define CONFIG_CMD_DATE 100 #define CONFIG_CMD_ELF 101 #define CONFIG_CMD_PING //此为添加的代码
3、修改网卡驱动
在网卡驱动drivers/net/dm9000x.c中,有一段程序试图连接网卡MII接口,而实际上此接口未使用,会有10s钟等待然后报错,可以将此注释掉
282 /* Initilize dm9000 board 283 */ 284 int 285 eth_init(bd_t * bd) 286 { 287 int i, oft, lnk; 288 u8 io_mode; 289 struct board_info *db = &dm9000_info; ................................. 385 /* Enable TX/RX interrupt mask */ 386 DM9000_iow(DM9000_IMR, IMR_PAR); 387 //注释开始 388 #if 0 389 i = 0; 390 while (!(phy_read(1) & 0x20)) { /* autonegation complete bit */ 391 udelay(1000); 392 i++; 393 if (i == 10000) { 394 printf("could not establish link\n"); 395 return 0; 396 } 397 } 398 399 /* see what we've got */ 400 lnk = phy_read(17) >> 12; 401 printf("operating at "); 402 switch (lnk) { 403 case 1: 404 printf("10M half duplex "); 405 break; 406 case 2: 407 printf("10M full duplex "); 408 break; 409 case 4: 410 printf("100M half duplex "); 411 break; 412 case 8: 413 printf("100M full duplex "); 414 break; 415 default: 416 printf("unknown: %d ", lnk); 417 break; 418 } 419 printf("mode\n"); 420 #endif //注释结束 421 return 0; 422 }
4、至此网卡修改完成,最近进行编译
#make clean
#make mini2440_config
#make CROSS_COMPILE=arm-linux-