[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180917153811.GE5458@lunn.ch>
Date: Mon, 17 Sep 2018 17:38:11 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Simon Horman <horms@...ge.net.au>
Cc: David Miller <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
Florian Fainelli <f.fainelli@...il.com>
Subject: Re: [PATCH v3 net-next 07/12] net: ethernet: Add helper to remove a
supported link mode
On Mon, Sep 17, 2018 at 05:13:07PM +0200, Simon Horman wrote:
> On Wed, Sep 12, 2018 at 01:53:14AM +0200, Andrew Lunn wrote:
> > Some MAC hardware cannot support a subset of link modes. e.g. often
> > 1Gbps Full duplex is supported, but Half duplex is not. Add a helper
> > to remove such a link mode.
> >
> > Signed-off-by: Andrew Lunn <andrew@...n.ch>
> > Reviewed-by: Florian Fainelli <f.fainelli@...il.com>
> > ---
> > drivers/net/ethernet/apm/xgene/xgene_enet_hw.c | 6 +++---
> > drivers/net/ethernet/cadence/macb_main.c | 5 ++---
> > drivers/net/ethernet/freescale/fec_main.c | 3 ++-
> > drivers/net/ethernet/microchip/lan743x_main.c | 2 +-
> > drivers/net/ethernet/renesas/ravb_main.c | 3 ++-
> > .../net/ethernet/stmicro/stmmac/stmmac_main.c | 12 ++++++++----
> > drivers/net/phy/phy_device.c | 18 ++++++++++++++++++
> > drivers/net/usb/lan78xx.c | 2 +-
> > include/linux/phy.h | 1 +
> > 9 files changed, 38 insertions(+), 14 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
> > index 078a04dc1182..4831f9de5945 100644
>
> ...
>
> > diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> > index aff5516b781e..fb2a1125780d 100644
> > --- a/drivers/net/ethernet/renesas/ravb_main.c
> > +++ b/drivers/net/ethernet/renesas/ravb_main.c
> > @@ -1074,7 +1074,8 @@ static int ravb_phy_init(struct net_device *ndev)
> > }
> >
> > /* 10BASE is not supported */
> > - phydev->supported &= ~PHY_10BT_FEATURES;
> > + phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Half_BIT);
> > + phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Full_BIT);
> >
> > phy_attached_info(phydev);
> >
>
> ...
>
> > diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> > index db1172db1e7c..e9ca83a438b0 100644
> > --- a/drivers/net/phy/phy_device.c
> > +++ b/drivers/net/phy/phy_device.c
> > @@ -1765,6 +1765,24 @@ int phy_set_max_speed(struct phy_device *phydev, u32 max_speed)
> > }
> > EXPORT_SYMBOL(phy_set_max_speed);
> >
> > +/**
> > + * phy_remove_link_mode - Remove a supported link mode
> > + * @phydev: phy_device structure to remove link mode from
> > + * @link_mode: Link mode to be removed
> > + *
> > + * Description: Some MACs don't support all link modes which the PHY
> > + * does. e.g. a 1G MAC often does not support 1000Half. Add a helper
> > + * to remove a link mode.
> > + */
> > +void phy_remove_link_mode(struct phy_device *phydev, u32 link_mode)
> > +{
> > + WARN_ON(link_mode > 31);
> > +
> > + phydev->supported &= ~BIT(link_mode);
> > + phydev->advertising = phydev->supported;
> > +}
> > +EXPORT_SYMBOL(phy_remove_link_mode);
> > +
> > static void of_set_phy_supported(struct phy_device *phydev)
> > {
> > struct device_node *node = phydev->mdio.dev.of_node;
>
> Hi Andrew,
>
> I believe that for the RAVB the overall effect of this change is that
> 10-BaseT modes are no longer advertised (although both with and without
> this patch they are not supported).
>
> Unfortunately on R-Car Gen3 M3-W (r8a7796) based Salvator-X board
> I have observed that this results in the link no longer being negotiated
> on one switch (the one I usually use) while it seemed fine on another.
Hi Simon
Thanks for testing this.
Could you dump the PHY registers with and without this patch:
$ mii-tool -vv eth0
Once difference is that phy_remove_link_mode() does
phydev->advertising = phydev->supported where as the old code does
not. I though phylib would do this anyway, it does at some point in
time, but i didn't check when. It could be you are actually
advertising 10, even if you don't support it.
Thanks
Andrew
Powered by blists - more mailing lists