diff mbox series

[1/1] net: phy: meson-gxl: Add generic dummy stubs for MMD register access

Message ID 20230129022615.379711-1-cphealy@gmail.com (mailing list archive)
State Superseded
Headers show
Series [1/1] net: phy: meson-gxl: Add generic dummy stubs for MMD register access | expand

Commit Message

Chris Healy Jan. 29, 2023, 2:26 a.m. UTC
From: Chris Healy <healych@amazon.com>

The Meson G12A Internal PHY does not support standard IEEE MMD extended
register access, therefore add generic dummy stubs to fail the read and
write MMD calls. This is necessary to prevent the core PHY code from
erroneously believing that EEE is supported by this PHY even though this
PHY does not support EEE, as MMD register access returns all FFFFs.

Signed-off-by: Chris Healy <healych@amazon.com>
---
 drivers/net/phy/meson-gxl.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Heiner Kallweit Jan. 29, 2023, 10:26 a.m. UTC | #1
On 29.01.2023 03:26, Chris Healy wrote:
> From: Chris Healy <healych@amazon.com>
> 
Hi Chris,

> The Meson G12A Internal PHY does not support standard IEEE MMD extended
> register access, therefore add generic dummy stubs to fail the read and
> write MMD calls. This is necessary to prevent the core PHY code from
> erroneously believing that EEE is supported by this PHY even though this
> PHY does not support EEE, as MMD register access returns all FFFFs.
> 
> Signed-off-by: Chris Healy <healych@amazon.com>
> ---
>  drivers/net/phy/meson-gxl.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/phy/meson-gxl.c b/drivers/net/phy/meson-gxl.c
> index c49062ad72c6..5e41658b1e2f 100644
> --- a/drivers/net/phy/meson-gxl.c
> +++ b/drivers/net/phy/meson-gxl.c
> @@ -271,6 +271,8 @@ static struct phy_driver meson_gxl_phy[] = {
>  		.handle_interrupt = meson_gxl_handle_interrupt,
>  		.suspend        = genphy_suspend,
>  		.resume         = genphy_resume,
> +		.read_mmd	= genphy_read_mmd_unsupported,
> +		.write_mmd	= genphy_write_mmd_unsupported,
>  	},
>  };
>  

thanks for catching this. The same issue we may have for the GXL-internal PHY.
Did you check this?

One result of the issue is the invalid ethtool --show-eee output given below.
Therefore the patch should go to stable, please annotate it as [PATCH net].

Fixes tag should be:
5c3407abb338 ("net: phy: meson-gxl: add g12a support")


EEE settings for eth0:
        EEE status: enabled - active
        Tx LPI: 1000000 (us)
        Supported EEE link modes:  100baseT/Full
                                   1000baseT/Full
                                   10000baseT/Full
                                   1000baseKX/Full
                                   10000baseKX4/Full
                                   10000baseKR/Full
        Advertised EEE link modes:  100baseT/Full
                                    1000baseT/Full
                                    10000baseT/Full
                                    1000baseKX/Full
                                    10000baseKX4/Full
                                    10000baseKR/Full
        Link partner advertised EEE link modes:  100baseT/Full
                                                 1000baseT/Full
                                                 10000baseT/Full
                                                 1000baseKX/Full
                                                 10000baseKX4/Full
                                                 10000baseKR/Full
Andrew Lunn Jan. 29, 2023, 4:51 p.m. UTC | #2
On Sat, Jan 28, 2023 at 06:26:15PM -0800, Chris Healy wrote:
> From: Chris Healy <healych@amazon.com>
> 
> The Meson G12A Internal PHY does not support standard IEEE MMD extended
> register access, therefore add generic dummy stubs to fail the read and
> write MMD calls. This is necessary to prevent the core PHY code from
> erroneously believing that EEE is supported by this PHY even though this
> PHY does not support EEE, as MMD register access returns all FFFFs.

Hi Chris

This change in itself makes sense. But i wounder if we should also
change phy_init_eee(). It reads the EEE Ability register. The 2018
version of the standard indicates the top two bits are reserved and
should be zero. We also don't have any PHY which supports 100GBase-R
through to 100Base-TX. So a read of 0xffff suggests the PHY does not
support EEE and returning -EPROTONOSUPPORT would be good.

	Andrew
Chris Healy Jan. 29, 2023, 9:25 p.m. UTC | #3
On Sun, Jan 29, 2023 at 2:26 AM Heiner Kallweit <hkallweit1@gmail.com> wrote:
>
> On 29.01.2023 03:26, Chris Healy wrote:
> > From: Chris Healy <healych@amazon.com>
> >
> Hi Chris,
>
> > The Meson G12A Internal PHY does not support standard IEEE MMD extended
> > register access, therefore add generic dummy stubs to fail the read and
> > write MMD calls. This is necessary to prevent the core PHY code from
> > erroneously believing that EEE is supported by this PHY even though this
> > PHY does not support EEE, as MMD register access returns all FFFFs.
> >
> > Signed-off-by: Chris Healy <healych@amazon.com>
> > ---
> >  drivers/net/phy/meson-gxl.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/net/phy/meson-gxl.c b/drivers/net/phy/meson-gxl.c
> > index c49062ad72c6..5e41658b1e2f 100644
> > --- a/drivers/net/phy/meson-gxl.c
> > +++ b/drivers/net/phy/meson-gxl.c
> > @@ -271,6 +271,8 @@ static struct phy_driver meson_gxl_phy[] = {
> >               .handle_interrupt = meson_gxl_handle_interrupt,
> >               .suspend        = genphy_suspend,
> >               .resume         = genphy_resume,
> > +             .read_mmd       = genphy_read_mmd_unsupported,
> > +             .write_mmd      = genphy_write_mmd_unsupported,
> >       },
> >  };
> >
>
> thanks for catching this. The same issue we may have for the GXL-internal PHY.
> Did you check this?

