Message ID | 20210604105733.31092-1-michael.wei.hong.sit@intel.com |
---|---|
Headers | show |
Series | Enable 2.5Gbps speed for stmmac | expand |
On Fri, Jun 04, 2021 at 06:57:33PM +0800, Michael Sit Wei Hong wrote: > From: Voon Weifeng <weifeng.voon@intel.com> > > The Intel mGbE supports 2.5Gbps link speed by increasing the clock rate by > 2.5 times of the original rate. In this mode, the serdes/PHY operates at a > serial baud rate of 3.125 Gbps and the PCS data path and GMII interface of > the MAC operate at 312.5 MHz instead of 125 MHz. > > For Intel mGbE, the overclocking of 2.5 times clock rate to support 2.5G is > only able to be configured in the BIOS during boot time. Kernel driver has > no access to modify the clock rate for 1Gbps/2.5G mode. The way to > determined the current 1G/2.5G mode is by reading a dedicated adhoc > register through mdio bus. In short, after the system boot up, it is either > in 1G mode or 2.5G mode which not able to be changed on the fly. > > Compared to 1G mode, the 2.5G mode selects the 2500BASEX as PHY interface and > disables the xpcs_an_inband. This is to cater for some PHYs that only > supports 2500BASEX PHY interface with no autonegotiation. > > v2: remove MAC supported link speed masking > v3: Restructure to introduce intel_speed_mode_2500() to read serdes registers > for max speed supported and select the appropritate configuration. > Use max_speed to determine the supported link speed mask. > > Signed-off-by: Voon Weifeng <weifeng.voon@intel.com> > Signed-off-by: Michael Sit Wei Hong <michael.wei.hong.sit@intel.com> > --- Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
On Fri, Jun 04, 2021 at 02:51:53PM +0300, Vladimir Oltean wrote: > On Fri, Jun 04, 2021 at 06:57:31PM +0800, Michael Sit Wei Hong wrote: > > From: Voon Weifeng <weifeng.voon@intel.com> > > > > This patch is a preparation patch for the enabling of Intel mGbE 2.5Gbps > > link speed. The Intel mGbR link speed configuration (1G/2.5G) is depends on > > a mdio ADHOC register which can be configured in the bios menu. > > As PHY interface might be different for 1G and 2.5G, the mdio bus need be > > ready to check the link speed and select the PHY interface before probing > > the xPCS. > > > > Signed-off-by: Voon Weifeng <weifeng.voon@intel.com> > > Signed-off-by: Michael Sit Wei Hong <michael.wei.hong.sit@intel.com> > > --- > > drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 + > > .../net/ethernet/stmicro/stmmac/stmmac_main.c | 7 ++ > > .../net/ethernet/stmicro/stmmac/stmmac_mdio.c | 64 ++++++++++--------- > > 3 files changed, 43 insertions(+), 29 deletions(-) > > > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h > > index b6cd43eda7ac..fd7212afc543 100644 > > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h > > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h > > @@ -311,6 +311,7 @@ enum stmmac_state { > > int stmmac_mdio_unregister(struct net_device *ndev); > > int stmmac_mdio_register(struct net_device *ndev); > > int stmmac_mdio_reset(struct mii_bus *mii); > > +int stmmac_xpcs_setup(struct mii_bus *mii); > > void stmmac_set_ethtool_ops(struct net_device *netdev); > > > > void stmmac_ptp_register(struct stmmac_priv *priv); > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > > index 6d41dd6f9f7a..c1331c07623d 100644 > > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > > @@ -6991,6 +6991,12 @@ int stmmac_dvr_probe(struct device *device, > > } > > } > > > > + if (priv->plat->mdio_bus_data->has_xpcs) { > > stmmac_mdio_register has: > > if (!mdio_bus_data) > return 0; > > which suggests that some platforms might not populate priv->plat->mdio_bus_data. > > Are you sure it is safe to go straight to dereferencing mdio_bus_data->has_xpcs > in the common driver probe function? This patch seems to agree with me: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=593f555fbc6091bbaec8dd2a38b47ee643412e61