mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Daniel Golle <daniel@makrotopia.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>,
	Russell King <linux@armlinux.org.uk>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH v2 2/4] net: dsa: mxl862xx: move phylink stubs to mxl862xx-phylink.c
Date: Thu, 21 May 2026 16:07:03 +0200	[thread overview]
Message-ID: <e67882fc-5321-4fba-adb9-c1acae55ca3e@bootlin.com> (raw)
In-Reply-To: <8e31ea20fa8a7650176ce4c9c1603ee34571eeb5.1779330653.git.daniel@makrotopia.org>

Hi Daniel,

On 5/21/26 04:40, Daniel Golle wrote:
> Move the phylink MAC operations and get_caps callback from mxl862xx.c
> into a dedicated mxl862xx-phylink.c file. This prepares for the SerDes
> PCS implementation which adds substantial phylink/PCS code -- keeping
> it in a separate file avoids function-position churn in the main
> driver file.
> 
> No functional change.
> 
> Signed-off-by: Daniel Golle <daniel@makrotopia.org>

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Maxime

> ---
> v2: no changes
> 
>   drivers/net/dsa/mxl862xx/Makefile           |  2 +-
>   drivers/net/dsa/mxl862xx/mxl862xx-phylink.c | 51 +++++++++++++++++++++
>   drivers/net/dsa/mxl862xx/mxl862xx-phylink.h | 14 ++++++
>   drivers/net/dsa/mxl862xx/mxl862xx.c         | 38 +--------------
>   4 files changed, 67 insertions(+), 38 deletions(-)
>   create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx-phylink.c
>   create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx-phylink.h
> 
> diff --git a/drivers/net/dsa/mxl862xx/Makefile b/drivers/net/dsa/mxl862xx/Makefile
> index d23dd3cd511d..a7be0e6669df 100644
> --- a/drivers/net/dsa/mxl862xx/Makefile
> +++ b/drivers/net/dsa/mxl862xx/Makefile
> @@ -1,3 +1,3 @@
>   # SPDX-License-Identifier: GPL-2.0
>   obj-$(CONFIG_NET_DSA_MXL862) += mxl862xx_dsa.o
> -mxl862xx_dsa-y := mxl862xx.o mxl862xx-host.o
> +mxl862xx_dsa-y := mxl862xx.o mxl862xx-host.o mxl862xx-phylink.o
> diff --git a/drivers/net/dsa/mxl862xx/mxl862xx-phylink.c b/drivers/net/dsa/mxl862xx/mxl862xx-phylink.c
> new file mode 100644
> index 000000000000..f17c429d1f1d
> --- /dev/null
> +++ b/drivers/net/dsa/mxl862xx/mxl862xx-phylink.c
> @@ -0,0 +1,51 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Phylink and PCS support for MaxLinear MxL862xx switch family
> + *
> + * Copyright (C) 2024 MaxLinear Inc.
> + * Copyright (C) 2025 John Crispin <john@phrozen.org>
> + * Copyright (C) 2025 Daniel Golle <daniel@makrotopia.org>
> + */
> +
> +#include <linux/phylink.h>
> +#include <net/dsa.h>
> +
> +#include "mxl862xx.h"
> +#include "mxl862xx-phylink.h"
> +
> +void mxl862xx_phylink_get_caps(struct dsa_switch *ds, int port,
> +			       struct phylink_config *config)
> +{
> +	config->mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | MAC_10 |
> +				   MAC_100 | MAC_1000 | MAC_2500FD;
> +
> +	__set_bit(PHY_INTERFACE_MODE_INTERNAL,
> +		  config->supported_interfaces);
> +}
> +
> +static void mxl862xx_phylink_mac_config(struct phylink_config *config,
> +					unsigned int mode,
> +					const struct phylink_link_state *state)
> +{
> +}
> +
> +static void mxl862xx_phylink_mac_link_down(struct phylink_config *config,
> +					   unsigned int mode,
> +					   phy_interface_t interface)
> +{
> +}
> +
> +static void mxl862xx_phylink_mac_link_up(struct phylink_config *config,
> +					 struct phy_device *phydev,
> +					 unsigned int mode,
> +					 phy_interface_t interface,
> +					 int speed, int duplex,
> +					 bool tx_pause, bool rx_pause)
> +{
> +}
> +
> +const struct phylink_mac_ops mxl862xx_phylink_mac_ops = {
> +	.mac_config = mxl862xx_phylink_mac_config,
> +	.mac_link_down = mxl862xx_phylink_mac_link_down,
> +	.mac_link_up = mxl862xx_phylink_mac_link_up,
> +};
> diff --git a/drivers/net/dsa/mxl862xx/mxl862xx-phylink.h b/drivers/net/dsa/mxl862xx/mxl862xx-phylink.h
> new file mode 100644
> index 000000000000..c3d5215bdf60
> --- /dev/null
> +++ b/drivers/net/dsa/mxl862xx/mxl862xx-phylink.h
> @@ -0,0 +1,14 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +
> +#ifndef __MXL862XX_PHYLINK_H
> +#define __MXL862XX_PHYLINK_H
> +
> +#include <linux/phylink.h>
> +
> +#include "mxl862xx.h"
> +
> +extern const struct phylink_mac_ops mxl862xx_phylink_mac_ops;
> +void mxl862xx_phylink_get_caps(struct dsa_switch *ds, int port,
> +			       struct phylink_config *config);
> +
> +#endif /* __MXL862XX_PHYLINK_H */
> diff --git a/drivers/net/dsa/mxl862xx/mxl862xx.c b/drivers/net/dsa/mxl862xx/mxl862xx.c
> index 2f22adedfbf6..a193f3c07d35 100644
> --- a/drivers/net/dsa/mxl862xx/mxl862xx.c
> +++ b/drivers/net/dsa/mxl862xx/mxl862xx.c
> @@ -22,6 +22,7 @@
>   #include "mxl862xx-api.h"
>   #include "mxl862xx-cmd.h"
>   #include "mxl862xx-host.h"
> +#include "mxl862xx-phylink.h"
>   
>   #define MXL862XX_API_WRITE(dev, cmd, data) \
>   	mxl862xx_api_wrap(dev, cmd, &(data), sizeof((data)), false, false)
> @@ -1424,16 +1425,6 @@ static void mxl862xx_port_teardown(struct dsa_switch *ds, int port)
>   	priv->ports[port].setup_done = false;
>   }
>   
> -static void mxl862xx_phylink_get_caps(struct dsa_switch *ds, int port,
> -				      struct phylink_config *config)
> -{
> -	config->mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | MAC_10 |
> -				   MAC_100 | MAC_1000 | MAC_2500FD;
> -
> -	__set_bit(PHY_INTERFACE_MODE_INTERNAL,
> -		  config->supported_interfaces);
> -}
> -
>   static int mxl862xx_get_fid(struct dsa_switch *ds, struct dsa_db db)
>   {
>   	struct mxl862xx_priv *priv = ds->priv;
> @@ -2099,33 +2090,6 @@ static const struct dsa_switch_ops mxl862xx_switch_ops = {
>   	.get_stats64 = mxl862xx_get_stats64,
>   };
>   
> -static void mxl862xx_phylink_mac_config(struct phylink_config *config,
> -					unsigned int mode,
> -					const struct phylink_link_state *state)
> -{
> -}
> -
> -static void mxl862xx_phylink_mac_link_down(struct phylink_config *config,
> -					   unsigned int mode,
> -					   phy_interface_t interface)
> -{
> -}
> -
> -static void mxl862xx_phylink_mac_link_up(struct phylink_config *config,
> -					 struct phy_device *phydev,
> -					 unsigned int mode,
> -					 phy_interface_t interface,
> -					 int speed, int duplex,
> -					 bool tx_pause, bool rx_pause)
> -{
> -}
> -
> -static const struct phylink_mac_ops mxl862xx_phylink_mac_ops = {
> -	.mac_config = mxl862xx_phylink_mac_config,
> -	.mac_link_down = mxl862xx_phylink_mac_link_down,
> -	.mac_link_up = mxl862xx_phylink_mac_link_up,
> -};
> -
>   static int mxl862xx_probe(struct mdio_device *mdiodev)
>   {
>   	struct device *dev = &mdiodev->dev;


  reply	other threads:[~2026-05-21 14:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-21  2:39 [PATCH v2 0/4] net: dsa: mxl862xx: add SerDes ports Daniel Golle
2026-05-21  2:40 ` [PATCH v2 1/4] net: dsa: mxl862xx: store firmware version for feature gating Daniel Golle
2026-05-21  2:40 ` [PATCH v2 2/4] net: dsa: mxl862xx: move phylink stubs to mxl862xx-phylink.c Daniel Golle
2026-05-21 14:07   ` Maxime Chevallier [this message]
2026-05-21  2:40 ` [PATCH v2 3/4] net: dsa: mxl862xx: move API macros to mxl862xx-host.h Daniel Golle
2026-05-21 14:07   ` Maxime Chevallier
2026-05-21  2:41 ` [PATCH v2 4/4] net: dsa: mxl862xx: add support for SerDes ports Daniel Golle
2026-05-21 12:54   ` 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=e67882fc-5321-4fba-adb9-c1acae55ca3e@bootlin.com \
    --to=maxime.chevallier@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=daniel@makrotopia.org \
    --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

Powered by JetHome