Re: [PATCH net-next v4 1/6] net: enetc: Add pseudo-MAC support for ENETCv4 Ports via a fixed-link node
From: Simon Horman
Date: Thu Nov 19 2026 - 08:23:54 EST
On Fri, Nov 13, 2026 at 05:02:32PM +0200, Claudiu Manoil wrote:
> 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. Build the fixed-link subnode directly in C
> with an of_changeset: of_changeset_create_node() adds a "fixed-link"
> node onto the port's own OF node, and of_changeset_add_prop_*() populate
> its "speed" and "full-duplex" properties. The changeset is applied with
> of_changeset_apply(), so the fixed-link node is spliced onto the ENETC
> netdev's fwnode exactly as if it had come from static DT, and phylink
> picks it up through dev_fwnode().
>
> The operating speed written into the node is read from PCR[PSPEED] at
> probe time and mapped to a phylink-supported value, so the fixed link
> reflects the actual boot-time configuration, as long as it's a phylink
> supported value. Otherwise, PCR[PSPEED] will be updated to the closest
> rounded down supported value.
>
> The pseudo-MAC 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.
>
> Building the fixed-link node requires the of_changeset API, which is only
> available with CONFIG_OF_DYNAMIC, so select it. As OF_DYNAMIC itself
> depends on OF, make NXP_ENETC4 depend on OF as well, rather than force
> OF_DYNAMIC on without the core OF code being built.
>
> The changeset is reverted and destroyed on teardown and on the probe
> error unwind. 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 fixed-link
> node is attached 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>
Reviewed-by: Simon Horman <horms@xxxxxxxxxx>