Skip to contentSkip to conversation

clk: eyeq: instantiate generic PHY children auxiliary device

PATCH Applied Théo Lebrun 3 participants 9 messages Feb 25 – Apr 29

Subsystems (4)

v7 of 9 Applied Latest is v9 →

lore
Share & tools
lore

Théo Lebrun

author maintainer
#0 lore raw

v7 cover clk: eyeq: instantiate generic PHY children auxiliary device

EyeQ5 SoCs integrate two GEM instances. A system-controller register region named "OLB" has some control over the Ethernet PHY integration.

Extend the current OLB ecosystem with a new generic PHY driver.
- OLB is carried by one main platform driver: clk-eyeq.
- It instantiates auxiliary devices: reset-eyeq & pinctrl-eyeq5.
- We add a new one: phy-eyeq5-eth.

Mainly we spawn a new auxdev from clk-eyeq. But alongside we use the newly introduced helper devm_auxiliary_device_create() that has the implication of setting child dev->of_node from parent. That implies we must drop the device_set_of_node_from_dev() at the same time.

Philipp Zabel gave his ACK [2] for the reset patch to go into linux-clk.

About related patches:

- PHY patches are incoming to add the driver. Patches used to be [2] in the same series.

- MIPS patches are incoming to add MACB/GEM instances in devicetree and their associated PHYs. They also update dt-bindings to reflect this new feature OLB provides. Patches used to be [2] in the same series.

Have a nice day,
Thanks!
Théo

[0]: https://lore.kernel.org/lkml/[email protected]/
[1]: https://lore.kernel.org/lkml/[email protected]/
[2]: https://lore.kernel.org/lkml/[email protected]/

---
Changes in v7:
- Separate PHY / clk / MIPS patches into three series.
- Rebase onto v7.0-rc1 and test on EyeQ5. Nothing to report.
- Link to v6: https://lore.kernel.org/r/[email protected]

Changes in v6:
- Rebase upon v6.19-rc7; nothing to report.
- Add new patch "phy: sort Kconfig and Makefile".
- phy-eyeq5-eth: drop useless explicit __iomem cast to
dev_get_platdata() return value.
- I did *not* drop the Kconfig default MACH_EYEQ5 nor driver dev_dbg(). I think both are useful and should be kept. See
last revision discussion here:
https://lore.kernel.org/lkml/[email protected]/
- Link to v5: https://lore.kernel.org/r/[email protected]

Changes in v5:
- phy-eyeq5-eth:
- fix #includes: add delay, gfp_types, module and drop array_size,
bug, cleanup, container_of, lockdep, mutex.
- eq5_phy_xlate(): avoid magic value, use EQ5_PHY_COUNT.
- use dev_err_probe() in error cases of devm_phy_create() and devm_of_phy_provider_register().
- 3x Reviewed-by: Luca Ceresoli.
- Add Neil Armstrong to Cc as new PHY subsystem reviewer.
- Rebase on v6.19-rc1, tested on hardware, no changes.
- Link to v4: https://lore.kernel.org/r/[email protected]

Changes in v4:
- Append my SoB to Jerome's patch:
[PATCH v4 3/7] clk: eyeq: use the auxiliary device creation helper
- Rebase on net-next & linux-{clk,mips,phy}. Nothing to report.
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Take Philipp Zabel's Reviewed-by & Acked-by trailers on reset patch.
- Take Thomas Bogendoerfer's two Acked-by trailers on DT patches.
- Rebase on net-next & test on target. Nothing to report.
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Take Acked-by: Conor Dooley on dt-bindings-patch.
- s/%ld/%tu/ for printing ptrdiff_t; warnings on 32-bit archs.
Reported by NIPA's netdev/build_32bit test.
https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/
https://netdev.bots.linux.dev/static/nipa/1014126/14277857/build_32bit/stderr
- Link to v1: https://lore.kernel.org/r/[email protected]

Changes since MACB V1:
- Drop the old "mobileye,olb" properties from DT patches; found while
running dtbs_check and dt_binding_check.
- Drop all patches targeting net-next. That is MACB dt-bindings patch
and MACB driver code. See there here [1].
- Link to v1: https://lore.kernel.org/lkml/[email protected]/

Past versions of MACB patches:
- March 2025: [PATCH net-next 00/13] Support the Cadence MACB/GEM instances on Mobileye EyeQ5 SoCs
https://lore.kernel.org/lkml/[email protected]/
- June 2025: [PATCH net-next v2 00/18] Support the Cadence MACB/GEM instances on Mobileye EyeQ5 SoCs
https://lore.kernel.org/lkml/[email protected]/
- August 2025: [PATCH net v3 00/16] net: macb: various fixes & cleanup
https://lore.kernel.org/lkml/[email protected]/

---
Jerome Brunet (1):
clk: eyeq: use the auxiliary device creation helper

Théo Lebrun (2):
clk: eyeq: add EyeQ5 children auxiliary device for generic PHYs
reset: eyeq: drop device_set_of_node_from_dev() done by parent

 drivers/clk/clk-eyeq.c     | 60 ++++++++++++----------------------------------
 drivers/reset/reset-eyeq.c | 24 ++-----------------
 2 files changed, 17 insertions(+), 67 deletions(-)

---
base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
change-id: 20251022-macb-phy-21bc4e1dfbb7

Best regards,

Signature · 1 line
Théo Lebrun <[email protected]>
author maintainer
#1 lore raw

PATCH v7 1/3 clk: eyeq: use the auxiliary device creation helper

From: Jerome Brunet <[email protected]>

The auxiliary device creation of this driver is simple enough to use the available auxiliary device creation helper.

Use it and remove some boilerplate code.

---
 drivers/clk/clk-eyeq.c | 57 +++++++++++---------------------------------------
 1 file changed, 12 insertions(+), 45 deletions(-)
drivers/clk/clk-eyeq.c +12 -45
index 81137269352d..b231d6deb209 100644
@@ -322,38 +322,18 @@ static void eqc_probe_init_fixed_factors(struct device *dev,
 	}
 }
 
-static void eqc_auxdev_release(struct device *dev)
-{
-	struct auxiliary_device *adev = to_auxiliary_dev(dev);
-
-	kfree(adev);
-}
-
-static int eqc_auxdev_create(struct device *dev, void __iomem *base,
-			     const char *name, u32 id)
+static void eqc_auxdev_create_optional(struct device *dev, void __iomem *base,
+				       const char *name)
 {
 	struct auxiliary_device *adev;
-	int ret;
 
-	adev = kzalloc_obj(*adev);
-	if (!adev)
-		return -ENOMEM;
-
-	adev->name = name;
-	adev->dev.parent = dev;
-	adev->dev.platform_data = (void __force *)base;
-	adev->dev.release = eqc_auxdev_release;
-	adev->id = id;
-
-	ret = auxiliary_device_init(adev);
-	if (ret)
-		return ret;
-
-	ret = auxiliary_device_add(adev);
-	if (ret)
-		auxiliary_device_uninit(adev);
-
-	return ret;
+	if (name) {
+		adev = devm_auxiliary_device_create(dev, name,
+						    (void __force *)base);
+		if (!adev)
+			dev_warn(dev, "failed creating auxiliary device %s.%s\n",
+				 KBUILD_MODNAME, name);
+	}
 }
 
 static int eqc_probe(struct platform_device *pdev)
@@ -365,7 +345,6 @@ static int eqc_probe(struct platform_device *pdev)
 	unsigned int i, clk_count;
 	struct resource *res;
 	void __iomem *base;
-	int ret;
 
 	data = device_get_match_data(dev);
 	if (!data)
@@ -379,21 +358,9 @@ static int eqc_probe(struct platform_device *pdev)
 	if (!base)
 		return -ENOMEM;
 
