aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/cadence/macb.c
diff options
context:
space:
mode:
authorJaeden Amero <jaeden.amero@ni.com>2015-03-12 19:07:54 -0400
committerDavid S. Miller <davem@davemloft.net>2015-03-12 23:04:32 -0400
commit2c29b2354a06f42493ddd2a5eb65962981e666ed (patch)
treec47c4f3b39496f10679fda3d8be3dfe069b544e9 /drivers/net/ethernet/cadence/macb.c
parent393619474ec0ba2a16dee12ec78fd43164f1e9b7 (diff)
net/macb: Only adjust tx_clk on link change
The PHY state machine (in drivers/net/phy/phy.c) will unconditionally call phydev->adjust_link (macb_handle_link_change) when polling in the PHY_CHANGELINK state. As currently written, macb always ends up requesting a new tx_clk frequency in macb_handle_link_change. It is a waste of time to request a new tx_clk frequency if the link state hasn't changed, as the tx_clk will already be configured properly. Let's only request a new tx_clk clock frequency when necessary. Signed-off-by: Jaeden Amero <jaeden.amero@ni.com> Cc: Josh Cartwright <joshc@ni.com> Cc: Soren Brinkmann <soren.brinkmann@xilinx.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/cadence/macb.c')
-rw-r--r--drivers/net/ethernet/cadence/macb.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index f00be585f661..a0a04b3638e6 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -293,10 +293,13 @@ static void macb_handle_link_change(struct net_device *dev)
293 293
294 spin_unlock_irqrestore(&bp->lock, flags); 294 spin_unlock_irqrestore(&bp->lock, flags);
295 295
296 macb_set_tx_clk(bp->tx_clk, phydev->speed, dev);
297
298 if (status_change) { 296 if (status_change) {
299 if (phydev->link) { 297 if (phydev->link) {
298 /* Update the TX clock rate if and only if the link is
299 * up and there has been a link change.
300 */
301 macb_set_tx_clk(bp->tx_clk, phydev->speed, dev);
302
300 netif_carrier_on(dev); 303 netif_carrier_on(dev);
301 netdev_info(dev, "link up (%d/%s)\n", 304 netdev_info(dev, "link up (%d/%s)\n",
302 phydev->speed, 305 phydev->speed,