Re: [PATCH net-next v3 2/8] net: dsa: vsc73xx: convert to PHYLINK

From: Vladimir Oltean
Date: Wed Sep 27 2023 - 01:32:37 EST


On Tue, Sep 12, 2023 at 05:49:36PM +0100, Russell King (Oracle) wrote:
> On Tue, Sep 12, 2023 at 02:21:56PM +0200, Pawel Dembicki wrote:
> > +static void vsc73xx_phylink_mac_link_up(struct dsa_switch *ds, int port,
> > + unsigned int mode,
> > + phy_interface_t interface,
> > + struct phy_device *phydev,
> > + int speed, int duplex,
> > + bool tx_pause, bool rx_pause)
> > +{
> > + struct vsc73xx *vsc = ds->priv;
> > + u32 val;
> > +
> > + if (speed == SPEED_1000)
> > + val = VSC73XX_MAC_CFG_GIGA_MODE | VSC73XX_MAC_CFG_TX_IPG_1000M;
> > + else
> > + val = VSC73XX_MAC_CFG_TX_IPG_100_10M;
> > +
> > + if (interface == PHY_INTERFACE_MODE_RGMII)
> > + val |= VSC73XX_MAC_CFG_CLK_SEL_1000M;
> > + else
> > + val |= VSC73XX_MAC_CFG_CLK_SEL_EXT;
>
> I know the original code tested against PHY_INTERFACE_MODE_RGMII, but
> is this correct, or should it be:
>
> if (phy_interface_is_rgmii(interface))
>
> since the various RGMII* modes are used to determine the delay on the
> PHY side.
>
> Even so, I don't think that is a matter for this patch, but a future
> (or maybe a preceeding patch) to address.
>
> Other than that, I think it looks okay.
>
> Thanks.
>
> --
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

I also agree with adding one more patch to this which converts to
phy_interface_is_rgmii(). Paweł: there was a recent discussion about
the (ir)relevance of the specific rgmii phy-mode in fixed-link here.
https://lore.kernel.org/netdev/ZNpEaMJjmDqhK1dW@xxxxxxxxxxxxxxxxxxxxx/