-	/* Init optional reset auxiliary device. */
-	if (data->reset_auxdev_name) {
-		ret = eqc_auxdev_create(dev, base, data->reset_auxdev_name, 0);
-		if (ret)
-			dev_warn(dev, "failed creating auxiliary device %s.%s: %d\n",
-				 KBUILD_MODNAME, data->reset_auxdev_name, ret);
-	}
-
-	/* Init optional pinctrl auxiliary device. */
-	if (data->pinctrl_auxdev_name) {
-		ret = eqc_auxdev_create(dev, base, data->pinctrl_auxdev_name, 0);
-		if (ret)
-			dev_warn(dev, "failed creating auxiliary device %s.%s: %d\n",
-				 KBUILD_MODNAME, data->pinctrl_auxdev_name, ret);
-	}
+	/* Init optional auxiliary devices. */
+	eqc_auxdev_create_optional(dev, base, data->reset_auxdev_name);
+	eqc_auxdev_create_optional(dev, base, data->pinctrl_auxdev_name);
 
 	if (data->pll_count + data->div_count + data->fixed_factor_count == 0)
 		return 0; /* Zero clocks, we are done. */
Signature · 1 line
2.53.0
author maintainer
#3 lore raw

PATCH v7 2/3 clk: eyeq: add EyeQ5 children auxiliary device for generic PHYs

In reply to Théo Lebrun

Grow our clk-eyeq family; it knows how to spawn reset provider and pin controller children. Expand with a generic PHY driver on EyeQ5.

---
 drivers/clk/clk-eyeq.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/clk/clk-eyeq.c +3 -0
index b231d6deb209..b17f47fda1da 100644
@@ -109,6 +109,7 @@ struct eqc_match_data {
 
 	const char		*reset_auxdev_name;
 	const char		*pinctrl_auxdev_name;
+	const char		*eth_phy_auxdev_name;
 
 	unsigned int		early_clk_count;
 };
@@ -361,6 +362,7 @@ static int eqc_probe(struct platform_device *pdev)
 	/* Init optional auxiliary devices. */
 	eqc_auxdev_create_optional(dev, base, data->reset_auxdev_name);
 	eqc_auxdev_create_optional(dev, base, data->pinctrl_auxdev_name);
+	eqc_auxdev_create_optional(dev, base, data->eth_phy_auxdev_name);
 
 	if (data->pll_count + data->div_count + data->fixed_factor_count == 0)
 		return 0; /* Zero clocks, we are done. */
