Commit 08fafd84 authored by Anton Vorontsov's avatar Anton Vorontsov Committed by David S. Miller

ucc_geth: Don't needlessly change MAC settings in adjust_link()

If PHY doesn't have an IRQ, phylib would poll for link changes, and
would call adjust_link() every second. In that case we disable and
enable the controller every second.

Let's better check if there is actually anything changed, and, if so,
change the MAC settings.
Signed-off-by: default avatarAnton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 08b5e1c9
......@@ -1651,11 +1651,18 @@ static void adjust_link(struct net_device *dev)
ugeth->oldspeed = phydev->speed;
}
if (!ugeth->oldlink) {
new_state = 1;
ugeth->oldlink = 1;
}
if (new_state) {
/*
* To change the MAC configuration we need to disable the
* controller. To do so, we have to either grab ugeth->lock,
* which is a bad idea since 'graceful stop' commands might
* take quite a while, or we can quiesce driver's activity.
* To change the MAC configuration we need to disable
* the controller. To do so, we have to either grab
* ugeth->lock, which is a bad idea since 'graceful
* stop' commands might take quite a while, or we can
* quiesce driver's activity.
*/
ugeth_quiesce(ugeth);
ugeth_disable(ugeth, COMM_DIR_RX_AND_TX);
......@@ -1665,10 +1672,6 @@ static void adjust_link(struct net_device *dev)
ugeth_enable(ugeth, COMM_DIR_RX_AND_TX);
ugeth_activate(ugeth);
if (!ugeth->oldlink) {
new_state = 1;
ugeth->oldlink = 1;
}
} else if (ugeth->oldlink) {
new_state = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment