Skip to content

Commit daf182d

Browse files
Shyam Sundar S Kdavem330
authored andcommitted
net: amd-xgbe: Toggle PLL settings during rate change
For each rate change command submission, the FW has to do a phy power off sequence internally. For this to happen correctly, the PLL re-initialization control setting has to be turned off before sending mailbox commands and re-enabled once the command submission is complete. Without the PLL control setting, the link up takes longer time in a fixed phy configuration. Fixes: 47f164d ("amd-xgbe: Add PCI device support") Co-developed-by: Sudheesh Mavila <[email protected]> Signed-off-by: Sudheesh Mavila <[email protected]> Signed-off-by: Shyam Sundar S K <[email protected]> Acked-by: Tom Lendacky <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent cec6880 commit daf182d

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

drivers/net/ethernet/amd/xgbe/xgbe-common.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,6 +1331,10 @@
13311331
#define MDIO_VEND2_PMA_CDR_CONTROL 0x8056
13321332
#endif
13331333

1334+
#ifndef MDIO_VEND2_PMA_MISC_CTRL0
1335+
#define MDIO_VEND2_PMA_MISC_CTRL0 0x8090
1336+
#endif
1337+
13341338
#ifndef MDIO_CTRL1_SPEED1G
13351339
#define MDIO_CTRL1_SPEED1G (MDIO_CTRL1_SPEED10G & ~BMCR_SPEED100)
13361340
#endif
@@ -1389,6 +1393,10 @@
13891393
#define XGBE_PMA_RX_RST_0_RESET_ON 0x10
13901394
#define XGBE_PMA_RX_RST_0_RESET_OFF 0x00
13911395

1396+
#define XGBE_PMA_PLL_CTRL_MASK BIT(15)
1397+
#define XGBE_PMA_PLL_CTRL_ENABLE BIT(15)
1398+
#define XGBE_PMA_PLL_CTRL_DISABLE 0x0000
1399+
13921400
/* Bit setting and getting macros
13931401
* The get macro will extract the current bit field value from within
13941402
* the variable

drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1977,12 +1977,26 @@ static void xgbe_phy_rx_reset(struct xgbe_prv_data *pdata)
19771977
}
19781978
}
19791979

1980+
static void xgbe_phy_pll_ctrl(struct xgbe_prv_data *pdata, bool enable)
1981+
{
1982+
XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_VEND2_PMA_MISC_CTRL0,
1983+
XGBE_PMA_PLL_CTRL_MASK,
1984+
enable ? XGBE_PMA_PLL_CTRL_ENABLE
1985+
: XGBE_PMA_PLL_CTRL_DISABLE);
1986+
1987+
/* Wait for command to complete */
1988+
usleep_range(100, 200);
1989+
}
1990+
19801991
static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,
19811992
unsigned int cmd, unsigned int sub_cmd)
19821993
{
19831994
unsigned int s0 = 0;
19841995
unsigned int wait;
19851996

1997+
/* Disable PLL re-initialization during FW command processing */
1998+
xgbe_phy_pll_ctrl(pdata, false);
1999+
19862000
/* Log if a previous command did not complete */
19872001
if (XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS)) {
19882002
netif_dbg(pdata, link, pdata->netdev,
@@ -2003,7 +2017,7 @@ static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,
20032017
wait = XGBE_RATECHANGE_COUNT;
20042018
while (wait--) {
20052019
if (!XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS))
2006-
return;
2020+
goto reenable_pll;
20072021

20082022
usleep_range(1000, 2000);
20092023
}
@@ -2013,6 +2027,10 @@ static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,
20132027

20142028
/* Reset on error */
20152029
xgbe_phy_rx_reset(pdata);
2030+
2031+
reenable_pll:
2032+
/* Enable PLL re-initialization */
2033+
xgbe_phy_pll_ctrl(pdata, true);
20162034
}
20172035

20182036
static void xgbe_phy_rrc(struct xgbe_prv_data *pdata)

0 commit comments

Comments
 (0)