From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: David Yang <mmyangfl@gmail.com>
Cc: netdev@vger.kernel.org, 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>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Simon Horman <horms@kernel.org>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v9 3/3] net: dsa: yt921x: Add support for Motorcomm YT921x
Date: Mon, 15 Sep 2025 23:42:41 +0100 [thread overview]
Message-ID: <aMiWYWKzrFnwyTuz@shell.armlinux.org.uk> (raw)
In-Reply-To: <20250913044404.63641-4-mmyangfl@gmail.com>
On Sat, Sep 13, 2025 at 12:44:01PM +0800, David Yang wrote:
> +static int
> +yt921x_port_config(struct yt921x_priv *priv, int port, unsigned int mode,
> + phy_interface_t interface)
> +{
> + struct device *dev = to_device(priv);
> + u32 mask;
> + u32 ctrl;
> + int res;
> +
> + if (!yt921x_port_is_external(port)) {
> + if (interface != PHY_INTERFACE_MODE_INTERNAL) {
> + dev_err(dev, "Wrong mode %d on port %d\n",
> + interface, port);
> + return -EINVAL;
> + }
> + return 0;
> + }
> +
> + switch (interface) {
> + /* SGMII */
> + case PHY_INTERFACE_MODE_SGMII:
> + case PHY_INTERFACE_MODE_100BASEX:
> + case PHY_INTERFACE_MODE_1000BASEX:
> + case PHY_INTERFACE_MODE_2500BASEX:
> + mask = YT921X_SGMII_CTRL_PORTn(port);
> + res = yt921x_reg_set_bits(priv, YT921X_SGMII_CTRL, mask);
> + if (res)
> + return res;
> +
> + mask = YT921X_XMII_CTRL_PORTn(port);
> + res = yt921x_reg_clear_bits(priv, YT921X_XMII_CTRL, mask);
> + if (res)
> + return res;
> +
> + mask = YT921X_SGMII_MODE_M;
> + switch (interface) {
> + case PHY_INTERFACE_MODE_SGMII:
> + ctrl = YT921X_SGMII_MODE_SGMII_PHY;
Does this mean that "SGMII" here means you are sending SGMII
speed/duplex to a host MAC (in other words, immitating a PHY) ?
If yes, then I think we want PHY_INTERFACE_MODE_REVSGMII added.
> +static void
> +yt921x_phylink_mac_link_down(struct phylink_config *config, unsigned int mode,
> + phy_interface_t interface)
> +{
> + struct dsa_port *dp = dsa_phylink_to_port(config);
> + struct dsa_switch *ds = dp->ds;
> + struct yt921x_priv *priv = to_yt921x_priv(ds);
> + struct device *dev = to_device(priv);
> + int port = dp->index;
> + int res;
Reverse christmas tree ordering please, and do we need "struct device
*dev..." because ds->dev should be this same device. Maybe:
struct dsa_port *dp = dsa_phylink_to_port(config);
struct yt921x_priv *priv = to_yt921x_priv(dp->ds);
int port = dp->index;
int res;
> +
> + cancel_delayed_work(&priv->ports[port].mib_read);
> +
> + mutex_lock(&priv->reg_lock);
> + res = yt921x_port_down(priv, port);
> + mutex_unlock(&priv->reg_lock);
> +
> + if (res)
> + dev_err(dev, "Failed to %s port %d: %i\n", "bring down",
> + port, res);
Then:
dev_err(dp->ds->dev, ...
Same comment for the other phylink methods.
Thanks.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2025-09-15 22:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-13 4:43 [PATCH net-next v9 0/3] net: dsa: yt921x: Add support for Motorcomm YT921x David Yang
2025-09-13 4:43 ` [PATCH net-next v9 1/3] dt-bindings: net: dsa: yt921x: Add Motorcomm YT921x switch support David Yang
2025-09-13 4:44 ` [PATCH net-next v9 2/3] net: dsa: tag_yt921x: add support for Motorcomm YT921x tags David Yang
2025-09-13 4:44 ` [PATCH net-next v9 3/3] net: dsa: yt921x: Add support for Motorcomm YT921x David Yang
2025-09-15 10:30 ` Simon Horman
2025-09-15 22:42 ` Russell King (Oracle) [this message]
2025-09-16 1:32 ` Andrew Lunn
2025-09-16 23:17 ` Vladimir Oltean
2025-09-17 0:08 ` Andrew Lunn
2025-09-17 10:02 ` Vladimir Oltean
2025-09-17 12:37 ` Andrew Lunn
2025-09-18 14:23 ` Yangfl
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=aMiWYWKzrFnwyTuz@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=andrew@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mmyangfl@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=robh@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.