Skip to content

Commit

Permalink
Merge branch 'net-support-bgmac-with-B50212E-B1-PHY'
Browse files Browse the repository at this point in the history
Rafał Miłecki says:

====================
net: support bgmac with B50212E B1 PHY

I got a report that a board with BCM47189 SoC and B50212E B1 PHY doesn't
work well some devices as there is massive ping loss. After analyzing
PHY state it has appeared that is runs in slave mode and doesn't auto
switch to master properly when needed.

This patchset fixes this by:
1) Adding new flag support to the PHY driver for setting master mode
2) Modifying bgmac to request master mode for reported hardware
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Oct 13, 2017
2 parents 32c10bb + 12acd13 commit c669b5c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/net/ethernet/broadcom/bgmac-bcma.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,19 @@ static int bgmac_probe(struct bcma_device *core)

if (!bgmac_is_bcm4707_family(core) &&
!(ci->id == BCMA_CHIP_ID_BCM53573 && core->core_unit == 1)) {
struct phy_device *phydev;

mii_bus = bcma_mdio_mii_register(bgmac);
if (IS_ERR(mii_bus)) {
err = PTR_ERR(mii_bus);
goto err;
}

bgmac->mii_bus = mii_bus;

phydev = mdiobus_get_phy(bgmac->mii_bus, bgmac->phyaddr);
if (ci->id == BCMA_CHIP_ID_BCM53573 && phydev &&
(phydev->drv->phy_id & phydev->drv->phy_id_mask) == PHY_ID_BCM54210E)
phydev->dev_flags |= PHY_BRCM_EN_MASTER_MODE;
}

if (core->bus->hosttype == BCMA_HOSTTYPE_PCI) {
Expand Down
6 changes: 6 additions & 0 deletions drivers/net/phy/broadcom.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ static int bcm54210e_config_init(struct phy_device *phydev)
val &= ~BCM54810_SHD_CLK_CTL_GTXCLK_EN;
bcm_phy_write_shadow(phydev, BCM54810_SHD_CLK_CTL, val);

if (phydev->dev_flags & PHY_BRCM_EN_MASTER_MODE) {
val = phy_read(phydev, MII_CTRL1000);
val |= CTL1000_AS_MASTER | CTL1000_ENABLE_MASTER;
phy_write(phydev, MII_CTRL1000, val);
}

return 0;
}

Expand Down
1 change: 1 addition & 0 deletions include/linux/brcmphy.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
#define PHY_BRCM_EXT_IBND_TX_ENABLE 0x00002000
#define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000
#define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000
#define PHY_BRCM_EN_MASTER_MODE 0x00010000

/* Broadcom BCM7xxx specific workarounds */
#define PHY_BRCM_7XXX_REV(x) (((x) >> 8) & 0xff)
Expand Down

0 comments on commit c669b5c

Please sign in to comment.