[PATCH net-next 03/12] dpll: Add helpers to find DPLL pin fwnode

Ivan Vecera posted 12 patches 1 month ago
There is a newer version of this series
[PATCH net-next 03/12] dpll: Add helpers to find DPLL pin fwnode
Posted by Ivan Vecera 1 month ago
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@redhat.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
Re: [PATCH net-next 03/12] dpll: Add helpers to find DPLL pin fwnode
Posted by Krzysztof Kozlowski 1 month ago
On Thu, Jan 08, 2026 at 07:23:09PM +0100, Ivan Vecera wrote:
> 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@redhat.com>
> ---
>  drivers/dpll/dpll_core.c | 20 ++++++++++++++++++++
>  include/linux/dpll.h     | 15 +++++++++++++++
>  2 files changed, 35 insertions(+)
> 

I don't see cells defined in your binding. Neither updated property.c.

Best regards,
Krzysztof
Re: [PATCH net-next 03/12] dpll: Add helpers to find DPLL pin fwnode
Posted by Ivan Vecera 4 weeks, 1 day ago

On 1/9/26 10:55 AM, Krzysztof Kozlowski wrote:
> On Thu, Jan 08, 2026 at 07:23:09PM +0100, Ivan Vecera wrote:
>> 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@redhat.com>
>> ---
>>   drivers/dpll/dpll_core.c | 20 ++++++++++++++++++++
>>   include/linux/dpll.h     | 15 +++++++++++++++
>>   2 files changed, 35 insertions(+)
>>
> 
> I don't see cells defined in your binding. Neither updated property.c.

And if the cells are not required? I mean that dpll-names only specifies
array of phandles without parameters...

e.g.
dpll-pin-names = "abc", "def";
dpll-pins = <&dpll_pin_abc>, <&dpll_pin_def>;

Should '#dpll-pin-cells' be defined as constantly equal to 0?

Thanks,
Ivan

> 
> Best regards,
> Krzysztof
>
Re: [PATCH net-next 03/12] dpll: Add helpers to find DPLL pin fwnode
Posted by Krzysztof Kozlowski 3 weeks, 5 days ago
On 09/01/2026 15:19, Ivan Vecera wrote:
> 
> 
> On 1/9/26 10:55 AM, Krzysztof Kozlowski wrote:
>> On Thu, Jan 08, 2026 at 07:23:09PM +0100, Ivan Vecera wrote:
>>> 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@redhat.com>
>>> ---
>>>   drivers/dpll/dpll_core.c | 20 ++++++++++++++++++++
>>>   include/linux/dpll.h     | 15 +++++++++++++++
>>>   2 files changed, 35 insertions(+)
>>>
>>
>> I don't see cells defined in your binding. Neither updated property.c.
> 
> And if the cells are not required? I mean that dpll-names only specifies
> array of phandles without parameters...
> 
> e.g.
> dpll-pin-names = "abc", "def";
> dpll-pins = <&dpll_pin_abc>, <&dpll_pin_def>;
> 
> Should '#dpll-pin-cells' be defined as constantly equal to 0?

I don't understand how can you guarantee for every possible future
device to have always cells=0. If that's the case then indeed you do not
need cells, but this needs explanation. You are designing now entire
ABI, so you must design it fully, not just "works for me now".

Lack of complete DTS - nothing here, nothing in the changelog - is IMO
reason to NAK this patchset completely, also for reason me guessing the
entire design instead of seeing the big picture.

Best regards,
Krzysztof
Re: [PATCH net-next 03/12] dpll: Add helpers to find DPLL pin fwnode
Posted by Ivan Vecera 3 weeks, 5 days ago

On 1/12/26 5:20 PM, Krzysztof Kozlowski wrote:
> On 09/01/2026 15:19, Ivan Vecera wrote:
>>
>>
>> On 1/9/26 10:55 AM, Krzysztof Kozlowski wrote:
>>> On Thu, Jan 08, 2026 at 07:23:09PM +0100, Ivan Vecera wrote:
>>>> 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@redhat.com>
>>>> ---
>>>>    drivers/dpll/dpll_core.c | 20 ++++++++++++++++++++
>>>>    include/linux/dpll.h     | 15 +++++++++++++++
>>>>    2 files changed, 35 insertions(+)
>>>>
>>>
>>> I don't see cells defined in your binding. Neither updated property.c.
>>
>> And if the cells are not required? I mean that dpll-names only specifies
>> array of phandles without parameters...
>>
>> e.g.
>> dpll-pin-names = "abc", "def";
>> dpll-pins = <&dpll_pin_abc>, <&dpll_pin_def>;
>>
>> Should '#dpll-pin-cells' be defined as constantly equal to 0?
> 
> I don't understand how can you guarantee for every possible future
> device to have always cells=0. If that's the case then indeed you do not
> need cells, but this needs explanation. You are designing now entire
> ABI, so you must design it fully, not just "works for me now".

Get it, you are right... Theoretically is possible that number of cells
will be > 0.

Will add '#dpll-pin-cells'

Thanks,
Ivan
Re: [PATCH net-next 03/12] dpll: Add helpers to find DPLL pin fwnode
Posted by Ivan Vecera 1 month ago

On 1/9/26 10:55 AM, Krzysztof Kozlowski wrote:
> On Thu, Jan 08, 2026 at 07:23:09PM +0100, Ivan Vecera wrote:
>> 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@redhat.com>
>> ---
>>   drivers/dpll/dpll_core.c | 20 ++++++++++++++++++++
>>   include/linux/dpll.h     | 15 +++++++++++++++
>>   2 files changed, 35 insertions(+)
>>
> 
> I don't see cells defined in your binding. Neither updated property.c.
> 
WDYM by property.c ?

Thanks,
Ivan
Re: [PATCH net-next 03/12] dpll: Add helpers to find DPLL pin fwnode
Posted by Krzysztof Kozlowski 3 weeks, 5 days ago
On 09/01/2026 11:22, Ivan Vecera wrote:
> 
> 
> On 1/9/26 10:55 AM, Krzysztof Kozlowski wrote:
>> On Thu, Jan 08, 2026 at 07:23:09PM +0100, Ivan Vecera wrote:
>>> 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@redhat.com>
>>> ---
>>>   drivers/dpll/dpll_core.c | 20 ++++++++++++++++++++
>>>   include/linux/dpll.h     | 15 +++++++++++++++
>>>   2 files changed, 35 insertions(+)
>>>
>>
>> I don't see cells defined in your binding. Neither updated property.c.
>>
> WDYM by property.c ?

Each standardized phandle reliationship is supposed to be reflected with
device links (at least of now... maybe it already changed after this LPC?)

Best regards,
Krzysztof
Re: [PATCH net-next 03/12] dpll: Add helpers to find DPLL pin fwnode
Posted by Ivan Vecera 3 weeks, 5 days ago
On 1/12/26 5:16 PM, Krzysztof Kozlowski wrote:
> On 09/01/2026 11:22, Ivan Vecera wrote:
>>
>>
>> On 1/9/26 10:55 AM, Krzysztof Kozlowski wrote:
>>> On Thu, Jan 08, 2026 at 07:23:09PM +0100, Ivan Vecera wrote:
>>>> 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@redhat.com>
>>>> ---
>>>>    drivers/dpll/dpll_core.c | 20 ++++++++++++++++++++
>>>>    include/linux/dpll.h     | 15 +++++++++++++++
>>>>    2 files changed, 35 insertions(+)
>>>>
>>>
>>> I don't see cells defined in your binding. Neither updated property.c.
>>>
>> WDYM by property.c ?
> 
> Each standardized phandle reliationship is supposed to be reflected with
> device links (at least of now... maybe it already changed after this LPC?)

Do you mean 'supplier_bindings' in drivers/of/property.c ?

Thanks,
Ivan