Commit fc13d8c0 authored by Doug Berger's avatar Doug Berger Committed by David S. Miller
Browse files

net: bcmgenet: pull mac_config from adjust_link



This commit separates out the MAC configuration that occurs on a
PHY state change into a function named bcmgenet_mac_config().

This allows the function to be called directly elsewhere.

Signed-off-by: default avatarDoug Berger <opendmb@gmail.com>
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fcb5dfe7
Loading
Loading
Loading
Loading
+49 −45
Original line number Diff line number Diff line
@@ -25,16 +25,12 @@

#include "bcmgenet.h"

/* setup netdev link state when PHY link status change and
 * update UMAC and RGMII block when link up
 */
void bcmgenet_mii_setup(struct net_device *dev)
static void bcmgenet_mac_config(struct net_device *dev)
{
	struct bcmgenet_priv *priv = netdev_priv(dev);
	struct phy_device *phydev = dev->phydev;
	u32 reg, cmd_bits = 0;

	if (phydev->link) {
	/* speed */
	if (phydev->speed == SPEED_1000)
		cmd_bits = CMD_SPEED_1000;
@@ -52,8 +48,7 @@ void bcmgenet_mii_setup(struct net_device *dev)
	if (!phydev->pause)
		cmd_bits |= CMD_RX_PAUSE_IGNORE | CMD_TX_PAUSE_IGNORE;

		/*
		 * Program UMAC and RGMII block based on established
	/* Program UMAC and RGMII block based on established
	 * link speed, duplex, and pause. The speed set in
	 * umac->cmd tell RGMII block which clock to use for
	 * transmit -- 25MHz(100Mbps) or 125MHz(1Gbps).
@@ -78,6 +73,15 @@ void bcmgenet_mii_setup(struct net_device *dev)
	bcmgenet_umac_writel(priv, reg, UMAC_CMD);
}

/* setup netdev link state when PHY link status change and
 * update UMAC and RGMII block when link up
 */
void bcmgenet_mii_setup(struct net_device *dev)
{
	struct phy_device *phydev = dev->phydev;

	if (phydev->link)
		bcmgenet_mac_config(dev);
	phy_print_status(phydev);
}