All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Coia Prant" <coiaprant@gmail.com>
Cc: vkoul@kernel.org, wsa+renesas@sang-engineering.com,
	neil.armstrong@linaro.org, linux-phy@lists.infradead.org,
	conor+dt@kernel.org, robh@kernel.org, olteanv@gmail.com,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v2 08/10] net: stmmac: dwmac-rk: add SGMII support for RK3568
Date: Sun, 02 Aug 2026 14:25:42 +0000	[thread overview]
Message-ID: <20260802142542.A26DA1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260801142244.679437-10-coiaprant@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] rk3568_set_to_sgmii fails to clear interface selection bits 4:6, leading to potential hardware misconfiguration.
- [Low] DWMAC_ROCKCHIP selects PCS_XPCS_ROCKCHIP without inheriting its PM dependency.
--

--- Patch [8]: [PATCH v2 08/10] net: stmmac: dwmac-rk: add SGMII support for RK3568 ---
commit 53e13be00ad70a538e5aaf2d42200c1ae27d3eef
Author: Coia Prant <coiaprant@gmail.com>

net: stmmac: dwmac-rk: add SGMII support for RK3568
    
The RK3568 SoC integrates a Synopsys DesignWare XPCS that can be
connected to GMAC0 or GMAC1 in SGMII mode. Add the necessary glue
logic to support this configuration.

Link: https://dl.radxa.com/rock3/docs/hw/datasheet/Rockchip%20RK3568%20TRM%20Part1%20V1.1-20210301.pdf (Page 386)

> diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
> index e3dd5adda5aca..5088acc06982e 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
> +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
> @@ -170,6 +170,7 @@ config DWMAC_ROCKCHIP
>  	default ARCH_ROCKCHIP
>  	depends on OF && (ARCH_ROCKCHIP || COMPILE_TEST)
>  	select MFD_SYSCON
> +	select PCS_XPCS_ROCKCHIP

[Severity: Low]
Could selecting PCS_XPCS_ROCKCHIP here cause a Kconfig unmet dependency
warning or build failure if PM is disabled? 

PCS_XPCS_ROCKCHIP depends on PM || COMPILE_TEST, but DWMAC_ROCKCHIP lacks
this dependency.

>  	help
>  	  Support for Ethernet controller on Rockchip RK3288 SoC.
>  

> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> index 8d7042e689261..e47ca1bec5b8b 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
[ ... ]
> @@ -851,18 +857,32 @@ static void rk3568_set_to_rgmii(struct rk_priv_data *bsp_priv,
>  		     RK3568_GMAC_CLK_TX_DL_CFG(tx_delay));
>  
>  	regmap_write(bsp_priv->grf, con1,
> +		     RK3568_GMAC_MODE_RMII_RGMII |
>  		     RK3568_GMAC_RXCLK_DLY_ENABLE |
>  		     RK3568_GMAC_TXCLK_DLY_ENABLE);
>  }
>  
> +static void rk3568_set_to_sgmii(struct rk_priv_data *bsp_priv)
> +{
> +	u32 con1;
> +
> +	con1 = (bsp_priv->id == 1) ? RK3568_GRF_GMAC1_CON1 :
> +				     RK3568_GRF_GMAC0_CON1;
> +
> +	regmap_write(bsp_priv->grf, con1, RK3568_GMAC_MODE_SGMII_QSGMII);
> +}

[Severity: High]
Does this actually clear the interface selection bits 4:6 as mentioned in the
commit message? 

It looks like this only writes RK3568_GMAC_MODE_SGMII_QSGMII (which sets
bit 7) but doesn't supply a write mask or data to clear bits 4:6. If the
bootloader left bits 4:6 set to a non-zero value, could this lead to an
incorrect hardware configuration?

[ ... ]
> @@ -1379,16 +1441,19 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv)
>  	if (ret)
>  		return ret;
>  
> +	ret = gmac_clk_enable(bsp_priv, true);
> +	if (ret)
> +		return ret;
> +
> +	if (bsp_priv->phy_iface == PHY_INTERFACE_MODE_SGMII)
> +		goto set_mode;
> +

[Severity: High]
Because of the goto here, the standard clearing of interface selection bits
using bsp_priv->gmac_phy_intf_sel_mask that happens below is bypassed for
SGMII mode. 

Should rk3568_set_to_sgmii() handle clearing those bits instead?

>  	ret = rk_get_phy_intf_sel(bsp_priv->phy_iface);
>  	if (ret < 0)
> -		return ret;
> +		goto clk_disable;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260801142244.679437-2-coiaprant@gmail.com?part=8

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

WARNING: multiple messages have this Message-ID (diff)
From: sashiko-bot@kernel.org
To: "Coia Prant" <coiaprant@gmail.com>
Cc: vkoul@kernel.org, wsa+renesas@sang-engineering.com,
	neil.armstrong@linaro.org, linux-phy@lists.infradead.org,
	conor+dt@kernel.org, robh@kernel.org, olteanv@gmail.com,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v2 08/10] net: stmmac: dwmac-rk: add SGMII support for RK3568
Date: Sun, 02 Aug 2026 14:25:42 +0000	[thread overview]
Message-ID: <20260802142542.A26DA1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260801142244.679437-10-coiaprant@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] rk3568_set_to_sgmii fails to clear interface selection bits 4:6, leading to potential hardware misconfiguration.
- [Low] DWMAC_ROCKCHIP selects PCS_XPCS_ROCKCHIP without inheriting its PM dependency.
--

--- Patch [8]: [PATCH v2 08/10] net: stmmac: dwmac-rk: add SGMII support for RK3568 ---
commit 53e13be00ad70a538e5aaf2d42200c1ae27d3eef
Author: Coia Prant <coiaprant@gmail.com>

net: stmmac: dwmac-rk: add SGMII support for RK3568
    
The RK3568 SoC integrates a Synopsys DesignWare XPCS that can be
connected to GMAC0 or GMAC1 in SGMII mode. Add the necessary glue
logic to support this configuration.

Link: https://dl.radxa.com/rock3/docs/hw/datasheet/Rockchip%20RK3568%20TRM%20Part1%20V1.1-20210301.pdf (Page 386)

> diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
> index e3dd5adda5aca..5088acc06982e 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
> +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
> @@ -170,6 +170,7 @@ config DWMAC_ROCKCHIP
>  	default ARCH_ROCKCHIP
>  	depends on OF && (ARCH_ROCKCHIP || COMPILE_TEST)
>  	select MFD_SYSCON
> +	select PCS_XPCS_ROCKCHIP

[Severity: Low]
Could selecting PCS_XPCS_ROCKCHIP here cause a Kconfig unmet dependency
warning or build failure if PM is disabled? 

PCS_XPCS_ROCKCHIP depends on PM || COMPILE_TEST, but DWMAC_ROCKCHIP lacks
this dependency.

>  	help
>  	  Support for Ethernet controller on Rockchip RK3288 SoC.
>  

> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> index 8d7042e689261..e47ca1bec5b8b 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
[ ... ]
> @@ -851,18 +857,32 @@ static void rk3568_set_to_rgmii(struct rk_priv_data *bsp_priv,
>  		     RK3568_GMAC_CLK_TX_DL_CFG(tx_delay));
>  
>  	regmap_write(bsp_priv->grf, con1,
> +		     RK3568_GMAC_MODE_RMII_RGMII |
>  		     RK3568_GMAC_RXCLK_DLY_ENABLE |
>  		     RK3568_GMAC_TXCLK_DLY_ENABLE);
>  }
>  
> +static void rk3568_set_to_sgmii(struct rk_priv_data *bsp_priv)
> +{
> +	u32 con1;
> +
> +	con1 = (bsp_priv->id == 1) ? RK3568_GRF_GMAC1_CON1 :
> +				     RK3568_GRF_GMAC0_CON1;
> +
> +	regmap_write(bsp_priv->grf, con1, RK3568_GMAC_MODE_SGMII_QSGMII);
> +}

[Severity: High]
Does this actually clear the interface selection bits 4:6 as mentioned in the
commit message? 

It looks like this only writes RK3568_GMAC_MODE_SGMII_QSGMII (which sets
bit 7) but doesn't supply a write mask or data to clear bits 4:6. If the
bootloader left bits 4:6 set to a non-zero value, could this lead to an
incorrect hardware configuration?

[ ... ]
> @@ -1379,16 +1441,19 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv)
>  	if (ret)
>  		return ret;
>  
> +	ret = gmac_clk_enable(bsp_priv, true);
> +	if (ret)
> +		return ret;
> +
> +	if (bsp_priv->phy_iface == PHY_INTERFACE_MODE_SGMII)
> +		goto set_mode;
> +

[Severity: High]
Because of the goto here, the standard clearing of interface selection bits
using bsp_priv->gmac_phy_intf_sel_mask that happens below is bypassed for
SGMII mode. 

Should rk3568_set_to_sgmii() handle clearing those bits instead?

>  	ret = rk_get_phy_intf_sel(bsp_priv->phy_iface);
>  	if (ret < 0)
> -		return ret;
> +		goto clk_disable;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260801142244.679437-2-coiaprant@gmail.com?part=8

  reply	other threads:[~2026-08-02 14:25 UTC|newest]

Thread overview: 114+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-01 14:22 [PATCH v2 00/10] net-next: add basic support for RK3568 XPCS Coia Prant
2026-08-01 14:22 ` Coia Prant
2026-08-01 14:22 ` Coia Prant
2026-08-01 14:22 ` [PATCH v2 01/10] net: stmmac: move XPCS lifetime management to platform drivers Coia Prant
2026-08-01 14:22   ` Coia Prant
2026-08-01 14:22   ` Coia Prant
2026-08-01 14:22 ` [PATCH v2 02/10] dt-bindings: phy: rockchip: naneng-combphy: add rockchip,sgmii-mac-sel property Coia Prant
2026-08-01 14:22   ` Coia Prant
2026-08-01 14:22   ` Coia Prant
2026-08-02 14:25   ` sashiko-bot
2026-08-02 14:25     ` sashiko-bot
2026-08-01 14:22 ` [PATCH v2 03/10] phy: rockchip: naneng-combphy: add SGMII MAC selection for RK3568 Coia Prant
2026-08-01 14:22   ` Coia Prant
2026-08-01 14:22   ` Coia Prant
2026-08-01 20:58   ` Andrew Lunn
2026-08-01 20:58     ` Andrew Lunn
2026-08-01 20:58     ` Andrew Lunn
2026-08-02  2:51     ` Coia Prant
2026-08-02  2:51       ` Coia Prant
2026-08-02  2:51       ` Coia Prant
2026-08-01 14:22 ` [PATCH v2 04/10] dt-bindings: net: pcs: add rockchip,rk3568-xpcs binding Coia Prant
2026-08-01 14:22   ` Coia Prant
2026-08-01 14:22   ` Coia Prant
2026-08-02 14:25   ` sashiko-bot
2026-08-02 14:25     ` sashiko-bot
2026-08-05  7:29   ` Krzysztof Kozlowski
2026-08-05  7:29     ` Krzysztof Kozlowski
2026-08-05  7:29     ` Krzysztof Kozlowski
2026-08-05 17:20     ` Coia Prant
2026-08-05 17:20       ` Coia Prant
2026-08-05 17:20       ` Coia Prant
2026-08-06  6:48       ` Krzysztof Kozlowski
2026-08-06  6:48         ` Krzysztof Kozlowski
2026-08-06  6:48         ` Krzysztof Kozlowski
2026-08-06 14:37     ` Coia Prant
2026-08-06 14:37       ` Coia Prant
2026-08-06 14:37       ` Coia Prant
2026-08-01 14:22 ` [PATCH v2 05/10] arm64: dts: rockchip: rk3568: add XPCS and fixed-clock nodes Coia Prant
2026-08-01 14:22   ` Coia Prant
2026-08-01 14:22   ` Coia Prant
2026-08-01 16:28   ` Heiko Stübner
2026-08-01 16:28     ` Heiko Stübner
2026-08-01 16:28     ` Heiko Stübner
2026-08-01 19:19     ` Coia Prant
2026-08-01 19:19       ` Coia Prant
2026-08-01 19:19       ` Coia Prant
2026-08-01 21:05       ` Andrew Lunn
2026-08-01 21:05         ` Andrew Lunn
2026-08-01 21:05         ` Andrew Lunn
2026-08-02  3:28         ` Coia Prant
2026-08-02  3:28           ` Coia Prant
2026-08-02  3:28           ` Coia Prant
2026-08-02 15:19           ` Andrew Lunn
2026-08-02 15:19             ` Andrew Lunn
2026-08-02 15:19             ` Andrew Lunn
2026-08-02 18:36             ` Coia Prant
2026-08-02 18:36               ` Coia Prant
2026-08-02 18:36               ` Coia Prant
2026-08-01 14:22 ` [PATCH v2 06/10] net: pcs: xpcs: add ANRESTART support for SGMII link recovery Coia Prant
2026-08-01 14:22   ` Coia Prant
2026-08-01 14:22   ` Coia Prant
2026-08-01 21:10   ` Andrew Lunn
2026-08-01 21:10     ` Andrew Lunn
2026-08-01 21:10     ` Andrew Lunn
2026-08-02  3:11     ` Coia Prant
2026-08-02  3:11       ` Coia Prant
2026-08-02  3:11       ` Coia Prant
2026-08-02 14:30       ` Andrew Lunn
2026-08-02 14:30         ` Andrew Lunn
2026-08-02 14:30         ` Andrew Lunn
2026-08-02 14:59         ` Maxime Chevallier
2026-08-02 14:59           ` Maxime Chevallier
2026-08-02 14:59           ` Maxime Chevallier
2026-08-02 18:25         ` Coia Prant
2026-08-02 18:25           ` Coia Prant
2026-08-02 18:25           ` Coia Prant
2026-08-02 14:25   ` sashiko-bot
2026-08-02 14:25     ` sashiko-bot
2026-08-04  7:35   ` Maxime Chevallier
2026-08-04  7:35     ` Maxime Chevallier
2026-08-04  7:35     ` Maxime Chevallier
2026-08-01 14:22 ` [PATCH v2 07/10] net: pcs: xpcs: add Rockchip RK3568 platform glue driver Coia Prant
2026-08-01 14:22   ` Coia Prant
2026-08-01 14:22   ` Coia Prant
2026-08-02  1:29   ` Andrew Lunn
2026-08-02  1:29     ` Andrew Lunn
2026-08-02  1:29     ` Andrew Lunn
2026-08-02  3:20     ` Coia Prant
2026-08-02  3:20       ` Coia Prant
2026-08-02  3:20       ` Coia Prant
2026-08-02 14:39       ` Andrew Lunn
2026-08-02 14:39         ` Andrew Lunn
2026-08-02 14:39         ` Andrew Lunn
2026-08-02 18:33         ` Coia Prant
2026-08-02 18:33           ` Coia Prant
2026-08-02 18:33           ` Coia Prant
2026-08-02 19:00           ` Andrew Lunn
2026-08-02 19:00             ` Andrew Lunn
2026-08-02 19:00             ` Andrew Lunn
2026-08-02 14:25   ` sashiko-bot
2026-08-02 14:25     ` sashiko-bot
2026-08-01 14:22 ` [PATCH v2 08/10] net: stmmac: dwmac-rk: add SGMII support for RK3568 Coia Prant
2026-08-01 14:22   ` Coia Prant
2026-08-01 14:22   ` Coia Prant
2026-08-02 14:25   ` sashiko-bot [this message]
2026-08-02 14:25     ` sashiko-bot
2026-08-01 14:22 ` [PATCH v2 09/10] arm64: dts: rockchip: rk3568-photonicat: enable SGMII LAN port Coia Prant
2026-08-01 14:22   ` Coia Prant
2026-08-01 14:22   ` Coia Prant
2026-08-02 14:25   ` sashiko-bot
2026-08-02 14:25     ` sashiko-bot
2026-08-01 14:22 ` [PATCH v2 10/10] MAINTAINERS: add entry for Rockchip XPCS driver Coia Prant
2026-08-01 14:22   ` Coia Prant
2026-08-01 14:22   ` Coia Prant

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=20260802142542.A26DA1F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=coiaprant@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=neil.armstrong@linaro.org \
    --cc=olteanv@gmail.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vkoul@kernel.org \
    --cc=wsa+renesas@sang-engineering.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 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.