File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
features/netsocket/emac-drivers/TARGET_NUVOTON_EMAC Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -78,13 +78,14 @@ static int reset_phy(void)
78
78
mdio_write (CONFIG_PHY_ADDR , MII_BMCR , BMCR_RESET );
79
79
80
80
delayCnt = 2000 ;
81
- while (delayCnt -- > 0 ) {
81
+ while (delayCnt > 0 ) {
82
+ delayCnt -- ;
82
83
if ((mdio_read (CONFIG_PHY_ADDR , MII_BMCR ) & BMCR_RESET ) == 0 )
83
84
break ;
84
85
85
86
}
86
87
87
- if (delayCnt == -1 ) {
88
+ if (delayCnt == 0 ) {
88
89
NU_DEBUGF (("Reset phy failed\n" ));
89
90
return (-1 );
90
91
}
@@ -99,13 +100,14 @@ static int reset_phy(void)
99
100
mdio_write (CONFIG_PHY_ADDR , MII_BMCR , reg | BMCR_ANRESTART );
100
101
101
102
delayCnt = 200000 ;
102
- while (delayCnt -- > 0 ) {
103
+ while (delayCnt > 0 ) {
104
+ delayCnt -- ;
103
105
if ((mdio_read (CONFIG_PHY_ADDR , MII_BMSR ) & (BMSR_ANEGCOMPLETE | BMSR_LSTATUS ))
104
106
== (BMSR_ANEGCOMPLETE | BMSR_LSTATUS ))
105
107
break ;
106
108
}
107
109
108
- if (delayCnt == -1 ) {
110
+ if (delayCnt == 0 ) {
109
111
NU_DEBUGF (("AN failed. Set to 100 FULL\n" ));
110
112
EMAC -> CTL |= (EMAC_CTL_OPMODE_Msk | EMAC_CTL_FUDUP_Msk );
111
113
return (-1 );
Original file line number Diff line number Diff line change @@ -78,7 +78,8 @@ static int reset_phy(void)
78
78
mdio_write (CONFIG_PHY_ADDR , MII_BMCR , BMCR_RESET );
79
79
80
80
delayCnt = 2000 ;
81
- while (delayCnt -- > 0 ) {
81
+ while (delayCnt > 0 ) {
82
+ delayCnt -- ;
82
83
if ((mdio_read (CONFIG_PHY_ADDR , MII_BMCR ) & BMCR_RESET ) == 0 )
83
84
break ;
84
85
@@ -99,7 +100,8 @@ static int reset_phy(void)
99
100
mdio_write (CONFIG_PHY_ADDR , MII_BMCR , reg | BMCR_ANRESTART );
100
101
101
102
delayCnt = 200000 ;
102
- while (delayCnt -- > 0 ) {
103
+ while (delayCnt > 0 ) {
104
+ delayCnt -- ;
103
105
if ((mdio_read (CONFIG_PHY_ADDR , MII_BMSR ) & (BMSR_ANEGCOMPLETE | BMSR_LSTATUS ))
104
106
== (BMSR_ANEGCOMPLETE | BMSR_LSTATUS ))
105
107
break ;
You can’t perform that action at this time.
0 commit comments