u-boot-2011.03在TQ2440上的移植(6)--支持dm9000x网卡

  

移植过程基本同http://blog.chinaunix.net/u3/101649/showart_2126764.html,稍作修改

1、u-boot-2011.03默认的网卡是CS8900,所以要先把它屏蔽掉

vi include/configs/smdk2440.h

/*

#define CONFIG_NET_MULTI
#define CONFIG_CS8900  /* we have a CS8900 on-board */
#define CONFIG_CS8900_BASE 0x19000300
#define CONFIG_CS8900_BUS16 /* the Linux driver does accesses as shorts */

*/

//添加u-boot对DM9000X网卡的支持

#define CONFIG_DRIVER_DM9000  1
#define CONFIG_NET_MULTI      1
#define CONFIG_DM9000_NO_SROM 1
#define CONFIG_DM9000_BASE 0x20000300 //网卡片选地址
#define DM9000_IO CONFIG_DM9000_BASE
#define DM9000_DATA (CONFIG_DM9000_BASE + 4)
//网卡数据地址

 

//在102行处添加命令,下面红色部分

#define CONFIG_CMD_CACHE
#define CONFIG_CMD_DATE
#define CONFIG_CMD_ELF
//给uboot加上ping命令,用来测试网络通不通
#define CONFIG_CMD_PING

//添加网卡支持命令

#define CONFIG_CMD_NET

//恢复被注释掉的网卡MAC地址

#define CONFIG_ETHADDR     08:00:3e:26:0a:5b//TQ2440dm9000xmac地址

#define CONFIG_NETMASK      255.255.255.0//子网掩码
#define CONFIG_IPADDR  192.168.0.106//TQ2440IP地址
#define CONFIG_SERVERIP  192.168.0.107//主机(PC)IP地址

 

2、修改板载DM9000网卡初始化代码

vi board/sumsung/smdk2440/smdk2440.c

#ifdef CONFIG_CMD_NET
int board_eth_init(bd_t *bis)
{
 int rc = 0;
#ifdef CONFIG_DRIVER_DM9000
 rc = dm9000_initialize(bis);

#endif
 return rc;
}

 

3、修改网卡驱动bug

vi drivers/net/dm9000x.c

<1>//屏蔽掉dm9000_init函数中的这一部分,不然使用网卡的时候会报“could not establish link”的错误

#if 0
 i = 0;
 while (!(phy_read(1) & 0x20))
 { /* autonegation complete bit */
  udelay(1000);
  i++;
  if (i == 10000)
  {
   printf("could not establish link/n");
   return 0;
  }
 }
#endif

<2>//屏蔽掉dm9000_halt函数中的内容

static void dm9000_halt(struct eth_device *netdev)
{
#if 0
 DM9000_DBG("%s/n", __func__);

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

 

3、make

插上网线,电脑上的ip netmask getway都要设置好,还要关闭防火墙

烧写进板子,启动uboot进入控制台

setenv getwayip 192.168.0.1

saveenv

ping 192.168.0.107即可

[SMDK2440]# ping 192.168.0.107
dm9000 i/o: 0x20000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 08:00:3e:26:0a:5b
operating at unknown: 0 mode
Using dm9000 device
host 192.168.0.108 is alive

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值