All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Joseph Telaak" <joseph@telaak.dev>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH net-next v2 3/3] net: stmmac: Add Siflower SF19A2890 glue
Date: Wed, 02 Dec 2026 07:00:45 +0000	[thread overview]
Message-ID: <sashiko-outbox-245015@kernel.org> (raw)
In-Reply-To: <20261201-sf19a2890-gmac-v2-3-8d2c513db496@telaak.dev>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] net: stmmac: missing internal delay flags in
  sf19a2890_gmac_set_delays()
- [Low] net: stmmac: DWMAC_SF19A2890 depends on undefined symbol
  MACH_SIFLOWER_MIPS
- [Low] net: stmmac: sf19a2890: probe fails with -EOPNOTSUPP when
  CONFIG_NVMEM=n
--

commit 498d2750a64a561804e902e01f161960b94efa83
Author: Joseph Telaak <joseph@telaak.dev>

net: stmmac: Add Siflower SF19A2890 glue

This commit adds the stmmac platform glue driver for the DesignWare GMAC
on the Siflower SF19A2890 SoC, configuring the PHY interface selection and
RGMII clock delays from factory nvmem calibration data.

> diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
> index c6559e749c0ce..3175f3c2bbc95 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
> +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
> @@ -201,6 +201,18 @@ config DWMAC_S32
>  	  SOCs GMAC ethernet controller, ie. S32G2xx, S32G3xx and
>  	  S32R45.
>  
> +config DWMAC_SF19A2890
> +	tristate "Siflower SF19A2890 GMAC support"
> +	default MACH_SIFLOWER_MIPS
> +	depends on OF && (MACH_SIFLOWER_MIPS || COMPILE_TEST)

[Severity: Low]
Is MACH_SIFLOWER_MIPS defined in the tree?  Because that Kconfig symbol
does not exist, it evaluates to n and prevents DWMAC_SF19A2890 from being
enabled unless COMPILE_TEST is set.

> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sf19a2890.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sf19a2890.c
> new file mode 100644
> index 0000000000000..d53f8fbede71d
> --- /dev/null
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sf19a2890.c
[ ... ]
> +static int sf19a2890_gmac_set_delays(struct device *dev,
> +				     struct sf19a2890_gmac *gmac,
> +				     struct plat_stmmacenet_data *plat_dat)
> +{
> +	char str[SF19A2890_DELAY_CAL_LEN + 1] = {};
> +	struct nvmem_cell *cell;
> +	size_t len;
> +	void *buf;
> +	u16 cal;
> +
> +	cell = devm_nvmem_cell_get(dev, "rgmii-delay");
> +	if (IS_ERR(cell)) {
> +		if (PTR_ERR(cell) == -ENOENT)
> +			return 0;
> +		return dev_err_probe(dev, PTR_ERR(cell),
> +				     "failed to get the delay calibration\n");
> +	}

[Severity: Low]
Does sf19a2890_gmac_set_delays() fail probe when CONFIG_NVMEM is disabled?
The !CONFIG_NVMEM stub for devm_nvmem_cell_get() returns
ERR_PTR(-EOPNOTSUPP), so without checking for -EOPNOTSUPP (or adding an
NVMEM dependency in Kconfig), probe aborts instead of falling back to the
bootloader's delay settings.

> +
> +	buf = nvmem_cell_read(cell, &len);
> +	if (IS_ERR(buf))
> +		return dev_err_probe(dev, PTR_ERR(buf),
> +				     "failed to read the delay calibration\n");
> +
> +	memcpy(str, buf, min(len, sizeof(str) - 1));
> +	kfree(buf);
> +
> +	/* An uncalibrated unit reads back erased flash */
> +	if (len != SF19A2890_DELAY_CAL_LEN || kstrtou16(str, 16, &cal)) {
> +		dev_warn(dev, "no valid delay calibration, keeping the bootloader's\n");
> +		return 0;
> +	}
> +
> +	writel(FIELD_GET(SF19A2890_DELAY_CAL_TX, cal),
> +	       gmac->cfg + SF19A2890_GMAC_TX_DELAY);
> +	writel(FIELD_GET(SF19A2890_DELAY_CAL_RX, cal),
> +	       gmac->cfg + SF19A2890_GMAC_RX_DELAY);
> +	/* With RX_DELAY_EN clear, the RX delay line is bypassed */
> +	writel(1, gmac->cfg + SF19A2890_GMAC_RX_DELAY_EN);
> +
> +	/* The MAC adds the delays, so stmmac must not ask the PHY for them */
> +	plat_dat->has_internal_tx_delay = true;
> +	plat_dat->has_internal_rx_delay = true;

[Severity: Medium]
Should plat_dat->has_internal_tx_delay and plat_dat->has_internal_rx_delay
also be set when falling back to the bootloader's delay settings on an
uncalibrated unit?

When the calibration cell is invalid or erased, returning early leaves
both flags false while the MAC's delay lines remain enabled with the
bootloader's configuration.  stmmac_pltfr_probe() then skips
phy_fix_phy_mode_for_mac_delays(), so plat_dat->phy_interface keeps the
RGMII delay mode from Device Tree and the PHY adds its own RGMII delays
on top of the MAC's.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201-sf19a2890-gmac-v2-0-8d2c513db496@telaak.dev?part=3

      reply	other threads:[~2026-12-02  7:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  7:00 [PATCH net-next v2 0/3] net: stmmac: Add the Siflower SF19A2890 glue Joseph Telaak
2026-12-01  7:00 ` Joseph Telaak via B4 Relay
2026-12-01  7:00 ` [PATCH net-next v2 1/3] dt-bindings: net: ethernet-controller: Allow a device-specific nvmem cell Joseph Telaak
2026-12-01  7:00   ` Joseph Telaak via B4 Relay
2026-12-02  7:00   ` sashiko-bot
2026-12-01  7:00 ` [PATCH net-next v2 2/3] dt-bindings: net: Add Siflower SF19A2890 GMAC Joseph Telaak
2026-12-01  7:00   ` Joseph Telaak via B4 Relay
2026-12-02  7:00   ` sashiko-bot
2026-12-01  7:00 ` [PATCH net-next v2 3/3] net: stmmac: Add Siflower SF19A2890 glue Joseph Telaak
2026-12-01  7:00   ` Joseph Telaak via B4 Relay
2026-12-02  7:00   ` sashiko-bot [this message]

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=sashiko-outbox-245015@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=joseph@telaak.dev \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.