[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260108182318.20935-4-ivecera@redhat.com>
Date: Thu, 8 Jan 2026 19:23:09 +0100
From: Ivan Vecera <ivecera@...hat.com>
To: netdev@...r.kernel.org
Cc: Vadim Fedorenko <vadim.fedorenko@...ux.dev>,
Arkadiusz Kubalewski <arkadiusz.kubalewski@...el.com>,
Jiri Pirko <jiri@...nulli.us>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Prathosh Satish <Prathosh.Satish@...rochip.com>,
Tony Nguyen <anthony.l.nguyen@...el.com>,
Przemek Kitszel <przemyslaw.kitszel@...el.com>,
Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Saeed Mahameed <saeedm@...dia.com>,
Leon Romanovsky <leon@...nel.org>,
Tariq Toukan <tariqt@...dia.com>,
Mark Bloch <mbloch@...dia.com>,
Jonathan Lemon <jonathan.lemon@...il.com>,
Richard Cochran <richardcochran@...il.com>,
Alexander Lobakin <aleksander.lobakin@...el.com>,
devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org,
intel-wired-lan@...ts.osuosl.org,
linux-rdma@...r.kernel.org,
Michal Schmidt <mschmidt@...hat.com>,
Petr Oros <poros@...hat.com>,
Grzegorz Nitka <grzegorz.nitka@...el.com>
Subject: [PATCH net-next 03/12] dpll: Add helpers to find DPLL pin fwnode
Add helper functions to the DPLL core to retrieve a DPLL pin's firmware
node handle based on the "dpll-pins" and "dpll-pin-names" properties.
* `fwnode_dpll_pin_node_get()`: matches the given name against the
"dpll-pin-names" property to find the correct index, then retrieves
the reference from "dpll-pins".
* `device_dpll_pin_node_get()`: a wrapper around the fwnode helper for
convenience when using a `struct device`.
These helpers simplify the process for consumer drivers (such as Ethernet
controllers or PHYs) to look up their associated DPLL pins defined in
the DT or ACPI, which can then be passed to the DPLL subsystem to acquire
the pin object.
Signed-off-by: Ivan Vecera <ivecera@...hat.com>
---
drivers/dpll/dpll_core.c | 20 ++++++++++++++++++++
include/linux/dpll.h | 15 +++++++++++++++
2 files changed, 35 insertions(+)
diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c
index fb68b5e19b480..23d04a9d022d7 100644
--- a/drivers/dpll/dpll_core.c
+++ b/drivers/dpll/dpll_core.c
@@ -654,6 +654,26 @@ struct dpll_pin *fwnode_dpll_pin_find(struct fwnode_handle *fwnode)
}
EXPORT_SYMBOL_GPL(fwnode_dpll_pin_find);
+/**
+ * fwnode_dpll_pin_node_get - get dpll pin node from given fw node and pin name
+ * @fwnode: firmware node that uses the dpll pin
+ * @name: dpll pin name from dpll-pin-names property
+ *
+ * Return: ERR_PTR() on error or a valid firmware node handle on success.
+ */
+struct fwnode_handle *fwnode_dpll_pin_node_get(struct fwnode_handle *fwnode,
+ const char *name)
+{
+ int index = 0;
+
+ if (name)
+ index = fwnode_property_match_string(fwnode, "dpll-pin-names",
+ name);
+
+ return fwnode_find_reference(fwnode, "dpll-pins", index);
+}
+EXPORT_SYMBOL_GPL(fwnode_dpll_pin_node_get);
+
static int
__dpll_pin_register(struct dpll_device *dpll, struct dpll_pin *pin,
const struct dpll_pin_ops *ops, void *priv, void *cookie)
diff --git a/include/linux/dpll.h b/include/linux/dpll.h
index f0c31a111c304..755c36d1ef45a 100644
--- a/include/linux/dpll.h
+++ b/include/linux/dpll.h
@@ -11,6 +11,7 @@
#include <linux/device.h>
#include <linux/netlink.h>
#include <linux/netdevice.h>
+#include <linux/property.h>
#include <linux/rtnetlink.h>
struct dpll_device;
@@ -176,6 +177,8 @@ int dpll_netdev_add_pin_handle(struct sk_buff *msg,
const struct net_device *dev);
struct dpll_pin *fwnode_dpll_pin_find(struct fwnode_handle *fwnode);
+struct fwnode_handle *fwnode_dpll_pin_node_get(struct fwnode_handle *fwnode,
+ const char *name);
#else
static inline void
dpll_netdev_pin_set(struct net_device *dev, struct dpll_pin *dpll_pin) { }
@@ -197,8 +200,20 @@ fwnode_dpll_pin_find(struct fwnode_handle *fwnode)
{
return NULL;
}
+
+static inline struct fwnode_handle *
+fwnode_dpll_pin_node_get(struct fwnode_handle *fwnode, const char *name)
+{
+ return NULL;
+}
#endif
+static inline struct fwnode_handle *
+device_dpll_pin_node_get(struct device *dev, const char *name)
+{
+ return fwnode_dpll_pin_node_get(dev_fwnode(dev), name);
+}
+
struct dpll_device *
dpll_device_get(u64 clock_id, u32 dev_driver_id, struct module *module);
--
2.52.0
Powered by blists - more mailing lists