On Wed, Oct 23, 2024 at 07:39:01PM +0200, Andrew Lunn wrote: > > Well the first case that comes to mind is multiple switch and conflict. > > I have no idea if there are hw strap to configure this so I assume if a > > SoC have 2 switch (maybe of the same type), this permits to configure > > them (with reset pin and deasserting them once the base address is > > correctly configured) > > Is this switch internal on an internal MDIO bus, or external? External so it can be mounted on any SoC given correct mdio/mdc. > > Most PHYs and switches i've seen have strapping pins to set the base > address. It would be unusual if there was not strapping. Same feeling, but I didn't found anything in the documentation. (actually no mention of hw strap or pin) > > For the Marvell switches, the strapping moves all the MDIO > registers. This is why we have a reg at the top level in mv88e6xxx: > > ethernet-switch@0 { > compatible = "marvell,mv88e6085"; > reg = <0>; > > There is one family which use the values of 0 or 16, and each switch > uses 16 addresses. So you can put two on the bus. > Yes this is what that property does. Everything is shifted. > > > > + mdio: > > > > + $ref: /schemas/net/mdio.yaml# > > > > + unevaluatedProperties: false > > > > + description: > > > > + Define the relative address of the internal PHY for each port. > > > > + > > > > + Each reg for the PHY is relative to the switch base PHY address. > > > > > > Which is not the usual meaning of reg. > > > > > > > + mdio { > > > > + #address-cells = <1>; > > > > + #size-cells = <0>; > > > > + > > > > + internal_phy0: phy@0 { > > > > + reg = <0>; > > > > > > So given that airoha,base_smi_address defaults to 1, this is actually > > > address 1 on the MDIO bus? > > > > > > > Yes correct. One problem I had was that moving this outside the swich > > cause panic as it does conflict with the switch PHY address... > > I would make these addresses absolute, not relative. The example above > from the marvell switch, the device using addresses 16-31 has its PHYs > within that range, and we uses the absolute reg values. > They were relative with the base SMI implementation in mind (as we would then offset) If the path is to drop that option then yes, these address should be absolute. Or do you think even with that option, these address should be absolute? -- Ansuel