Commit c669b5cf authored by David S. Miller's avatar David S. Miller

Merge branch 'net-support-bgmac-with-B50212E-B1-PHY'

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: default avatarDavid S. Miller <davem@davemloft.net>
parents 32c10bbf 12acd136
...@@ -184,13 +184,19 @@ static int bgmac_probe(struct bcma_device *core) ...@@ -184,13 +184,19 @@ static int bgmac_probe(struct bcma_device *core)
if (!bgmac_is_bcm4707_family(core) && if (!bgmac_is_bcm4707_family(core) &&
!(ci->id == BCMA_CHIP_ID_BCM53573 && core->core_unit == 1)) { !(ci->id == BCMA_CHIP_ID_BCM53573 && core->core_unit == 1)) {
struct phy_device *phydev;
mii_bus = bcma_mdio_mii_register(bgmac); mii_bus = bcma_mdio_mii_register(bgmac);
if (IS_ERR(mii_bus)) { if (IS_ERR(mii_bus)) {
err = PTR_ERR(mii_bus); err = PTR_ERR(mii_bus);
goto err; goto err;
} }
bgmac->mii_bus = mii_bus; 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) { if (core->bus->hosttype == BCMA_HOSTTYPE_PCI) {
......
...@@ -43,6 +43,12 @@ static int bcm54210e_config_init(struct phy_device *phydev) ...@@ -43,6 +43,12 @@ static int bcm54210e_config_init(struct phy_device *phydev)
val &= ~BCM54810_SHD_CLK_CTL_GTXCLK_EN; val &= ~BCM54810_SHD_CLK_CTL_GTXCLK_EN;
bcm_phy_write_shadow(phydev, BCM54810_SHD_CLK_CTL, val); 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; return 0;
} }
......
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
#define PHY_BRCM_EXT_IBND_TX_ENABLE 0x00002000 #define PHY_BRCM_EXT_IBND_TX_ENABLE 0x00002000
#define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000 #define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000
#define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000 #define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000
#define PHY_BRCM_EN_MASTER_MODE 0x00010000
/* Broadcom BCM7xxx specific workarounds */ /* Broadcom BCM7xxx specific workarounds */
#define PHY_BRCM_7XXX_REV(x) (((x) >> 8) & 0xff) #define PHY_BRCM_7XXX_REV(x) (((x) >> 8) & 0xff)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment