Skip to content

Commit 1e1b812

Browse files
Sergei Shtylyovdavem330
authored andcommitted
sh_eth: fix handling of no LINK signal
The code handling the absent LINK signal (or the absent PSR register -- which reflects the state of this signal) is quite naive and has probably never really worked. It's probably enough to say that this code is executed only on the LINK change interrupt (sic!) but even if we actually have the signal and choose to ignore it (it might be connected to PHY's link/activity LED output as on the Renesas BOCK-W board), sh_eth_adjust_link() on which this code relies to update 'mdp->link' gets executed later than the LINK change interrupt where it is checked, and so RX/TX never get enabled via ECMR register. So, ignore the LINK changed interrupt iff LINK signal is absent (or just chosen not to be used) or PSR register is absent, and enable/disable RX/TX directly in sh_eth_adjust_link() in this case. Signed-off-by: Sergei Shtylyov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 14bc435 commit 1e1b812

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/net/ethernet/renesas/sh_eth.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,10 +1216,7 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
12161216
if (felic_stat & ECSR_LCHNG) {
12171217
/* Link Changed */
12181218
if (mdp->cd->no_psr || mdp->no_ether_link) {
1219-
if (mdp->link == PHY_DOWN)
1220-
link_stat = 0;
1221-
else
1222-
link_stat = PHY_ST_LINK;
1219+
goto ignore_link;
12231220
} else {
12241221
link_stat = (sh_eth_read(ndev, PSR));
12251222
if (mdp->ether_link_active_low)
@@ -1242,6 +1239,7 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
12421239
}
12431240
}
12441241

1242+
ignore_link:
12451243
if (intr_status & EESR_TWB) {
12461244
/* Write buck end. unused write back interrupt */
12471245
if (intr_status & EESR_TABT) /* Transmit Abort int */
@@ -1392,12 +1390,16 @@ static void sh_eth_adjust_link(struct net_device *ndev)
13921390
(sh_eth_read(ndev, ECMR) & ~ECMR_TXF), ECMR);
13931391
new_state = 1;
13941392
mdp->link = phydev->link;
1393+
if (mdp->cd->no_psr || mdp->no_ether_link)
1394+
sh_eth_rcv_snd_enable(ndev);
13951395
}
13961396
} else if (mdp->link) {
13971397
new_state = 1;
13981398
mdp->link = PHY_DOWN;
13991399
mdp->speed = 0;
14001400
mdp->duplex = -1;
1401+
if (mdp->cd->no_psr || mdp->no_ether_link)
1402+
sh_eth_rcv_snd_disable(ndev);
14011403
}
14021404

14031405
if (new_state && netif_msg_link(mdp))

0 commit comments

Comments
 (0)