Re: [PATCH net-next v2 0/4] of: mdio: fix fw_devlink for Ethernet PHY packages
Saravana Kannan <[email protected]>
| Newsgroups | dev.linux.lists.driver-core,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel,org.kernel.vger.netdev |
|---|---|
| Message-ID | <CACRMN=eWk8OTgAQio2COZnpL3EP+Bb4k6iF+ypX_Z0s2pmsUUA@mail.gmail.com> |
Hi James, Thanks for the patch set. On Sun, Aug 16, 2026 at 5:00 PM James Hilliard <[email protected]> wrote: > > Ethernet PHY package nodes describe resources shared by their member > PHYs, but the package node is a container rather than a struct device. > fw_devlink therefore represents those dependencies with temporary > sync-state-only links from the closest existing ancestor device to each > supplier. > > For OF MDIO, that ancestor is the MDIO bus class device. The bus is This is not a unique problem, but not too common. This is exactly why __fw_devlink_pickup_dangling_consumers() has: // Email comment: This picks up class devices intentionally if (fwnode->dev && fwnode->dev->bus) return; And not: // Email comment: This would have not picked up links from class devices. if (fwnode->dev) return; We can have cases of class devices being consumer devices and preventing sync_state() and also cases of class devices being supplier devices and preventing consumer device probes. The right fix is to have class devices properly update the device link states of MANAGED device links similar to bus devices being probed. So, a class device being added should start off with dl_dev_state is DL_DEV_PROBING, and if the device_add() finishes without issues, move the dl_dev_state to DL_DEV_DRIVER_BOUND. Similar changes for class device removal, start off as DL_DEV_UNBINDING, and end up in DL_DEV_NO_DRIVER. This has been in my todo list for way too long (see previous LPC talks). So, I'd be happy to review it if someone wants to take a stab at it. I have a clear design and corner cases in my head and it just needs to get converted to code and I've been swamped. You just need to create equivalent functions to device_links_driver_bound() and call it at the end of device_add() for class devices. Or something along those lines. > driverless, so its proxy links never reach the usual driver-bound > cleanup. They can remain after all member PHYs have probed and > indefinitely prevent suppliers from receiving sync_state(). > > Before fixing the proxy-link lifecycle, skip supplier links when a binding > cannot resolve its consumer node. This prevents malformed graph descriptions > from passing a NULL consumer to the fwnode-link core. > > Fix both parts of the lifecycle. First, factor the sync-state-only > cleanup already performed by device_links_driver_bound() and expose it > to frameworks which populate children below driverless devices. This should be fixed at the driver core level. No need to fix it one framework at a time. -Saravana > Next, > treat each enabled member PHY as a consumer of suppliers referenced by > its package node. Finally, call the cleanup helper after successful OF > MDIO population. The real links from each member PHY retain dependency > and runtime-PM ordering. > > This was found while validating an X-Powers AC300 package whose input > clock is supplied by PWM. Before the fix, the PWM driver reported that > sync_state() was pending due to stmmac-0 even after the PHY had probed. > > The complete fix was tested on an Allwinner H616 board with an X-Powers > AC300 PHY package. All five real supplier links targeted the member PHY, > and no proxy link remained on the driverless MDIO bus. The PWM supplier > reached state_synced while continuing to generate the PHY clock. The PHY > negotiated a 100 Mbps full-duplex link, 8 MiB was transferred in each > direction, and 100 consecutive pings completed without loss. > > Validation completed with: > > - arm64 defconfig object builds of driver core, OF property and OF MDIO > with W=1; > - strict per-patch checkpatch checks; and > - the H616/AC300 hardware test described above. > > Assisted-by: Codex:gpt-5.6-sol > Signed-off-by: James Hilliard <[email protected]> > --- > Changes in v2: > - Add a preparatory guard for malformed graph consumers (reported by Sashiko) > - Rebase on net-next/main > - Link to v1: https://patch.msgid.link/20260814-submit-phy-package-fwdevlink-v1-v1-0-2319844f057a@gmail.com > > --- > James Hilliard (4): > of: property: skip links without a consumer node > driver core: factor sync-state-only link cleanup > of: property: link PHY package suppliers to member PHYs > net: mdio: release fw_devlink proxies after population > > drivers/base/core.c | 74 +++++++++++++++++++++++++++++++++++----------- > drivers/net/mdio/of_mdio.c | 5 +++- > drivers/of/property.c | 18 ++++++++++- > include/linux/device.h | 1 + > 4 files changed, 79 insertions(+), 19 deletions(-) > --- > base-commit: e6a5d573d24cd375e09d24f136523cb3cc85c9d3 > change-id: 20260814-submit-phy-package-fwdevlink-v1-76a8f9efe539 > > Best regards, > -- > James Hilliard <[email protected]> >