RE: [PATCH v2 net-next 2/2] net: phy: c45-tja11xx: add support for outputing RMII reference clock

From: Wei Fang
Date: Tue Oct 08 2024 - 05:43:24 EST


> -----Original Message-----
> From: Russell King <linux@xxxxxxxxxxxxxxx>
> Sent: 2024年10月8日 16:31
> To: Wei Fang <wei.fang@xxxxxxx>
> Cc: davem@xxxxxxxxxxxxx; edumazet@xxxxxxxxxx; kuba@xxxxxxxxxx;
> pabeni@xxxxxxxxxx; robh@xxxxxxxxxx; krzk+dt@xxxxxxxxxx;
> conor+dt@xxxxxxxxxx; andrew@xxxxxxx; f.fainelli@xxxxxxxxx;
> hkallweit1@xxxxxxxxx; Andrei Botila (OSS) <andrei.botila@xxxxxxxxxxx>;
> devicetree@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx;
> netdev@xxxxxxxxxxxxxxx; imx@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH v2 net-next 2/2] net: phy: c45-tja11xx: add support for
> outputing RMII reference clock
>
> On Tue, Oct 08, 2024 at 03:07:08PM +0800, Wei Fang wrote:
> > @@ -1561,8 +1565,13 @@ static int nxp_c45_set_phy_mode(struct
> phy_device *phydev)
> > phydev_err(phydev, "rmii mode not supported\n");
> > return -EINVAL;
> > }
> > - phy_write_mmd(phydev, MDIO_MMD_VEND1,
> VEND1_MII_BASIC_CONFIG,
> > - MII_BASIC_CONFIG_RMII);
> > +
> > + if (priv->flags & TJA11XX_REVERSE_MODE)
> > + phy_write_mmd(phydev, MDIO_MMD_VEND1,
> VEND1_MII_BASIC_CONFIG,
> > + MII_BASIC_CONFIG_RMII |
> MII_BASIC_CONFIG_REV);
> > + else
> > + phy_write_mmd(phydev, MDIO_MMD_VEND1,
> VEND1_MII_BASIC_CONFIG,
> > + MII_BASIC_CONFIG_RMII);
>
> Netdev has an 80 column limit, and this needs commenting because we have
> PHY_INTERFACE_MODE_REVRMII which could be confused with this (although
> I haven't checked.)
>
> u16 basic_config;
> ...
> basic_config = MII_BASIC_CONFIG_RMII;
>
> /* This is not PHY_INTERFACE_MODE_REVRMII */
> if (priv->flags & TJA11XX_REVERSE_MODE)
> basic_config |= MII_BASIC_CONFIG_REV;
>
> phy_write_mmd(phydev, MDIO_MMD_VEND1,
> VEND1_MII_BASIC_CONFIG,
> basic_config);
>
> is much nicer to read.
>

Okay, I will refine the patch, thanks!