diff mbox series

[v2,net-next,2/3] net: phy: tja11xx: replace "nxp,rmii-refclk-in" with "nxp,phy-output-refclk"

Message ID 20240822013721.203161-3-wei.fang@nxp.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series add "nxp,phy-output-refclk" to instead of "nxp,rmii-refclk-in" | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 16 this patch: 16
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 16 this patch: 16
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 16 this patch: 16
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 32 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest fail net-next-2024-08-22--06-00 (tests: 712)

Commit Message

Wei Fang Aug. 22, 2024, 1:37 a.m. UTC
As the new property "nxp,phy-output-refclk" is added to instead of
the "nxp,rmii-refclk-in" property, so replace the "nxp,rmii-refclk-in"
property used in the driver with the "nxp,reverse-mode" property and
make slight modifications.

Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
V2 changes:
1. Changed the property name.
---
 drivers/net/phy/nxp-tja11xx.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Comments

Conor Dooley Aug. 22, 2024, 8:47 a.m. UTC | #1
On Thu, Aug 22, 2024 at 09:37:20AM +0800, Wei Fang wrote:
> As the new property "nxp,phy-output-refclk" is added to instead of
> the "nxp,rmii-refclk-in" property, so replace the "nxp,rmii-refclk-in"
> property used in the driver with the "nxp,reverse-mode" property and
> make slight modifications.

Can you explain what makes this backwards compatible please?

> 
> Signed-off-by: Wei Fang <wei.fang@nxp.com>
> ---
> V2 changes:
> 1. Changed the property name.
> ---
>  drivers/net/phy/nxp-tja11xx.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/phy/nxp-tja11xx.c b/drivers/net/phy/nxp-tja11xx.c
> index 2c263ae44b4f..7aa0599c38c3 100644
> --- a/drivers/net/phy/nxp-tja11xx.c
> +++ b/drivers/net/phy/nxp-tja11xx.c
> @@ -78,8 +78,7 @@
>  #define MII_COMMCFG			27
>  #define MII_COMMCFG_AUTO_OP		BIT(15)
>  
> -/* Configure REF_CLK as input in RMII mode */
> -#define TJA110X_RMII_MODE_REFCLK_IN       BIT(0)
> +#define TJA11XX_REVERSE_MODE		BIT(0)
>  
>  struct tja11xx_priv {
>  	char		*hwmon_name;
> @@ -274,10 +273,10 @@ static int tja11xx_get_interface_mode(struct phy_device *phydev)
>  		mii_mode = MII_CFG1_REVMII_MODE;
>  		break;
>  	case PHY_INTERFACE_MODE_RMII:
> -		if (priv->flags & TJA110X_RMII_MODE_REFCLK_IN)
> -			mii_mode = MII_CFG1_RMII_MODE_REFCLK_IN;
> -		else
> +		if (priv->flags & TJA11XX_REVERSE_MODE)
>  			mii_mode = MII_CFG1_RMII_MODE_REFCLK_OUT;
> +		else
> +			mii_mode = MII_CFG1_RMII_MODE_REFCLK_IN;
>  		break;
>  	default:
>  		return -EINVAL;
> @@ -517,8 +516,8 @@ static int tja11xx_parse_dt(struct phy_device *phydev)
>  	if (!IS_ENABLED(CONFIG_OF_MDIO))
>  		return 0;
>  
> -	if (of_property_read_bool(node, "nxp,rmii-refclk-in"))
> -		priv->flags |= TJA110X_RMII_MODE_REFCLK_IN;
> +	if (of_property_read_bool(node, "nxp,phy-output-refclk"))
> +		priv->flags |= TJA11XX_REVERSE_MODE;
>  
>  	return 0;
>  }
> -- 
> 2.34.1
>
Wei Fang Aug. 22, 2024, 9:37 a.m. UTC | #2
> -----Original Message-----
> From: Conor Dooley <conor@kernel.org>
> Sent: 2024年8月22日 16:47
> To: Wei Fang <wei.fang@nxp.com>
> Cc: davem@davemloft.net; edumazet@google.com; kuba@kernel.org;
> pabeni@redhat.com; robh@kernel.org; krzk+dt@kernel.org;
> conor+dt@kernel.org; andrew@lunn.ch; f.fainelli@gmail.com;
> hkallweit1@gmail.com; linux@armlinux.org.uk; Andrei Botila (OSS)
> <andrei.botila@oss.nxp.com>; netdev@vger.kernel.org;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v2 net-next 2/3] net: phy: tja11xx: replace
> "nxp,rmii-refclk-in" with "nxp,phy-output-refclk"
> 
> On Thu, Aug 22, 2024 at 09:37:20AM +0800, Wei Fang wrote:
> > As the new property "nxp,phy-output-refclk" is added to instead of the
> > "nxp,rmii-refclk-in" property, so replace the "nxp,rmii-refclk-in"
> > property used in the driver with the "nxp,reverse-mode" property and
> > make slight modifications.
> 
> Can you explain what makes this backwards compatible please?
> 
It does not backward compatible, the related PHY nodes in DTS also
need to be updated. I have not seen "nxp,rmii-refclk-in" used in the
upstream. For nodes that do not use " nxp,rmii-refclk-in", they need
to be updated, but unfortunately I cannot confirm which DTS use
TJA11XX PHY, and there may be no relevant nodes in upstream DTS.

