Skip to content

Commit c602f4c

Browse files
committed
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/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents fb984d1 + 2c60c4c commit c602f4c

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

Documentation/devicetree/bindings/net/renesas,etheravb.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,16 @@ properties:
8888
'#address-cells':
8989
description: Number of address cells for the MDIO bus.
9090
const: 1
91+
deprecated: true
9192

9293
'#size-cells':
9394
description: Number of size cells on the MDIO bus.
9495
const: 0
96+
deprecated: true
97+
98+
mdio:
99+
$ref: /schemas/net/mdio.yaml#
100+
unevaluatedProperties: false
95101

96102
renesas,no-ether-link:
97103
type: boolean
@@ -110,9 +116,13 @@ properties:
110116
tx-internal-delay-ps:
111117
enum: [0, 2000]
112118

119+
# In older bindings there where no mdio child-node to describe the MDIO bus
120+
# and the PHY. To not fail older bindings accept any node with an address. New
121+
# users should describe the PHY inside the mdio child-node.
113122
patternProperties:
114123
"@[0-9a-f]$":
115124
type: object
125+
deprecated: true
116126

117127
required:
118128
- compatible
@@ -123,8 +133,6 @@ required:
123133
- resets
124134
- phy-mode
125135
- phy-handle
126-
- '#address-cells'
127-
- '#size-cells'
128136

129137
allOf:
130138
- $ref: ethernet-controller.yaml#

drivers/net/ethernet/renesas/ravb_main.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2564,6 +2564,7 @@ static int ravb_mdio_init(struct ravb_private *priv)
25642564
{
25652565
struct platform_device *pdev = priv->pdev;
25662566
struct device *dev = &pdev->dev;
2567+
struct device_node *mdio_node;
25672568
struct phy_device *phydev;
25682569
struct device_node *pn;
25692570
int error;
@@ -2583,7 +2584,13 @@ static int ravb_mdio_init(struct ravb_private *priv)
25832584
pdev->name, pdev->id);
25842585

25852586
/* Register MDIO bus */
2586-
error = of_mdiobus_register(priv->mii_bus, dev->of_node);
2587+
mdio_node = of_get_child_by_name(dev->of_node, "mdio");
2588+
if (!mdio_node) {
2589+
/* backwards compatibility for DT lacking mdio subnode */
2590+
mdio_node = of_node_get(dev->of_node);
2591+
}
2592+
error = of_mdiobus_register(priv->mii_bus, mdio_node);
2593+
of_node_put(mdio_node);
25872594
if (error)
25882595
goto out_free_bus;
25892596

0 commit comments

Comments
 (0)