[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zy3tPeWCHOH-CMoy@shell.armlinux.org.uk>
Date: Fri, 8 Nov 2024 10:51:41 +0000
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Christian Marangi <ansuelsmth@...il.com>
Cc: Andrew Lunn <andrew@...n.ch>, Florian Fainelli <f.fainelli@...il.com>,
Vladimir Oltean <olteanv@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Heiner Kallweit <hkallweit1@...il.com>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, netdev@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
upstream@...oha.com
Subject: Re: [net-next PATCH v3 2/3] net: dsa: Add Airoha AN8855 5-Port
Gigabit DSA Switch driver
On Wed, Nov 06, 2024 at 01:22:37PM +0100, Christian Marangi wrote:
> +static int an8855_port_enable(struct dsa_switch *ds, int port,
> + struct phy_device *phy)
> +{
> + int ret;
> +
> + ret = an8855_port_set_status(ds->priv, port, true);
> + if (ret)
> + return ret;
> +
> + if (dsa_is_user_port(ds, port))
> + phy_support_asym_pause(phy);
This is unnecessary if you've set the phylink capabilities correctly
because phylink_bringup_phy() will setup the PHY accordingly.
> +static u32 en8855_get_phy_flags(struct dsa_switch *ds, int port)
> +{
> + struct an8855_priv *priv = ds->priv;
> +
> + /* PHY doesn't need calibration */
> + if (!priv->phy_require_calib)
> + return 0;
> +
> + /* Use BIT(0) to signal calibration needed */
> + return BIT(0);
This should be a #define somewhere that preferably includes the PHY
name so we have an idea in future which PHY driver is going to be
making use of this random bit.
> +static struct phylink_pcs *
> +an8855_phylink_mac_select_pcs(struct phylink_config *config,
> + phy_interface_t interface)
> +{
> + struct dsa_port *dp = dsa_phylink_to_port(config);
> + struct an8855_priv *priv = dp->ds->priv;
> +
> + switch (interface) {
> + case PHY_INTERFACE_MODE_SGMII:
> + case PHY_INTERFACE_MODE_2500BASEX:
> + return &priv->pcs;
> + default:
> + return NULL;
> + }
> +}
> +
> +static void
> +an8855_phylink_mac_config(struct phylink_config *config, unsigned int mode,
> + const struct phylink_link_state *state)
> +{
> + struct dsa_port *dp = dsa_phylink_to_port(config);
> + struct dsa_switch *ds = dp->ds;
> + struct an8855_priv *priv;
> + int port = dp->index;
> +
> + priv = ds->priv;
> +
> + switch (port) {
> + case 0:
> + case 1:
> + case 2:
> + case 3:
> + case 4:
> + return;
> + case 5:
> + break;
> + default:
> + dev_err(ds->dev, "unsupported port: %d", port);
> + return;
> + }
if (port != 5) {
if (port > 5)
dev_err(ds->dev, "unsupported port: %d", port);
return;
}
is simpler, no?
> +static int an8855_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
> + phy_interface_t interface,
> + const unsigned long *advertising,
> + bool permit_pause_to_mac)
> +{
> + struct an8855_priv *priv = container_of(pcs, struct an8855_priv, pcs);
> + u32 val;
> + int ret;
> +
> + switch (interface) {
> + case PHY_INTERFACE_MODE_RGMII:
> + return 0;
This shouldn't happen. First, in an8855_phylink_mac_select_pcs(), you
don't return a PCS in this mode. Second, phylink is highly unlikely to
switch from SGMII/2500baseX to RGMII mode. Third, in commit
486dc391ef43 ("net: phylink: allow mac_select_pcs() to remove a PCS")
will ensure that if phylink does do such a switch, because
an8855_phylink_mac_select_pcs() returns NULL for RGMII, these PCS
functions will never be called for RGMII modes.
Thanks.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists