From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
To: Tristram.Ha@microchip.com
Cc: Vladimir Oltean <olteanv@gmail.com>,
UNGLinuxDriver@microchip.com,
Woojung Huh <woojung.huh@microchip.com>,
Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org
Subject: [PATCH RFC net-next 1/4] net: xpcs: add support for configuring width of 10/100M MII connection
Date: Wed, 05 Feb 2025 13:27:32 +0000 [thread overview]
Message-ID: <E1tffRE-003Z5c-0L@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <Z6NnPm13D1n5-Qlw@shell.armlinux.org.uk>
When in SGMII mode, the hardware can be configured to use either 4-bit
or 8-bit MII connection. Currently, we don't change this bit for most
implementations with the exception of TXGBE requiring 8-bit. Move this
decision to the creation code and act on it when configuring SGMII.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/pcs/pcs-xpcs.c | 19 +++++++++++++++----
drivers/net/pcs/pcs-xpcs.h | 8 ++++++++
2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c
index 1faa37f0e7b9..12a3d5a80b45 100644
--- a/drivers/net/pcs/pcs-xpcs.c
+++ b/drivers/net/pcs/pcs-xpcs.c
@@ -695,9 +695,18 @@ static int xpcs_config_aneg_c37_sgmii(struct dw_xpcs *xpcs,
val = FIELD_PREP(DW_VR_MII_PCS_MODE_MASK,
DW_VR_MII_PCS_MODE_C37_SGMII);
- if (xpcs->info.pma == WX_TXGBE_XPCS_PMA_10G_ID) {
- mask |= DW_VR_MII_AN_CTRL_8BIT;
+ switch (xpcs->sgmii_10_100_8bit) {
+ case DW_XPCS_SGMII_10_100_8BIT:
val |= DW_VR_MII_AN_CTRL_8BIT;
+ fallthrough;
+ case DW_XPCS_SGMII_10_100_4BIT:
+ mask |= DW_VR_MII_AN_CTRL_8BIT;
+ fallthrough;
+ case DW_XPCS_SGMII_10_100_UNCHANGED:
+ break;
+ }
+
+ if (xpcs->info.pma == WX_TXGBE_XPCS_PMA_10G_ID) {
/* Hardware requires it to be PHY side SGMII */
tx_conf = DW_VR_MII_TX_CONFIG_PHY_SIDE_SGMII;
} else {
@@ -1450,10 +1459,12 @@ static struct dw_xpcs *xpcs_create(struct mdio_device *mdiodev)
xpcs_get_interfaces(xpcs, xpcs->pcs.supported_interfaces);
- if (xpcs->info.pma == WX_TXGBE_XPCS_PMA_10G_ID)
+ if (xpcs->info.pma == WX_TXGBE_XPCS_PMA_10G_ID) {
xpcs->pcs.poll = false;
- else
+ xpcs->sgmii_10_100_8bit = DW_XPCS_SGMII_10_100_8BIT;
+ } else {
xpcs->need_reset = true;
+ }
return xpcs;
diff --git a/drivers/net/pcs/pcs-xpcs.h b/drivers/net/pcs/pcs-xpcs.h
index adc5a0b3c883..4d53ccf917f3 100644
--- a/drivers/net/pcs/pcs-xpcs.h
+++ b/drivers/net/pcs/pcs-xpcs.h
@@ -114,6 +114,12 @@ enum dw_xpcs_clock {
DW_XPCS_NUM_CLKS,
};
+enum dw_xpcs_sgmii_10_100 {
+ DW_XPCS_SGMII_10_100_UNCHANGED,
+ DW_XPCS_SGMII_10_100_4BIT,
+ DW_XPCS_SGMII_10_100_8BIT
+};
+
struct dw_xpcs {
struct dw_xpcs_info info;
const struct dw_xpcs_desc *desc;
@@ -122,6 +128,8 @@ struct dw_xpcs {
struct phylink_pcs pcs;
phy_interface_t interface;
bool need_reset;
+ /* Width of the MII MAC/XPCS interface in 100M and 10M modes */
+ enum dw_xpcs_sgmii_10_100 sgmii_10_100_8bit;
};
int xpcs_read(struct dw_xpcs *xpcs, int dev, u32 reg);
--
2.30.2
next prev parent reply other threads:[~2025-02-05 13:27 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-05 13:27 [PATCH RFC net-next 0/4] net: xpcs: cleanups and partial support for KSZ9477 Russell King (Oracle)
2025-02-05 13:27 ` Russell King (Oracle) [this message]
2025-02-07 18:45 ` [PATCH RFC net-next 1/4] net: xpcs: add support for configuring width of 10/100M MII connection Tristram.Ha
2025-02-05 13:27 ` [PATCH RFC net-next 2/4] net: xpcs: add SGMII mode setting Russell King (Oracle)
2025-02-07 18:46 ` Tristram.Ha
2025-02-05 13:27 ` [PATCH RFC net-next 3/4] net: xpcs: add SGMII MAC manual update mode Russell King (Oracle)
2025-02-07 18:46 ` Tristram.Ha
2025-02-05 13:27 ` [PATCH RFC net-next 4/4] net: xpcs: allow 1000BASE-X to work with older XPCS IP Russell King (Oracle)
2025-02-07 18:47 ` Tristram.Ha
2025-02-10 11:05 ` Vladimir Oltean
2025-02-10 11:49 ` Russell King (Oracle)
2025-02-10 12:02 ` Vladimir Oltean
2025-02-08 12:01 ` [PATCH RFC net-next 0/4] net: xpcs: cleanups and partial support for KSZ9477 Russell King (Oracle)
2025-03-18 19:59 ` Tristram.Ha
2025-03-31 14:31 ` Vladimir Oltean
2025-04-12 0:18 ` Tristram.Ha
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=E1tffRE-003Z5c-0L@rmk-PC.armlinux.org.uk \
--to=rmk+kernel@armlinux.org.uk \
--cc=Tristram.Ha@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=woojung.huh@microchip.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).