通过使用uboot的网络功能可以更新ubook,烧写内核,文件系统,如果网络功能不可能,那还不如同变砖了一样.当然如果支持sd卡启动,可能通过sd卡完成这些功能,但是也太过麻烦了.飞凌的6410开发板提供的uboot的网络驱动是cs8900,但是实际上网卡是dm9000ae.

烧入后发无法ping通,tftp不可用,输出:

  1. CS8900 Ethernet chip not found?!
CS8900 Ethernet chip not found?!

下面,提供简单的修改方法,把驱动改为dm9000,让网络功能用起来.

1.修改include/configs/smdk6410.h

  1. #ifdef  CONFIG_DRIVER_SMC911X
  2. #undef  CONFIG_DRIVER_CS8900
  3. #define CONFIG_DRIVER_SMC911X_BASE  0x18800300
  4. #else
  5. //注释掉下面3行
  6. //#define CONFIG_DRIVER_CS8900  0   /* we have a CS8900 on-board */
  7. //#define CS8900_BASE       0x18800300
  8. //#define CS8900_BUS16      1   /* the Linux driver does accesses as shorts */
  9. //增加下面4行
  10. #define CONFIG_DRIVER_DM9000                1
  11. #define CONFIG_DM9000_BASE          0x18000000
  12. #define DM9000_IO                   CONFIG_DM9000_BASE
  13. #define DM9000_DATA                 (CONFIG_DM9000_BASE+4)
  14. #define CONFIG_DM9000_USE_16BIT
  15. //#define CONFIG_DM9000_DEBUG
  16. #endif
#ifdef 	CONFIG_DRIVER_SMC911X
#undef	CONFIG_DRIVER_CS8900
#define CONFIG_DRIVER_SMC911X_BASE	0x18800300
#else
//注释掉下面3行
//#define CONFIG_DRIVER_CS8900	0	/* we have a CS8900 on-board */
//#define CS8900_BASE	  	0x18800300
//#define CS8900_BUS16		1 	/* the Linux driver does accesses as shorts */
//增加下面4行
#define CONFIG_DRIVER_DM9000                1
#define CONFIG_DM9000_BASE          0x18000000
#define DM9000_IO                   CONFIG_DM9000_BASE
#define DM9000_DATA                 (CONFIG_DM9000_BASE+4)
#define CONFIG_DM9000_USE_16BIT
//#define CONFIG_DM9000_DEBUG
#endif

2.303行

从环境变量中读取MAC地址

把((u16 *) bd->bi_enetaddr)[i] = read_srom_word(i);替换为:

  1. char *s, *e;
  2. s = getenv ("ethaddr");
  3. for (i = 0; i < 6; ++i)
  4. {
  5. bd->bi_enetaddr[i] = s ? simple_strtoul (s, &e, 16) : 0;
  6. if (s)
  7. s = (*e) ? e + 1 : e;
  8. }
char *s, *e;
s = getenv ("ethaddr");
for (i = 0; i < 6; ++i)
{
	bd->bi_enetaddr[i] = s ? simple_strtoul (s, &e, 16) : 0;
	if (s)
		s = (*e) ? e + 1 : e;
}

3.修改318行,修改0x00为0xff

修改MAR寄存器(Multicast Address Register)的值,修正第一次收不到数据的错误

  1. for (i = 0, oft = 0x16; i < 8; i++, oft++)
  2. DM9000_iow(oft,0x00);
  3. //DM9000_iow(oft, 0xff);
for (i = 0, oft = 0x16; i < 8; i++, oft++)
	DM9000_iow(oft,0x00);
	//DM9000_iow(oft, 0xff);

4.413行

注释掉下面2行

修正一直无法收到数据的错误,不要每次调用halt的时候都对PHY进行复位操作,否则会引起无法接受到数据的情况

  1. void
  2. eth_halt(void)
  3. {
  4. DM9000_DBG("eth_halt\n");
  5. /* RESET devie */
  6. //phy_write(0, 0x8000); /* PHY RESET */
  7. //DM9000_iow(DM9000_GPR, 0x01); /* Power-Down PHY */
  8. DM9000_iow(DM9000_IMR, 0x80);   /* Disable all interrupt */
  9. DM9000_iow(DM9000_RCR, 0x00);   /* Disable RX */
  10. }
void
eth_halt(void)
{
	DM9000_DBG("eth_halt\n");

	/* 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 */
}

这里只是根据别人的文章进行实现,的确可行,但是具体为什么这么做还有些问题需要自己去弄明白.

最新文章

  1. sh 测试网段在线主机
  2. css笔记1: html页面的CSS、DIV命名规则
  3. MySQL 5.6 &amp; 5.7最优配置模板
  4. CoreData的使用
  5. 类加载器ClassLoader之jar包隔离
  6. 穷举法破解 zebrone1.1
  7. C# 两个Object比较
  8. 百度BAE环境下WordPress安装教程
  9. Java构造和解析Json数据的两种方法详解一
  10. &lt;顶&gt;vim快捷键映射Map使用
  11. 轻松突击ThreadLocal
  12. MemCache分布式内存对象缓存系统
  13. PHP数据访问批量删除(10261101)
  14. laravel框架基础知识点
  15. Java 对IP请求进行限流.
  16. JS 实现的浏览器系统通知 iNotify.js
  17. nginx 返回数据不完整
  18. 【DDD】使用领域驱动设计思想实现业务系统
  19. 力扣(LeetCode)67. 二进制求和
  20. 使用pandas导入csv文件到MySQL

热门文章

  1. springboot(十九):使用Spring Boot Actuator监控应用
  2. dom4j读取xml
  3. JMeter基础教程1:若隐若现的参数化
  4. 使用FileReader实现前端预览所选图片
  5. mkdir与mkdirs的区别
  6. Yii AR中处理多表关联的relations配置
  7. HBase 数据库检索性能优化策略--转
  8. 洛谷 [P1024]一元三次方程求解
  9. 用 label 控制 Pod 的位置 - 每天5分钟玩转 Docker 容器技术(128)
  10. 孤立的SQL用户