netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Heiko Stuebner <heiko@sntech.de>,
	Jakub Kicinski <kuba@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org,
	linux-stm32@st-md-mailman.stormreply.com,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	netdev@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH RFC net-next 00/15] net: stmmac: rk: cleanups galore
Date: Mon, 1 Dec 2025 16:44:15 +0000	[thread overview]
Message-ID: <aS3F36UAkeLfFeHx@shell.armlinux.org.uk> (raw)
In-Reply-To: <aS2rFBlz1jdwXaS8@shell.armlinux.org.uk>

On Mon, Dec 01, 2025 at 02:49:56PM +0000, Russell King (Oracle) wrote:
> This is work in progress, cleaning up the excessively large Rockchip
> glue driver somewhat. This series as it currently stands removes
> approximately 200 lines from this file, while adding slightly to its
> flexibility.
> 
> A brief overview of the changes:
> 
> - similar to previous commits, it seems the RGMII clock field follows
>   a common pattern irrespective of the SoC.
> - update rk3328 to use the ->id mechanism rather than guessing from
>   the PHY interface mode and whether the PHY is integrated.
> - switch to wm16 based masking, providing the lower-16 bits of the
>   mask to indicate appropriate fields, and use this to construct the
>   values to write to the registers.
> - convert px30 to these methods.
> - since many set_to_rmii() methods are now empty, add flags to indicate
>   whether RMII / RGMII are supported.
> - clear RGMII where the specific SoC's GMAC instance doesn't support
>   this.
> 
> I've spent quite a while mulling over how to deal with these "wm16"
> registers, none of the kernel bitfield macros (not even the
> hw_bitfield.h macros) allow for what I present here, because the
> masks are not constant.
> 
> One of the interesting things is that this appears to deal with RGMII
> delays at the MAC end of the link, but there's no way to tell phylib
> that's the case. I've not looked deeply into what is going on there,
> but it is surprising that the driver insists that the delays (in
> register values?) are provided, but then ignores them depending on the
> exact RGMII mode selected.
> 
> One outstanding issue with these patches: RK3528_GMAC0_CLK_RMII_DIV2
> remains, although I deleted its definition, so there's build errors
> in this series. Before I do anything about that, I would like to hear
> from the Rockchip guys whether it is necessary for rk3528_set_to_rmii()
> to set the clock rate, given that rk_set_clk_tx_rate() will do this
> when the link comes up. Does it matter whether it was set to 2.5MHz
> (/ 20) or 25MHz (/ 2) when we switch to RMII mode?

Another issue has come up while looking at this driver -
gmac_clk_enable() is buggy.

If clk_bulk_prepare_enable() succeeds, but then the following
clk_prepare_enable() fails, we simply return its error code, failing
gmac_clk_enable(, true), leaving the bulk clocks prepared and enabled.

Calling this with "false" to disable clocks won't - because we never
get as far as setting bsp_priv->clk_enabled, and even if we did, we'd
disable and unprepare clk_phy which failed to prepare/enable.

Again, I don't like this foo_enable() / foo_power_on() pattern with
a true/false argument - when false, the function is not enabling
nor "on"-ing, but disabling or "off"-ing. So, gmac_clk_enable() is
going to get split up and renamed.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

  parent reply	other threads:[~2025-12-01 16:44 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-01 14:49 [PATCH RFC net-next 00/15] net: stmmac: rk: cleanups galore Russell King (Oracle)
2025-12-01 14:50 ` [PATCH RFC net-next 01/15] net: stmmac: rk: add GMAC_CLK_xx constants, simplify RGMII definitions Russell King (Oracle)
2025-12-02 20:31   ` Andrew Lunn
2025-12-01 14:50 ` [PATCH RFC net-next 02/15] net: stmmac: rk: convert rk3328 to use bsp_priv->id Russell King (Oracle)
2025-12-01 14:50 ` [PATCH RFC net-next 03/15] net: stmmac: rk: add SoC specific ->init() method Russell King (Oracle)
2025-12-01 14:51 ` [PATCH RFC net-next 04/15] net: stmmac: rk: convert to mask-based interface mode configuration Russell King (Oracle)
2025-12-02 20:41   ` Russell King (Oracle)
2025-12-01 14:51 ` [PATCH RFC net-next 05/15] net: stmmac: rk: move speed GRF register offset to private data Russell King (Oracle)
2025-12-01 14:51 ` [PATCH RFC net-next 06/15] net: stmmac: rk: convert rk3588 to rk_set_reg_speed() Russell King (Oracle)
2025-12-01 14:51 ` [PATCH RFC net-next 07/15] net: stmmac: rk: use rk_encode_wm16() for RGMII clocks Russell King (Oracle)
2025-12-01 14:51 ` [PATCH RFC net-next 08/15] net: stmmac: rk: use rk_encode_wm16() for RMII speed Russell King (Oracle)
2025-12-01 14:51 ` [PATCH RFC net-next 09/15] net: stmmac: rk: use rk_encode_wm16() for RMII clock Russell King (Oracle)
2025-12-01 14:51 ` [PATCH RFC net-next 10/15] net: stmmac: rk: move speed register into bsp_priv Russell King (Oracle)
2025-12-01 14:51 ` [PATCH RFC net-next 11/15] net: stmmac: rk: convert px30 Russell King (Oracle)
2025-12-01 14:51 ` [PATCH RFC net-next 12/15] net: stmmac: rk: introduce flags indicating support for RGMII/RMII Russell King (Oracle)
2025-12-01 14:51 ` [PATCH RFC net-next 13/15] net: stmmac: rk: replace empty set_to_rmii() with supports_rmii Russell King (Oracle)
2025-12-01 14:51 ` [PATCH RFC net-next 14/15] net: stmmac: rk: rk3328: gmac2phy only supports RMII Russell King (Oracle)
2025-12-01 14:51 ` [PATCH RFC net-next 15/15] net: stmmac: rk: rk3528: gmac0 " Russell King (Oracle)
2025-12-01 15:55 ` [PATCH RFC net-next 00/15] net: stmmac: rk: cleanups galore Andrew Lunn
2025-12-01 16:38   ` Russell King (Oracle)
2025-12-04  0:50     ` Jacob Keller
2025-12-01 16:44 ` Russell King (Oracle) [this message]
2025-12-04  0:51   ` Jacob Keller

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=aS3F36UAkeLfFeHx@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --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=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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;
as well as URLs for NNTP newsgroup(s).