Skip to contentSkip to conversation

Add generic PHY driver used by MACB/GEM on EyeQ5

PATCH Superseded Théo Lebrun 3 participants 13 messages Nov 1, 2025 – Nov 7, 2025

Subsystems (6)

v2 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Théo Lebrun

author maintainer
#0 lore raw

v2 cover Add generic PHY driver used by MACB/GEM on EyeQ5

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

Past iterations [0] touched those syscon registers directly from MACB. It was a bad idea. 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.

Here is a DT overview:

   olb: system-controller@e00000 {
           compatible = "mobileye,eyeq5-olb", "syscon";
           reg = <0 0xe00000 0x0 0x400>;
           // ...
           #reset-cells = <2>;
           #clock-cells = <1>;
           #phy-cells = <1>; // <= this is new
   };

   macb0: ethernet@2a00000 {
           compatible = "mobileye,eyeq5-gem";
           phys = <&olb 0>; // <= GEM device consumes the PHY
           // ...
   };

   macb1: ethernet@2b00000 {
           compatible = "mobileye,eyeq5-gem";
           phys = <&olb 1>; // <= same thing for the second instance
           // ...
   };

The Linux MACB driver already consumes a generic PHY for some other compatibles, this is nothing new. The MACB series [1] has been merged into net-next/main.

--

One topic to talk about: the whole "we must assign child->of_node manually". Auxiliary driver core does not do it automatically, so either the parent (clk-eyeq) or the children must do it.

In OLB land, until now, children were doing it with a device_set_of_node_from_dev(dev, dev->parent) call in probe.

Recently, Jerome Brunet added devm_auxiliary_device_create():
eaa0d30216c1 ("driver core: auxiliary bus: add device creation helpers"). Using that cleans up clk-eyeq but means we must remove device_set_of_node_from_dev() from reset-eyeq in the same patch series, as the helpers do the dev->of_node assignement from the parent driver.

That explains why the ideal patch:
[PATCH 4/7] clk: eyeq: add EyeQ5 children auxiliary device for generic PHYs Turned into those three:
[PATCH 3/7] clk: eyeq: use the auxiliary device creation helper [PATCH 4/7] clk: eyeq: add EyeQ5 children auxiliary device for generic PHYs [PATCH 5/7] reset: eyeq: drop device_set_of_node_from_dev() done by parent

--

About merging, it'll probably be complex. I see no build dependencies, but the board will be in an odd state if only some patches are applied. Some dev_warn() at boot and dev->of_node refcounting issues at unload.

- [PATCH 1/7] dt-bindings: soc: mobileye: OLB is an Ethernet PHY provider on EyeQ5 We touch dt-bindings because OLB becomes a PHY provider.
=> linux-mips (?)

- [PATCH 2/7] phy: Add driver for EyeQ5 Ethernet PHY wrapper We add the generic PHY driver in drivers/phy/phy-eyeq5-eth.c with the usual Kconfig, Makefile and MAINTAINERS changes.
=> linux-phy (?)

- [PATCH 6/7] MIPS: mobileye: eyeq5: add two Cadence GEM Ethernet controllers [PATCH 7/7] MIPS: mobileye: eyeq5-epm: add two Cadence GEM Ethernet PHYs DTS patches to add both the #phy-cells of OLB and the MACB instances. => linux-mips

- [PATCH 4/7] clk: eyeq: add EyeQ5 children auxiliary device for generic PHYs We must update clk-eyeq because it instantiates a new auxdev. => linux-clk

- [PATCH 3/7] clk: eyeq: use the auxiliary device creation helper [PATCH 5/7] reset: eyeq: drop device_set_of_node_from_dev() done by parent With the dev->of_node assignement, we must also correct reset-eyeq. => separate them into linux-clk and linux-reset?

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/all/[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 (6):
dt-bindings: soc: mobileye: OLB is an Ethernet PHY provider on EyeQ5
phy: Add driver for EyeQ5 Ethernet PHY wrapper
clk: eyeq: add EyeQ5 children auxiliary device for generic PHYs
reset: eyeq: drop device_set_of_node_from_dev() done by parent
MIPS: mobileye: eyeq5: add two Cadence GEM Ethernet controllers
MIPS: mobileye: eyeq5-epm: add two Cadence GEM Ethernet PHYs

 .../bindings/soc/mobileye/mobileye,eyeq5-olb.yaml  |   7 +-
 MAINTAINERS                                        |   1 +
 arch/mips/boot/dts/mobileye/eyeq5-epm5.dts         |  26 +++
 arch/mips/boot/dts/mobileye/eyeq5.dtsi             |  45 ++++
 drivers/clk/clk-eyeq.c                             |  60 ++---
 drivers/phy/Kconfig                                |  13 ++
 drivers/phy/Makefile                               |   1 +
 drivers/phy/phy-eyeq5-eth.c                        | 254 +++++++++++++++++++++
 drivers/reset/reset-eyeq.c                         |  24 +-
 9 files changed, 363 insertions(+), 68 deletions(-)

---
base-commit: 01cc760632b875c4ad0d8fec0b0c01896b8a36d4
change-id: 20251022-macb-phy-21bc4e1dfbb7

Best regards,

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

PATCH v2 1/7 dt-bindings: soc: mobileye: OLB is an Ethernet PHY provider on EyeQ5

OLB on EyeQ5 ("mobileye,eyeq5-olb" compatible) is now declared as a generic PHY provider. Under the hood, it provides Ethernet RGMII/SGMII PHY support for both MAC instances.

---
 .../devicetree/bindings/soc/mobileye/mobileye,eyeq5-olb.yaml       | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/soc/mobileye/mobileye,eyeq5-olb.yaml +6 -1
index 6d11472ba5a7..56401d76a9b5 100644
@@ -51,6 +51,9 @@ properties:
   clock-names:
     const: ref
 
+  '#phy-cells':
+    const: 1
+
 patternProperties:
   '-pins?$':
     type: object
@@ -310,7 +313,7 @@ allOf:
       properties:
         '#reset-cells': false
 
-    # Only EyeQ5 has pinctrl in OLB.
+    # Only EyeQ5 has pinctrl and PHY in OLB.
   - if:
       not:
         properties:
@@ -320,6 +323,8 @@ allOf:
     then:
       patternProperties:
         '-pins?$': false
+      properties:
+        '#phy-cells': false
 
 examples:
   - |
Signature · 1 line
2.51.1
author maintainer
#2 lore raw

PATCH v2 2/7 phy: Add driver for EyeQ5 Ethernet PHY wrapper

In reply to Théo Lebrun

EyeQ5 embeds a system-controller called OLB. It features many unrelated registers, and some of those are registers used to configure the integration of the RGMII/SGMII Cadence PHY used by MACB/GEM instances.

Wrap in a neat generic PHY provider, exposing two PHYs with standard phy_init() / phy_set_mode() / phy_power_on() operations.

---
 MAINTAINERS                 |   1 +
 drivers/phy/Kconfig         |  13 +++
 drivers/phy/Makefile        |   1 +
 drivers/phy/phy-eyeq5-eth.c | 254 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 269 insertions(+)
MAINTAINERS +1 -0
index 1ab7e8746299..9e748955061b 100644
@@ -17394,6 +17394,7 @@ F:	arch/mips/boot/dts/mobileye/
 F:	arch/mips/configs/eyeq5_defconfig
 F:	arch/mips/mobileye/board-epm5.its.S
 F:	drivers/clk/clk-eyeq.c
+F:	drivers/phy/phy-eyeq5-eth.c
 F:	drivers/pinctrl/pinctrl-eyeq5.c
 F:	drivers/reset/reset-eyeq.c
 F:	include/dt-bindings/clock/mobileye,eyeq5-clk.h
drivers/phy/Kconfig +13 -0
index 678dd0452f0a..1aa6eff12dbc 100644
@@ -101,6 +101,19 @@ config PHY_NXP_PTN3222
 	  schemes. It supports all three USB 2.0 data rates: Low Speed, Full
 	  Speed and High Speed.
 
+config PHY_EYEQ5_ETH
+	tristate "Ethernet PHY Driver on EyeQ5"
+	depends on OF
+	depends on MACH_EYEQ5 || COMPILE_TEST
+	select AUXILIARY_BUS
+	select GENERIC_PHY
+	default MACH_EYEQ5
+	help
+	  Enable this to support the Ethernet PHY integrated on EyeQ5.
+	  It supports both RGMII and SGMII. Registers are located in a
+	  shared register region called OLB. If M is selected, the
+	  module will be called phy-eyeq5-eth.
+
 source "drivers/phy/allwinner/Kconfig"
 source "drivers/phy/amlogic/Kconfig"
 source "drivers/phy/broadcom/Kconfig"
drivers/phy/Makefile +1 -0
index bfb27fb5a494..8289497ece55 100644
@@ -13,6 +13,7 @@ obj-$(CONFIG_PHY_SNPS_EUSB2)		+= phy-snps-eusb2.o
 obj-$(CONFIG_USB_LGM_PHY)		+= phy-lgm-usb.o
 obj-$(CONFIG_PHY_AIROHA_PCIE)		+= phy-airoha-pcie.o
 obj-$(CONFIG_PHY_NXP_PTN3222)		+= phy-nxp-ptn3222.o
+obj-$(CONFIG_PHY_EYEQ5_ETH)		+= phy-eyeq5-eth.o
 obj-y					+= allwinner/	\
 					   amlogic/	\
 					   broadcom/	\
drivers/phy/phy-eyeq5-eth.c new file +254 -0

254 lines not on this page · raw message

Signature · 1 line
2.51.1
author maintainer
#3 lore raw

PATCH v2 3/7 clk: eyeq: use the auxiliary device creation helper

In reply to Théo Lebrun

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 ea1c3d78e7cd..664ce7d7868d 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(sizeof(*adev), GFP_KERNEL);
-	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.51.1
author maintainer
#4 lore raw

PATCH v2 4/7 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 664ce7d7868d..a9de57315e48 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.51.1
author maintainer
#5 lore raw

PATCH v2 5/7 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.51.1
author maintainer
#7 lore raw

PATCH v2 6/7 MIPS: mobileye: eyeq5: add two Cadence GEM Ethernet controllers

In reply to Théo Lebrun

Add both MACB/GEM instances found in the Mobileye EyeQ5 SoC.

---
 arch/mips/boot/dts/mobileye/eyeq5.dtsi | 45 ++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
arch/mips/boot/dts/mobileye/eyeq5.dtsi +45 -0
index 36a73e8a63a1..cec5ad875228 100644
@@ -77,6 +77,8 @@ aliases {
 		serial0 = &uart0;
 		serial1 = &uart1;
 		serial2 = &uart2;
+		ethernet0 = &macb0;
+		ethernet1 = &macb1;
 	};
 
 	cpu_intc: interrupt-controller {
@@ -231,6 +233,7 @@ olb: system-controller@e00000 {
 			#clock-cells = <1>;
 			clocks = <&xtal>;
 			clock-names = "ref";
+			#phy-cells = <1>;
 		};
 
 		gic: interrupt-controller@140000 {
@@ -305,6 +308,48 @@ gpio1: gpio@1500000 {
 			#interrupt-cells = <2>;
 			resets = <&olb 0 26>;
 		};
+
+		iocu-bus {
+			compatible = "simple-bus";
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges;
+			dma-coherent;
+			dma-ranges = <0x10 0x00000000 0x0 0x0 0x10 0>;
+
+			macb0: ethernet@2a00000 {
+				compatible = "mobileye,eyeq5-gem";
+				reg = <0x0 0x02a00000 0x0 0x4000>;
+				interrupt-parent = <&gic>;
+				/* One interrupt per queue */
+				interrupts = <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>,
+					     <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>,
+					     <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>,
+					     <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>;
+				clock-names = "pclk", "hclk", "tsu_clk";
+				clocks = <&pclk>, <&pclk>, <&tsu_clk>;
+				nvmem-cells = <&eth0_mac>;
+				nvmem-cell-names = "mac-address";
+				phys = <&olb 0>;
+			};
+
+			macb1: ethernet@2b00000 {
+				compatible = "mobileye,eyeq5-gem";
+				reg = <0x0 0x02b00000 0x0 0x4000>;
+				interrupt-parent = <&gic>;
+				/* One interrupt per queue */
+				interrupts = <GIC_SHARED 24 IRQ_TYPE_LEVEL_HIGH>,
+					     <GIC_SHARED 24 IRQ_TYPE_LEVEL_HIGH>,
+					     <GIC_SHARED 24 IRQ_TYPE_LEVEL_HIGH>,
+					     <GIC_SHARED 24 IRQ_TYPE_LEVEL_HIGH>;
+				clock-names = "pclk", "hclk", "tsu_clk";
+				clocks = <&pclk>, <&pclk>, <&tsu_clk>;
+				nvmem-cells = <&eth1_mac>;
+				nvmem-cell-names = "mac-address";
+				phys = <&olb 1>;
+			};
+		};
+
 	};
 };
 
Signature · 1 line
2.51.1
author maintainer
#9 lore raw

PATCH v2 7/7 MIPS: mobileye: eyeq5-epm: add two Cadence GEM Ethernet PHYs

In reply to Théo Lebrun

The Mobileye EyeQ5 eval board (EPM) embeds two MDIO PHYs.

---
 arch/mips/boot/dts/mobileye/eyeq5-epm5.dts | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
arch/mips/boot/dts/mobileye/eyeq5-epm5.dts +26 -0
index 9fc1a1b0a81b..babf52731ea6 100644
@@ -29,3 +29,29 @@ temperature-sensor@48 {
 		label = "U60";
 	};
 };
