diff mbox series

[net-next,v5,3/5] net: phy: Kconfig: Add ptp library support and 1588 optional flag in Microchip phys

Message ID 20241203085248.14575-4-divya.koppera@microchip.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series Add ptp library for Microchip phys | 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: 3 this patch: 3
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 4 this patch: 4
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: 308 this patch: 308
netdev/checkpatch warning WARNING: please write a help paragraph that fully describes the config symbol
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 success net-next-2024-12-04--15-02 (tests: 760)

Commit Message

Divya Koppera Dec. 3, 2024, 8:52 a.m. UTC
Add ptp library support in Kconfig
As some of Microchip T1 phys support ptp, add dependency
of 1588 optional flag in Kconfig

Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Signed-off-by: Divya Koppera <divya.koppera@microchip.com>
---
v4 -> v5
Addressed below review comments.
- Indentation fix
- Changed dependency check to if check for PTP_1588_CLOCK_OPTIONAL

v1 -> v2 -> v3 -> v4
- No changes
---
 drivers/net/phy/Kconfig | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Andrew Lunn Dec. 4, 2024, 1:39 a.m. UTC | #1
On Tue, Dec 03, 2024 at 02:22:46PM +0530, Divya Koppera wrote:
> Add ptp library support in Kconfig
> As some of Microchip T1 phys support ptp, add dependency
> of 1588 optional flag in Kconfig
> 
> Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
> Signed-off-by: Divya Koppera <divya.koppera@microchip.com>
> ---
> v4 -> v5
> Addressed below review comments.
> - Indentation fix
> - Changed dependency check to if check for PTP_1588_CLOCK_OPTIONAL
> 
> v1 -> v2 -> v3 -> v4
> - No changes
> ---
>  drivers/net/phy/Kconfig | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
> index 15828f4710a9..e97d389bb250 100644
> --- a/drivers/net/phy/Kconfig
> +++ b/drivers/net/phy/Kconfig
> @@ -287,8 +287,15 @@ config MICROCHIP_PHY
>  
>  config MICROCHIP_T1_PHY
>  	tristate "Microchip T1 PHYs"
> +	select MICROCHIP_PHYPTP if NETWORK_PHY_TIMESTAMPING && \
> +				  PTP_1588_CLOCK_OPTIONAL
>  	help
> -	  Supports the LAN87XX PHYs.
> +	  Supports the LAN8XXX PHYs.
> +
> +config MICROCHIP_PHYPTP
> +	tristate "Microchip PHY PTP"
> +	help
> +	  Currently supports LAN887X T1 PHY

How many different PTP implementations does Microchip have?

I see mscc_ptp.c, lan743x_ptp.c, lan966x_ptp.c and sparx5_ptp.c. Plus
this one.

Does Microchip keep reinventing the wheel? Or can this library be used
in place of any of these? And how many more ptp implementations will
microchip have in the future? Maybe MICROCHIP_PHYPTP is too generic,
maybe you should leave space for the next PTP implementation?

	Andrew
Divya Koppera Dec. 4, 2024, 3:47 p.m. UTC | #2
Hi Andrew,

> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: Wednesday, December 4, 2024 7:10 AM
> To: Divya Koppera - I30481 <Divya.Koppera@microchip.com>
> Cc: Arun Ramadoss - I17769 <Arun.Ramadoss@microchip.com>;
> UNGLinuxDriver <UNGLinuxDriver@microchip.com>; hkallweit1@gmail.com;
> linux@armlinux.org.uk; davem@davemloft.net; edumazet@google.com;
> kuba@kernel.org; pabeni@redhat.com; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org; richardcochran@gmail.com;
> vadim.fedorenko@linux.dev
> Subject: Re: [PATCH net-next v5 3/5] net: phy: Kconfig: Add ptp library support
> and 1588 optional flag in Microchip phys
> 
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the
> content is safe
> 
> On Tue, Dec 03, 2024 at 02:22:46PM +0530, Divya Koppera wrote:
> > Add ptp library support in Kconfig
> > As some of Microchip T1 phys support ptp, add dependency of 1588
> > optional flag in Kconfig
> >
> > Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
> > Signed-off-by: Divya Koppera <divya.koppera@microchip.com>
> > ---
> > v4 -> v5
> > Addressed below review comments.
> > - Indentation fix
> > - Changed dependency check to if check for PTP_1588_CLOCK_OPTIONAL
> >
> > v1 -> v2 -> v3 -> v4
> > - No changes
> > ---
> >  drivers/net/phy/Kconfig | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index
> > 15828f4710a9..e97d389bb250 100644
> > --- a/drivers/net/phy/Kconfig
> > +++ b/drivers/net/phy/Kconfig
> > @@ -287,8 +287,15 @@ config MICROCHIP_PHY
> >
> >  config MICROCHIP_T1_PHY
> >       tristate "Microchip T1 PHYs"
> > +     select MICROCHIP_PHYPTP if NETWORK_PHY_TIMESTAMPING && \
> > +                               PTP_1588_CLOCK_OPTIONAL
> >       help
> > -       Supports the LAN87XX PHYs.
> > +       Supports the LAN8XXX PHYs.
> > +
> > +config MICROCHIP_PHYPTP
> > +     tristate "Microchip PHY PTP"
> > +     help
> > +       Currently supports LAN887X T1 PHY
> 
> How many different PTP implementations does Microchip have?
> 
> I see mscc_ptp.c, lan743x_ptp.c, lan966x_ptp.c and sparx5_ptp.c. Plus this
> one.
> 

