DM9000初始化过程

drivers/dm9000x.c eth_init()函数 

这里的初始化并不复杂,首先对dm9000进行复位 
static void 
dm9000_reset(void) 

       DM9000_DBG("resetting\n"); 
       DM9000_iow(DM9000_NCR, NCR_RST); 
       udelay(1000);               

这里将NRC寄存器的第0位置1,之后要保持至少20us的延时。这里延时了1ms。 
int 
dm9000_probe(void) 

       u32 id_val; 
       id_val = DM9000_ior(DM9000_VIDL); 
       id_val |= DM9000_ior(DM9000_VIDH) << 8; 
       id_val |= DM9000_ior(DM9000_PIDL) << 16; 
       id_val |= DM9000_ior(DM9000_PIDH) << 24; 
       if (id_val == DM9000_ID) { 
              printf("dm9000 i/o: 0x%x, id: 0x%x \n", CONFIG_DM9000_BASE, 
                     id_val); 
              return 0; 
       } else { 
              printf("dm9000 not found at 0xx id: 0xx\n", 
                     CONFIG_DM9000_BASE, id_val); 
              return -1; 
      

复位结束后到网卡的vendor ID寄存器和product ID寄存器读取id,检测此网卡是否是dm9000。 
static void 
identify_nic(void) 

       struct board_info *db = &dmfe_info;        
       u16 phy_reg3; 
       DM9000_iow(DM9000_NCR, NCR_EXT_PHY); 
       phy_reg3 = phy_read(3); 
       switch (phy_reg3 & 0xfff0) { 
       case 0xb900: 
              if (phy_read(31) == 0x4404) { 
         

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值