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>,
Jakub Kicinski <kuba@kernel.org>,
linux-arm-kernel@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: [PATCH net-next 0/9] net: stmmac: rk: much needed cleanups
Date: Thu, 12 Jun 2025 16:40:54 +0100 [thread overview]
Message-ID: <aEr1BhIoC6-UM2XV@shell.armlinux.org.uk> (raw)
Hi,
This series starts attacking the reams of fairly identical duplicated
code in dwmac-rk. Every new SoC that comes along seems to need more
code added to this file because e.g. the way the clock is controlled
is different in every SoC.
The first thing to realise is that the driver only supports RMII and
RGMII interface modes. So, the first patch adds a .get_interfaces()
implementation which reports this for phylink's usage, thus ensuring
that we error out during initialisation should something that isn't
supported be specified. Note that there is one case where there are
a pair of interfaces, one supports only RMII the other supports RMII
and RGMII, but we report both anyway - something that the existing
driver allows. A future patch may attempt to fix this.
Rather than writing code, let's realise that there are two major
implementations here:
1. a struct clk that needs to be set.
2. writing a register with settings for RGMII and RMII speeds.
Provide implementations for these, Also realise that as a result
of doing this, we can kill off the .set_rgmii_speed() and
.set_rmii_speed() methods by combining them together - indeed,
this is what later SoCs already do by pointing both these methods
at the same function.
Overall, this patch series shrinks the file LOC by almost 8.7%
by removing 175 lines from over 2000 lines.
Apart from the error reporting changing and restricting interface
modes to those that the driver supports, no functional change is
anticipated with this patch. However, I have no hardware to test
this.
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 689 +++++++++----------------
1 file changed, 257 insertions(+), 432 deletions(-)
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
next reply other threads:[~2025-06-12 15:41 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-12 15:40 Russell King (Oracle) [this message]
2025-06-12 15:40 ` [PATCH net-next 1/9] net: stmmac: rk: add get_interfaces() implementation Russell King (Oracle)
2025-06-12 15:46 ` Andrew Lunn
2025-06-12 15:40 ` [PATCH net-next 2/9] net: stmmac: rk: simplify set_*_speed() Russell King (Oracle)
2025-06-12 15:47 ` Andrew Lunn
2025-06-12 15:40 ` [PATCH net-next 3/9] net: stmmac: rk: add struct for programming register based speeds Russell King (Oracle)
2025-06-12 15:48 ` Andrew Lunn
2025-06-12 15:40 ` [PATCH net-next 4/9] net: stmmac: rk: combine rv1126 set_*_speed() methods Russell King (Oracle)
2025-06-12 15:49 ` Andrew Lunn
2025-06-12 15:41 ` [PATCH net-next 5/9] net: stmmac: rk: combine clk_mac_speed rate setting functions Russell King (Oracle)
2025-06-12 15:49 ` Andrew Lunn
2025-06-12 15:41 ` [PATCH net-next 6/9] net: stmmac: rk: combine .set_*_speed() methods Russell King (Oracle)
2025-06-12 15:51 ` Andrew Lunn
2025-06-12 15:41 ` [PATCH net-next 7/9] net: stmmac: rk: simplify px30_set_rmii_speed() Russell King (Oracle)
2025-06-12 15:52 ` Andrew Lunn
2025-06-12 15:41 ` [PATCH net-next 8/9] net: stmmac: rk: convert px30_set_rmii_speed() to .set_speed() Russell King (Oracle)
2025-06-12 15:52 ` Andrew Lunn
2025-06-12 15:41 ` [PATCH net-next 9/9] net: stmmac: rk: remove obsolete .set_*_speed() methods Russell King (Oracle)
2025-06-12 15:53 ` Andrew Lunn
2025-06-14 1:30 ` [PATCH net-next 0/9] net: stmmac: rk: much needed cleanups 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=aEr1BhIoC6-UM2XV@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=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@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).