Re: [PATCH v3 1/3] dt-bindings: net: Add Realtek MDIO controller

From: Daniel Golle
Date: Tue Dec 17 2024 - 18:55:11 EST


On Wed, Dec 18, 2024 at 11:44:59AM +1300, Chris Packham wrote:
> [...]
> +patternProperties:
> + '^ethernet-phy(@[a-f0-9]+)?':
> + type: object
> + $ref: ethernet-phy.yaml#
> +
> + properties:
> + reg:
> + description:
> + The MDIO communication on the RTL9300 is abstracted by the switch. At
> + the software level communication uses the switch port to address the
> + PHY with the actual MDIO bus and address having been setup via the
> + realtek,smi-address property.
> +
> + realtek,smi-address:
> + $ref: /schemas/types.yaml#/definitions/uint32-array
> + description: SMI interface and address for the connected PHY
> + items:
> + - description: SMI interface number associated with the port.
> + - description: SMI address of the PHY for the port.

What speaks against describing the actual MDIO busses and addresses (ie.
the hardware) in Device Tree and setting up the hardware mapping between
ports and SMI bus and address by parsing the DSA switch port description
in the MDIO driver?

In that way you would not need the additional vendor-specific property
and on switches with high port density also avoid having to deal with
bogus "MDIO addresses" greater than 31.