From: Andrew Lunn <andrew@lunn.ch>
To: Frieder Schrempf <frieder@fris.de>
Cc: Claudiu Manoil <claudiu.manoil@nxp.com>,
Vladimir Oltean <vladimir.oltean@nxp.com>,
Wei Fang <wei.fang@nxp.com>, Clark Wang <xiaoning.wang@nxp.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Richard Cochran <richardcochran@gmail.com>,
imx@lists.linux.dev, netdev@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Frieder Schrempf <frieder.schrempf@kontron.de>
Subject: Re: [PATCH net-next 2/4] net: enetc: netc_blk_ctrl: add i.MX952 support
Date: Wed, 18 Nov 2026 14:51:49 +0100 [thread overview]
Message-ID: <abd5b300-2dd6-45b9-9ef1-c7c123b6dfa3@lunn.ch> (raw)
In-Reply-To: <20261118-imx952-enetc-v1-2-25721440602e@kontron.de>
> +static int imx952_netcmix_init(struct platform_device *pdev)
> +{
> + struct netc_blk_ctrl *priv = platform_get_drvdata(pdev);
> + struct device_node *np = pdev->dev.of_node;
> + phy_interface_t interface;
> + int bus_devfn, mii_proto;
> + u32 val;
> + int err;
> +
> + /* Default setting */
> + val = MII_PROT(0, MII_PROT_RGMII) | MII_PROT(1, MII_PROT_RGMII);
> +
> + /* Update the link MII protocol through parsing phy-mode */
> + for_each_child_of_node_scoped(np, child) {
> + for_each_child_of_node_scoped(child, gchild) {
> + if (!of_device_is_compatible(gchild, "pci1131,e101"))
> + continue;
> +
> + bus_devfn = netc_of_pci_get_bus_devfn(gchild);
> + if (bus_devfn < 0)
> + return bus_devfn;
> +
> + err = of_get_phy_mode(gchild, &interface);
> + if (err)
> + continue;
> +
> + mii_proto = netc_get_link_mii_protocol(interface);
> + if (mii_proto < 0)
> + return mii_proto;
> +
> + switch (bus_devfn) {
> + case IMX952_ENETC0_BUS_DEVFN:
> + val = u32_replace_bits(val, mii_proto,
> + CFG_LINK_MII_PORT_0);
> + break;
> + case IMX952_ENETC1_BUS_DEVFN:
> + val = u32_replace_bits(val, mii_proto,
> + CFG_LINK_MII_PORT_1);
> + break;
> + default:
> + return -EINVAL;
> + }
> + }
> + }
> +
> + netc_reg_write(priv->netcmix, IMX95_CFG_LINK_MII_PROT, val);
> +
> + return 0;
> +}
> +
This looks very similar to imx95_netcmix_init(), and
imx94_link_config() is similar to the core of this loop.
Can some core refactoring be done to reduce duplication?
Andrew
next prev parent reply other threads:[~2026-11-18 13:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 10:37 [PATCH net-next 0/4] net: enetc: Add " Frieder Schrempf
2026-11-18 10:37 ` [PATCH net-next 1/4] dt-bindings: net: nxp,netc-blk-ctrl: add i.MX952 compatible Frieder Schrempf
2026-11-18 10:37 ` [PATCH net-next 2/4] net: enetc: netc_blk_ctrl: add i.MX952 support Frieder Schrempf
2026-11-18 13:51 ` Andrew Lunn [this message]
2026-11-18 10:37 ` [PATCH net-next 3/4] net: enetc: add i.MX952 ENETC support Frieder Schrempf
2026-11-18 10:37 ` [PATCH net-next 4/4] ptp: netc: use 133 MHz system clock on i.MX952 Frieder Schrempf
2026-11-18 10:43 ` [PATCH net-next 0/4] net: enetc: Add i.MX952 support Clark Wang
2026-11-18 10:50 ` Frieder Schrempf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=abd5b300-2dd6-45b9-9ef1-c7c123b6dfa3@lunn.ch \
--to=andrew@lunn.ch \
--cc=andrew+netdev@lunn.ch \
--cc=claudiu.manoil@nxp.com \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@kernel.org \
--cc=frieder.schrempf@kontron.de \
--cc=frieder@fris.de \
--cc=imx@lists.linux.dev \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=robh@kernel.org \
--cc=vladimir.oltean@nxp.com \
--cc=wei.fang@nxp.com \
--cc=xiaoning.wang@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®