Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: frieder@fris.de
Cc: claudiu.manoil@nxp.com, vladimir.oltean@nxp.com,
	wei.fang@nxp.com, xiaoning.wang@nxp.com, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, richardcochran@gmail.com,
	imx@lists.linux.dev, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	frieder.schrempf@kontron.de
Subject: Re: [PATCH net-next 2/4] net: enetc: netc_blk_ctrl: add i.MX952 support
Date: Sun, 22 Nov 2026 11:00:49 +0000	[thread overview]
Message-ID: <179534524969.3135.7066285557650709547@kernel.org> (raw)
In-Reply-To: <20261118-imx952-enetc-v1-2-25721440602e@kontron.de>

Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 2 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] imx952_ierb_init()
  (drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c) writes only…
- [Medium] imx952_netcmix_init()
  (drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c) accepts serial…
- [Low] imx952_ierb_init() writes the hard-coded IMX952_BYTE_CREDIT
  (0xc35 = 3125 bytes) to E0TXHPTBCR/E0TXLPTBCR.

--

net: enetc: netc_blk_ctrl: add i.MX952 support

This patch adds NETCMIX support for i.MX952, which has two ENETC
instances on separate PCIe buses. Their link MII protocol is configured
through the IMX95_CFG_LINK_MII_PROT register. During IERB init it also
sets the ENETC0 TX byte-credit registers to 0xc35.

> diff --git a/drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c b/drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c
> index 658fab31e9ed7..6e3098a0a43ee 100644
> --- a/drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c
> +++ b/drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c

[ ... ]

> @@ -368,6 +374,56 @@ static int imx94_netcmix_init(struct platform_device *pdev)
>  	return 0;
>  }
>  
> +static int imx952_netcmix_init(struct platform_device *pdev)
> +{

[ ... ]

> +			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);

[Severity: Medium]
Does this leave serial links only partly configured?

netc_get_link_mii_protocol() maps sgmii, 2500base-x, 10gbase-r, xgmii and
usxgmii to MII_PROT_SERIAL, and that value gets written into
CFG_LINK_MII_PORT_n here. However, IMX95_CFG_LINK_IO_VAR and
IMX95_CFG_LINK_PCS_PROT(n) are never written, and serial modes are not
rejected either.

imx95_netcmix_init() sets these registers together for its serial link:

	/* Configure Link I/O variant */
	netc_reg_write(priv->netcmix, IMX95_CFG_LINK_IO_VAR,
		       IO_VAR(2, IO_VAR_16FF_16G_SERDES));
	/* Configure Link 2 PCS protocol */
	netc_reg_write(priv->netcmix, IMX95_CFG_LINK_PCS_PROT(2),
		       PCS_PROT_10G_SXGMII);

imx94_link_config() also sets NETC_LINK_CFG_IO_VAR whenever the protocol
is MII_PROT_SERIAL.

The patch "net: enetc: add i.MX952 ENETC support" in this series says
133 MHz is needed as the ENETC sysclk "to enable SGMII 1G". That makes
SGMII look like a supported configuration on i.MX952.

Take an i.MX952 ENETC with phy-mode = "sgmii". Would the MAC be switched
to the serial datapath while the I/O variant and PCS protocol keep their
reset or bootloader values? If so, the link would never come up even
though probe succeeds.

> +
> +	return 0;
> +}

[ ... ]

> @@ -783,6 +839,16 @@ static int imx94_ierb_init(struct platform_device *pdev)
>  	return 0;
>  }
>  
> +static int imx952_ierb_init(struct platform_device *pdev)
> +{
> +	struct netc_blk_ctrl *priv = platform_get_drvdata(pdev);
> +
> +	netc_reg_write(priv->ierb, IERB_ETXHPTBCR(0), IMX952_BYTE_CREDIT);
> +	netc_reg_write(priv->ierb, IERB_ETXLPTBCR(0), IMX952_BYTE_CREDIT);

[Severity: Low]
How was IMX952_BYTE_CREDIT (0xc35, or 3125 bytes) derived?

The commit message says:

  Both ENETC0 transmit byte-credit registers reset to 0x5dc, which
  matches the RM example for a 1536-byte maximum frame size.

0x5dc is 1500, and 1536 would be 0x600. Is the arithmetic in the commit
message correct?

The commit message also links the problem to jumbo frames. However, 3125
has no clear relation to ENETC_MAC_MAXFRM_SIZE (9600), which enetc4_pf.c
programs into PM_MAXFRM. The only reason given for the value is "the
same as port 1".

For comparison, the LS1028A code in enetc_ierb.c derives its TX credit
from the maximum frame size:

	tx_credit = roundup(1000 + ENETC_MAC_MAXFRM_SIZE / 2, 100);

Suppose the i.MX952 credit needs to cover at least one maximum-size
frame. Would 3125 bytes still throttle ENETC0 jumbo TX?

These registers cannot be changed once the IERB is locked. Could the RM
rule be documented here, or the value derived from ENETC_MAC_MAXFRM_SIZE?

Writing the value unconditionally seems fine, though. "ptp: netc: use
133 MHz system clock on i.MX952" in this series says the i.MX952 NETC
system clock is 133 MHz.

> +
> +	return 0;
> +}

[Severity: Medium]
Should imx952_ierb_init() also program the port EMDIO PHY address into
IERB_LBCR(n) for each ENETC?

Both sibling SoCs do this in their ierb_init callbacks: i.MX95 through
imx95_enetc_mdio_phyaddr_config() and i.MX94 through
imx94_enetc_mdio_phyaddr_config(). The i.MX95 version says:

	/* Update the port EMDIO PHY address through parsing phy properties.
	 * This is needed when using the port EMDIO but it's harmless when
	 * using the central EMDIO. So apply it on all cases.
	 */

Those functions also check the PHY addresses against the central EMDIO
mask from netc_get_emdio_phy_mask(). That check is missing here too.

netc_ierb_init() calls netc_lock_ierb() as soon as devinfo->ierb_init()
returns, so LBCR cannot be corrected later. Meanwhile,
enetc_mdiobus_create() still creates a port MDIO bus whenever the ENETC
node has an "mdio" child:

	mdio_np = of_get_child_by_name(node, "mdio");
	if (mdio_np) {
		err = enetc_mdio_probe(pf, mdio_np);

On an i.MX952 board that uses port MDIO, would that bus stay at the
reset-default PHY address instead of the PHY described in DT? That would
make the PHY probe or the link fail. A PHY address that clashes with the
central EMDIO would also go undetected.

The dt-bindings patch in this series describes the i.MX952 IERB block as
the same as on i.MX95. No later patch in the series touches
netc_blk_ctrl.c.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118-imx952-enetc-v1-0-25721440602e%40kontron.de

  parent reply	other threads:[~2026-11-22 11:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 10:37 [PATCH net-next 0/4] net: enetc: Add i.MX952 support 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 17:43   ` Conor Dooley
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
2026-11-22 11:00   ` netdev-bot+sashiko [this message]
2026-11-18 10:37 ` [PATCH net-next 3/4] net: enetc: add i.MX952 ENETC support Frieder Schrempf
2026-11-22 11:00   ` netdev-bot+sashiko
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=179534524969.3135.7066285557650709547@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --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