diff mbox series

[OpenWrt-Devel,1/2] ipq40xx: 5.4: fix networking PHY driver

Message ID 20200303191931.917613-1-robert.marko@sartura.hr
State Accepted
Delegated to: Petr Štetiar
Headers show
Series [OpenWrt-Devel,1/2] ipq40xx: 5.4: fix networking PHY driver | expand

Commit Message

Robert Marko March 3, 2020, 7:19 p.m. UTC
In 5.4 kernel old u32 array way of setting network features was dropped and linkmode is now the only way.
So lets migrate the PHY driver to support linkmode.
Also, now in order for gigabit to work, PHY driver needs to advertise PHY_GBIT_FEATURES instead of PHY_BASIC_FEATURES

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
---
 .../patches-5.4/705-net-add-qualcomm-ar40xx-phy.patch |  6 +++---
 .../706-ar40xx-abort-probe-on-missig-phy.patch        | 11 -----------
 2 files changed, 3 insertions(+), 14 deletions(-)

Comments

Robert Marko March 15, 2020, 11:42 a.m. UTC | #1
On Tue, Mar 3, 2020 at 8:19 PM Robert Marko <robert.marko@sartura.hr> wrote:
>
> In 5.4 kernel old u32 array way of setting network features was dropped and linkmode is now the only way.
> So lets migrate the PHY driver to support linkmode.
> Also, now in order for gigabit to work, PHY driver needs to advertise PHY_GBIT_FEATURES instead of PHY_BASIC_FEATURES
>
Any chance of merging this?
Without this networking is broken in 5.4

> Signed-off-by: Robert Marko <robert.marko@sartura.hr>
> ---
>  .../patches-5.4/705-net-add-qualcomm-ar40xx-phy.patch |  6 +++---
>  .../706-ar40xx-abort-probe-on-missig-phy.patch        | 11 -----------
>  2 files changed, 3 insertions(+), 14 deletions(-)
>
> diff --git a/target/linux/ipq40xx/patches-5.4/705-net-add-qualcomm-ar40xx-phy.patch b/target/linux/ipq40xx/patches-5.4/705-net-add-qualcomm-ar40xx-phy.patch
> index 6df447fcd5..083de038a2 100644
> --- a/target/linux/ipq40xx/patches-5.4/705-net-add-qualcomm-ar40xx-phy.patch
> +++ b/target/linux/ipq40xx/patches-5.4/705-net-add-qualcomm-ar40xx-phy.patch
> @@ -1837,8 +1837,8 @@
>  +      if (phydev->mdio.addr == 0)
>  +              ar40xx_priv->phy = phydev;
>  +
> -+      phydev->supported |= SUPPORTED_1000baseT_Full;
> -+      phydev->advertising |= ADVERTISED_1000baseT_Full;
> ++      linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, phydev->supported);
> ++      linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, phydev->advertising);
>  +      return 0;
>  +}
>  +
> @@ -1877,7 +1877,7 @@
>  +      .phy_id         = 0x004d0000,
>  +      .name           = "QCA Malibu",
>  +      .phy_id_mask    = 0xffff0000,
> -+      .features       = PHY_BASIC_FEATURES,
> ++      .features       = PHY_GBIT_FEATURES,
>  +      .probe          = ar40xx_phy_probe,
>  +      .remove         = ar40xx_phy_remove,
>  +      .config_init    = ar40xx_phy_config_init,
> diff --git a/target/linux/ipq40xx/patches-5.4/706-ar40xx-abort-probe-on-missig-phy.patch b/target/linux/ipq40xx/patches-5.4/706-ar40xx-abort-probe-on-missig-phy.patch
> index cda05bfb9f..19474bff0d 100644
> --- a/target/linux/ipq40xx/patches-5.4/706-ar40xx-abort-probe-on-missig-phy.patch
> +++ b/target/linux/ipq40xx/patches-5.4/706-ar40xx-abort-probe-on-missig-phy.patch
> @@ -1,16 +1,5 @@
>  --- a/drivers/net/phy/ar40xx.c
>  +++ b/drivers/net/phy/ar40xx.c
> -@@ -1808,8 +1808,8 @@ ar40xx_phy_probe(struct phy_device *phyd
> -       if (phydev->mdio.addr == 0)
> -               ar40xx_priv->phy = phydev;
> -
> --      phydev->supported |= SUPPORTED_1000baseT_Full;
> --      phydev->advertising |= ADVERTISED_1000baseT_Full;
> -+      phy_set_max_speed(phydev, SPEED_1000);
> -+      linkmode_copy(phydev->advertising, phydev->supported);
> -       return 0;
> - }
> -
>  @@ -2021,6 +2021,12 @@ static int ar40xx_probe(struct platform_
>         /* register switch */
>         swdev = &priv->dev;
> --
> 2.24.1
>
Petr Štetiar March 15, 2020, 12:14 p.m. UTC | #2
Mar 15, 2020 12:42:59 Robert Marko <robert.marko@sartura.hr>:

> On Tue, Mar 3, 2020 at 8:19 PM Robert Marko <robert.marko@sartura.hr> wrote:
>
> >
> > In 5.4 kernel old u32 array way of setting network features was dropped and linkmode is now the only way.
> > So lets migrate the PHY driver to support linkmode.
> > Also, now in order for gigabit to work, PHY driver needs to advertise PHY_GBIT_FEATURES instead of PHY_BASIC_FEATURES
> >
> >
> Any chance of merging this?
> Without this networking is broken in 5.4

I wanted to merge this few days ago (hopefully you got notification from Patchwork that the patches are under review already), but unfortunately my nbg6617 ended up in the bootloop due to some OOPs in the edma_axi_probe() so I would like to sort this out first, but didn't find more time to look at this in more detail yet.
Robert Marko March 15, 2020, 12:21 p.m. UTC | #3
On Sun, Mar 15, 2020 at 1:14 PM Petr Štetiar <ynezz@true.cz> wrote:
>
> Mar 15, 2020 12:42:59 Robert Marko <robert.marko@sartura.hr>:
>
> > On Tue, Mar 3, 2020 at 8:19 PM Robert Marko <robert.marko@sartura.hr> wrote:
> >
> > >
> > > In 5.4 kernel old u32 array way of setting network features was dropped and linkmode is now the only way.
> > > So lets migrate the PHY driver to support linkmode.
> > > Also, now in order for gigabit to work, PHY driver needs to advertise PHY_GBIT_FEATURES instead of PHY_BASIC_FEATURES
> > >
> > >
> > Any chance of merging this?
> > Without this networking is broken in 5.4
>
> I wanted to merge this few days ago (hopefully you got notification from Patchwork that the patches are under review already), but unfortunately my nbg6617 ended up in the bootloop due to some OOPs in the edma_axi_probe() so I would like to sort this out first, but didn't find more time to look at this in more detail yet.
Yeah, got the notifications, that is why I pinged now.
Do you maybe have a bootlog as I have been using these fixes on 5.4,
5.5 and 5.6 kernels for a while without issues on multiple IPQ40xx
boards
>
>
diff mbox series

Patch

diff --git a/target/linux/ipq40xx/patches-5.4/705-net-add-qualcomm-ar40xx-phy.patch b/target/linux/ipq40xx/patches-5.4/705-net-add-qualcomm-ar40xx-phy.patch
index 6df447fcd5..083de038a2 100644
--- a/target/linux/ipq40xx/patches-5.4/705-net-add-qualcomm-ar40xx-phy.patch
+++ b/target/linux/ipq40xx/patches-5.4/705-net-add-qualcomm-ar40xx-phy.patch
@@ -1837,8 +1837,8 @@ 
 +	if (phydev->mdio.addr == 0)
 +		ar40xx_priv->phy = phydev;
 +
-+	phydev->supported |= SUPPORTED_1000baseT_Full;
-+	phydev->advertising |= ADVERTISED_1000baseT_Full;
++	linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, phydev->supported);
++	linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, phydev->advertising);
 +	return 0;
 +}
 +
