From: David Yang <mmyangfl@gmail.com>
To: netdev@vger.kernel.org
Cc: David Yang <mmyangfl@gmail.com>, Andrew Lunn <andrew@lunn.ch>,
Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Russell King <linux@armlinux.org.uk>,
linux-kernel@vger.kernel.org
Subject: [PATCH net-next 1/7] net: dsa: motorcomm: Split xMII and SERDES port masks
Date: Thu, 10 Sep 2026 03:05:29 +0800 [thread overview]
Message-ID: <20260909190541.466476-2-mmyangfl@gmail.com> (raw)
In-Reply-To: <20260909190541.466476-1-mmyangfl@gmail.com>
Replace external_mask with xmii_mask and serdes_mask, and advertise the
interface modes it actually supports.
Also move struct yt921x_info into chip.h for future use.
Signed-off-by: David Yang <mmyangfl@gmail.com>
---
drivers/net/dsa/motorcomm/chip.c | 39 ++++++++++++--------------------
drivers/net/dsa/motorcomm/chip.h | 18 +++++++++++++++
2 files changed, 32 insertions(+), 25 deletions(-)
diff --git a/drivers/net/dsa/motorcomm/chip.c b/drivers/net/dsa/motorcomm/chip.c
index d663af010f43..64fdc5109cc6 100644
--- a/drivers/net/dsa/motorcomm/chip.c
+++ b/drivers/net/dsa/motorcomm/chip.c
@@ -96,18 +96,6 @@ static const struct yt921x_mib_desc yt921x_mib_descs[] = {
MIB_DESC(1, YT921X_MIB_DATA_TX_OAM, "TxOAM"),
};
-struct yt921x_info {
- const char *name;
- u16 major;
- /* Unknown, seems to be plain enumeration */
- u8 mode;
- u8 extmode;
- /* Ports with integral GbE PHYs, not including MCU Port 10 */
- u16 internal_mask;
- /* TODO: see comments in yt921x_dsa_phylink_get_caps() */
- u16 external_mask;
-};
-
#define YT921X_PORT_MASK_INTn(port) BIT(port)
#define YT921X_PORT_MASK_INT0_n(n) GENMASK((n) - 1, 0)
#define YT921X_PORT_MASK_EXT0 BIT(8)
@@ -117,37 +105,44 @@ static const struct yt921x_info yt921x_infos[] = {
{
"YT9215SC", YT9215_MAJOR, 1, 0,
YT921X_PORT_MASK_INT0_n(5),
+ YT921X_PORT_MASK_EXT1,
YT921X_PORT_MASK_EXT0 | YT921X_PORT_MASK_EXT1,
},
{
"YT9215S", YT9215_MAJOR, 2, 0,
YT921X_PORT_MASK_INT0_n(5),
- YT921X_PORT_MASK_EXT0 | YT921X_PORT_MASK_EXT1,
+ YT921X_PORT_MASK_EXT1,
+ YT921X_PORT_MASK_EXT0,
},
{
"YT9215RB", YT9215_MAJOR, 3, 0,
YT921X_PORT_MASK_INT0_n(5),
YT921X_PORT_MASK_EXT0 | YT921X_PORT_MASK_EXT1,
+ 0,
},
{
"YT9214NB", YT9215_MAJOR, 3, 2,
YT921X_PORT_MASK_INTn(1) | YT921X_PORT_MASK_INTn(3),
- YT921X_PORT_MASK_EXT0 | YT921X_PORT_MASK_EXT1,
+ YT921X_PORT_MASK_EXT1,
+ YT921X_PORT_MASK_EXT0,
},
{
"YT9213NB", YT9215_MAJOR, 3, 3,
YT921X_PORT_MASK_INTn(1) | YT921X_PORT_MASK_INTn(3),
YT921X_PORT_MASK_EXT1,
+ YT921X_PORT_MASK_EXT1,
},
{
"YT9218N", YT9218_MAJOR, 0, 0,
YT921X_PORT_MASK_INT0_n(8),
0,
+ 0,
},
{
"YT9218MB", YT9218_MAJOR, 1, 0,
YT921X_PORT_MASK_INT0_n(8),
YT921X_PORT_MASK_EXT0 | YT921X_PORT_MASK_EXT1,
+ YT921X_PORT_MASK_EXT0 | YT921X_PORT_MASK_EXT1,
},
{}
};
@@ -4026,15 +4021,10 @@ yt921x_dsa_phylink_get_caps(struct dsa_switch *ds, int port,
*/
__set_bit(PHY_INTERFACE_MODE_INTERNAL,
config->supported_interfaces);
- } else if (info->external_mask & BIT(port)) {
- /* TODO: external ports may support SERDES only, XMII only, or
- * SERDES + XMII depending on the chip. However, we can't get
- * the accurate config table due to lack of document, thus
- * we simply declare SERDES + XMII and rely on the correctness
- * of devicetree for now.
- */
+ return;
+ }
- /* SERDES */
+ if (BIT(port) & info->serdes_mask) {
__set_bit(PHY_INTERFACE_MODE_SGMII,
config->supported_interfaces);
/* REVSGMII (SGMII in PHY role) should go here, once
@@ -4047,9 +4037,8 @@ yt921x_dsa_phylink_get_caps(struct dsa_switch *ds, int port,
__set_bit(PHY_INTERFACE_MODE_2500BASEX,
config->supported_interfaces);
config->mac_capabilities |= MAC_2500FD;
-
- /* XMII */
-
+ }
+ if (BIT(port) & info->xmii_mask) {
/* Not tested. To add support for XMII:
* - Add proper interface modes below
* - Handle them in yt921x_port_config()
diff --git a/drivers/net/dsa/motorcomm/chip.h b/drivers/net/dsa/motorcomm/chip.h
index 83cd454955dd..bc2641ded101 100644
--- a/drivers/net/dsa/motorcomm/chip.h
+++ b/drivers/net/dsa/motorcomm/chip.h
@@ -960,6 +960,24 @@ struct yt921x_reg_ops {
int (*write)(void *context, u32 reg, u32 val);
};
+struct yt921x_info {
+ const char *name;
+ u16 major;
+ /* Unknown, seems to be plain enumeration */
+ u8 mode;
+ u8 extmode;
+ /* Ports with integral GbE PHYs, not including MCU Port 10 */
+ u16 internal_mask;
+ /* Note: xmii_mask and serdes_mask may overlap */
+ u16 xmii_mask;
+ u16 serdes_mask;
+};
+
+static inline u16 yt921x_info_ports_mask(const struct yt921x_info *info)
+{
+ return info->internal_mask | info->xmii_mask | info->serdes_mask;
+}
+
struct yt921x_priv {
struct dsa_switch ds;
--
2.53.0
next prev parent reply other threads:[~2026-09-09 19:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 19:05 [PATCH net-next 0/7] net: dsa: motorcomm: Add SerDes PCS David Yang
2026-09-09 19:05 ` David Yang [this message]
2026-09-10 20:59 ` [PATCH net-next 1/7] net: dsa: motorcomm: Split xMII and SERDES port masks Andrew Lunn
2026-09-10 21:37 ` David Yang
2026-09-09 19:05 ` [PATCH net-next 2/7] net: dsa: motorcomm: Check port type with runtime info David Yang
2026-09-09 19:05 ` [PATCH net-next 3/7] net: dsa: motorcomm: Fix port control/status register bit field names David Yang
2026-09-09 19:05 ` [PATCH net-next 4/7] net: dsa: motorcomm: Introduce yt921x_speed David Yang
2026-09-09 19:05 ` [PATCH net-next 5/7] net: dsa: motorcomm: Hoist port_to_priv helper into chip.h David Yang
2026-09-09 19:05 ` [PATCH net-next 6/7] net: dsa: motorcomm: Split MDIO bus module David Yang
2026-09-09 19:05 ` [PATCH net-next 7/7] net: dsa: motorcomm: Add SerDes PCS David Yang
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=20260909190541.466476-2-mmyangfl@gmail.com \
--to=mmyangfl@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--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
all inboxes | Powered by JetHome®