Commit c602f4ca authored by Jakub Kicinski's avatar Jakub Kicinski

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.seSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents fb984d17 2c60c4c0
......@@ -88,10 +88,16 @@ properties:
'#address-cells':
description: Number of address cells for the MDIO bus.
const: 1
deprecated: true
'#size-cells':
description: Number of size cells on the MDIO bus.
const: 0
deprecated: true
mdio:
$ref: /schemas/net/mdio.yaml#
unevaluatedProperties: false
renesas,no-ether-link:
type: boolean
......@@ -110,9 +116,13 @@ properties:
tx-internal-delay-ps:
enum: [0, 2000]
# In older bindings there where no mdio child-node to describe the MDIO bus
# and the PHY. To not fail older bindings accept any node with an address. New
# users should describe the PHY inside the mdio child-node.
patternProperties:
"@[0-9a-f]$":
type: object
deprecated: true
required:
- compatible
......@@ -123,8 +133,6 @@ required:
- resets
- phy-mode
- phy-handle
- '#address-cells'
- '#size-cells'
allOf:
- $ref: ethernet-controller.yaml#
......
......@@ -2564,6 +2564,7 @@ static int ravb_mdio_init(struct ravb_private *priv)
{
struct platform_device *pdev = priv->pdev;
struct device *dev = &pdev->dev;
struct device_node *mdio_node;
struct phy_device *phydev;
struct device_node *pn;
int error;
......@@ -2583,7 +2584,13 @@ static int ravb_mdio_init(struct ravb_private *priv)
pdev->name, pdev->id);
/* Register MDIO bus */
error = of_mdiobus_register(priv->mii_bus, dev->of_node);
mdio_node = of_get_child_by_name(dev->of_node, "mdio");
if (!mdio_node) {
/* backwards compatibility for DT lacking mdio subnode */
mdio_node = of_node_get(dev->of_node);
}
error = of_mdiobus_register(priv->mii_bus, mdio_node);
of_node_put(mdio_node);
if (error)
goto out_free_bus;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment