From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: davem@davemloft.net, Andrew Lunn <andrew@lunn.ch>,
Jakub Kicinski <kuba@kernel.org>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Russell King <linux@armlinux.org.uk>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Heiner Kallweit <hkallweit1@gmail.com>
Cc: "Maxime Chevallier" <maxime.chevallier@bootlin.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
thomas.petazzoni@bootlin.com,
"Herve Codina" <herve.codina@bootlin.com>,
"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
linuxppc-dev@lists.ozlabs.org
Subject: [PATCH net-next v2 09/10] net: freescale: ucc_geth: Introduce a helper to check Reduced modes
Date: Thu, 14 Nov 2024 16:36:00 +0100 [thread overview]
Message-ID: <20241114153603.307872-10-maxime.chevallier@bootlin.com> (raw)
In-Reply-To: <20241114153603.307872-1-maxime.chevallier@bootlin.com>
A number of parallel MII interfaces also exist in a "Reduced" mode,
usually with higher clock rates and fewer data lines, to ease the
hardware design. This is what the 'R' stands for in RGMII, RMII, RTBI,
RXAUI, etc.
The UCC Geth controller has a special configuration bit that needs to be
set when the MII mode is one of the supported reduced modes.
Add a local helper for that.
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
V2: New patch
drivers/net/ethernet/freescale/ucc_geth.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
index 15d05b270b6e..ace332d51aa8 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.c
+++ b/drivers/net/ethernet/freescale/ucc_geth.c
@@ -1258,6 +1258,13 @@ static int init_min_frame_len(u16 min_frame_length,
return 0;
}
+static bool phy_interface_mode_is_reduced(phy_interface_t interface)
+{
+ return phy_interface_mode_is_rgmii(interface) ||
+ interface == PHY_INTERFACE_MODE_RMII ||
+ interface == PHY_INTERFACE_MODE_RTBI;
+}
+
static int adjust_enet_interface(struct ucc_geth_private *ugeth)
{
struct ucc_geth_info *ug_info;
@@ -1290,12 +1297,7 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth)
upsmr = in_be32(&uf_regs->upsmr);
upsmr &= ~(UCC_GETH_UPSMR_RPM | UCC_GETH_UPSMR_R10M |
UCC_GETH_UPSMR_TBIM | UCC_GETH_UPSMR_RMM);
- if ((ugeth->phy_interface == PHY_INTERFACE_MODE_RMII) ||
- (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII) ||
- (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_ID) ||
- (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
- (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) ||
- (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) {
+ if (phy_interface_mode_is_reduced(ugeth->phy_interface)) {
if (ugeth->phy_interface != PHY_INTERFACE_MODE_RMII)
upsmr |= UCC_GETH_UPSMR_RPM;
switch (ugeth->max_speed) {
@@ -1594,9 +1596,7 @@ static void ugeth_link_up(struct ucc_geth_private *ugeth,
~(MACCFG2_INTERFACE_MODE_MASK)) |
MACCFG2_INTERFACE_MODE_NIBBLE);
/* if reduced mode, re-set UPSMR.R10M */
- if (interface == PHY_INTERFACE_MODE_RMII ||
- phy_interface_mode_is_rgmii(interface) ||
- interface == PHY_INTERFACE_MODE_RTBI) {
+ if (phy_interface_mode_is_reduced(interface)) {
if (speed == SPEED_10)
upsmr |= UCC_GETH_UPSMR_R10M;
else
--
2.47.0
next prev parent reply other threads:[~2024-11-14 15:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-14 15:35 [PATCH net-next v2 00/10] net: freescale: ucc_geth: Phylink conversion Maxime Chevallier
2024-11-14 15:35 ` [PATCH net-next v2 01/10] net: freescale: ucc_geth: Drop support for the "interface" DT property Maxime Chevallier
2024-11-15 12:19 ` Simon Horman
2024-11-20 8:43 ` Maxime Chevallier
2024-11-14 15:35 ` [PATCH net-next v2 02/10] net: freescale: ucc_geth: split adjust_link for phylink conversion Maxime Chevallier
2024-11-14 15:35 ` [PATCH net-next v2 03/10] net: freescale: ucc_geth: Use netdev->phydev to access the PHY Maxime Chevallier
2024-11-14 15:35 ` [PATCH net-next v2 04/10] net: freescale: ucc_geth: Fix WOL configuration Maxime Chevallier
2024-11-14 15:35 ` [PATCH net-next v2 05/10] net: freescale: ucc_geth: Use the correct type to store WoL opts Maxime Chevallier
2024-11-14 15:35 ` [PATCH net-next v2 06/10] net: freescale: ucc_geth: Simplify frame length check Maxime Chevallier
2024-11-14 15:35 ` [PATCH net-next v2 07/10] net: freescale: ucc_geth: Hardcode the preamble length to 7 bytes Maxime Chevallier
2024-11-14 15:35 ` [PATCH net-next v2 08/10] net: freescale: ucc_geth: Move the serdes configuration around Maxime Chevallier
2024-11-14 15:36 ` Maxime Chevallier [this message]
2024-11-14 15:36 ` [PATCH net-next v2 10/10] net: freescale: ucc_geth: phylink conversion Maxime Chevallier
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=20241114153603.307872-10-maxime.chevallier@bootlin.com \
--to=maxime.chevallier@bootlin.com \
--cc=andrew@lunn.ch \
--cc=christophe.leroy@csgroup.eu \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=herve.codina@bootlin.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=u.kleine-koenig@baylibre.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).