I do not have HW with GXL-internal PHY so I cannot test it and don't
feel comfortable making the change for that PHY ID without someone
providing the necessary feedback.  If someone can confirm the same all
FFFFs with the MMD registers, I'd be happy to add the read/write MMD
callbacks for that PHY in v2.

>
> One result of the issue is the invalid ethtool --show-eee output given below.
> Therefore the patch should go to stable, please annotate it as [PATCH net].
>
> Fixes tag should be:
> 5c3407abb338 ("net: phy: meson-gxl: add g12a support")

Yep, looking at the ethtool --show-eee output is what got me looking
at this in the first place.  I was hoping to enable EEE... ;-)

I'll add the fixes tag in v2.

>
>
> EEE settings for eth0:
>         EEE status: enabled - active
>         Tx LPI: 1000000 (us)
>         Supported EEE link modes:  100baseT/Full
>                                    1000baseT/Full
>                                    10000baseT/Full
>                                    1000baseKX/Full
>                                    10000baseKX4/Full
>                                    10000baseKR/Full
>         Advertised EEE link modes:  100baseT/Full
>                                     1000baseT/Full
>                                     10000baseT/Full
>                                     1000baseKX/Full
>                                     10000baseKX4/Full
>                                     10000baseKR/Full
>         Link partner advertised EEE link modes:  100baseT/Full
>                                                  1000baseT/Full
>                                                  10000baseT/Full
>                                                  1000baseKX/Full
>                                                  10000baseKX4/Full
>                                                  10000baseKR/Full
>
Chris Healy Jan. 29, 2023, 9:28 p.m. UTC | #4
On Sun, Jan 29, 2023 at 8:52 AM Andrew Lunn <andrew@lunn.ch> wrote:
>
> On Sat, Jan 28, 2023 at 06:26:15PM -0800, Chris Healy wrote:
> > From: Chris Healy <healych@amazon.com>
> >
> > The Meson G12A Internal PHY does not support standard IEEE MMD extended
> > register access, therefore add generic dummy stubs to fail the read and
> > write MMD calls. This is necessary to prevent the core PHY code from
> > erroneously believing that EEE is supported by this PHY even though this
> > PHY does not support EEE, as MMD register access returns all FFFFs.
>
> Hi Chris
>
> This change in itself makes sense. But i wounder if we should also
> change phy_init_eee(). It reads the EEE Ability register. The 2018
> version of the standard indicates the top two bits are reserved and
> should be zero. We also don't have any PHY which supports 100GBase-R
> through to 100Base-TX. So a read of 0xffff suggests the PHY does not
> support EEE and returning -EPROTONOSUPPORT would be good.
>
This seems like a good change to make in phy_init_eee().  I should be
able to do this.  Can this be done in a subsequent patch or does this
need to be present to land this meson specific PHY patch?

>         Andrew
Andrew Lunn Jan. 29, 2023, 9:53 p.m. UTC | #5
> > Hi Chris
> >
> > This change in itself makes sense. But i wounder if we should also
> > change phy_init_eee(). It reads the EEE Ability register. The 2018
> > version of the standard indicates the top two bits are reserved and
> > should be zero. We also don't have any PHY which supports 100GBase-R
> > through to 100Base-TX. So a read of 0xffff suggests the PHY does not
> > support EEE and returning -EPROTONOSUPPORT would be good.
> >
> This seems like a good change to make in phy_init_eee().  I should be
> able to do this.  Can this be done in a subsequent patch or does this
> need to be present to land this meson specific PHY patch?

They are independent, submit them in whatever order you want. But
doing it first will make it easier to test it actually works.

      Andrew
diff mbox series

Patch

diff --git a/drivers/net/phy/meson-gxl.c b/drivers/net/phy/meson-gxl.c
index c49062ad72c6..5e41658b1e2f 100644
--- a/drivers/net/phy/meson-gxl.c
+++ b/drivers/net/phy/meson-gxl.c
@@ -271,6 +271,8 @@  static struct phy_driver meson_gxl_phy[] = {
 		.handle_interrupt = meson_gxl_handle_interrupt,
 		.suspend        = genphy_suspend,
 		.resume         = genphy_resume,
+		.read_mmd	= genphy_read_mmd_unsupported,
+		.write_mmd	= genphy_write_mmd_unsupported,
 	},
 };