Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: mohd.anwar@oss.qualcomm.com
Cc: 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, afd@ti.com,
	andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk,
	richardcochran@gmail.com, andersson@kernel.org,
	konradybcio@kernel.org, alexandre.torgue@foss.st.com,
	peppe.cavallaro@st.com, joabreu@synopsys.com,
	maxime.chevallier@bootlin.com, mcoquelin.stm32@gmail.com,
	lorenzo.bianconi@oss.qualcomm.com, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net-next v4 05/10] net: stmmac: qcom-ethqos: add DLL-bypass for PHY-managed RGMII delays
Date: Fri, 20 Nov 2026 11:45:58 +0000	[thread overview]
Message-ID: <179517515873.3136.13386164324921238997@kernel.org> (raw)
In-Reply-To: <20261117-shikra_ethernet-v4-5-c41902e5f2fa@oss.qualcomm.com>

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

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

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).

- [High] In ethqos_set_clk_tx_rate()
  (drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c), the new…
- [Medium] Speculative: the new RGMII_ID DLL-bypass path returns before
  the POR reset loop in ethqos_fix_mac_speed_rgmii().

--

net: stmmac: qcom-ethqos: add DLL-bypass for PHY-managed RGMII delays

This adds a DLL-bypass programming path for RGMII_ID, where the PHY
supplies both TX and RX delays. The path is guarded by a new
phy_managed_delays flag in the platform descriptors. It also changes
ethqos_set_clk_tx_rate() so the link clock is not doubled at 100M/10M in
RGMII_ID mode.

> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> index f2428f0467bbb..99ea7e0cfb00d 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c

[ ... ]

> @@ -189,7 +193,15 @@ static int ethqos_set_clk_tx_rate(void *bsp_priv, struct clk *clk_tx_i,
>  	if (rate < 0)
>  		return rate;
>  
> -	return clk_set_rate(ethqos->link_clk, rate * 2);
> +	/* Clock Rate Requirements:
> +	 * MAC added delay: 250/50/5 MHz for 1G/100M/10M
> +	 * No MAC delay (DLL bypass): 250/25/2.5 MHz for 1G/100M/10M
> +	 */
> +	if (ethqos->phy_mode != PHY_INTERFACE_MODE_RGMII_ID ||
> +	    speed == SPEED_1000)
> +		rate *= 2;

[Severity: High]
Should this check also look at ethqos->data->phy_managed_delays?

In ethqos_fix_mac_speed_rgmii(), the bypass programming only runs when
both conditions are true:

	if (ethqos->data->phy_managed_delays &&
	    ethqos->phy_mode == PHY_INTERFACE_MODE_RGMII_ID) {

The existing descriptors don't set the flag. That covers emac_v2_3_0_data
(qcs404), emac_v2_1_0_data (sm8150), emac_v3_0_0_data (sc8280xp) and
emac_v4_0_0_data (sa8775p). With phy-mode "rgmii-id", these still take
the legacy POR/DLL path and call ethqos_rgmii_macro_init(). That function
always sets RGMII_CONFIG_DDR_MODE and programs the MAX_SPD_PRG_2/9
dividers.

The comment above says the MAC-delay setup needs 50/5 MHz. After this
patch, these boards would get 25/2.5 MHz at 100M/10M. Doesn't that
contradict this part of the commit message?

  "This new programming is guarded by a boolean set by the platform
  descriptors. No change intended on existing platforms."

A later patch in the series, "add QCS615 EMAC support", notes that unlike
QCS404, the QCS615 RGMII clock source supports the 25 MHz and 2.5 MHz
rates. So on QCS404 with rgmii-id, this could request rates the clock
source can't produce.

Another later patch, "set initial RGMII link clock to lowest speed",
changes the probe-time call to SPEED_10. Non-flagged rgmii-id platforms
would then also get the halved 2.5 MHz rate at probe. The issue is still
present at the end of the series.

Would it work to use the same predicate as the bypass path? For example:

	if (!(ethqos->data->phy_managed_delays &&
	      ethqos->phy_mode == PHY_INTERFACE_MODE_RGMII_ID) ||
	    speed == SPEED_1000)
		rate *= 2;

> +
> +	return clk_set_rate(ethqos->link_clk, rate);
>  }

[ ... ]

> @@ -515,6 +527,58 @@ static void ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos, int speed)

[ ... ]