@@ -1877,7 +1877,7 @@ 
 +	.phy_id		= 0x004d0000,
 +	.name		= "QCA Malibu",
 +	.phy_id_mask	= 0xffff0000,
-+	.features	= PHY_BASIC_FEATURES,
++	.features	= PHY_GBIT_FEATURES,
 +	.probe		= ar40xx_phy_probe,
 +	.remove		= ar40xx_phy_remove,
 +	.config_init	= ar40xx_phy_config_init,
diff --git a/target/linux/ipq40xx/patches-5.4/706-ar40xx-abort-probe-on-missig-phy.patch b/target/linux/ipq40xx/patches-5.4/706-ar40xx-abort-probe-on-missig-phy.patch
index cda05bfb9f..19474bff0d 100644
--- a/target/linux/ipq40xx/patches-5.4/706-ar40xx-abort-probe-on-missig-phy.patch
+++ b/target/linux/ipq40xx/patches-5.4/706-ar40xx-abort-probe-on-missig-phy.patch
@@ -1,16 +1,5 @@ 
 --- a/drivers/net/phy/ar40xx.c
 +++ b/drivers/net/phy/ar40xx.c
-@@ -1808,8 +1808,8 @@ ar40xx_phy_probe(struct phy_device *phyd
- 	if (phydev->mdio.addr == 0)
- 		ar40xx_priv->phy = phydev;
- 
--	phydev->supported |= SUPPORTED_1000baseT_Full;
--	phydev->advertising |= ADVERTISED_1000baseT_Full;
-+	phy_set_max_speed(phydev, SPEED_1000);
-+	linkmode_copy(phydev->advertising, phydev->supported);
- 	return 0;
- }
- 
 @@ -2021,6 +2021,12 @@ static int ar40xx_probe(struct platform_
  	/* register switch */
  	swdev = &priv->dev;