Re: [PATCH] dt-bindings: net: qcom,emac: convert to dtschema

Andrew Lunn
2024-07-17T18:19:57Z

On Wed, Jul 17, 2024 at 04:45:55PM +0100, Rayyan Ansari wrote:
> On Wed Jul 17, 2024 at 4:20 PM BST, Andrew Lunn wrote:
> > On Wed, Jul 17, 2024 at 10:09:27AM +0100, Rayyan Ansari wrote:
> > > Convert the bindings for the Qualcomm EMAC Ethernet Controller from the
> > > old text format to yaml.
> > >
> > > Also move the phy node of the controller to be within an mdio block so
> > > we can use mdio.yaml.
> >
> > Does the MAC driver already support this?
> >
> > When i look at the emacs-phy.c there is
> >
> > struct device_node *np = pdev->dev.of_node;
> >
> > ret = of_mdiobus_register(mii_bus, np);
> >
> > I don't see anything looking for the mdio node in the tree.
> >
> > Andrew
>
> Hi Andrew,
>
> Yes, from my understanding an mdio node is not explicitly needed as it
> just uses "phy-handle".
>
> However, I think it makes more sense to place the phy within an mdio
> node instead of directly under the controller node. This is based off
> of 5ecd39d1bc4b ("dt-bindings: net: convert emac_rockchip.txt to YAML"),
> in which the same decision was made ("Add mdio sub node"), also during a
> text -> yaml conversion.

Using an MDIO node is preferred, and is the modern way of doing
it. Placing the PHY directly in the MAC node is valid, but it is the
old way of doing it.

It is up to the driver to decide where it looks for the PHY nodes when
it registers the MDIO bus. The np in of_mdiobus_register(mii_bus, np);
points to the MAC node. So when you move the PHYs into the new MDIO
node, they will not be found when the MDIO bus is probed.

Take a look at:

commit 2c60c4c008d4b05b9b65bf88f784556208029333
Author: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Date: Mon Mar 25 16:34:51 2024 +0100

ravb: Add support for an optional MDIO mode

as an example where support for such an MDIO node was added to a
driver.

Andrew

---
pw-bot: cr