> +static void ethqos_configure_rgmii_id(struct qcom_ethqos *ethqos, int speed)
> +{
> +	ethqos_set_func_clk_en(ethqos);
> +
> +	/* For rgmii-id mode, the PHY should add the required delays.
> +	 * Therefore, power down the DLL and program it in bypass mode.
> +	 * Program the IO_MACRO as per the settings recommended by the
> +	 * programming guide for bypass mode. This will ensure that the
> +	 * MAC core doesn't add any additional delays.
> +	 */
> +	rgmii_setmask(ethqos, SDCC_DLL_CONFIG_PDN, SDCC_HC_REG_DLL_CONFIG);
> +	rgmii_setmask(ethqos, SDCC_USR_CTL_DDR_BYPASS, SDCC_USR_CTL);

[Severity: Medium]
Can leftover MAC-side delay state still affect RX timing here?

The early return in ethqos_fix_mac_speed_rgmii() skips the POR reset
loop. The descriptors that use this path later in the series,
qcs615_data and shikra_data, have no rgmii_por table anyway.

This function only sets SDCC_DLL_CONFIG_PDN and SDCC_USR_CTL_DDR_BYPASS.
ethqos_rgmii_id_macro_init() only does partial read-modify-writes of
RGMII_IO_MACRO_CONFIG and RGMII_IO_MACRO_CONFIG2.

Nothing on this path does any of the following:

  - writes SDCC_HC_REG_DDR_CONFIG (PRG_DLY_EN, PRG_RCLK_DLY,
    EXT_PRG_RCLK_DLY_EN/CODE)
  - clears SDCC_DLL_CONFIG_DLL_EN or SDCC_DLL_CONFIG_CK_OUT_EN
  - programs RGMII_CONFIG_INTF_SEL or RGMII_CONFIG_MAX_SPD_PRG_2/9

These fields keep whatever hardware reset or an earlier boot stage left.
For example, UEFI may have brought the MAC up in DLL/MAC-delay mode for
network boot.

The has_emac_ge_3 POR value for SDCC_HC_REG_DDR_CONFIG (0x80040800) has
PRG_DLY_EN set, and Shikra is has_emac_ge_3.

If these fields still matter with the DLL powered down and DDR_BYPASS
set, wouldn't the MAC add RX delay on top of the PHY's delay? The result
would then depend on boot history. Would it be safer to clear them
explicitly here?

> +
> +	ethqos_rgmii_id_macro_init(ethqos, speed);
> +}

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117-shikra_ethernet-v4-0-c41902e5f2fa%40oss.qualcomm.com

  reply	other threads:[~2026-11-20 11:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17  8:45 [PATCH net-next v4 00/10] net: stmmac: qcom-ethqos: add Shikra EMAC support Mohd Ayaan Anwar
2026-11-17  8:45 ` [PATCH net-next v4 01/10] dt-bindings: net: ti,dp83867: add supply properties Mohd Ayaan Anwar
2026-11-18 18:58   ` Rob Herring (Arm)
2026-11-17  8:45 ` [PATCH net-next v4 02/10] net: phy: dp83867: add regulator supply management Mohd Ayaan Anwar
2026-11-20 11:45   ` netdev-bot+sashiko
2026-11-17  8:45 ` [PATCH net-next v4 03/10] dt-bindings: net: qcom,ethqos: add qcom,shikra-ethqos compatible Mohd Ayaan Anwar
2026-11-18 19:07   ` Rob Herring
2026-11-20 11:45   ` netdev-bot+sashiko
2026-11-17  8:45 ` [PATCH net-next v4 04/10] net: stmmac: qcom-ethqos: convert ethqos_rgmii_macro_init() to void Mohd Ayaan Anwar
2026-11-17  8:45 ` [PATCH net-next v4 05/10] net: stmmac: qcom-ethqos: add DLL-bypass for PHY-managed RGMII delays Mohd Ayaan Anwar
2026-11-20 11:45   ` netdev-bot+sashiko [this message]
2026-11-17  8:45 ` [PATCH net-next v4 06/10] net: stmmac: qcom-ethqos: set initial RGMII link clock to lowest speed Mohd Ayaan Anwar
2026-11-18  9:13   ` Lorenzo Bianconi
2026-11-17  8:45 ` [PATCH net-next v4 07/10] net: stmmac: qcom-ethqos: share common GMAC4 address table Mohd Ayaan Anwar
2026-11-17  8:45 ` [PATCH net-next v4 08/10] net: stmmac: qcom-ethqos: add per-platform NOC clock voting Mohd Ayaan Anwar
2026-11-18  9:40   ` Lorenzo Bianconi
2026-11-17  8:45 ` [PATCH net-next v4 09/10] net: stmmac: qcom-ethqos: add Shikra EMAC support Mohd Ayaan Anwar
2026-11-18  9:43   ` Lorenzo Bianconi
2026-11-20 11:46   ` netdev-bot+sashiko
2026-11-17  8:45 ` [PATCH net-next v4 10/10] net: stmmac: qcom-ethqos: add QCS615 " Mohd Ayaan Anwar
2026-11-18  9:44   ` Lorenzo Bianconi
2026-11-20 11:46   ` netdev-bot+sashiko

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=179517515873.3136.13386164324921238997@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=afd@ti.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andersson@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@kernel.org \
    --cc=hkallweit1@gmail.com \
    --cc=joabreu@synopsys.com \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=linux@armlinux.org.uk \
    --cc=lorenzo.bianconi@oss.qualcomm.com \
    --cc=maxime.chevallier@bootlin.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=mohd.anwar@oss.qualcomm.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=peppe.cavallaro@st.com \
    --cc=richardcochran@gmail.com \
    --cc=robh@kernel.org \
    /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