Skip to content

Commit 3117a11

Browse files
Kamil Horák - 2Nkuba-moo
authored andcommitted
net: phy: bcm54811: PHY initialization
Reset the bit 12 in PHY's LRE Control register upon initialization. According to the datasheet, this bit must be written to zero after every device reset. Signed-off-by: Kamil Horák - 2N <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 34bf222 commit 3117a11

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

drivers/net/phy/broadcom.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ static int bcm5481x_read_abilities(struct phy_device *phydev)
667667
{
668668
struct device_node *np = phydev->mdio.dev.of_node;
669669
struct bcm54xx_phy_priv *priv = phydev->priv;
670-
int i, val, err;
670+
int i, val, err, aneg;
671671

672672
for (i = 0; i < ARRAY_SIZE(bcm54811_linkmodes); i++)
673673
linkmode_clear_bit(bcm54811_linkmodes[i], phydev->supported);
@@ -688,9 +688,19 @@ static int bcm5481x_read_abilities(struct phy_device *phydev)
688688
if (val < 0)
689689
return val;
690690

691+
/* BCM54811 is not capable of LDS but the corresponding bit
692+
* in LRESR is set to 1 and marked "Ignore" in the datasheet.
693+
* So we must read the bcm54811 as unable to auto-negotiate
694+
* in BroadR-Reach mode.
695+
*/
696+
if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54811)
697+
aneg = 0;
698+
else
699+
aneg = val & LRESR_LDSABILITY;
700+
691701
linkmode_mod_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
692702
phydev->supported,
693-
val & LRESR_LDSABILITY);
703+
aneg);
694704
linkmode_mod_bit(ETHTOOL_LINK_MODE_100baseT1_Full_BIT,
695705
phydev->supported,
696706
val & LRESR_100_1PAIR);
@@ -747,8 +757,15 @@ static int bcm54811_config_aneg(struct phy_device *phydev)
747757

748758
/* Aneg firstly. */
749759
if (priv->brr_mode) {
750-
/* BCM54811 is only capable of autonegotiation in IEEE mode */
751-
phydev->autoneg = 0;
760+
/* BCM54811 is only capable of autonegotiation in IEEE mode.
761+
* In BroadR-Reach mode, disable the Long Distance Signaling,
762+
* the BRR mode autoneg as supported in other Broadcom PHYs.
763+
* This bit is marked as "Reserved" and "Default 1, must be
764+
* written to 0 after every device reset" in the datasheet.
765+
*/
766+
ret = phy_modify(phydev, MII_BCM54XX_LRECR, LRECR_LDSEN, 0);
767+
if (ret < 0)
768+
return ret;
752769
ret = bcm_config_lre_aneg(phydev, false);
753770
} else {
754771
ret = genphy_config_aneg(phydev);

0 commit comments

Comments
 (0)