mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Daniel Golle <daniel@makrotopia.org>
Cc: 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>,
	Hauke Mehrtens <hauke@hauke-m.de>,
	Simon Horman <horms@kernel.org>,
	Russell King <linux@armlinux.org.uk>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Arkadi Sharshevsky <arkadis@mellanox.com>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	Andreas Schirm <andreas.schirm@siemens.com>,
	Lukas Stockmann <lukas.stockmann@siemens.com>,
	Alexander Sverdlin <alexander.sverdlin@siemens.com>,
	Peter Christen <peter.christen@siemens.com>,
	Avinash Jayaraman <ajayaraman@maxlinear.com>,
	Bing tao Xu <bxu@maxlinear.com>, Liang Xu <lxu@maxlinear.com>,
	Juraj Povazanec <jpovazanec@maxlinear.com>,
	"Fanni (Fang-Yi) Chan" <fchan@maxlinear.com>,
	"Benny (Ying-Tsan) Weng" <yweng@maxlinear.com>,
	"Livia M. Rosu" <lrosu@maxlinear.com>,
	John Crispin <john@phrozen.org>
Subject: Re: [PATCH RFC net-next 05/23] net: dsa: lantiq_gswip: introduce bitmaps for port types
Date: Sun, 17 Aug 2025 17:19:23 +0200	[thread overview]
Message-ID: <622cde0e-8ec6-4de1-bbbf-39dedac71046@lunn.ch> (raw)
In-Reply-To: <aKDhXWIjk3VYYTQh@pidgin.makrotopia.org>

On Sat, Aug 16, 2025 at 08:51:57PM +0100, Daniel Golle wrote:
> Instead of relying on hard-coded numbers for MII ports, introduce
> bitmaps for ports with either built-in PHYs, MII or SGMII.
> This is done in order to prepare for supporting MaxLinear GSW1xx ICs
> which got a different layout of ports, and also support SGMII.
> 
> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> ---
>  drivers/net/dsa/lantiq_gswip.c | 15 ++++++++++++---
>  drivers/net/dsa/lantiq_gswip.h |  3 +++
>  2 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c
> index 5a8fb358fb59..86e02ac0c221 100644
> --- a/drivers/net/dsa/lantiq_gswip.c
> +++ b/drivers/net/dsa/lantiq_gswip.c
> @@ -185,14 +185,19 @@ static void gswip_mii_mask(struct gswip_priv *priv, u32 clear, u32 set,
>  static void gswip_mii_mask_cfg(struct gswip_priv *priv, u32 clear, u32 set,
>  			       int port)
>  {
> -	/* There's no MII_CFG register for the CPU port */
> -	if (!dsa_is_cpu_port(priv->ds, port))
> -		gswip_mii_mask(priv, clear, set, GSWIP_MII_CFGp(port));
> +	if (!(priv->hw_info->mii_ports & BIT(port)))
> +		return;
> +
> +	/* MII_CFG register only exists for MII ports */
> +	gswip_mii_mask(priv, clear, set, GSWIP_MII_CFGp(port));

I would probably put the comment before the if (). The comment is
about the if () after all. And it is replacing the current comment and
the presence or not of the register.

> +	.phy_ports = BIT(2) | BIT(3) | BIT(4) | BIT(5),
> +	.mii_ports = BIT(0) | BIT(5),

phy_ports is a bit ambiguous, all ports should be capable of having a
PHY somehow. Maybe internal_phy_ports? or int_phy_ports if that is too
long.

> @@ -217,6 +217,9 @@
>  struct gswip_hw_info {
>  	int max_ports;
>  	unsigned int allowed_cpu_ports;
> +	unsigned int phy_ports;
> +	unsigned int mii_ports;
> +	unsigned int sgmii_ports;

Maybe ass sgmii_ports when you add support for sgmii? This patch does
not need it, i think.

    Andrew

---
pw-bot: cr

      reply	other threads:[~2025-08-17 15:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-16 19:51 Daniel Golle
2025-08-17 15:19 ` Andrew Lunn [this message]

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=622cde0e-8ec6-4de1-bbbf-39dedac71046@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=ajayaraman@maxlinear.com \
    --cc=alexander.sverdlin@siemens.com \
    --cc=andreas.schirm@siemens.com \
    --cc=arkadis@mellanox.com \
    --cc=bxu@maxlinear.com \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=fchan@maxlinear.com \
    --cc=hauke@hauke-m.de \
    --cc=horms@kernel.org \
    --cc=john@phrozen.org \
    --cc=jpovazanec@maxlinear.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=lrosu@maxlinear.com \
    --cc=lukas.stockmann@siemens.com \
    --cc=lxu@maxlinear.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=peter.christen@siemens.com \
    --cc=yweng@maxlinear.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®