+
+&macb0 {
+	phy-mode = "sgmii";
+	phy-handle = <&macb0_phy>;
+
+	mdio {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		macb0_phy: ethernet-phy@e {
+			reg = <0xe>;
+		};
+	};
+};
+
+&macb1 {
+	phy-mode = "rgmii-id";
+	phy-handle = <&macb1_phy>;
+
+	mdio {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		macb1_phy: ethernet-phy@e {
+			reg = <0xe>;
+		};
+	};
+};
Signature · 1 line
2.51.1
maintainer Reviewed-by Acked-by on v2 5/7
#6 lore raw

Re: [PATCH v2 5/7] reset: eyeq: drop device_set_of_node_from_dev() done by parent

In reply to Théo Lebrun
Quoted 10 lines · 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".

and

to be merged via the clk tree together with patch 3.

regards
Philipp

maintainer
#11 lore raw
In reply to Théo Lebrun
Quoted 79 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.

Past iterations [0] touched those syscon registers directly from MACB. It was a bad idea. 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.

Here is a DT overview:

   olb: system-controller@e00000 {
           compatible = "mobileye,eyeq5-olb", "syscon";
           reg = <0 0xe00000 0x0 0x400>;
           // ...
           #reset-cells = <2>;
           #clock-cells = <1>;
           #phy-cells = <1>; // <= this is new
   };

   macb0: ethernet@2a00000 {
           compatible = "mobileye,eyeq5-gem";
           phys = <&olb 0>; // <= GEM device consumes the PHY
           // ...
   };

   macb1: ethernet@2b00000 {
           compatible = "mobileye,eyeq5-gem";
           phys = <&olb 1>; // <= same thing for the second instance
           // ...
   };

The Linux MACB driver already consumes a generic PHY for some other compatibles, this is nothing new. The MACB series [1] has been merged into net-next/main.

--

One topic to talk about: the whole "we must assign child->of_node manually". Auxiliary driver core does not do it automatically, so either the parent (clk-eyeq) or the children must do it.

In OLB land, until now, children were doing it with a device_set_of_node_from_dev(dev, dev->parent) call in probe.

Recently, Jerome Brunet added devm_auxiliary_device_create():
eaa0d30216c1 ("driver core: auxiliary bus: add device creation helpers"). Using that cleans up clk-eyeq but means we must remove device_set_of_node_from_dev() from reset-eyeq in the same patch series, as the helpers do the dev->of_node assignement from the parent driver.

That explains why the ideal patch:
[PATCH 4/7] clk: eyeq: add EyeQ5 children auxiliary device for generic PHYs Turned into those three:
[PATCH 3/7] clk: eyeq: use the auxiliary device creation helper [PATCH 4/7] clk: eyeq: add EyeQ5 children auxiliary device for generic PHYs [PATCH 5/7] reset: eyeq: drop device_set_of_node_from_dev() done by parent

--

About merging, it'll probably be complex. I see no build dependencies, but the board will be in an odd state if only some patches are applied. Some dev_warn() at boot and dev->of_node refcounting issues at unload.

- [PATCH 1/7] dt-bindings: soc: mobileye: OLB is an Ethernet PHY provider on EyeQ5 We touch dt-bindings because OLB becomes a PHY provider.
=> linux-mips (?)

- [PATCH 2/7] phy: Add driver for EyeQ5 Ethernet PHY wrapper We add the generic PHY driver in drivers/phy/phy-eyeq5-eth.c with the usual Kconfig, Makefile and MAINTAINERS changes.
=> linux-phy (?)

- [PATCH 6/7] MIPS: mobileye: eyeq5: add two Cadence GEM Ethernet controllers [PATCH 7/7] MIPS: mobileye: eyeq5-epm: add two Cadence GEM Ethernet PHYs DTS patches to add both the #phy-cells of OLB and the MACB instances. => linux-mips

Quoted 8 lines

- [PATCH 4/7] clk: eyeq: add EyeQ5 children auxiliary device for generic PHYs We must update clk-eyeq because it instantiates a new auxdev. => linux-clk

- [PATCH 3/7] clk: eyeq: use the auxiliary device creation helper [PATCH 5/7] reset: eyeq: drop device_set_of_node_from_dev() done by parent With the dev->of_node assignement, we must also correct reset-eyeq. => separate them into linux-clk and linux-reset?

Since 3 and 4 should go via clk, and 5 has a dependency on 3, I would suggest merging them all together.

regards
Philipp

author maintainer
#12 lore raw
Quoted 23 lines · Philipp Zabel
Quoted 22 lines · Théo Lebrun

About merging, it'll probably be complex. I see no build dependencies, but the board will be in an odd state if only some patches are applied. Some dev_warn() at boot and dev->of_node refcounting issues at unload.

- [PATCH 1/7] dt-bindings: soc: mobileye: OLB is an Ethernet PHY provider on EyeQ5 We touch dt-bindings because OLB becomes a PHY provider.
=> linux-mips (?)

- [PATCH 2/7] phy: Add driver for EyeQ5 Ethernet PHY wrapper We add the generic PHY driver in drivers/phy/phy-eyeq5-eth.c with the usual Kconfig, Makefile and MAINTAINERS changes.
=> linux-phy (?)

- [PATCH 6/7] MIPS: mobileye: eyeq5: add two Cadence GEM Ethernet controllers [PATCH 7/7] MIPS: mobileye: eyeq5-epm: add two Cadence GEM Ethernet PHYs DTS patches to add both the #phy-cells of OLB and the MACB instances. => linux-mips

- [PATCH 4/7] clk: eyeq: add EyeQ5 children auxiliary device for generic PHYs We must update clk-eyeq because it instantiates a new auxdev. => linux-clk

Quoted 7 lines
Quoted 4 lines

- [PATCH 3/7] clk: eyeq: use the auxiliary device creation helper [PATCH 5/7] reset: eyeq: drop device_set_of_node_from_dev() done by parent With the dev->of_node assignement, we must also correct reset-eyeq. => separate them into linux-clk and linux-reset?

Since 3 and 4 should go via clk, and 5 has a dependency on 3, I would suggest merging them all together.

Thanks for the feedback Philipp, and the review on [5/7]. Getting it merged in linux-clk will ease the process and avoid breakage. Updated summary:

- [PATCH 1/7] dt-bindings: soc: mobileye: OLB is an Ethernet PHY provider on EyeQ5 [PATCH 6/7] MIPS: mobileye: eyeq5: add two Cadence GEM Ethernet controllers [PATCH 7/7] MIPS: mobileye: eyeq5-epm: add two Cadence GEM Ethernet PHYs => linux-mips

- [PATCH 2/7] phy: Add driver for EyeQ5 Ethernet PHY wrapper => linux-phy

- [PATCH 3/7] clk: eyeq: use the auxiliary device creation helper [PATCH 4/7] clk: eyeq: add EyeQ5 children auxiliary device for generic PHYs [PATCH 5/7] reset: eyeq: drop device_set_of_node_from_dev() done by parent => linux-clk

I might send V3 soon, with your trailers appended.

Thanks,

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

maintainer Acked-by on v2 6/7
#8 lore raw

Re: [PATCH v2 6/7] MIPS: mobileye: eyeq5: add two Cadence GEM Ethernet controllers

In reply to Théo Lebrun
Quoted 6 lines · Théo Lebrun

Add both MACB/GEM instances found in the Mobileye EyeQ5 SoC.

---
 arch/mips/boot/dts/mobileye/eyeq5.dtsi | 45 ++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
Signature · 7 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

-- 
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
maintainer Acked-by on v2 7/7
#10 lore raw

Re: [PATCH v2 7/7] MIPS: mobileye: eyeq5-epm: add two Cadence GEM Ethernet PHYs

In reply to Théo Lebrun
Quoted 7 lines · Théo Lebrun

The Mobileye EyeQ5 eval board (EPM) embeds two MDIO PHYs.

---
 arch/mips/boot/dts/mobileye/eyeq5-epm5.dts | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
Signature · 7 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

-- 
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy