Subject: Re: [PATCH RFC net-next 2/5] net: dsa: b53: populate supported_interfaces and mac_capabilities

From: "Russell King (Oracle)" <[email-masked]>
Date: Thu, 17 Feb 2022 10:17:05 +0000

On Wed, Feb 16, 2022 at 11:51:49AM -0800, Florian Fainelli wrote:
> On 2/3/22 6:48 AM, Russell King (Oracle) wrote:
> > Populate the supported interfaces and MAC capabilities for the Broadcom
> > B53 DSA switches in preparation to using these for the generic
> > validation functionality.
> > 
> > The interface modes are derived from:
> > - b53_serdes_phylink_validate()
> > - SRAB mux configuration
> > 
> > NOTE: much of this conversion is a guess as the driver doesn't contain
> > sufficient information. I would appreciate a thorough review and
> > testing of this change before it is merged.
> > 
> > Signed-off-by: Russell King (Oracle) <[email-masked]>
> 
> This patch breaks with the following:
> 
> [    2.680318] b53-srab-switch 18036000.ethernet-switch sfp
> (uninitialized): failed to validate link configuration for in-band status
> [    2.692470] error creating PHYLINK: -22
> [    2.696441] b53-srab-switch 18036000.ethernet-switch sfp
> (uninitialized): error -22 setting up PHY for tree 0, switch 0, port 5
> 
> Adding more debug shows us the following:
> 
> [    2.804854] phylink_validate: unable to find a mode for 4
> 0000000,000001ff,0060004c
> [    2.812807] phylink_validate: unable to find a mode for 4
> 0000000,000001ff,0060004c
> [    2.820733] b53-srab-switch 18036000.ethernet-switch sfp
> (uninitialized): failed to validate link configuration for in-band status
> [    2.832868] error creating PHYLINK: -22
> 
> 4 = PHY_INTERFACE_MODE_SGMII and the config->supported_interfaces bitmap
> is printed. If we add this hunk, you entire patch set works again:
> 
> @@ -178,10 +180,14 @@ void b53_serdes_phylink_get_caps(struct b53_device
> *dev, int port,
>                 __set_bit(PHY_INTERFACE_MODE_1000BASEX,
>                           config->supported_interfaces);
>                 config->mac_capabilities |= MAC_1000FD;
> +               __set_bit(PHY_INTERFACE_MODE_SGMII,
> +                         config->supported_interfaces);
>                 break;
>         default:
>                 break;
>         }

Thanks, added, and I've updated the comment as well just above the first
line of the above hunk to be consistent with the code.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!