[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210814023132.2729731-3-saravanak@google.com>
Date: Fri, 13 Aug 2021 19:31:31 -0700
From: Saravana Kannan <saravanak@...gle.com>
To: Rob Herring <robh+dt@...nel.org>,
Frank Rowand <frowand.list@...il.com>
Cc: Saravana Kannan <saravanak@...gle.com>, kernel-team@...roid.com,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
Andrew Lunn <andrew@...n.ch>, netdev@...r.kernel.org
Subject: [PATCH v1 2/2] of: property: fw_devlink: Add support for "phy-handle" property
Allows tracking dependencies between consumers of an Ethernet PHY and
the parent devices that own the PHY.
Cc: Andrew Lunn <andrew@...n.ch>
Cc: netdev@...r.kernel.org
Signed-off-by: Saravana Kannan <saravanak@...gle.com>
---
Hi Andrew,
I spent a few hours looking at most/all uses of phy-handle and my
comment in the code seems valid. Can you confirm that please? Also there
are so many phy related properties that my head is spinning. Is there a
"phy" property (which is different from "phys") that treated exactly as
"phy-handle"?
-Saravana
drivers/of/property.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/of/property.c b/drivers/of/property.c
index 931340329414..70d9843fd4bf 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -1350,6 +1350,20 @@ static struct device_node *parse_interrupts(struct device_node *np,
return of_irq_parse_one(np, index, &sup_args) ? NULL : sup_args.np;
}
+static struct device_node *parse_phy_handle(struct device_node *np,
+ const char *prop_name, int index)
+{
+ if (strcmp(prop_name, "phy-handle"))
+ return NULL;
+
+ /*
+ * Device tree nodes pointed to by phy-handle never have struct devices
+ * created for them even if they have a "compatible" property. So
+ * return the parent node pointer.
+ */
+ return of_get_next_parent(of_parse_phandle(np, prop_name, index));
+}
+
static const struct supplier_bindings of_supplier_bindings[] = {
{ .parse_prop = parse_clocks, },
{ .parse_prop = parse_interconnects, },
@@ -1379,6 +1393,7 @@ static const struct supplier_bindings of_supplier_bindings[] = {
{ .parse_prop = parse_resets, },
{ .parse_prop = parse_leds, },
{ .parse_prop = parse_backlight, },
+ { .parse_prop = parse_phy_handle, },
{ .parse_prop = parse_gpio_compat, },
{ .parse_prop = parse_interrupts, },
{ .parse_prop = parse_regulators, },
--
2.33.0.rc1.237.g0d66db33f3-goog
Powered by blists - more mailing lists