> >
> > Signed-off-by: Wei Fang <wei.fang@nxp.com>
> > ---
> > V2 changes:
> > 1. Changed the property name.
> > ---
> >  drivers/net/phy/nxp-tja11xx.c | 13 ++++++-------
> >  1 file changed, 6 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/net/phy/nxp-tja11xx.c
> > b/drivers/net/phy/nxp-tja11xx.c index 2c263ae44b4f..7aa0599c38c3
> > 100644
> > --- a/drivers/net/phy/nxp-tja11xx.c
> > +++ b/drivers/net/phy/nxp-tja11xx.c
> > @@ -78,8 +78,7 @@
> >  #define MII_COMMCFG			27
> >  #define MII_COMMCFG_AUTO_OP		BIT(15)
> >
> > -/* Configure REF_CLK as input in RMII mode */
> > -#define TJA110X_RMII_MODE_REFCLK_IN       BIT(0)
> > +#define TJA11XX_REVERSE_MODE		BIT(0)
> >
> >  struct tja11xx_priv {
> >  	char		*hwmon_name;
> > @@ -274,10 +273,10 @@ static int tja11xx_get_interface_mode(struct
> phy_device *phydev)
> >  		mii_mode = MII_CFG1_REVMII_MODE;
> >  		break;
> >  	case PHY_INTERFACE_MODE_RMII:
> > -		if (priv->flags & TJA110X_RMII_MODE_REFCLK_IN)
> > -			mii_mode = MII_CFG1_RMII_MODE_REFCLK_IN;
> > -		else
> > +		if (priv->flags & TJA11XX_REVERSE_MODE)
> >  			mii_mode = MII_CFG1_RMII_MODE_REFCLK_OUT;
> > +		else
> > +			mii_mode = MII_CFG1_RMII_MODE_REFCLK_IN;
> >  		break;
> >  	default:
> >  		return -EINVAL;
> > @@ -517,8 +516,8 @@ static int tja11xx_parse_dt(struct phy_device
> *phydev)
> >  	if (!IS_ENABLED(CONFIG_OF_MDIO))
> >  		return 0;
> >
> > -	if (of_property_read_bool(node, "nxp,rmii-refclk-in"))
> > -		priv->flags |= TJA110X_RMII_MODE_REFCLK_IN;
> > +	if (of_property_read_bool(node, "nxp,phy-output-refclk"))
> > +		priv->flags |= TJA11XX_REVERSE_MODE;
> >
> >  	return 0;
> >  }
> > --
> > 2.34.1
> >
Conor Dooley Aug. 22, 2024, 4:14 p.m. UTC | #3
On Thu, Aug 22, 2024 at 09:37:11AM +0000, Wei Fang wrote:
> > -----Original Message-----
> > From: Conor Dooley <conor@kernel.org>
> > Sent: 2024年8月22日 16:47
> > To: Wei Fang <wei.fang@nxp.com>
> > Cc: davem@davemloft.net; edumazet@google.com; kuba@kernel.org;
> > pabeni@redhat.com; robh@kernel.org; krzk+dt@kernel.org;
> > conor+dt@kernel.org; andrew@lunn.ch; f.fainelli@gmail.com;
> > hkallweit1@gmail.com; linux@armlinux.org.uk; Andrei Botila (OSS)
> > <andrei.botila@oss.nxp.com>; netdev@vger.kernel.org;
> > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org
> > Subject: Re: [PATCH v2 net-next 2/3] net: phy: tja11xx: replace
> > "nxp,rmii-refclk-in" with "nxp,phy-output-refclk"
> > 
> > On Thu, Aug 22, 2024 at 09:37:20AM +0800, Wei Fang wrote:
> > > As the new property "nxp,phy-output-refclk" is added to instead of the
> > > "nxp,rmii-refclk-in" property, so replace the "nxp,rmii-refclk-in"
> > > property used in the driver with the "nxp,reverse-mode" property and
> > > make slight modifications.
> > 
> > Can you explain what makes this backwards compatible please?
> > 
> It does not backward compatible, the related PHY nodes in DTS also
> need to be updated. I have not seen "nxp,rmii-refclk-in" used in the
> upstream.

Since you have switched the polarity, devicestrees that contain
"nxp,rmii-refclk-in" would actually not need an update to preserve
functionality. However...

> For nodes that do not use " nxp,rmii-refclk-in", they need
> to be updated, but unfortunately I cannot confirm which DTS use
> TJA11XX PHY, and there may be no relevant nodes in upstream DTS.

...as you say here, all tja11xx phy nodes that do not have the property
would need to be updated to retain functionality. Given you can't even
determine which devicetrees would need to be updated, I'm going to have
to NAK this change as an unnecessary ABI break.

Thanks,
Conor.

> 
> > >
> > > Signed-off-by: Wei Fang <wei.fang@nxp.com>
> > > ---
> > > V2 changes:
> > > 1. Changed the property name.
> > > ---
> > >  drivers/net/phy/nxp-tja11xx.c | 13 ++++++-------
> > >  1 file changed, 6 insertions(+), 7 deletions(-)
> > >
> > > diff --git a/drivers/net/phy/nxp-tja11xx.c
> > > b/drivers/net/phy/nxp-tja11xx.c index 2c263ae44b4f..7aa0599c38c3
> > > 100644
> > > --- a/drivers/net/phy/nxp-tja11xx.c
> > > +++ b/drivers/net/phy/nxp-tja11xx.c
> > > @@ -78,8 +78,7 @@
> > >  #define MII_COMMCFG			27
> > >  #define MII_COMMCFG_AUTO_OP		BIT(15)
> > >
> > > -/* Configure REF_CLK as input in RMII mode */
> > > -#define TJA110X_RMII_MODE_REFCLK_IN       BIT(0)
> > > +#define TJA11XX_REVERSE_MODE		BIT(0)
> > >
> > >  struct tja11xx_priv {
> > >  	char		*hwmon_name;
> > > @@ -274,10 +273,10 @@ static int tja11xx_get_interface_mode(struct
> > phy_device *phydev)
> > >  		mii_mode = MII_CFG1_REVMII_MODE;
> > >  		break;
> > >  	case PHY_INTERFACE_MODE_RMII:
> > > -		if (priv->flags & TJA110X_RMII_MODE_REFCLK_IN)
> > > -			mii_mode = MII_CFG1_RMII_MODE_REFCLK_IN;
> > > -		else
> > > +		if (priv->flags & TJA11XX_REVERSE_MODE)
> > >  			mii_mode = MII_CFG1_RMII_MODE_REFCLK_OUT;
> > > +		else
> > > +			mii_mode = MII_CFG1_RMII_MODE_REFCLK_IN;
> > >  		break;
> > >  	default:
> > >  		return -EINVAL;
> > > @@ -517,8 +516,8 @@ static int tja11xx_parse_dt(struct phy_device
> > *phydev)
> > >  	if (!IS_ENABLED(CONFIG_OF_MDIO))
> > >  		return 0;
> > >
> > > -	if (of_property_read_bool(node, "nxp,rmii-refclk-in"))
> > > -		priv->flags |= TJA110X_RMII_MODE_REFCLK_IN;
> > > +	if (of_property_read_bool(node, "nxp,phy-output-refclk"))
> > > +		priv->flags |= TJA11XX_REVERSE_MODE;
> > >
> > >  	return 0;
> > >  }
> > > --
> > > 2.34.1
> > >
Wei Fang Aug. 23, 2024, 1:31 a.m. UTC | #4
> -----Original Message-----
> From: Conor Dooley <conor@kernel.org>
> Sent: 2024年8月23日 0:14
> To: Wei Fang <wei.fang@nxp.com>
> Cc: davem@davemloft.net; edumazet@google.com; kuba@kernel.org;
> pabeni@redhat.com; robh@kernel.org; krzk+dt@kernel.org;
> conor+dt@kernel.org; andrew@lunn.ch; f.fainelli@gmail.com;
> hkallweit1@gmail.com; linux@armlinux.org.uk; Andrei Botila (OSS)
> <andrei.botila@oss.nxp.com>; netdev@vger.kernel.org;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v2 net-next 2/3] net: phy: tja11xx: replace
> "nxp,rmii-refclk-in" with "nxp,phy-output-refclk"
> 
> On Thu, Aug 22, 2024 at 09:37:11AM +0000, Wei Fang wrote:
> > > -----Original Message-----
> > > From: Conor Dooley <conor@kernel.org>
> > > Sent: 2024年8月22日 16:47
> > > To: Wei Fang <wei.fang@nxp.com>
> > > Cc: davem@davemloft.net; edumazet@google.com; kuba@kernel.org;
> > > pabeni@redhat.com; robh@kernel.org; krzk+dt@kernel.org;
> > > conor+dt@kernel.org; andrew@lunn.ch; f.fainelli@gmail.com;
> > > hkallweit1@gmail.com; linux@armlinux.org.uk; Andrei Botila (OSS)
> > > <andrei.botila@oss.nxp.com>; netdev@vger.kernel.org;
> > > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org
> > > Subject: Re: [PATCH v2 net-next 2/3] net: phy: tja11xx: replace
> > > "nxp,rmii-refclk-in" with "nxp,phy-output-refclk"
> > >
> > > On Thu, Aug 22, 2024 at 09:37:20AM +0800, Wei Fang wrote:
> > > > As the new property "nxp,phy-output-refclk" is added to instead of
> > > > the "nxp,rmii-refclk-in" property, so replace the "nxp,rmii-refclk-in"
> > > > property used in the driver with the "nxp,reverse-mode" property
> > > > and make slight modifications.
> > >
> > > Can you explain what makes this backwards compatible please?
> > >
> > It does not backward compatible, the related PHY nodes in DTS also
> > need to be updated. I have not seen "nxp,rmii-refclk-in" used in the
> > upstream.
> 
> Since you have switched the polarity, devicestrees that contain
> "nxp,rmii-refclk-in" would actually not need an update to preserve
> functionality. However...
> 
> > For nodes that do not use " nxp,rmii-refclk-in", they need to be
> > updated, but unfortunately I cannot confirm which DTS use TJA11XX PHY,
> > and there may be no relevant nodes in upstream DTS.
> 
> ...as you say here, all tja11xx phy nodes that do not have the property would
> need to be updated to retain functionality. Given you can't even determine
> which devicetrees would need to be updated, I'm going to have to NAK this
> change as an unnecessary ABI break.
> 

