Re: [PATCH net-next v1 1/5] net: enetc: Add pseudo-MAC support for ENETCv4 Ports via a DT overlay
From: Frank Li
Date: Fri Oct 09 2026 - 22:27:02 EST
On Fri, Oct 09, 2026 at 03:40:30PM +0300, Claudiu Manoil wrote:
> [You don't often get email from claudiu.manoil@xxxxxxx. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> ENETCv4 has special internal links when connected to the on-chip NETC
> switch via internal switch ports, called pseudo-MAC links. These
> pseudo-MACs are proprietary, they don't implement any standard IEEE
> interface (like MII), and can be modeled as fixed links with the link
> speed determined at boot time by the Port PCR[PSPEED] register
> configuration.
>
> We also need to be able to probe the ENETCv4 Ports featuring pseudo-MACs
> as pure PCI devices, i.e. without any "ethernet" DT node representation.
> The typical use case for this consists in a board with NETC connected
> via PCI to another host which probes the ENETC. Note that in this
> scenario, the pseudo-MAC ENETCs are connected internally to a NETC
> switch that is not owned by Linux.
>
> Since such a port has no "ethernet" DT node, its fixed link has to be
> synthesized at probe time. Rather than hand-building a named software
> node, describe the fixed link with a self-contained device-tree overlay,
> following the approach used by the Microchip lan966x PCI driver. The
> overlay is compiled from enetc4_pseudo_mac.dtso into a .dtbo blob and
> embedded in the driver via the kernel's dtbo wrapping
> (__dtbo_*_begin/_end symbols).
>
> The overlay fragment uses an empty target-path, so it is grafted onto
> the base node passed to of_overlay_fdt_apply(), i.e. the PCI function's
> own dynamic OF node (created by the PCI core when
> CONFIG_PCI_DYNAMIC_OF_NODES is enabled). The fixed-link node is therefore
> spliced directly onto the ENETC netdev's fwnode, exactly as if it had
> come from static DT, and phylink picks it up through dev_fwnode().
>
> The overlay only adds a new fixed-link node; it deliberately does not add
> a phy-mode property. A device-tree overlay may only add new nodes (which
> are tracked with the OF_OVERLAY flag and freed cleanly on removal), not
> new properties onto an already-live node such as the PCI function's
> dynamic OF node. The phy-mode is instead set programmatically by the driver
> (pf->if_mode) before the overlay is applied.
>
> The pseudo-MAC overlay path is selected when the port has no OF node, or
> when it only has the empty PCI-synthesized node (OF_DYNAMIC), which
> carries no fixed-link description. Ports described by static DT take the
> regular of_get_phy_mode() path instead.
>
> The overlay blob is applied unmodified, it only selects fixed-link
> mode and carries the duplex setting; its 'speed' cell is a placeholder.
> The real operating speed is sourced live from PCR[PSPEED] through the
> phylink get_fixed_state callback, which lets the driver override the
> fixed-link state at link time. The overlay is removed on teardown and on
> the probe error unwind.
>
> The driver gains a build dependency on OF_OVERLAY. In addition, the
> node-less pseudo-MAC path has a runtime dependency on
> CONFIG_PCI_DYNAMIC_OF_NODES: that is what makes the PCI core synthesize
> the per-function OF node (of_pci_make_dev_node()) that the overlay is
> applied onto. This is intentionally not a hard Kconfig dependency, since
> the ENETC4 driver also serves regular ports described by static DT; when
> PCI_DYNAMIC_OF_NODES is absent the PCI function has no of_node and the
> pseudo-MAC probe path fails gracefully with a clear -ENODEV error.
>
> Signed-off-by: Claudiu Manoil <claudiu.manoil@xxxxxxx>
> ---
> drivers/net/ethernet/freescale/enetc/Kconfig | 1 +
> drivers/net/ethernet/freescale/enetc/Makefile | 1 +
> drivers/net/ethernet/freescale/enetc/enetc.h | 1 +
> .../net/ethernet/freescale/enetc/enetc4_pf.c | 98 +++++++++++++++++--
> .../freescale/enetc/enetc4_pseudo_mac.dtso | 32 ++++++
Not sure why need dt overlay here, there are already dymatic update dts by
of_changeset_* API, like of_changeset_create_node().
Frank