phy: Add generic PHY driver used by MACB/GEM on EyeQ5
Subsystems (3)
Théo Lebrun
maintainerPATCH v8 1/1 phy: 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.
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.
About related patches:
- The MACB series [1] has been merged in v6.19-rc1. It makes MACB consume a generic PHY from devicetree with the EyeQ5 compatible.
- clk patches are on the lkml [3]; they make clk-eyeq instantiate this new auxiliary device. They also ensure we get a dev->of_node assigned. Patches used to be [2] in the same series.
- MIPS patches are on the lkml [4]; they 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/all/[email protected]/
[3]: https://lore.kernel.org/all/[email protected]/
[4]: https://lore.kernel.org/all/[email protected]/
---
Changes in v8:
- Rebase upon linux-phy/next. Drop sorting Kconfig/Makefile patch
because one exists upstream.
- Instead of storing a phy_interface_t to know which submode to target, store a custom enum with two states (RGMII/SGMII). Ignore RGMII
timings in this generic PHY driver because they are handled by the
net PHY.
- eq5_phy_set_mode() calls into eq5_phy_validate() and now propagates
its error return value. Previously it shadowed EINVAL with EOPNOTSUPP.
- Link to v7: https://lore.kernel.org/r/[email protected]
Changes in v7:
- Separate PHY / clk / MIPS patches into three series.
- Implement phy_validate().
- phy_power_on() now supports being called without a prior
phy_set_mode() because at probe we read the hardware state to initialise inst->phy_instance.
- phy_set_mode() now support being called while the PHY is powered on.
- Add sgmii_support bool for each PHY instance to reject SGMII configuration on PHY 1 which only supports RGMII.
- Drop dev_dbg() calls.
- Drop readl(gp) in phy_init().
- Replace inst->priv field by inst->dev; that is the only value we need from the driver private data. Drop priv->dev field that is unused.
- Call into phy_exit() from phy_init() as the sequence is the same.
Add comment to explain the reasoning.
- Take Reviewed-by: Luca on "phy: sort Kconfig and Makefile".
- Rebase onto v7.0-rc1 and test on EyeQ5. Only diff to report:
PHY_COMMON_PROPS and PHY_COMMON_PROPS_TEST are kept at the top in the sorting patch; we do not strictly respect an alphabetical ordering.
- 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]/
---
Théo Lebrun (1):
phy: Add driver for EyeQ5 Ethernet PHY wrapper
MAINTAINERS | 1 + drivers/phy/Kconfig | 13 ++ drivers/phy/Makefile | 1 + drivers/phy/phy-eyeq5-eth.c | 280 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 295 insertions(+)
---
base-commit: caf08514bbee0736c31d8d4f406e3415cdf726bb
change-id: 20251022-macb-phy-21bc4e1dfbb7
Best regards,
Signature · 1 line
Théo Lebrun <[email protected]>
Théo Lebrun
maintainerPATCH v8 1/1 phy: Add driver for EyeQ5 Ethernet PHY wrapper
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 | 280 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 295 insertions(+)
MAINTAINERS +1 -0
@@ -17812,6 +17812,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
@@ -67,6 +67,19 @@ config PHY_CAN_TRANSCEIVER functional modes using gpios and sets the attribute max link rate, for CAN drivers. +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. + config PHY_GOOGLE_USB tristate "Google Tensor SoC USB PHY driver" select GENERIC_PHY
drivers/phy/Makefile +1 -0
@@ -9,6 +9,7 @@ obj-$(CONFIG_GENERIC_PHY) += phy-core.o obj-$(CONFIG_GENERIC_PHY_MIPI_DPHY) += phy-core-mipi-dphy.o obj-$(CONFIG_PHY_AIROHA_PCIE) += phy-airoha-pcie.o obj-$(CONFIG_PHY_CAN_TRANSCEIVER) += phy-can-transceiver.o +obj-$(CONFIG_PHY_EYEQ5_ETH) += phy-eyeq5-eth.o obj-$(CONFIG_PHY_GOOGLE_USB) += phy-google-usb.o obj-$(CONFIG_USB_LGM_PHY) += phy-lgm-usb.o obj-$(CONFIG_PHY_LPC18XX_USB_OTG) += phy-lpc18xx-usb-otg.o
drivers/phy/phy-eyeq5-eth.c new file +280 -0
280 lines not on this page · raw message
Signature · 1 line
2.53.0
kernel test robot
build botRe: [PATCH v8] phy: Add driver for EyeQ5 Ethernet PHY wrapper
kernel test robot noticed the following build warnings:
Hi Théo,
kernel test robot noticed the following build warnings:
[auto build test WARNING on next-20260305]
[cannot apply to linus/master v7.0-rc2 v7.0-rc1 v6.19 v7.0-rc2] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Th-o-Lebrun/phy-Add-driver-for-EyeQ5-Ethernet-PHY-wrapper/20260307-034032 base: next-20260305 patch link: https://lore.kernel.org/r/20260306-macb-phy-v8-1-b5c48ee61402%40bootlin.com patch subject: [PATCH v8] phy: Add driver for EyeQ5 Ethernet PHY wrapper config: arm-randconfig-r111-20260308 (https://download.01.org/0day-ci/archive/20260308/[email protected]/config) compiler: arm-linux-gnueabi-gcc (GCC) 10.5.0 sparse: v0.6.5-rc1 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260308/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
sparse warnings: (new ones prefixed by >>)
>> drivers/phy/phy-eyeq5-eth.c:246:14: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void [noderef] __iomem *base @@ got void * @@
drivers/phy/phy-eyeq5-eth.c:246:14: sparse: expected void [noderef] __iomem *base
drivers/phy/phy-eyeq5-eth.c:246:14: sparse: got void *
vim +246 drivers/phy/phy-eyeq5-eth.c
230
231 static int eq5_phy_probe(struct auxiliary_device *adev,
232 const struct auxiliary_device_id *id)
233 {
234 struct device *dev = &adev->dev;
235 struct phy_provider *provider;
236 struct eq5_phy_private *priv;
237 void __iomem *base;
238 int ret;
239
240 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
241 if (!priv)
242 return -ENOMEM;
243
244 dev_set_drvdata(dev, priv);
245
> 246 base = dev_get_platdata(dev);
247
248 ret = eq5_phy_probe_phy(dev, priv, 0, base, EQ5_PHY0_GP,
249 EQ5_PHY0_SGMII, true);
250 if (ret)
251 return ret;
252
253 ret = eq5_phy_probe_phy(dev, priv, 1, base, EQ5_PHY1_GP,
254 EQ5_PHY1_SGMII, false);
255 if (ret)
256 return ret;
257
258 provider = devm_of_phy_provider_register(dev, eq5_phy_xlate);
259 if (IS_ERR(provider))
260 return dev_err_probe(dev, PTR_ERR(provider),
261 "registering provider failed\n");
262
263 return 0;
264 }
265
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki