Message ID | 20190108162926.17806-5-vkoul@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | net: Add support for Qualcomm ethqos | expand |
On 1/8/19 8:29 AM, Vinod Koul wrote: > For RGMII mode, phy delay should be disabled. Add this case along > with disable delay routines. > > Signed-off-by: Vinod Koul <vkoul@kernel.org> > --- > drivers/net/phy/at803x.c | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c > index f9432d053a22..e7cf1d5b0514 100644 > --- a/drivers/net/phy/at803x.c > +++ b/drivers/net/phy/at803x.c > @@ -122,6 +122,18 @@ static inline int at803x_enable_tx_delay(struct phy_device *phydev) > AT803X_DEBUG_TX_CLK_DLY_EN); > } > > +static inline int at803x_disable_rx_delay(struct phy_device *phydev) > +{ > + return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, > + AT803X_DEBUG_RX_CLK_DLY_EN, 0); > +} > + > +static inline int at803x_disable_tx_delay(struct phy_device *phydev) > +{ > + return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5, > + AT803X_DEBUG_TX_CLK_DLY_EN, 0); > +} > + > /* save relevant PHY registers to private copy */ > static void at803x_context_save(struct phy_device *phydev, > struct at803x_context *context) > @@ -269,6 +281,15 @@ static int at803x_config_init(struct phy_device *phydev) > return ret; > } > > + if (phydev->interface == PHY_INTERFACE_MODE_RGMII) { > + ret = at803x_disable_rx_delay(phydev); > + if (ret < 0) > + return ret; > + ret = at803x_disable_tx_delay(phydev); > + if (ret < 0) > + return ret; > + } This looks right in that PHY_INTERFACE_MODE_RGMII from the perspective of the PHY means no TX/RX delays, but you would also have to take care of PHY_INTERFACE_MODE_RGMII_TXID and disable the RX delay in that case, and PHY_INTERFACE_MODE_RGMII_RXID and disabled the TX delay in that case. Thanks!
Hi Florian, Thanks for a quick review, On 08-01-19, 09:59, Florian Fainelli wrote: > On 1/8/19 8:29 AM, Vinod Koul wrote: > > + if (phydev->interface == PHY_INTERFACE_MODE_RGMII) { > > + ret = at803x_disable_rx_delay(phydev); > > + if (ret < 0) > > + return ret; > > + ret = at803x_disable_tx_delay(phydev); > > + if (ret < 0) > > + return ret; > > + } > > This looks right in that PHY_INTERFACE_MODE_RGMII from the perspective > of the PHY means no TX/RX delays, but you would also have to take care > of PHY_INTERFACE_MODE_RGMII_TXID and disable the RX delay in that case, > and PHY_INTERFACE_MODE_RGMII_RXID and disabled the TX delay in that case. Okay and I guess same about the PHY_INTERFACE_MODE_RGMII_ID. Right now driver enables delay for PHY_INTERFACE_MODE_RGMII_ID and PHY_INTERFACE_MODE_RGMII_TXID, PHY_INTERFACE_MODE_RGMII_RXID so I would remove that as well.. Thanks
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index f9432d053a22..e7cf1d5b0514 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -122,6 +122,18 @@ static inline int at803x_enable_tx_delay(struct phy_device *phydev) AT803X_DEBUG_TX_CLK_DLY_EN); } +static inline int at803x_disable_rx_delay(struct phy_device *phydev) +{ + return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, + AT803X_DEBUG_RX_CLK_DLY_EN, 0); +} + +static inline int at803x_disable_tx_delay(struct phy_device *phydev) +{ + return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5, + AT803X_DEBUG_TX_CLK_DLY_EN, 0); +} + /* save relevant PHY registers to private copy */ static void at803x_context_save(struct phy_device *phydev, struct at803x_context *context) @@ -269,6 +281,15 @@ static int at803x_config_init(struct phy_device *phydev) return ret; } + if (phydev->interface == PHY_INTERFACE_MODE_RGMII) { + ret = at803x_disable_rx_delay(phydev); + if (ret < 0) + return ret; + ret = at803x_disable_tx_delay(phydev); + if (ret < 0) + return ret; + } + return 0; }
For RGMII mode, phy delay should be disabled. Add this case along with disable delay routines. Signed-off-by: Vinod Koul <vkoul@kernel.org> --- drivers/net/phy/at803x.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)