These are MAC specific PTP. The library that we implemented is for PHYs.

> Does Microchip keep reinventing the wheel? Or can this library be used in
> place of any of these? 

As there are no register similarities between these implementations, we cannot use this library for the above mentioned MAC PTPs.

>And how many more ptp implementations will
> microchip have in the future? Maybe MICROCHIP_PHYPTP is too generic,
> maybe you should leave space for the next PTP implementation?
>

Microchip plan is to use this PTP IP in future PHYs. Hence this phy library will be reused in future PHYs.

>         Andrew

Thanks,
Divya
Andrew Lunn Dec. 4, 2024, 4:02 p.m. UTC | #3
> > How many different PTP implementations does Microchip have?
> > 
> > I see mscc_ptp.c, lan743x_ptp.c, lan966x_ptp.c and sparx5_ptp.c. Plus this
> > one.
> > 
> 
> These are MAC specific PTP. The library that we implemented is for PHYs.

And the difference is? Marvell has one PTP implementation they use in
the PHYs and MACs in Ethernet switches. The basic core is the same,
with different wrappers around it.

> > Does Microchip keep reinventing the wheel? Or can this library be used in
> > place of any of these? 
> 

> As there are no register similarities between these implementations,
> we cannot use this library for the above mentioned MAC PTPs.

> 
> >And how many more ptp implementations will
> > microchip have in the future? Maybe MICROCHIP_PHYPTP is too generic,
> > maybe you should leave space for the next PTP implementation?

> Microchip plan is to use this PTP IP in future PHYs. Hence this phy
> library will be reused in future PHYs.

And future MACs? 

And has Microchip finial decided not to keep reinventing the wheel,
and there will never be a new PHY implementation? I ask, because what
would its KCONFIG symbol be?

	Andrew
Russell King (Oracle) Dec. 4, 2024, 4:09 p.m. UTC | #4
On Wed, Dec 04, 2024 at 05:02:46PM +0100, Andrew Lunn wrote:
> > > How many different PTP implementations does Microchip have?
> > > 
> > > I see mscc_ptp.c, lan743x_ptp.c, lan966x_ptp.c and sparx5_ptp.c. Plus this
> > > one.
> > > 
> > 
> > These are MAC specific PTP. The library that we implemented is for PHYs.
> 
> And the difference is? Marvell has one PTP implementation they use in
> the PHYs and MACs in Ethernet switches. The basic core is the same,
> with different wrappers around it.

... and I have code that implements a library for Marvell PTP, which is
dependent on the timestamping stuff getting sorted. I tested it
recently, and at least the user API wasn't working as intended in
mainline kernels.

When we actually get to a point where we can choose between the MAC and
the PHY timestamper, I'll go back to working on that library. Sadly,
that's not yet.
Divya Koppera Dec. 5, 2024, 6:04 a.m. UTC | #5
Hi Andrew,

Thanks for your comments.

> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: Wednesday, December 4, 2024 9:33 PM
> To: Divya Koppera - I30481 <Divya.Koppera@microchip.com>
> Cc: Arun Ramadoss - I17769 <Arun.Ramadoss@microchip.com>;
> UNGLinuxDriver <UNGLinuxDriver@microchip.com>; hkallweit1@gmail.com;
> linux@armlinux.org.uk; davem@davemloft.net; edumazet@google.com;
> kuba@kernel.org; pabeni@redhat.com; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org; richardcochran@gmail.com;
> vadim.fedorenko@linux.dev
> Subject: Re: [PATCH net-next v5 3/5] net: phy: Kconfig: Add ptp library support
> and 1588 optional flag in Microchip phys
> 
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the
> content is safe
> 
> > > How many different PTP implementations does Microchip have?
> > >
> > > I see mscc_ptp.c, lan743x_ptp.c, lan966x_ptp.c and sparx5_ptp.c.
> > > Plus this one.
> > >
> >
> > These are MAC specific PTP. The library that we implemented is for PHYs.
> 
> And the difference is? Marvell has one PTP implementation they use in the
> PHYs and MACs in Ethernet switches. The basic core is the same, with
> different wrappers around it.
> 