@@ -521,6 +523,7 @@ static const struct eqc_match_data eqc_eyeq5_match_data = {
 
 	.reset_auxdev_name = "reset",
 	.pinctrl_auxdev_name = "pinctrl",
+	.eth_phy_auxdev_name = "phy",
 
 	.early_clk_count = ARRAY_SIZE(eqc_eyeq5_early_plls) +
 			   ARRAY_SIZE(eqc_eyeq5_early_fixed_factors),
Signature · 1 line
2.53.0
author maintainer
#5 lore raw

PATCH v7 3/3 reset: eyeq: drop device_set_of_node_from_dev() done by parent

In reply to Théo Lebrun

Our parent driver (clk-eyeq) now does the

	device_set_of_node_from_dev(dev, dev->parent)

call through the newly introduced devm_auxiliary_device_create() helper.

Doing it again in the reset-eyeq probe would be redundant. Drop both the WARN_ON() and the device_set_of_node_from_dev() call. Also fix the following comment that talks about "our newfound OF node".

---
 drivers/reset/reset-eyeq.c | 24 ++----------------------
 1 file changed, 2 insertions(+), 22 deletions(-)
drivers/reset/reset-eyeq.c +2 -22
index 2d3998368a1c..8018fa895427 100644
@@ -410,13 +410,6 @@ static int eqr_of_xlate_twocells(struct reset_controller_dev *rcdev,
 	return eqr_of_xlate_internal(rcdev, reset_spec->args[0], reset_spec->args[1]);
 }
 
-static void eqr_of_node_put(void *_dev)
-{
-	struct device *dev = _dev;
-
-	of_node_put(dev->of_node);
-}
-
 static int eqr_probe(struct auxiliary_device *adev,
 		     const struct auxiliary_device_id *id)
 {
@@ -427,21 +420,8 @@ static int eqr_probe(struct auxiliary_device *adev,
 	int ret;
 
 	/*
-	 * We are an auxiliary device of clk-eyeq. We do not have an OF node by
-	 * default; let's reuse our parent's OF node.
-	 */
-	WARN_ON(dev->of_node);
-	device_set_of_node_from_dev(dev, dev->parent);
-	if (!dev->of_node)
-		return -ENODEV;
-
-	ret = devm_add_action_or_reset(dev, eqr_of_node_put, dev);
-	if (ret)
-		return ret;
-
-	/*
-	 * Using our newfound OF node, we can get match data. We cannot use
-	 * device_get_match_data() because it does not match reused OF nodes.
+	 * Get match data. We cannot use device_get_match_data() because it does
+	 * not accept reused OF nodes; see device_set_of_node_from_dev().
 	 */
 	match = of_match_node(dev->driver->of_match_table, dev->of_node);
 	if (!match || !match->data)
Signature · 1 line
2.53.0
maintainer
#8 lore raw
In reply to Théo Lebrun

Hello Michael, Stephen,

Quoted 8 lines · Théo Lebrun

EyeQ5 SoCs integrate two GEM instances. A system-controller register region named "OLB" has some control over the Ethernet PHY integration.

Extend the current OLB ecosystem with a new generic PHY driver.
- OLB is carried by one main platform driver: clk-eyeq.
- It instantiates auxiliary devices: reset-eyeq & pinctrl-eyeq5.
- We add a new one: phy-eyeq5-eth.

Quoted 7 lines

Mainly we spawn a new auxdev from clk-eyeq. But alongside we use the newly introduced helper devm_auxiliary_device_create() that has the implication of setting child dev->of_node from parent. That implies we must drop the device_set_of_node_from_dev() at the same time.

Philipp Zabel gave his ACK [2] for the reset patch to go into linux-clk.

Is there any way to move forward with this series?

With the latest changes merged in Linus' tree the Mobileye EyeQ SoCs fail to boot. This series is needed to resolve the boot failures.

Best regards,

Signature · 3 lines
Benoît Monin, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
maintainer Applied
#2 lore raw

Re: [PATCH v7 1/3] clk: eyeq: use the auxiliary device creation helper

In reply to Théo Lebrun

Quoting Théo Lebrun (2026-02-25 08:55:05)

Quoted 5 lines

From: Jerome Brunet <[email protected]>

The auxiliary device creation of this driver is simple enough to use the available auxiliary device creation helper.

Quoted 7 lines

Use it and remove some boilerplate code.

---

Applied to clk-fixes

maintainer Applied
#6 lore raw

Re: [PATCH v7 3/3] reset: eyeq: drop device_set_of_node_from_dev() done by parent

In reply to Théo Lebrun

Quoting Théo Lebrun (2026-02-25 08:55:07)

Quoted 8 lines

Our parent driver (clk-eyeq) now does the

        device_set_of_node_from_dev(dev, dev->parent)

call through the newly introduced devm_auxiliary_device_create() helper.

Doing it again in the reset-eyeq probe would be redundant. Drop both the WARN_ON() and the device_set_of_node_from_dev() call. Also fix the following comment that talks about "our newfound OF node".

Quoted 5 lines

---

Applied to clk-fixes

author maintainer
#7 lore raw

Re: [PATCH v7 3/3] reset: eyeq: drop device_set_of_node_from_dev() done by parent

Quoted 9 lines · Stephen Boyd

Quoting Théo Lebrun (2026-02-25 08:55:07)

Quoted 8 lines

Our parent driver (clk-eyeq) now does the

        device_set_of_node_from_dev(dev, dev->parent)

call through the newly introduced devm_auxiliary_device_create() helper.

Doing it again in the reset-eyeq probe would be redundant. Drop both the WARN_ON() and the device_set_of_node_from_dev() call. Also fix the following comment that talks about "our newfound OF node".

Quoted 7 lines
Quoted 5 lines

---

Applied to clk-fixes

Thanks Stephen!

--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com