Skip to content

Commit

Permalink
net: bcmgenet: only update UMAC_CMD if something changed
Browse files Browse the repository at this point in the history
The link adjustment callback can be called as frequently as desired
by the PHY library, as such, let's avoid doing a Read/Modify/Write
sequence if nothing changed, since these register accesses can be
expensive.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Florian Fainelli authored and David S. Miller committed Jul 22, 2014
1 parent bb1fed7 commit 2405240
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/net/ethernet/broadcom/genet/bcmmii.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,18 @@ static void bcmgenet_mii_setup(struct net_device *dev)
/* pause capability */
if (!phydev->pause)
cmd_bits |= CMD_RX_PAUSE_IGNORE | CMD_TX_PAUSE_IGNORE;
}

if (status_changed) {
reg = bcmgenet_umac_readl(priv, UMAC_CMD);
reg &= ~((CMD_SPEED_MASK << CMD_SPEED_SHIFT) |
CMD_HD_EN |
CMD_RX_PAUSE_IGNORE | CMD_TX_PAUSE_IGNORE);
reg |= cmd_bits;
bcmgenet_umac_writel(priv, reg, UMAC_CMD);
}

if (status_changed)
phy_print_status(phydev);
}
}

void bcmgenet_mii_reset(struct net_device *dev)
Expand Down

0 comments on commit 2405240

Please sign in to comment.