MAC and PHY uses different PTP IPs. Also register space is different for different PTP IP implementations.
This Microchip PTP Phy library may not be relevant for other implementations.
As I mentioned earlier all future Microchip Phys will use the same IP hence Microchip PTP library will be reused.

> > > Does Microchip keep reinventing the wheel? Or can this library be
> > > used in place of any of these?
> >
> 
> > As there are no register similarities between these implementations,
> > we cannot use this library for the above mentioned MAC PTPs.
> 
> >
> > >And how many more ptp implementations will  microchip have in the
> > >future? Maybe MICROCHIP_PHYPTP is too generic,  maybe you should
> > >leave space for the next PTP implementation?
> 
> > Microchip plan is to use this PTP IP in future PHYs. Hence this phy
> > library will be reused in future PHYs.
> 
> And future MACs?

Future MACs may use different PTP IP.

> 
> And has Microchip finial decided not to keep reinventing the wheel, and there
> will never be a new PHY implementation? I ask, because what would its
> KCONFIG symbol be?
> 

For all future Microchip PHYs PTP IP will be same, hence the implementation and kconfig symbol is under MICROCHIP_PHYPTP to keep it more generic.

>         Andrew

Thanks,
Divya
Andrew Lunn Dec. 5, 2024, 2:35 p.m. UTC | #6
> > And has Microchip finial decided not to keep reinventing the wheel, and there
> > will never be a new PHY implementation? I ask, because what would its
> > KCONFIG symbol be?
> > 
> 

> For all future Microchip PHYs PTP IP will be same, hence the
> implementation and kconfig symbol is under MICROCHIP_PHYPTP to keep
> it more generic.

So you would be happy for me to NACK all new PHY PTP implementations?

Are you management happy with this statement?

Even if they are, i still think you need a less generic KCONFIG
symbol, i doubt somebody somewhere in Microchip can resist making yet
another PTP implementation.

	Andrew
Divya Koppera Dec. 6, 2024, 11:30 a.m. UTC | #7
Hi Andrew,

Thanks for your comments.

> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: Thursday, December 5, 2024 8:06 PM
> To: Divya Koppera - I30481 <Divya.Koppera@microchip.com>
> Cc: Arun Ramadoss - I17769 <Arun.Ramadoss@microchip.com>;
> UNGLinuxDriver <UNGLinuxDriver@microchip.com>; hkallweit1@gmail.com;
> linux@armlinux.org.uk; davem@davemloft.net; edumazet@google.com;
> kuba@kernel.org; pabeni@redhat.com; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org; richardcochran@gmail.com;
> vadim.fedorenko@linux.dev
> Subject: Re: [PATCH net-next v5 3/5] net: phy: Kconfig: Add ptp library support
> and 1588 optional flag in Microchip phys
> 
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the
> content is safe
> 
> > > And has Microchip finial decided not to keep reinventing the wheel,
> > > and there will never be a new PHY implementation? I ask, because
> > > what would its KCONFIG symbol be?
> > >
> >
> 
> > For all future Microchip PHYs PTP IP will be same, hence the
> > implementation and kconfig symbol is under MICROCHIP_PHYPTP to keep it
> > more generic.
> 
> So you would be happy for me to NACK all new PHY PTP implementations?
> 
> Are you management happy with this statement?
> 
> Even if they are, i still think you need a less generic KCONFIG symbol, i doubt
> somebody somewhere in Microchip can resist making yet another PTP
> implementation.
> 

I understand your point.

I will change the Kconfig symbol to "MICROCHIP_PHY_RDS_PTP". RDS is internal code name to identify the PHY PTP IP. 

I will also change the file names, macros, and functions to reflect the internal code name as per macro.

>         Andrew

Thanks,
Divya
diff mbox series

Patch

diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 15828f4710a9..e97d389bb250 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -287,8 +287,15 @@  config MICROCHIP_PHY
 
 config MICROCHIP_T1_PHY
 	tristate "Microchip T1 PHYs"
+	select MICROCHIP_PHYPTP if NETWORK_PHY_TIMESTAMPING && \
+				  PTP_1588_CLOCK_OPTIONAL
 	help
-	  Supports the LAN87XX PHYs.
+	  Supports the LAN8XXX PHYs.
+
+config MICROCHIP_PHYPTP
+	tristate "Microchip PHY PTP"
+	help
+	  Currently supports LAN887X T1 PHY
 
 config MICROSEMI_PHY
 	tristate "Microsemi PHYs"