Skip to content
Snippets Groups Projects
Commit 33f684d6 authored by Wolfgang Wegner's avatar Wolfgang Wegner Committed by Ben Warren
Browse files

fix lockup in mcfmii/mii_discover_phy() in case communication fails

parent 23c34af4
No related branches found
No related tags found
No related merge requests found
...@@ -175,38 +175,39 @@ int mii_discover_phy(struct eth_device *dev) ...@@ -175,38 +175,39 @@ int mii_discover_phy(struct eth_device *dev)
#ifdef ET_DEBUG #ifdef ET_DEBUG
printf("PHY type 0x%x pass %d type\n", phytype, pass); printf("PHY type 0x%x pass %d type\n", phytype, pass);
#endif #endif
if (phytype != 0xffff) { if (phytype == 0xffff)
phyaddr = phyno; continue;
phytype <<= 16; phyaddr = phyno;
phytype |= phytype <<= 16;
mii_send(mk_mii_read(phyno, PHY_PHYIDR2)); phytype |=
mii_send(mk_mii_read(phyno, PHY_PHYIDR2));
#ifdef ET_DEBUG #ifdef ET_DEBUG
printf("PHY @ 0x%x pass %d\n", phyno, pass); printf("PHY @ 0x%x pass %d\n", phyno, pass);
#endif #endif
for (i = 0; i < (sizeof(phyinfo) / sizeof(phy_info_t)); i++) { for (i = 0; (i < (sizeof(phyinfo) / sizeof(phy_info_t)))
if (phyinfo[i].phyid == phytype) { && (phyinfo[i].phyid != 0); i++) {
if (phyinfo[i].phyid == phytype) {
#ifdef ET_DEBUG #ifdef ET_DEBUG
printf("phyid %x - %s\n", printf("phyid %x - %s\n",
phyinfo[i].phyid, phyinfo[i].phyid,
phyinfo[i].strid); phyinfo[i].strid);
#endif #endif
strcpy(info->phy_name, phyinfo[i].strid); strcpy(info->phy_name, phyinfo[i].strid);
info->phyname_init = 1; info->phyname_init = 1;
found = 1; found = 1;
break; break;
}
} }
}
if (!found) { if (!found) {
#ifdef ET_DEBUG #ifdef ET_DEBUG
printf("0x%08x\n", phytype); printf("0x%08x\n", phytype);
#endif #endif
strcpy(info->phy_name, "unknown"); strcpy(info->phy_name, "unknown");
info->phyname_init = 1; info->phyname_init = 1;
break; break;
}
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment