Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'ravb-support-describing-the-mdio-bus'

Niklas Söderlund says:

====================
ravb: Support describing the MDIO bus

This series adds support to the binding and driver of the Renesas
Ethernet AVB to described the MDIO bus. Currently the driver uses
the OF node of the device itself when registering the MDIO bus.
This forces any MDIO bus properties the MDIO core should react on
to be set on the device OF node. This is confusing and none of
the MDIO bus properties are described in the Ethernet AVB bindings.

Patch 1/2 extends the bindings with an optional mdio child-node
to the device that can be used to contain the MDIO bus settings.
While patch 2/2 changes the driver to use this node (if present)
when registering the MDIO bus.

If the new optional mdio child-node is not present the driver
fallback to the old behavior and uses the device OF node like before.
This change is fully backward compatible with existing usage
of the bindings.
====================

Link: https://lore.kernel.org/r/20240325153451.2366083-1-niklas.soderlund+renesas@ragnatech.se
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+18 -3
+10 -2
Documentation/devicetree/bindings/net/renesas,etheravb.yaml
··· 88 88 '#address-cells': 89 89 description: Number of address cells for the MDIO bus. 90 90 const: 1 91 + deprecated: true 91 92 92 93 '#size-cells': 93 94 description: Number of size cells on the MDIO bus. 94 95 const: 0 96 + deprecated: true 97 + 98 + mdio: 99 + $ref: /schemas/net/mdio.yaml# 100 + unevaluatedProperties: false 95 101 96 102 renesas,no-ether-link: 97 103 type: boolean ··· 116 110 tx-internal-delay-ps: 117 111 enum: [0, 2000] 118 112 113 + # In older bindings there where no mdio child-node to describe the MDIO bus 114 + # and the PHY. To not fail older bindings accept any node with an address. New 115 + # users should describe the PHY inside the mdio child-node. 119 116 patternProperties: 120 117 "@[0-9a-f]$": 121 118 type: object 119 + deprecated: true 122 120 123 121 required: 124 122 - compatible ··· 133 123 - resets 134 124 - phy-mode 135 125 - phy-handle 136 - - '#address-cells' 137 - - '#size-cells' 138 126 139 127 allOf: 140 128 - $ref: ethernet-controller.yaml#
+8 -1
drivers/net/ethernet/renesas/ravb_main.c
··· 2564 2564 { 2565 2565 struct platform_device *pdev = priv->pdev; 2566 2566 struct device *dev = &pdev->dev; 2567 + struct device_node *mdio_node; 2567 2568 struct phy_device *phydev; 2568 2569 struct device_node *pn; 2569 2570 int error; ··· 2584 2583 pdev->name, pdev->id); 2585 2584 2586 2585 /* Register MDIO bus */ 2587 - error = of_mdiobus_register(priv->mii_bus, dev->of_node); 2586 + mdio_node = of_get_child_by_name(dev->of_node, "mdio"); 2587 + if (!mdio_node) { 2588 + /* backwards compatibility for DT lacking mdio subnode */ 2589 + mdio_node = of_node_get(dev->of_node); 2590 + } 2591 + error = of_mdiobus_register(priv->mii_bus, mdio_node); 2592 + of_node_put(mdio_node); 2588 2593 if (error) 2589 2594 goto out_free_bus; 2590 2595