[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a1474d9a-f12c-48cb-881d-bce5fe7c646f@lunn.ch>
Date: Mon, 18 Aug 2025 19:16:06 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Yangfl <mmyangfl@...il.com>
Cc: netdev@...r.kernel.org, Vladimir Oltean <olteanv@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Simon Horman <horms@...nel.org>,
Russell King <linux@...linux.org.uk>, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [net-next v4 1/3] dt-bindings: net: dsa: yt921x: Add Motorcomm
YT921x switch support
On Tue, Aug 19, 2025 at 01:06:00AM +0800, Yangfl wrote:
> On Tue, Aug 19, 2025 at 12:55 AM Andrew Lunn <andrew@...n.ch> wrote:
> >
> > > + motorcomm,switch-id:
> > > + $ref: /schemas/types.yaml#/definitions/uint32
> > > + description: |
> > > + Value selected by Pin SWITCH_ID_1 / SWITCH_ID_0.
> > > +
> > > + Up to 4 chips can share the same MII port ('reg' in DT) by giving
> > > + different SWITCH_ID values. The default value should work if only one chip
> > > + is present.
> > > + enum: [0, 1, 2, 3]
> > > + default: 0
> >
> > It is like getting blood from a stone.
> >
> > So what you are saying is that you have:
> >
> > mdio {
> > #address-cells = <1>;
> > #size-cells = <0>;
> >
> > switch@1d {
> > compatible = "motorcomm,yt9215";
> > /* default 0x1d, alternate 0x0 */
> > reg = <0x1d>;
> > motorcomm,switch-id = <0>;
> > reset-gpios = <&tlmm 39 GPIO_ACTIVE_LOW>;
> > ...
> > }
> >
> > switch@1d {
> > compatible = "motorcomm,yt9215";
> > reg = <0x1d>;
> > motorcomm,switch-id = <1>;
> > reset-gpios = <&tlmm 39 GPIO_ACTIVE_LOW>;
> > ...
> > }
> >
> > switch@1d {
> > compatible = "motorcomm,yt9215";
> > reg = <0x1d>;
> > motorcomm,switch-id = <2>;
> > reset-gpios = <&tlmm 39 GPIO_ACTIVE_LOW>;
> > ...
> > }
> > }
> >
> > Have you tested this? My _guess_ is, it does not work.
> >
> > I'm not even sure DT allows you to have the same reg multiple times on
> > one bus.
> >
> > I'm pretty sure the MDIO core does not allow multiple devices on one
> > MDIO address. Each device is represented by a struct
> > mdio_device. struct mii_bus has an array of 32 of these, one per
> > address on the bus. You cannot have 4 of them for one address.
> >
> > Andrew
> >
> > ---
> > pw-bot: cr
>
> Of course I cannot test this, since I only have a stock device, as
> mentioned in patch 3.
You could create such a DT and see if it compiles and passes the
binding tests. You could boot such a DT. You should get -ENODEV for
the other two devices. But if it crashes, that tells you
something... Looking at the stack trace might confirm this is never
going to work with the current MDIO core code.
> If this is not acceptable anyway, I might as well remove switch-id
> completely since I doubt if anyone would concat more than one switch
> together in real world.
I have a board with 4 Marvell switches. It does happen, especially in
industrial systems. But they have individual addresses on the MDIO
bus. I also have a SOHO black box switch, using two qualcomm switches
in order to support 16 ports.
But i do agree you are unlikely to see a WiFi AP, or a cable modem use
two switches.
Andrew
Powered by blists - more mailing lists