aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@ru.mvista.com>2009-12-24 00:31:20 -0500
committerDavid S. Miller <davem@davemloft.net>2009-12-26 23:24:43 -0500
commit08fafd8461c0ca8d1b389b7dc11d17e7b2331282 (patch)
tree60e2a5850c087bcc47301b1fc37adcb1a570e121
parent08b5e1c91ce95793c59a59529a362a1bcc81faae (diff)
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: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ucc_geth.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 7fff4c5a1693..41ad2f3697c7 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -1651,25 +1651,28 @@ static void adjust_link(struct net_device *dev)
1651 ugeth->oldspeed = phydev->speed; 1651 ugeth->oldspeed = phydev->speed;
1652 } 1652 }
1653 1653
1654 /*
1655 * To change the MAC configuration we need to disable the
1656 * controller. To do so, we have to either grab ugeth->lock,
1657 * which is a bad idea since 'graceful stop' commands might
1658 * take quite a while, or we can quiesce driver's activity.
1659 */
1660 ugeth_quiesce(ugeth);
1661 ugeth_disable(ugeth, COMM_DIR_RX_AND_TX);
1662
1663 out_be32(&ug_regs->maccfg2, tempval);
1664 out_be32(&uf_regs->upsmr, upsmr);
1665
1666 ugeth_enable(ugeth, COMM_DIR_RX_AND_TX);
1667 ugeth_activate(ugeth);
1668
1669 if (!ugeth->oldlink) { 1654 if (!ugeth->oldlink) {
1670 new_state = 1; 1655 new_state = 1;
1671 ugeth->oldlink = 1; 1656 ugeth->oldlink = 1;
1672 } 1657 }
1658
1659 if (new_state) {
1660 /*
1661 * To change the MAC configuration we need to disable
1662 * the controller. To do so, we have to either grab
1663 * ugeth->lock, which is a bad idea since 'graceful
1664 * stop' commands might take quite a while, or we can
1665 * quiesce driver's activity.
1666 */
1667 ugeth_quiesce(ugeth);
1668 ugeth_disable(ugeth, COMM_DIR_RX_AND_TX);
1669
1670 out_be32(&ug_regs->maccfg2, tempval);
1671 out_be32(&uf_regs->upsmr, upsmr);
1672
1673 ugeth_enable(ugeth, COMM_DIR_RX_AND_TX);
1674 ugeth_activate(ugeth);
1675 }
1673 } else if (ugeth->oldlink) { 1676 } else if (ugeth->oldlink) {
1674 new_state = 1; 1677 new_state = 1;
1675 ugeth->oldlink = 0; 1678 ugeth->oldlink = 0;