Skip to content

Commit

Permalink
Merge branch 'bcmgenet-net'
Browse files Browse the repository at this point in the history
Florian Fainelli says:

====================
net: bcmgenet: power management related fixes

These two patches fixes issues seen while testing power management on
platforms using the GENET driver.

First patch fixes an issue with the PHY state machine queuing work after
resume since we are not properly detached from it.

Second patch fixes an issue with GENET interfaces that were not properly
restored to a working state after a S3 suspend/resume cycle.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Nov 11, 2014
2 parents 93ecd26 + dbd479d commit caa13a9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
11 changes: 10 additions & 1 deletion drivers/net/ethernet/broadcom/genet/bcmgenet.c
Original file line number Diff line number Diff line change
Expand Up @@ -2140,6 +2140,12 @@ static int bcmgenet_open(struct net_device *dev)
goto err_irq0;
}

/* Re-configure the port multiplexer towards the PHY device */
bcmgenet_mii_config(priv->dev, false);

phy_connect_direct(dev, priv->phydev, bcmgenet_mii_setup,
priv->phy_interface);

bcmgenet_netif_start(dev);

return 0;
Expand Down Expand Up @@ -2184,6 +2190,9 @@ static int bcmgenet_close(struct net_device *dev)

bcmgenet_netif_stop(dev);

/* Really kill the PHY state machine and disconnect from it */
phy_disconnect(priv->phydev);

/* Disable MAC receive */
umac_enable_set(priv, CMD_RX_EN, false);

Expand Down Expand Up @@ -2685,7 +2694,7 @@ static int bcmgenet_resume(struct device *d)

phy_init_hw(priv->phydev);
/* Speed settings must be restored */
bcmgenet_mii_config(priv->dev);
bcmgenet_mii_config(priv->dev, false);

/* disable ethernet MAC while updating its registers */
umac_enable_set(priv, CMD_TX_EN | CMD_RX_EN, false);
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/ethernet/broadcom/genet/bcmgenet.h
Original file line number Diff line number Diff line change
Expand Up @@ -617,9 +617,10 @@ GENET_IO_MACRO(rbuf, GENET_RBUF_OFF);

/* MDIO routines */
int bcmgenet_mii_init(struct net_device *dev);
int bcmgenet_mii_config(struct net_device *dev);
int bcmgenet_mii_config(struct net_device *dev, bool init);
void bcmgenet_mii_exit(struct net_device *dev);
void bcmgenet_mii_reset(struct net_device *dev);
void bcmgenet_mii_setup(struct net_device *dev);

/* Wake-on-LAN routines */
void bcmgenet_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol);
Expand Down
9 changes: 5 additions & 4 deletions drivers/net/ethernet/broadcom/genet/bcmmii.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static int bcmgenet_mii_write(struct mii_bus *bus, int phy_id,
/* setup netdev link state when PHY link status change and
* update UMAC and RGMII block when link up
*/
static void bcmgenet_mii_setup(struct net_device *dev)
void bcmgenet_mii_setup(struct net_device *dev)
{
struct bcmgenet_priv *priv = netdev_priv(dev);
struct phy_device *phydev = priv->phydev;
Expand Down Expand Up @@ -211,7 +211,7 @@ static void bcmgenet_moca_phy_setup(struct bcmgenet_priv *priv)
bcmgenet_sys_writel(priv, reg, SYS_PORT_CTRL);
}

int bcmgenet_mii_config(struct net_device *dev)
int bcmgenet_mii_config(struct net_device *dev, bool init)
{
struct bcmgenet_priv *priv = netdev_priv(dev);
struct phy_device *phydev = priv->phydev;
Expand Down Expand Up @@ -298,7 +298,8 @@ int bcmgenet_mii_config(struct net_device *dev)
return -EINVAL;
}

dev_info(kdev, "configuring instance for %s\n", phy_name);
if (init)
dev_info(kdev, "configuring instance for %s\n", phy_name);

return 0;
}
Expand Down Expand Up @@ -350,7 +351,7 @@ static int bcmgenet_mii_probe(struct net_device *dev)
* PHY speed which is needed for bcmgenet_mii_config() to configure
* things appropriately.
*/
ret = bcmgenet_mii_config(dev);
ret = bcmgenet_mii_config(dev, true);
if (ret) {
phy_disconnect(priv->phydev);
return ret;
Expand Down

0 comments on commit caa13a9

Please sign in to comment.