修正Ok6410的U-Boot网络不可用


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

U-Boot源代码下载地址

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

  1. 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  
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. }  
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);  
4.413行
注释掉下面2行
修正一直无法收到数据的错误,不要每次调用halt的时候都对PHY进行复位操作,否则会引起无法接受到数据的情况
  1. void  
  2. eth_halt(void)  
  3. {  
  4.     DM9000_DBG("eth_halt\n");  
  5.   
  6.   
  7.     /* RESET devie */  
  8.     //phy_write(0, 0x8000); /* PHY RESET */   
  9.     //DM9000_iow(DM9000_GPR, 0x01); /* Power-Down PHY */   
  10.     DM9000_iow(DM9000_IMR, 0x80);   /* Disable all interrupt */  
  11.     DM9000_iow(DM9000_RCR, 0x00);   /* Disable RX */  
  12. }  
这里只是根据别人的文章进行实现,的确可行,但是具体为什么这么做还有些问题需要自己去弄明白.

相关内容