Netdev List
 help / color / mirror / Atom feed
From: Kordian Chmielewski <kudzo51@gmail.com>
To: netdev@vger.kernel.org
Cc: "Florian Fainelli" <florian.fainelli@broadcom.com>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Jonas Gorski" <jonas.gorski@gmail.com>,
	"Andrew Lunn" <andrew@lunn.ch>,
	"Vladimir Oltean" <olteanv@gmail.com>,
	"Rafał Miłecki" <rafal@milecki.pl>,
	"David S . Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@kernel.org>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>
Subject: [PATCH net] net: dsa: bcm_sf2: don't warn when BCM4908 port 7 is not used
Date: Wed,  2 Dec 2026 10:58:35 +0100	[thread overview]
Message-ID: <20261202095743.157195-1-kudzo51@gmail.com> (raw)

bcm_sf2_crossbar_setup() connects port 7 of the BCM4908 switch to the
internal GPHY4 or to the RGMII pins, depending on the port's mode, and
warns "Invalid port mode" otherwise. A device tree that does not use
port 7, such as bcm94908.dts, leaves that mode at PHY_INTERFACE_MODE_NA,
so bcm_sf2_crossbar_setup() hits the WARN on every call, from
bcm_sf2_sw_probe() and from bcm_sf2_sw_resume(), although nothing is
wrong.

Return before setting up the port 7 route when port 7 has no mode. The
function did not write the register in that case before either, so
only the warning goes away. A port 7 node without a valid phy-mode is
treated the same way. A port 7 with a mode that the crossbar code does
not handle still warns.

Fixes: a9349f08ec6c ("net: dsa: bcm_sf2: setup BCM4908 internal crossbar")
Signed-off-by: Kordian Chmielewski <kudzo51@gmail.com>
---
Tested on a TP-Link Archer AX6000 v1 with OpenWrt and Linux 6.18.55,
whose bcm_sf2_crossbar_setup() is the one in net, and a device tree
without port 7. Without this patch the boot log has the warning twice,
once in each of the two calls of bcm_sf2_sw_probe(); with it there is
none. In both cases the four LAN ports registered, and TCP between the
router and a host on lan1, the only port with a link, ran at 941 Mbit/s
in both directions. Resume was not tested.

 drivers/net/dsa/bcm_sf2.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index cbaa5de9b107..f30cedb9ec73 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -518,6 +518,10 @@ static void bcm_sf2_crossbar_setup(struct bcm_sf2_priv *priv)
 	reg = reg_readl(priv, REG_CROSSBAR);
 	switch (priv->type) {
 	case BCM4908_DEVICE_ID:
+		/* Nothing to route when the device tree does not use port 7 */
+		if (priv->port_sts[7].mode == PHY_INTERFACE_MODE_NA)
+			return;
+
 		shift = CROSSBAR_BCM4908_INT_P7 * priv->num_crossbar_ext_bits;
 		reg &= ~(mask << shift);
 		if (0) /* FIXME */

base-commit: 0d39bf81267861742b80d5f1c52e8a63e9ca0ca1
-- 
2.56.1


                 reply	other threads:[~2026-12-02  9:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261202095743.157195-1-kudzo51@gmail.com \
    --to=kudzo51@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=jonas.gorski@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=rafal@milecki.pl \
    /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