Okay, that make sense, "nxp,rmii-refclk-in" was added only for TJA1100 and
TJA1101, although it does not seem to be a suitable property now, it cannot
be changed at present. :(
Since TJA1103/TJA1104/TJA1120/TJA1121 use different driver than TJA1100
and TJA1101, which is nxp-c4-tja11xx. I think it's fine to add " nxp,phy-output-refclk "
for these PHYs, so I will remove this patch from the patch set.
Conor Dooley Aug. 23, 2024, 3:56 p.m. UTC | #5
On Fri, Aug 23, 2024 at 01:31:02AM +0000, Wei Fang wrote:
> > -----Original Message-----
> > From: Conor Dooley <conor@kernel.org>
> > Sent: 2024年8月23日 0:14
> > To: Wei Fang <wei.fang@nxp.com>
> > Cc: davem@davemloft.net; edumazet@google.com; kuba@kernel.org;
> > pabeni@redhat.com; robh@kernel.org; krzk+dt@kernel.org;
> > conor+dt@kernel.org; andrew@lunn.ch; f.fainelli@gmail.com;
> > hkallweit1@gmail.com; linux@armlinux.org.uk; Andrei Botila (OSS)
> > <andrei.botila@oss.nxp.com>; netdev@vger.kernel.org;
> > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org
> > Subject: Re: [PATCH v2 net-next 2/3] net: phy: tja11xx: replace
> > "nxp,rmii-refclk-in" with "nxp,phy-output-refclk"
> > 
> > On Thu, Aug 22, 2024 at 09:37:11AM +0000, Wei Fang wrote:
> > > > -----Original Message-----
> > > > From: Conor Dooley <conor@kernel.org>
> > > > Sent: 2024年8月22日 16:47
> > > > To: Wei Fang <wei.fang@nxp.com>
> > > > Cc: davem@davemloft.net; edumazet@google.com; kuba@kernel.org;
> > > > pabeni@redhat.com; robh@kernel.org; krzk+dt@kernel.org;
> > > > conor+dt@kernel.org; andrew@lunn.ch; f.fainelli@gmail.com;
> > > > hkallweit1@gmail.com; linux@armlinux.org.uk; Andrei Botila (OSS)
> > > > <andrei.botila@oss.nxp.com>; netdev@vger.kernel.org;
> > > > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org
> > > > Subject: Re: [PATCH v2 net-next 2/3] net: phy: tja11xx: replace
> > > > "nxp,rmii-refclk-in" with "nxp,phy-output-refclk"
> > > >
> > > > On Thu, Aug 22, 2024 at 09:37:20AM +0800, Wei Fang wrote:
> > > > > As the new property "nxp,phy-output-refclk" is added to instead of
> > > > > the "nxp,rmii-refclk-in" property, so replace the "nxp,rmii-refclk-in"
> > > > > property used in the driver with the "nxp,reverse-mode" property
> > > > > and make slight modifications.
> > > >
> > > > Can you explain what makes this backwards compatible please?
> > > >
> > > It does not backward compatible, the related PHY nodes in DTS also
> > > need to be updated. I have not seen "nxp,rmii-refclk-in" used in the
> > > upstream.
> > 
> > Since you have switched the polarity, devicestrees that contain
> > "nxp,rmii-refclk-in" would actually not need an update to preserve
> > functionality. However...
> > 
> > > For nodes that do not use " nxp,rmii-refclk-in", they need to be
> > > updated, but unfortunately I cannot confirm which DTS use TJA11XX PHY,
> > > and there may be no relevant nodes in upstream DTS.
> > 
> > ...as you say here, all tja11xx phy nodes that do not have the property would
> > need to be updated to retain functionality. Given you can't even determine
> > which devicetrees would need to be updated, I'm going to have to NAK this
> > change as an unnecessary ABI break.
> > 
> 
> Okay, that make sense, "nxp,rmii-refclk-in" was added only for TJA1100 and
> TJA1101, although it does not seem to be a suitable property now, it cannot
> be changed at present. :(
> Since TJA1103/TJA1104/TJA1120/TJA1121 use different driver than TJA1100
> and TJA1101, which is nxp-c4-tja11xx. I think it's fine to add " nxp,phy-output-refclk "
> for these PHYs, so I will remove this patch from the patch set.

If they use a different binding, then yeah, you can add use the new
name/polarity for those devices.
diff mbox series

Patch

diff --git a/drivers/net/phy/nxp-tja11xx.c b/drivers/net/phy/nxp-tja11xx.c
index 2c263ae44b4f..7aa0599c38c3 100644
--- a/drivers/net/phy/nxp-tja11xx.c
+++ b/drivers/net/phy/nxp-tja11xx.c
@@ -78,8 +78,7 @@ 
 #define MII_COMMCFG			27
 #define MII_COMMCFG_AUTO_OP		BIT(15)
 
-/* Configure REF_CLK as input in RMII mode */
-#define TJA110X_RMII_MODE_REFCLK_IN       BIT(0)
+#define TJA11XX_REVERSE_MODE		BIT(0)
 
 struct tja11xx_priv {
 	char		*hwmon_name;
@@ -274,10 +273,10 @@  static int tja11xx_get_interface_mode(struct phy_device *phydev)
 		mii_mode = MII_CFG1_REVMII_MODE;
 		break;
 	case PHY_INTERFACE_MODE_RMII:
-		if (priv->flags & TJA110X_RMII_MODE_REFCLK_IN)
-			mii_mode = MII_CFG1_RMII_MODE_REFCLK_IN;
-		else
+		if (priv->flags & TJA11XX_REVERSE_MODE)
 			mii_mode = MII_CFG1_RMII_MODE_REFCLK_OUT;
+		else
+			mii_mode = MII_CFG1_RMII_MODE_REFCLK_IN;
 		break;
 	default:
 		return -EINVAL;
@@ -517,8 +516,8 @@  static int tja11xx_parse_dt(struct phy_device *phydev)
 	if (!IS_ENABLED(CONFIG_OF_MDIO))
 		return 0;
 
-	if (of_property_read_bool(node, "nxp,rmii-refclk-in"))
-		priv->flags |= TJA110X_RMII_MODE_REFCLK_IN;
+	if (of_property_read_bool(node, "nxp,phy-output-refclk"))
+		priv->flags |= TJA11XX_REVERSE_MODE;
 
 	return 0;
 }