您的位置:首页 > 理论基础 > 计算机网络

uboot网络移植成功,tftp能用。

2012-10-18 15:47 369 查看
开发板:OK6410-A uboot版本:uboot1.16

一、修改include/configs/smdk6410.h里配置网卡的相应代码

  原来:

  //#define CONFIG_DRIVER_SMC911X1 /* we have a SMC9115 on-board */

  //#define CONFIG_CH7033

  #ifdef CONFIG_DRIVER_SMC911X

  #undef CONFIG_DRIVER_CS8900

  #define CONFIG_DRIVER_SMC911X_BASE 0x18800300

  #else

  #define CONFIG_DRIVER_CS89000 /* we have a CS8900 on-board */

  #define CS8900_BASE 0x18800300

#define CS8900_BUS16 1 /* the Linux driver does accesses as shorts */

  #endif

  替换为: 

#define CONFIG_DRIVER_DM9000AE1
#ifdef CONFIG_DRIVER_DM9000AE
#define CONFIG_DRIVER_DM90001
#define CONFIG_DM9000_BASE(0x18000000) /*XM0CSN1*/
#define DM9000_IO(CONFIG_DM9000_BASE)
#define DM9000_DATA(CONFIG_DM9000_BASE+0x4) /*ADDR2*/
#define CONFIG_DM9000_USE_16BIT 1
//#define CONFIG_DM9000_DEBUG 1
#else
#ifdef CONFIG_DRIVER_SMC911X
#undef CONFIG_DRIVER_CS8900
#define CONFIG_DRIVER_SMC911X_BASE 0x18800300
#else
#define CONFIG_DRIVER_CS89000 /* we have a CS8900 on-board */
#define CS8900_BASE0x18800300
#define CS8900_BUS161 /* the Linux driver does accesses as shorts */
#endif //end of #ifdef CONFIG_DRIVER_SMC911X
#endif   //end of #ifdef CONFIG_DRIVER_DM9000AE


  另外按实际修改或添加网络配置信息:

#define CONFIG_ETHADDR00:40:5c:26:0a:5b
#define CONFIG_NETMASK255.255.255.0
#define CONFIG_IPADDR192.168.0.110
#define CONFIG_SERVERIP192.168.0.101
#define CONFIG_GATEWAYIP192.168.0.1


  

二、修改uboot1.16/board/samsung/smdk6410/smdk6410.c (可选做)

  将 SC8900 替换为 DM9000 。

  将 sc8900 替换为 dm9000 。

三、修改drivers/dm9000x.c

  int eth_init(bd_t * bd)函数:


  1)

  /* GPIO0 on pre-activate PHY */

  DM9000_iow(DM9000_GPR, 0x00); /*REG_1F bit0 activate phyxcer */

  //==============添加以下===============//

#if CONFIG_DRIVER_DM9000AE
udelay(100*1000);	 /* wait >2 ms (2~60 ms normal) for PHY power-up ready */
/* software-RESET NIC */
DM9000_iow(0x00,0x3);  /* NCR REG. 00 RST Bit[0]=1 RESET on, LBK=1 MAC loopback on */
udelay(1000);  /* wait >10us for software-RESET ok, then let it auto-clear */
#endif


  //==============添加以上=============//

  /* Set PHY */

  set_PHY_mode();

  2)

  DM9000_iow(DM9000_ISR, 0x0f); /* Clear interrupt status */

  /* Set Node address */

  //==============添加以下===============//

if (is_zero_ether_addr(bd->bi_enetaddr) ||
is_multicast_ether_addr(bd->bi_enetaddr))
{
/* try reading from environment */
u8 i;
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)

  for (i = 0, oft = 0x16; i < 8; i++, oft++)

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

  //DM9000_iow(oft, 0xff); //替换

  DM9000_iow(oft, 0x00);

void eth_halt(void)函数: (可选做)

  注释掉下面两行,修正一直无法收到数据的错误

  phy_write(0, 0x8000); /* PHY RESET */

  DM9000_iow(DM9000_GPR, 0x01);/* Power-Down PHY */

另附相关文件的下载地址:http://download.csdn.net/detail/wwf0123/4660329
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: