public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: rmk+kernel@armlinux.org.uk
Cc: Jakub Kicinski <kuba@kernel.org>,
	linux-stm32@st-md-mailman.stormreply.com, andrew+netdev@lunn.ch,
	linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org,
	pabeni@redhat.com, linux-rockchip@lists.infradead.org,
	heiko@sntech.de, alexandre.torgue@foss.st.com, andrew@lunn.ch,
	davem@davemloft.net, edumazet@google.com
Subject: Re: [net-next,v2,21/22] net: stmmac: rk: use rk_encode_wm16() for clock selection
Date: Mon, 26 Jan 2026 16:41:01 -0800	[thread overview]
Message-ID: <20260127004101.3785871-1-kuba@kernel.org> (raw)
In-Reply-To: <E1vkL3N-00000005uuA-2GnK@rmk-PC.armlinux.org.uk>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.

For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
net: stmmac: rk: use rk_encode_wm16() for clock selection

This commit refactors the per-SoC set_clock_selection() method into
unified helper functions using rk_encode_wm16(), with mask-based
configuration stored in struct rk_clock_fields.

> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> index 26fc93854cb0..443d3bd62cae 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c

[ ... ]

> @@ -1000,25 +991,23 @@ static const struct rk_gmac_ops rk3576_ops = {
>  #define RK3588_GMAC_CLK_RMII_MODE(id)		GRF_BIT(5 * (id))
>  #define RK3588_GMAC_CLK_RGMII_MODE(id)		GRF_CLR_BIT(5 * (id))
>
> -#define RK3588_GMAC_CLK_SELECT_CRU(id)		GRF_BIT(5 * (id) + 4)
> -#define RK3588_GMAC_CLK_SELECT_IO(id)		GRF_CLR_BIT(5 * (id) + 4)
> -
> -#define RK3588_GMAC_CLK_RMII_GATE(id)		GRF_BIT(5 * (id) + 1)
> -#define RK3588_GMAC_CLK_RMII_NOGATE(id)		GRF_CLR_BIT(5 * (id) + 1)
> -
>  static int rk3588_init(struct rk_priv_data *bsp_priv)
>  {
>  	switch (bsp_priv->id) {
>  	case 0:
>  		bsp_priv->gmac_phy_intf_sel_mask = GENMASK_U16(5, 3);
> +		bsp_priv->clock.io_clksel_cru_mask = BIT_U16(4);
>  		bsp_priv->clock.gmii_clk_sel_mask = GENMASK_U16(3, 2);
>  		bsp_priv->clock.rmii_clk_sel_mask = BIT_U16(2);
> +		bsp_priv->clock.rmii_gate_en_mask = BIT_U16(1);
>  		return 0;
>
>  	case 1:
>  		bsp_priv->gmac_phy_intf_sel_mask = GENMASK_U16(11, 9);
> +		bsp_priv->clock.io_clksel_cru_mask = BIT_U16(10);
                                                        ^^

Should this be BIT_U16(9) instead of BIT_U16(10)?

The removed macro RK3588_GMAC_CLK_SELECT_CRU(id) used the formula
GRF_BIT(5 * (id) + 4), which for id=1 gives 5*1+4 = bit 9.

The other masks for id=1 follow the 5*(id) pattern correctly:
  - rmii_gate_en_mask = BIT_U16(6)  matches 5*1+1 = 6
  - gmii_clk_sel_mask = GENMASK_U16(8, 7)  matches 5*1+{2,3}
  - rmii_clk_sel_mask = BIT_U16(7)

But io_clksel_cru_mask = BIT_U16(10) does not match 5*1+4 = 9.

>  		bsp_priv->clock.gmii_clk_sel_mask = GENMASK_U16(8, 7);
>  		bsp_priv->clock.rmii_clk_sel_mask = BIT_U16(7);
> +		bsp_priv->clock.rmii_gate_en_mask = BIT_U16(6);
>  		return 0;

[ ... ]

  reply	other threads:[~2026-01-27  0:41 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-26 11:44 [PATCH net-next v2 00/22] net: stmmac: rk: simplify per-SoC configuration Russell King (Oracle)
2026-01-26 11:45 ` [PATCH net-next v2 01/22] net: stmmac: rk: avoid phy_power_on() Russell King (Oracle)
2026-01-26 11:45 ` [PATCH net-next v2 02/22] net: stmmac: rk: get rid of rk_phy_power_ctl() Russell King (Oracle)
2026-01-26 11:45 ` [PATCH net-next v2 03/22] net: stmmac: rk: convert rk3328 to use bsp_priv->id Russell King (Oracle)
2026-01-26 11:45 ` [PATCH net-next v2 04/22] net: stmmac: rk: group MACPHY register offset and fields together Russell King (Oracle)
2026-01-26 11:45 ` [PATCH net-next v2 05/22] net: stmmac: rk: add GMAC_CLK_xx constants, simplify RGMII definitions Russell King (Oracle)
2026-01-26 11:45 ` [PATCH net-next v2 06/22] net: stmmac: rk: add SoC specific ->init() method Russell King (Oracle)
2026-01-26 14:34   ` Russell King (Oracle)
2026-01-27  0:51     ` Jakub Kicinski
2026-01-27  0:59       ` Russell King (Oracle)
2026-01-27  1:16         ` Jakub Kicinski
2026-01-27  1:55           ` Russell King (Oracle)
2026-01-27  2:54             ` Jakub Kicinski
2026-01-27  0:40   ` [net-next,v2,06/22] " Jakub Kicinski
2026-01-27  0:51     ` Russell King (Oracle)
2026-01-27 11:09       ` Russell King (Oracle)
2026-01-27 16:18         ` Jakub Kicinski
2026-01-27 16:42           ` Russell King (Oracle)
2026-01-27 18:38             ` Jakub Kicinski
2026-01-26 11:45 ` [PATCH net-next v2 07/22] net: stmmac: rk: convert to mask-based interface mode configuration Russell King (Oracle)
2026-01-27  0:40   ` [net-next,v2,07/22] " Jakub Kicinski
2026-01-27  0:53     ` Russell King (Oracle)
2026-01-26 11:45 ` [PATCH net-next v2 08/22] net: stmmac: rk: convert rk3588 to mask-based interface mode config Russell King (Oracle)
2026-01-26 22:19   ` kernel test robot
2026-01-27  0:41   ` [net-next,v2,08/22] " Jakub Kicinski
2026-01-26 11:45 ` [PATCH net-next v2 09/22] net: stmmac: rk: move speed GRF register offset to private data Russell King (Oracle)
2026-01-26 11:45 ` [PATCH net-next v2 10/22] net: stmmac: rk: convert rk3588 to rk_set_reg_speed() Russell King (Oracle)
2026-01-26 11:45 ` [PATCH net-next v2 11/22] net: stmmac: rk: remove rk3528 RMII clock initialisation Russell King (Oracle)
2026-01-26 11:45 ` [PATCH net-next v2 12/22] net: stmmac: rk: use rk_encode_wm16() for RGMII clocks Russell King (Oracle)
2026-01-26 11:46 ` [PATCH net-next v2 13/22] net: stmmac: rk: use rk_encode_wm16() for RMII speed Russell King (Oracle)
2026-01-26 11:46 ` [PATCH net-next v2 14/22] net: stmmac: rk: use rk_encode_wm16() for RMII clock Russell King (Oracle)
2026-01-26 11:46 ` [PATCH net-next v2 15/22] net: stmmac: rk: remove need for ->set_speed() method Russell King (Oracle)
2026-01-26 11:46 ` [PATCH net-next v2 16/22] net: stmmac: rk: convert px30 Russell King (Oracle)
2026-01-26 11:46 ` [PATCH net-next v2 17/22] net: stmmac: rk: introduce flags indicating support for RGMII/RMII Russell King (Oracle)
2026-01-26 11:46 ` [PATCH net-next v2 18/22] net: stmmac: rk: replace empty set_to_rmii() with supports_rmii Russell King (Oracle)
2026-01-26 11:46 ` [PATCH net-next v2 19/22] net: stmmac: rk: rk3328: gmac2phy only supports RMII Russell King (Oracle)
2026-01-26 11:46 ` [PATCH net-next v2 20/22] net: stmmac: rk: rk3528: gmac0 " Russell King (Oracle)
2026-01-26 11:46 ` [PATCH net-next v2 21/22] net: stmmac: rk: use rk_encode_wm16() for clock selection Russell King (Oracle)
2026-01-27  0:41   ` Jakub Kicinski [this message]
2026-01-26 11:46 ` [PATCH net-next v2 22/22] net: stmmac: rk: rk3506, rk3528 and kk3588 have rmii_mode in clock register Russell King (Oracle)
2026-01-27  0:41   ` [net-next,v2,22/22] " Jakub Kicinski
2026-01-27 19:00 ` [PATCH net-next v2 00/22] net: stmmac: rk: simplify per-SoC configuration patchwork-bot+netdevbpf

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=20260127004101.3785871-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=heiko@sntech.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rmk+kernel@armlinux.org.uk \
    /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