Message ID | 20240403180226.1641383-3-l.stach@pengutronix.de (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [1/3] net: dsa: microchip: lan9372: fix TX PHY access | expand |
On Wed, Apr 03, 2024 at 08:02:26PM +0200, Lucas Stach wrote: > While the documented VPHY out-of-reset configuration should autonegotiate > the maximum supported link speed on the CPU interface, that doesn't work > on RGMII links, where the VPHY negotiates 100MBit speed. This causes the > RGMII TX interface to run with a wrong clock rate. > > Disable the VPHY output altogether, so it doesn't interfere with the > CPU interface configuration set via fixed-link. The VPHY is a compatibility > functionality to be able to attach network drivers without fixed-link > support to the switch, which generally should not be needed with linux > network drivers. > > Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Andrew
Hi Lucas, On Wed, 2024-04-03 at 20:02 +0200, Lucas Stach wrote: > [Some people who received this message don't often get email from > l.stach@pengutronix.de. Learn why this is important at > https://aka.ms/LearnAboutSenderIdentification ] > > EXTERNAL EMAIL: Do not click links or open attachments unless you > know the content is safe > > While the documented VPHY out-of-reset configuration should > autonegotiate > the maximum supported link speed on the CPU interface, that doesn't > work > on RGMII links, where the VPHY negotiates 100MBit speed. This causes > the > RGMII TX interface to run with a wrong clock rate. > > Disable the VPHY output altogether, so it doesn't interfere with the > CPU interface configuration set via fixed-link. The VPHY is a > compatibility > functionality to be able to attach network drivers without fixed-link > support to the switch, which generally should not be needed with > linux > network drivers. > > Signed-off-by: Lucas Stach <l.stach@pengutronix.de> I believe, if targeted to net, fixes tag is required. > --- > drivers/net/dsa/microchip/lan937x_main.c | 3 +++ > drivers/net/dsa/microchip/lan937x_reg.h | 4 ++++ > 2 files changed, 7 insertions(+) > > diff --git a/drivers/net/dsa/microchip/lan937x_main.c > b/drivers/net/dsa/microchip/lan937x_main.c > index 04fa74c7dcbe..9db1d278ee9b 100644 > --- a/drivers/net/dsa/microchip/lan937x_main.c > +++ b/drivers/net/dsa/microchip/lan937x_main.c > @@ -400,6 +400,9 @@ int lan937x_setup(struct dsa_switch *ds) > lan937x_cfg(dev, REG_SW_GLOBAL_OUTPUT_CTRL__1, > (SW_CLK125_ENB | SW_CLK25_ENB), true); > > + /* disable VPHY output*/ > + ksz_rmw32(dev, REG_SW_CFG_STRAP_OVR, SW_VPHY_DISABLE, > SW_VPHY_DISABLE); ksz_rmw32 returns value, it needs to be handled. > + > return 0; > } >
diff --git a/drivers/net/dsa/microchip/lan937x_main.c b/drivers/net/dsa/microchip/lan937x_main.c index 04fa74c7dcbe..9db1d278ee9b 100644 --- a/drivers/net/dsa/microchip/lan937x_main.c +++ b/drivers/net/dsa/microchip/lan937x_main.c @@ -400,6 +400,9 @@ int lan937x_setup(struct dsa_switch *ds) lan937x_cfg(dev, REG_SW_GLOBAL_OUTPUT_CTRL__1, (SW_CLK125_ENB | SW_CLK25_ENB), true); + /* disable VPHY output*/ + ksz_rmw32(dev, REG_SW_CFG_STRAP_OVR, SW_VPHY_DISABLE, SW_VPHY_DISABLE); + return 0; } diff --git a/drivers/net/dsa/microchip/lan937x_reg.h b/drivers/net/dsa/microchip/lan937x_reg.h index e36bcb155f54..be553e23a964 100644 --- a/drivers/net/dsa/microchip/lan937x_reg.h +++ b/drivers/net/dsa/microchip/lan937x_reg.h @@ -37,6 +37,10 @@ #define SW_CLK125_ENB BIT(1) #define SW_CLK25_ENB BIT(0) +/* 2 - PHY Control */ +#define REG_SW_CFG_STRAP_OVR 0x214 +#define SW_VPHY_DISABLE BIT(31) + /* 3 - Operation Control */ #define REG_SW_OPERATION 0x0300
While the documented VPHY out-of-reset configuration should autonegotiate the maximum supported link speed on the CPU interface, that doesn't work on RGMII links, where the VPHY negotiates 100MBit speed. This causes the RGMII TX interface to run with a wrong clock rate. Disable the VPHY output altogether, so it doesn't interfere with the CPU interface configuration set via fixed-link. The VPHY is a compatibility functionality to be able to attach network drivers without fixed-link support to the switch, which generally should not be needed with linux network drivers. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> --- drivers/net/dsa/microchip/lan937x_main.c | 3 +++ drivers/net/dsa/microchip/lan937x_reg.h | 4 ++++ 2 files changed, 7 insertions(+)