Fixes applied to VCS8514
Subsystems (3)
v3 cover Fixes applied to VCS8514
3 different fixes applied to VSC8514:
LCPLL reset, serdes calibration and coma mode disabled. Especially the serdes calibration is large and is now placed in a new file 'mscc_serdes.c' which can act as
a placeholder for future serdes configuration.
v1 -> v2:
Preserved reversed christmas tree
Removed forward definitions
Fixed build issues
Changed net to net-next
v2 -> v3:
Added cover letter.
Removed ena_clk_bypass from function call Created mscc_serdes.c and .h for serdes configuration Modified coma register config.
Bjarni Jonasson (3):
net: phy: mscc: adding LCPLL reset to VSC8514
net: phy: mscc: improved serdes calibration applied to VSC8514
net: phy: mscc: coma mode disabled for VSC8514
drivers/net/phy/mscc/Makefile | 1 + drivers/net/phy/mscc/mscc.h | 28 ++ drivers/net/phy/mscc/mscc_main.c | 608 ++++++++++++++++----------- drivers/net/phy/mscc/mscc_serdes.c | 650 +++++++++++++++++++++++++++++ drivers/net/phy/mscc/mscc_serdes.h | 31 ++ 5 files changed, 1063 insertions(+), 255 deletions(-) create mode 100644 drivers/net/phy/mscc/mscc_serdes.c create mode 100644 drivers/net/phy/mscc/mscc_serdes.h
Signature · 1 line
2.17.1
PATCH v3 1/3 net: phy: mscc: adding LCPLL reset to VSC8514
At Power-On Reset, transients may cause the LCPLL to lock onto a clock that is momentarily unstable. This is normally seen in QSGMII setups where the higher speed 6G SerDes is being used. This patch adds an initial LCPLL Reset to the PHY (first instance) to avoid this issue.
--- drivers/net/phy/mscc/mscc.h | 8 + drivers/net/phy/mscc/mscc_main.c | 350 ++++++++++++++++++++----------- 2 files changed, 236 insertions(+), 122 deletions(-)
drivers/net/phy/mscc/mscc.h +8 -0
@@ -102,6 +102,7 @@ enum rgmii_clock_delay {#define PHY_MCB_S6G_READ BIT(30)#define PHY_S6G_PLL5G_CFG0 0x06 +#define PHY_S6G_PLL5G_CFG2 0x08#define PHY_S6G_LCPLL_CFG 0x11#define PHY_S6G_PLL_CFG 0x2b#define PHY_S6G_COMMON_CFG 0x2c
@@ -121,6 +122,9 @@ enum rgmii_clock_delay {#define PHY_S6G_PLL_FSM_CTRL_DATA_POS 8#define PHY_S6G_PLL_FSM_ENA_POS 7 +#define PHY_S6G_CFG2_FSM_DIS 1 +#define PHY_S6G_CFG2_FSM_CLK_BP 23 +#define MSCC_EXT_PAGE_ACCESS 31#define MSCC_PHY_PAGE_STANDARD 0x0000/* Standard registers */ #define MSCC_PHY_PAGE_EXTENDED 0x0001/* Extended registers */
@@ -412,6 +416,10 @@ struct vsc8531_edge_rate_table { };#endif /* CONFIG_OF_MDIO */ +enum csr_target { +MACRO_CTRL =0x07 , +}; +#if IS_ENABLED (CONFIG_MACSEC )int vsc8584_macsec_init (struct phy_device *phydev);void vsc8584_handle_macsec_interrupt (struct phy_device *phydev);
drivers/net/phy/mscc/mscc_main.c +228 -122
429 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 2/3 net: phy: mscc: improved serdes calibration applied to VSC8514
In reply to Bjarni JonassonThe current IB serdes calibration algorithm (performed by the onboard 8051) has proven to be unstable for the VSC8514 QSGMII phy.
A new algorithm has been developed based on
'Frequency-offset Jittered-Injection' or 'FoJi' method which solves all known issues. This patch disables the 8051 algorithm and replaces it with the new FoJi algorithm.
The calibration is now performed in a new file (mscc_serdes.c), which can act as an placeholder for future serdes configurations.
--- drivers/net/phy/mscc/Makefile | 1 + drivers/net/phy/mscc/mscc.h | 16 + drivers/net/phy/mscc/mscc_main.c | 308 +++++++------- drivers/net/phy/mscc/mscc_serdes.c | 650 +++++++++++++++++++++++++++++ drivers/net/phy/mscc/mscc_serdes.h | 31 ++ 5 files changed, 840 insertions(+), 166 deletions(-) create mode 100644 drivers/net/phy/mscc/mscc_serdes.c create mode 100644 drivers/net/phy/mscc/mscc_serdes.h
drivers/net/phy/mscc/Makefile +1 -0
@@ -4,6 +4,7 @@ obj-$(CONFIG_MICROSEMI_PHY) := mscc.o mscc-objs := mscc_main.o +mscc-objs += mscc_serdes.o ifdef CONFIG_MACSEC mscc-objs += mscc_macsec.o
drivers/net/phy/mscc/mscc.h +16 -0
@@ -339,6 +339,10 @@ enum rgmii_clock_delay {#define VSC8584_REVB 0x0001#define MSCC_DEV_REV_MASK GENMASK(3, 0) +#define MSCC_ROM_TRAP_SERDES_6G_CFG 0x1E48 +#define MSCC_RAM_TRAP_SERDES_6G_CFG 0x1E4F +#define PATCH_VEC_ZERO_EN 0x0100 +struct reg_val {u16 reg;u32 val;
@@ -420,6 +424,18 @@ enum csr_target { MACRO_CTRL = 0x07, }; +u32 vsc85xx_csr_read (struct phy_device *phydev, +enum csr_target target,u32 reg); + +int vsc85xx_csr_write (struct phy_device *phydev, +enum csr_target target,u32 reg,u32 val); + +int phy_base_write (struct phy_device *phydev,u32 regnum,u16 val); +int phy_base_read (struct phy_device *phydev,u32 regnum); +int phy_update_mcb_s6g (struct phy_device *phydev,u32 reg,u8 mcb); +int phy_commit_mcb_s6g (struct phy_device *phydev,u32 reg,u8 mcb); +int vsc8584_cmd (struct phy_device *phydev,u16 val); +#if IS_ENABLED (CONFIG_MACSEC )int vsc8584_macsec_init (struct phy_device *phydev);void vsc8584_handle_macsec_interrupt (struct phy_device *phydev);
drivers/net/phy/mscc/mscc_main.c +142 -166
371 lines not on this page · raw message
drivers/net/phy/mscc/mscc_serdes.c new file +650 -0
650 lines not on this page · raw message
drivers/net/phy/mscc/mscc_serdes.h new file +31 -0
@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */ +/* +* Driver for Microsemi VSC85xx PHYs +* +* Copyright (c) 2021 Microsemi Corporation +*/ + +#ifndef _MSCC_SERDES_PHY_H_ +#define _MSCC_SERDES_PHY_H_ + +#define PHY_S6G_PLL5G_CFG2_GAIN_MASK GENMASK(9, 5) +#define PHY_S6G_PLL5G_CFG2_ENA_GAIN 1 + +#define PHY_S6G_DES_PHY_CTRL_POS 13 +#define PHY_S6G_DES_MBTR_CTRL_POS 10 +#define PHY_S6G_DES_CPMD_SEL_POS 8 +#define PHY_S6G_DES_BW_HYST_POS 5 +#define PHY_S6G_DES_BW_ANA_POS 1 +#define PHY_S6G_DES_CFG 0x21 +#define PHY_S6G_IB_CFG0 0x22 +#define PHY_S6G_IB_CFG1 0x23 +#define PHY_S6G_IB_CFG2 0x24 +#define PHY_S6G_IB_CFG3 0x25 +#define PHY_S6G_IB_CFG4 0x26 +#define PHY_S6G_GP_CFG 0x2E +#define PHY_S6G_DFT_CFG0 0x35 +#define PHY_S6G_IB_DFT_CFG2 0x37 + +int vsc85xx_sd6g_config_v2 (struct phy_device *phydev); + +#endif /* _MSCC_PHY_SERDES_H_ */
Signature · 1 line
2.17.1
PATCH v3 3/3 net: phy: mscc: coma mode disabled for VSC8514
In reply to Bjarni JonassonThe 'coma mode' (configurable through sw or hw) provides an optional feature that may be used to control when the PHYs become active. The typical usage is to synchronize the link-up time across all PHY instances. This patch releases coma mode if not done by hardware, otherwise the phys will not link-up.
--- drivers/net/phy/mscc/mscc.h | 4 ++++ drivers/net/phy/mscc/mscc_main.c | 16 ++++++++++++++++ 2 files changed, 20 insertions(+)
drivers/net/phy/mscc/mscc.h +4 -0
@@ -140,6 +140,10 @@ enum rgmii_clock_delay {#define MSCC_PHY_PAGE_1588 0x1588/* PTP (1588) */ #define MSCC_PHY_PAGE_TEST 0x2a30/* Test reg */ #define MSCC_PHY_PAGE_TR 0x52b5/* Token ring registers */ +#define MSCC_PHY_GPIO_CONTROL_2 14 + +#define MSCC_PHY_COMA_MODE 0x2000/* input(1) / output(0) */ +#define MSCC_PHY_COMA_OUTPUT 0x1000/* value to output */ /* Extended Page 1 Registers */ #define MSCC_PHY_CU_MEDIA_CRC_VALID_CNT 18
drivers/net/phy/mscc/mscc_main.c +16 -0
@@ -1516,6 +1516,21 @@ static void vsc8584_get_base_addr(struct phy_device *phydev) vsc8531->addr = addr; } +static void vsc85xx_coma_mode_release (struct phy_device *phydev) +{ +/* The coma mode (pin or reg) provides an optional feature that +* may be used to control when the PHYs become active. +* Alternatively the COMA_MODE pin may be connected low +* so that the PHYs are fully active once out of reset. +*/ + +/* Enable output (mode=0) and write zero to it */ +vsc85xx_phy_write_page (phydev,MSCC_PHY_PAGE_EXTENDED_GPIO ); +__phy_modify (phydev,MSCC_PHY_GPIO_CONTROL_2 , +MSCC_PHY_COMA_MODE |MSCC_PHY_COMA_OUTPUT ,0 ); +vsc85xx_phy_write_page (phydev,MSCC_PHY_PAGE_STANDARD ); +} +static int vsc8584_config_init (struct phy_device *phydev) {struct vsc8531_private *vsc8531 = phydev->priv;
@@ -1962,6 +1977,7 @@ static int vsc8514_config_init(struct phy_device *phydev) ret =vsc8514_config_host_serdes (phydev);if (ret) goto err; +vsc85xx_coma_mode_release (phydev); }phy_unlock_mdio_bus (phydev);
Signature · 1 line
2.17.1
This series was applied to netdev/net-next.git (refs/heads/master):
Hello:
This series was applied to netdev/net-next.git (refs/heads/master):
Quoted 6 lines · On Tue, 16 Feb 2021 16:29:41 +0100 you wrote:
3 different fixes applied to VSC8514:
LCPLL reset, serdes calibration and coma mode disabled. Especially the serdes calibration is large and is now placed in a new file 'mscc_serdes.c' which can act as
a placeholder for future serdes configuration.
Quoted 7 lines
v1 -> v2:
Preserved reversed christmas tree
Removed forward definitions
Fixed build issues
Changed net to net-next[...]
Here is the summary with links:
- [net-next,v3,1/3] net: phy: mscc: adding LCPLL reset to VSC8514
https://git.kernel.org/netdev/net-next/c/3cc2c646be0b - [net-next,v3,2/3] net: phy: mscc: improved serdes calibration applied to VSC8514 https://git.kernel.org/netdev/net-next/c/85e97f0b984e - [net-next,v3,3/3] net: phy: mscc: coma mode disabled for VSC8514 https://git.kernel.org/netdev/net-next/c/ca0d7fd0a58d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html