求助,igb intel82576网卡驱动初始化启动的问题

ls_MingHong 2013-04-11 07:13:55
网卡初始化时读取第一次寄存器读取失败
读取网卡phy层的寄存器时需要E1000_MDIC寄存器来获取
但是第一次读取时E1000_MDIC_ERROR错误位被置
s32 e1000_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
{
struct e1000_phy_info *phy = &hw->phy;
u32 i, mdic = 0;
s32 ret_val = E1000_SUCCESS;

DEBUGFUNC("e1000_read_phy_reg_mdic");

if (offset > MAX_PHY_REG_ADDRESS) {
DEBUGOUT1("PHY Address %d is out of range\n", offset);
return -E1000_ERR_PARAM;
}

/*
* Set up Op-code, Phy Address, and register offset in the MDI
* Control register. The MAC will take care of interfacing with the
* PHY to retrieve the desired data.
*/
mdic = ((offset << E1000_MDIC_REG_SHIFT) |
(phy->addr << E1000_MDIC_PHY_SHIFT) |
(E1000_MDIC_OP_READ));

E1000_WRITE_REG(hw, E1000_MDIC, mdic);

/*
* Poll the ready bit to see if the MDI read completed
* Increasing the time out as testing showed failures with
* the lower time out
*/
for (i = 0; i < (E1000_GEN_POLL_TIMEOUT * 3); i++) {
usec_delay(50);
mdic = E1000_READ_REG(hw, E1000_MDIC);
if (mdic & E1000_MDIC_READY)
break;
}
if (!(mdic & E1000_MDIC_READY)) {
DEBUGOUT("MDI Read did not complete\n");
ret_val = -E1000_ERR_PHY;
goto out;
}
if (mdic & E1000_MDIC_ERROR) {
DEBUGOUT("MDI Error\n");
ret_val = -E1000_ERR_PHY;
goto out;
}
*data = (u16) mdic;

out:
return ret_val;
}

这个函数因为E1000_MDIC_ERROR被置 返回错误
出这个错误的原因一般是什么?
网卡手册是这个样说的:
This bit is set to 1b by hardware when it fails to complete an
MDI read. Software should make sure this bit is clear (0b)
before issuing an MDI read or write command.
求各位大牛指教!
...全文
381 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
ls_MingHong 2013-04-15
  • 打赏
  • 举报
回复
ls_MingHong 2013-04-12
  • 打赏
  • 举报
回复
自己顶一下 ,求大牛们遇到这种情况的说一下

21,595

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 驱动开发/核心开发
社区管理员
  • 驱动开发/核心开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