Re: [PATCH v3 net-next 12/14] dt-bindings: net: dsa: ocelot: add ocelot-ext documentation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 30, 2022 at 05:20:22PM -0700, Colin Foster wrote:
> On Fri, Sep 30, 2022 at 02:15:58PM -0700, Colin Foster wrote:
> > On Tue, Sep 27, 2022 at 11:26:00PM +0300, Vladimir Oltean wrote:
> > > On Sun, Sep 25, 2022 at 05:29:26PM -0700, Colin Foster wrote:
> > > > ---
> > > > +      - phy-mode = "internal": on ports 0, 1, 2, 3
> > > 
> > > More PHY interface types are supported. Please document them all.
> > > It doesn't matter what the driver supports. Drivers and device tree
> > > blobs should be able to have different lifetimes. A driver which doesn't
> > > support the SERDES ports should work with a device tree that defines
> > > them, and a driver that supports the SERDES ports should work with a
> > > device tree that doesn't.
> > 
> > This will change my patch a little bit then. I didn't undersand this
> > requirement.
> > 
> > My current device tree has all 8 ethernet ports populated. ocelot_ext
> > believes "all these port modes are accepted" by way of a fully-populated
> > vsc7512_port_modes[] array.
> > 
> > As a result, when I'm testing, swp4 through swp7 all enumerate as
> > devices, though they don't actually function. It isn't until serdes /
> > phylink / pcs / pll5 come along that they become functional ports.
> > 
> > I doubt this is desired. Though if I'm using the a new macro
> > OCELOT_PORT_MODE_NONE, felix.c stops after felix_validate_phy_mode.
> > 
> > I think the only thing I can do is to allow felix to ignore invalid phy
> > modes on some ports (which might be desired) and continue on with the
> > most it can do. That seems like a potential improvement to the felix
> > driver...
> > 
> > The other option is to allow the ports to enumerate, but leave them
> > non-functional. This is how my system currently acts, but as I said, I
> > bet it would be confusing to any user.
> > 
> > Thoughts?

Having the interfaces probe but not work isn't the worst, but if we
could make just the SERDES ports fail to probe, it would be better.

> Also, for what its worth, I tried this just now by making this change:
> 
> err = felix_validate_phy_mode(felix, port, phy_mode);
> if (err < 0) {
>         dev_err(dev, "Unsupported PHY mode %s on port %d\n",
>                 phy_modes(phy_mode), port);
>         of_node_put(child);
>  -      return err;
>  +      continue;
> }
> 
> This functions in that I only see swp1-swp3, but I don't think it
> should - it is just leaving phy_mode set to 0 (PHY_INTERFACE_MODE_NA).

You could add a comment above the "continue" statement explaining this.

> My guess is it'll need more logic to say "don't add these DSA ports because
> the driver doesn't support those PHY interfaces"
> 
> [    3.555367] ocelot-switch ocelot-switch.4.auto: Unsupported PHY mode qsgmii on port 4
> [    3.563551] ocelot-switch ocelot-switch.4.auto: Unsupported PHY mode qsgmii on port 5
> [    3.571570] ocelot-switch ocelot-switch.4.auto: Unsupported PHY mode qsgmii on port 6
> [    3.579459] ocelot-switch ocelot-switch.4.auto: Unsupported PHY mode qsgmii on port 7
> [    4.271832] ocelot-switch ocelot-switch.4.auto: PHY [ocelot-miim0.2.auto-mii:00] driver [Generic PHY] (irq=POLL)
> [    4.282715] ocelot-switch ocelot-switch.4.auto: configuring for phy/internal link mode
> [    4.296478] ocelot-switch ocelot-switch.4.auto swp1 (uninitialized): PHY [ocelot-miim0.2.auto-mii:01] driver [Generic PHY] (irq=POLL)
> [    4.312876] ocelot-switch ocelot-switch.4.auto swp2 (uninitialized): PHY [ocelot-miim0.2.auto-mii:02] driver [Generic PHY] (irq=POLL)
> [    4.328897] ocelot-switch ocelot-switch.4.auto swp3 (uninitialized): PHY [ocelot-miim0.2.auto-mii:03] driver [Generic PHY] (irq=POLL)
> [    5.032849] ocelot-switch ocelot-switch.4.auto swp4 (uninitiailized): validation of qsgmii with support 00000000,00000000,000062ff and advertisement 00000000,00000000,000062ff failed: -EINVAL
> [    5.051265] ocelot-switch ocelot-switch.4.auto swp4 (uninitialized): failed to connect to PHY: -EINVAL
> [    5.060670] ocelot-switch ocelot-switch.4.auto swp4 (uninitialized): error -22 setting up PHY for tree 0, switch 0, port 4
> (repeated for swp5-7)

I think the behavior is correct and sufficient. The ocelot driver always
requires a valid phy-mode in the device tree for all ports, and
PHY_INTERFACE_MODE_NA means the lack of one. In turn, this is enough to
make phylink_validate() fail with any valid device tree. And DSA is
smart enough to limp on with the rest of its ports if phylink setup
failed for some of them - see dsa_port_setup_as_unused() in the current
net-next git tree.

If you don't think this is enough, you could also patch felix_phylink_get_caps()
to exclude ocelot->ports[port]->phy_mode == PHY_INTERFACE_MODE_NA from
applying this assignment (which would make config->supported_interfaces
remain empty):

	__set_bit(ocelot->ports[port]->phy_mode,
		  config->supported_interfaces);



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux