首页 / 操作系统 / Linux / u-boot-2011.06在基于s3c2440开发板的移植之DM9000
u-boot默认的网络芯片是CS8900,但开发板上的网络芯片是DM9000,所以为了使用网络功能,就必须进行移植。好在u-boot有DM9000的驱动程序,我们只需要把关于CS8900的部分换成DM9000的部分即可。首先在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= dm8900_initialize(bis);#endif returnrc;}完成上述步骤,开发板就能正常的使用网络功能了。 开机显示下面内容:U-Boot 2011.06 (Dec 18 2011 - 20:23:37) DRAM: 64 MiBFlash: 2 MiBNAND: 256 MiB*** Warning - bad CRC, using defaultenvironment In: serialOut: serialErr: serialNet: dm9000系统已经识别出DM9000,我们再来ping主机:ZHAOCJ2440 # ping 192.168.1.125dm9000 i/o: 0x20000300, id: 0x90000a46DM9000: running in 16 bit modeMAC: 00:01:02:03:04:05could not establish linkUsing dm9000 devicehost 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
"); 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; }相关阅读:U-Boot源代码下载地址 http://www.linuxidc.com/Linux/2011-07/38897.htmU-Boot-2011.06启动流程分析 http://www.linuxidc.com/Linux/2011-07/39310.htmu-boot-2011.06在基于s3c2440开发板的移植之编译配置 http://www.linuxidc.com/Linux/2011-10/45455.htmu-boot-2011.06在基于s3c2440开发板的移植之NorFlash启动 http://www.linuxidc.com/Linux/2011-10/45456.htmu-boot-2011.06在基于S3C2440开发板的移植之解决raise: Signal # 8 caught http://www.linuxidc.com/Linux/2011-10/454554.htmu-boot-2011.06在基于s3c2440开发板的移植之支持NandFlash读写 http://www.linuxidc.com/Linux/2011-10/45457.htmu-boot-2011.06在基于s3c2440开发板的移植之硬件ECC http://www.linuxidc.com/Linux/2011-10/454558.htmu-boot-2011.06在基于s3c2440开发板的移植之DM9000 http://www.linuxidc.com/Linux/2012-09/70507.htmu-boot-2011.06在基于s3c2440开发板的移植之nandflash启动 http://www.linuxidc.com/Linux/2012-09/70508.htmu-boot-2011.06在基于s3c2440开发板的移植之支持YAFFS2 http://www.linuxidc.com/Linux/2012-09/70509.htmu-boot-2011.06在基于s3c2440开发板的移植之引导内核与加载根文件系统 http://www.linuxidc.com/Linux/2012-09/70510.htmu-boot-2011.06在基于s3c2440开发板的移植之结束篇 http://www.linuxidc.com/Linux/2012-09/70511.htm