mirror of https://github.com/ARMmbed/mbed-os.git
Nuvoton: netsocket correction of judgment errors
parent
f3f69b8db7
commit
7ef3275b47
|
|
@ -78,13 +78,14 @@ static int reset_phy(void)
|
||||||
mdio_write(CONFIG_PHY_ADDR, MII_BMCR, BMCR_RESET);
|
mdio_write(CONFIG_PHY_ADDR, MII_BMCR, BMCR_RESET);
|
||||||
|
|
||||||
delayCnt = 2000;
|
delayCnt = 2000;
|
||||||
while(delayCnt-- > 0) {
|
while(delayCnt > 0) {
|
||||||
|
delayCnt--;
|
||||||
if((mdio_read(CONFIG_PHY_ADDR, MII_BMCR) & BMCR_RESET) == 0)
|
if((mdio_read(CONFIG_PHY_ADDR, MII_BMCR) & BMCR_RESET) == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(delayCnt == -1) {
|
if(delayCnt == 0) {
|
||||||
NU_DEBUGF(("Reset phy failed\n"));
|
NU_DEBUGF(("Reset phy failed\n"));
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
@ -99,13 +100,14 @@ static int reset_phy(void)
|
||||||
mdio_write(CONFIG_PHY_ADDR, MII_BMCR, reg | BMCR_ANRESTART);
|
mdio_write(CONFIG_PHY_ADDR, MII_BMCR, reg | BMCR_ANRESTART);
|
||||||
|
|
||||||
delayCnt = 200000;
|
delayCnt = 200000;
|
||||||
while(delayCnt-- > 0) {
|
while(delayCnt > 0) {
|
||||||
|
delayCnt--;
|
||||||
if((mdio_read(CONFIG_PHY_ADDR, MII_BMSR) & (BMSR_ANEGCOMPLETE | BMSR_LSTATUS))
|
if((mdio_read(CONFIG_PHY_ADDR, MII_BMSR) & (BMSR_ANEGCOMPLETE | BMSR_LSTATUS))
|
||||||
== (BMSR_ANEGCOMPLETE | BMSR_LSTATUS))
|
== (BMSR_ANEGCOMPLETE | BMSR_LSTATUS))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(delayCnt == -1) {
|
if(delayCnt == 0) {
|
||||||
NU_DEBUGF(("AN failed. Set to 100 FULL\n"));
|
NU_DEBUGF(("AN failed. Set to 100 FULL\n"));
|
||||||
EMAC->CTL |= (EMAC_CTL_OPMODE_Msk | EMAC_CTL_FUDUP_Msk);
|
EMAC->CTL |= (EMAC_CTL_OPMODE_Msk | EMAC_CTL_FUDUP_Msk);
|
||||||
return(-1);
|
return(-1);
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,8 @@ static int reset_phy(void)
|
||||||
mdio_write(CONFIG_PHY_ADDR, MII_BMCR, BMCR_RESET);
|
mdio_write(CONFIG_PHY_ADDR, MII_BMCR, BMCR_RESET);
|
||||||
|
|
||||||
delayCnt = 2000;
|
delayCnt = 2000;
|
||||||
while(delayCnt-- > 0) {
|
while(delayCnt > 0) {
|
||||||
|
delayCnt--;
|
||||||
if((mdio_read(CONFIG_PHY_ADDR, MII_BMCR) & BMCR_RESET) == 0)
|
if((mdio_read(CONFIG_PHY_ADDR, MII_BMCR) & BMCR_RESET) == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -99,7 +100,8 @@ static int reset_phy(void)
|
||||||
mdio_write(CONFIG_PHY_ADDR, MII_BMCR, reg | BMCR_ANRESTART);
|
mdio_write(CONFIG_PHY_ADDR, MII_BMCR, reg | BMCR_ANRESTART);
|
||||||
|
|
||||||
delayCnt = 200000;
|
delayCnt = 200000;
|
||||||
while(delayCnt-- > 0) {
|
while(delayCnt > 0) {
|
||||||
|
delayCnt--;
|
||||||
if((mdio_read(CONFIG_PHY_ADDR, MII_BMSR) & (BMSR_ANEGCOMPLETE | BMSR_LSTATUS))
|
if((mdio_read(CONFIG_PHY_ADDR, MII_BMSR) & (BMSR_ANEGCOMPLETE | BMSR_LSTATUS))
|
||||||
== (BMSR_ANEGCOMPLETE | BMSR_LSTATUS))
|
== (BMSR_ANEGCOMPLETE | BMSR_LSTATUS))
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue