mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-29 18:41:30 +00:00
fix lockup in mcfmii/mii_discover_phy() in case communication fails
Signed-off-by: Wolfgang Wegner <w.wegner@astro-kom.de> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
This commit is contained in:
parent
23c34af48f
commit
33f684d6d5
1 changed files with 24 additions and 23 deletions
|
@ -175,39 +175,40 @@ int mii_discover_phy(struct eth_device *dev)
|
|||
#ifdef ET_DEBUG
|
||||
printf("PHY type 0x%x pass %d type\n", phytype, pass);
|
||||
#endif
|
||||
if (phytype != 0xffff) {
|
||||
phyaddr = phyno;
|
||||
phytype <<= 16;
|
||||
phytype |=
|
||||
mii_send(mk_mii_read(phyno, PHY_PHYIDR2));
|
||||
if (phytype == 0xffff)
|
||||
continue;
|
||||
phyaddr = phyno;
|
||||
phytype <<= 16;
|
||||
phytype |=
|
||||
mii_send(mk_mii_read(phyno, PHY_PHYIDR2));
|
||||
|
||||
#ifdef ET_DEBUG
|
||||
printf("PHY @ 0x%x pass %d\n", phyno, pass);
|
||||
printf("PHY @ 0x%x pass %d\n", phyno, pass);
|
||||
#endif
|
||||
|
||||
for (i = 0; i < (sizeof(phyinfo) / sizeof(phy_info_t)); i++) {
|
||||
if (phyinfo[i].phyid == phytype) {
|
||||
for (i = 0; (i < (sizeof(phyinfo) / sizeof(phy_info_t)))
|
||||
&& (phyinfo[i].phyid != 0); i++) {
|
||||
if (phyinfo[i].phyid == phytype) {
|
||||
#ifdef ET_DEBUG
|
||||
printf("phyid %x - %s\n",
|
||||
phyinfo[i].phyid,
|
||||
phyinfo[i].strid);
|
||||
printf("phyid %x - %s\n",
|
||||
phyinfo[i].phyid,
|
||||
phyinfo[i].strid);
|
||||
#endif
|
||||
strcpy(info->phy_name, phyinfo[i].strid);
|
||||
info->phyname_init = 1;
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
#ifdef ET_DEBUG
|
||||
printf("0x%08x\n", phytype);
|
||||
#endif
|
||||
strcpy(info->phy_name, "unknown");
|
||||
strcpy(info->phy_name, phyinfo[i].strid);
|
||||
info->phyname_init = 1;
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
#ifdef ET_DEBUG
|
||||
printf("0x%08x\n", phytype);
|
||||
#endif
|
||||
strcpy(info->phy_name, "unknown");
|
||||
info->phyname_init = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue