Skip to content

Commit 69e2ecc

Browse files
kunyi731davem330
authored andcommitted
net: phy: broadcom: Enable 125 MHz clock on LED4 pin for BCM54612E by default.
BCM54612E have 4 multi-functional LED pins that can be configured through register setting; the LED4 pin can be configured to a 125MHz reference clock output by setting the spare register. Since the dedicated CLK125 reference clock pin is not brought out on the 48-Pin MLP, the LED4 pin is the only pin to provide such function in this package, and therefore it is beneficial to just enable the reference clock by default. Signed-off-by: Kun Yi <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3d60934 commit 69e2ecc

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

drivers/net/phy/broadcom.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ static int bcm54210e_config_init(struct phy_device *phydev)
5454

5555
static int bcm54612e_config_init(struct phy_device *phydev)
5656
{
57+
int reg;
58+
5759
/* Clear TX internal delay unless requested. */
5860
if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) &&
5961
(phydev->interface != PHY_INTERFACE_MODE_RGMII_TXID)) {
@@ -65,8 +67,6 @@ static int bcm54612e_config_init(struct phy_device *phydev)
6567
/* Clear RX internal delay unless requested. */
6668
if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) &&
6769
(phydev->interface != PHY_INTERFACE_MODE_RGMII_RXID)) {
68-
u16 reg;
69-
7070
reg = bcm54xx_auxctl_read(phydev,
7171
MII_BCM54XX_AUXCTL_SHDWSEL_MISC);
7272
/* Disable RXD to RXC delay (default set) */
@@ -77,6 +77,18 @@ static int bcm54612e_config_init(struct phy_device *phydev)
7777
MII_BCM54XX_AUXCTL_MISC_WREN | reg);
7878
}
7979

80+
/* Enable CLK125 MUX on LED4 if ref clock is enabled. */
81+
if (!(phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED)) {
82+
int err;
83+
84+
reg = bcm_phy_read_exp(phydev, BCM54612E_EXP_SPARE0);
85+
err = bcm_phy_write_exp(phydev, BCM54612E_EXP_SPARE0,
86+
BCM54612E_LED4_CLK125OUT_EN | reg);
87+
88+
if (err < 0)
89+
return err;
90+
}
91+
8092
return 0;
8193
}
8294

include/linux/brcmphy.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
#define MII_BCM54XX_EXP_SEL 0x17 /* Expansion register select */
8686
#define MII_BCM54XX_EXP_SEL_SSD 0x0e00 /* Secondary SerDes select */
8787
#define MII_BCM54XX_EXP_SEL_ER 0x0f00 /* Expansion register select */
88+
#define MII_BCM54XX_EXP_SEL_ETC 0x0d00 /* Expansion register spare + 2k mem */
8889

8990
#define MII_BCM54XX_AUX_CTL 0x18 /* Auxiliary control register */
9091
#define MII_BCM54XX_ISR 0x1a /* BCM54xx interrupt status register */
@@ -219,6 +220,9 @@
219220
#define BCM54810_SHD_CLK_CTL 0x3
220221
#define BCM54810_SHD_CLK_CTL_GTXCLK_EN (1 << 9)
221222

223+
/* BCM54612E Registers */
224+
#define BCM54612E_EXP_SPARE0 (MII_BCM54XX_EXP_SEL_ETC + 0x34)
225+
#define BCM54612E_LED4_CLK125OUT_EN (1 << 1)
222226

223227
/*****************************************************************************/
224228
/* Fast Ethernet Transceiver definitions. */

0 commit comments

Comments
 (0)