2023-08-04 03:42:01

by Da Xue

[permalink] [raw]
Subject: [PATCH] net: phy: meson-gxl: implement meson_gxl_phy_resume()

After suspend and resume, the meson GXL internal PHY config needs to
be initialized again or the carrier cannot be found.

Signed-off-by: Luke Lu <[email protected]>
Reviewed-by: Da Xue <[email protected]>

---
drivers/net/phy/meson-gxl.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/meson-gxl.c b/drivers/net/phy/meson-gxl.c
index bb9b33b6b..c4a07e6f7 100644
--- a/drivers/net/phy/meson-gxl.c
+++ b/drivers/net/phy/meson-gxl.c
@@ -132,6 +132,18 @@ static int meson_gxl_config_init(struct phy_device *phydev)
return 0;
}

+static int meson_gxl_phy_resume(struct phy_device *phydev)
+{
+ int ret;
+
+ phy_clear_bits(phydev, MII_BMCR, BMCR_PDOWN);
+ ret = meson_gxl_config_init(phydev);
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
/* This function is provided to cope with the possible failures of this phy
* during aneg process. When aneg fails, the PHY reports that aneg is done
* but the value found in MII_LPA is wrong:
@@ -196,7 +208,7 @@ static struct phy_driver meson_gxl_phy[] = {
.config_intr = smsc_phy_config_intr,
.handle_interrupt = smsc_phy_handle_interrupt,
.suspend = genphy_suspend,
- .resume = genphy_resume,
+ .resume = meson_gxl_phy_resume,
.read_mmd = genphy_read_mmd_unsupported,
.write_mmd = genphy_write_mmd_unsupported,
}, {
--
2.39.2


2023-08-04 09:16:16

by Neil Armstrong

[permalink] [raw]
Subject: Re: [PATCH] net: phy: meson-gxl: implement meson_gxl_phy_resume()

Hi Da,

On 04/08/2023 05:07, Da Xue wrote:
> After suspend and resume, the meson GXL internal PHY config needs to
> be initialized again or the carrier cannot be found.
>
> Signed-off-by: Luke Lu <[email protected]>
> Reviewed-by: Da Xue <[email protected]>
>
> ---
> drivers/net/phy/meson-gxl.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/phy/meson-gxl.c b/drivers/net/phy/meson-gxl.c
> index bb9b33b6b..c4a07e6f7 100644
> --- a/drivers/net/phy/meson-gxl.c
> +++ b/drivers/net/phy/meson-gxl.c
> @@ -132,6 +132,18 @@ static int meson_gxl_config_init(struct phy_device *phydev)
> return 0;
> }
>
> +static int meson_gxl_phy_resume(struct phy_device *phydev)
> +{
> + int ret;
> +
> + phy_clear_bits(phydev, MII_BMCR, BMCR_PDOWN);

Call genphy_resume() instead.

> + ret = meson_gxl_config_init(phydev);
> + if (ret)
> + return ret;
> +
> + return 0;
> +}

Please re-indent this function.

> +
> /* This function is provided to cope with the possible failures of this phy
> * during aneg process. When aneg fails, the PHY reports that aneg is done
> * but the value found in MII_LPA is wrong:
> @@ -196,7 +208,7 @@ static struct phy_driver meson_gxl_phy[] = {
> .config_intr = smsc_phy_config_intr,
> .handle_interrupt = smsc_phy_handle_interrupt,
> .suspend = genphy_suspend,
> - .resume = genphy_resume,
> + .resume = meson_gxl_phy_resume,
> .read_mmd = genphy_read_mmd_unsupported,
> .write_mmd = genphy_write_mmd_unsupported,
> }, {
> --
> 2.39.2

Thanks,
Neil

2023-08-05 01:31:37

by Da Xue

[permalink] [raw]
Subject: Re: [PATCH] net: phy: meson-gxl: implement meson_gxl_phy_resume()

On Fri, Aug 4, 2023 at 4:44 AM Neil Armstrong <[email protected]> wrote:
>
> Hi Da,
>
> On 04/08/2023 05:07, Da Xue wrote:
> > After suspend and resume, the meson GXL internal PHY config needs to
> > be initialized again or the carrier cannot be found.
> >
> > Signed-off-by: Luke Lu <[email protected]>
> > Reviewed-by: Da Xue <[email protected]>
> >
> > ---
> > drivers/net/phy/meson-gxl.c | 14 +++++++++++++-
> > 1 file changed, 13 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/phy/meson-gxl.c b/drivers/net/phy/meson-gxl.c
> > index bb9b33b6b..c4a07e6f7 100644
> > --- a/drivers/net/phy/meson-gxl.c
> > +++ b/drivers/net/phy/meson-gxl.c
> > @@ -132,6 +132,18 @@ static int meson_gxl_config_init(struct phy_device *phydev)
> > return 0;
> > }
> >
> > +static int meson_gxl_phy_resume(struct phy_device *phydev)
> > +{
> > + int ret;
> > +
> > + phy_clear_bits(phydev, MII_BMCR, BMCR_PDOWN);
>
> Call genphy_resume() instead.

Sent v2.

>
> > + ret = meson_gxl_config_init(phydev);
> > + if (ret)
> > + return ret;
> > +
> > + return 0;
> > +}
>
> Please re-indent this function.

Ack, my apologies. I didn't read the excerpt about Gmail compose
converting tabs to spaces.

>
> > +
> > /* This function is provided to cope with the possible failures of this phy
> > * during aneg process. When aneg fails, the PHY reports that aneg is done
> > * but the value found in MII_LPA is wrong:
> > @@ -196,7 +208,7 @@ static struct phy_driver meson_gxl_phy[] = {
> > .config_intr = smsc_phy_config_intr,
> > .handle_interrupt = smsc_phy_handle_interrupt,
> > .suspend = genphy_suspend,
> > - .resume = genphy_resume,
> > + .resume = meson_gxl_phy_resume,
> > .read_mmd = genphy_read_mmd_unsupported,
> > .write_mmd = genphy_write_mmd_unsupported,
> > }, {
> > --
> > 2.39.2
>
> Thanks,
> Neil
>
> _______________________________________________
> linux-amlogic mailing list
> [email protected]
> http://lists.infradead.org/mailman/listinfo/linux-amlogic