Skip to content

Commit 62e1309

Browse files
Rafał Miłeckidavem330
authored andcommitted
net: phy: broadcom: rehook BCM54612E specific init
This extra BCM54612E code in PHY driver isn't really aneg specific. Even without it aneg works OK but the problem is no packets pass through PHY. Moreover putting this code inside config_aneg callback didn't allow resuming PHY correctly. When driver called phy_stop and phy_start it was putting PHY machine into RESUMING state. After that machine was switching into AN and NOLINK without ever calling phy_start_aneg. This prevented this extra setup from being called and PHY didn't work. This change has been verified to fix network on BCM47186B0 SoC device with BCM54612E. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 974c3f1 commit 62e1309

1 file changed

Lines changed: 33 additions & 34 deletions

File tree

‎drivers/net/phy/broadcom.c‎

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,34 @@ static int bcm54210e_config_init(struct phy_device *phydev)
4646
return 0;
4747
}
4848

49+
static int bcm54612e_config_init(struct phy_device *phydev)
50+
{
51+
/* Clear TX internal delay unless requested. */
52+
if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) &&
53+
(phydev->interface != PHY_INTERFACE_MODE_RGMII_TXID)) {
54+
/* Disable TXD to GTXCLK clock delay (default set) */
55+
/* Bit 9 is the only field in shadow register 00011 */
56+
bcm_phy_write_shadow(phydev, 0x03, 0);
57+
}
58+
59+
/* Clear RX internal delay unless requested. */
60+
if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) &&
61+
(phydev->interface != PHY_INTERFACE_MODE_RGMII_RXID)) {
62+
u16 reg;
63+
64+
reg = bcm54xx_auxctl_read(phydev,
65+
MII_BCM54XX_AUXCTL_SHDWSEL_MISC);
66+
/* Disable RXD to RXC delay (default set) */
67+
reg &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN;
68+
/* Clear shadow selector field */
69+
reg &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MASK;
70+
bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC,
71+
MII_BCM54XX_AUXCTL_MISC_WREN | reg);
72+
}
73+
74+
return 0;
75+
}
76+
4977
static int bcm54810_config(struct phy_device *phydev)
5078
{
5179
int rc, val;
@@ -250,6 +278,10 @@ static int bcm54xx_config_init(struct phy_device *phydev)
250278
err = bcm54210e_config_init(phydev);
251279
if (err)
252280
return err;
281+
} else if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54612E) {
282+
err = bcm54612e_config_init(phydev);
283+
if (err)
284+
return err;
253285
} else if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810) {
254286
err = bcm54810_config(phydev);
255287
if (err)
@@ -395,39 +427,6 @@ static int bcm5481_config_aneg(struct phy_device *phydev)
395427
return ret;
396428
}
397429

398-
static int bcm54612e_config_aneg(struct phy_device *phydev)
399-
{
400-
int ret;
401-
402-
/* First, auto-negotiate. */
403-
ret = genphy_config_aneg(phydev);
404-
405-
/* Clear TX internal delay unless requested. */
406-
if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) &&
407-
(phydev->interface != PHY_INTERFACE_MODE_RGMII_TXID)) {
408-
/* Disable TXD to GTXCLK clock delay (default set) */
409-
/* Bit 9 is the only field in shadow register 00011 */
410-
bcm_phy_write_shadow(phydev, 0x03, 0);
411-
}
412-
413-
/* Clear RX internal delay unless requested. */
414-
if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) &&
415-
(phydev->interface != PHY_INTERFACE_MODE_RGMII_RXID)) {
416-
u16 reg;
417-
418-
reg = bcm54xx_auxctl_read(phydev,
419-
MII_BCM54XX_AUXCTL_SHDWSEL_MISC);
420-
/* Disable RXD to RXC delay (default set) */
421-
reg &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN;
422-
/* Clear shadow selector field */
423-
reg &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MASK;
424-
bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC,
425-
MII_BCM54XX_AUXCTL_MISC_WREN | reg);
426-
}
427-
428-
return ret;
429-
}
430-
431430
static int brcm_phy_setbits(struct phy_device *phydev, int reg, int set)
432431
{
433432
int val;
@@ -590,7 +589,7 @@ static struct phy_driver broadcom_drivers[] = {
590589
.features = PHY_GBIT_FEATURES,
591590
.flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
592591
.config_init = bcm54xx_config_init,
593-
.config_aneg = bcm54612e_config_aneg,
592+
.config_aneg = genphy_config_aneg,
594593
.read_status = genphy_read_status,
595594
.ack_interrupt = bcm_phy_ack_intr,
596595
.config_intr = bcm_phy_config_intr,

0 commit comments

Comments
 (0)