From: "Álvaro Fernández Rojas" <noltari@gmail.com>
To: jonas.gorski@gmail.com, florian.fainelli@broadcom.com,
andrew@lunn.ch, olteanv@gmail.com, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
vivien.didelot@gmail.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, dgcbueu@gmail.com
Cc: "Álvaro Fernández Rojas" <noltari@gmail.com>
Subject: [RFC PATCH net-next v2 10/10] net: dsa: b53: ensure BCM5325 PHYs are enabled
Date: Tue, 3 Jun 2025 22:48:58 +0200 [thread overview]
Message-ID: <20250603204858.72402-11-noltari@gmail.com> (raw)
In-Reply-To: <20250603204858.72402-1-noltari@gmail.com>
According to the datasheet, BCM5325 uses B53_PD_MODE_CTRL_25 register to
disable clocking to individual PHYs.
Only ports 1-4 can be enabled or disabled and the datasheet is explicit
about not toggling BIT(0) since it disables the PLL power and the switch.
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
drivers/net/dsa/b53/b53_common.c | 13 +++++++++++++
drivers/net/dsa/b53/b53_regs.h | 2 ++
2 files changed, 15 insertions(+)
v2: add changes requested by Florian:
- Move B53_PD_MODE_CTRL_25 to b53_setup_port().
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index a9b19451ffb30..38c08f6278d27 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -659,6 +659,19 @@ int b53_setup_port(struct dsa_switch *ds, int port)
if (dsa_is_user_port(ds, port))
b53_set_eap_mode(dev, port, EAP_MODE_SIMPLIFIED);
+ if (is5325(dev) &&
+ (port >= B53_PD_MODE_PORT_MIN) &&
+ (port <= B53_PD_MODE_PORT_MAX)) {
+ u8 reg;
+
+ b53_read8(dev, B53_CTRL_PAGE, B53_PD_MODE_CTRL_25, ®);
+ if (dsa_is_unused_port(ds, port))
+ reg |= BIT(port);
+ else
+ reg &= ~BIT(port);
+ b53_write8(dev, B53_CTRL_PAGE, B53_PD_MODE_CTRL_25, reg);
+ }
+
return 0;
}
EXPORT_SYMBOL(b53_setup_port);
diff --git a/drivers/net/dsa/b53/b53_regs.h b/drivers/net/dsa/b53/b53_regs.h
index d6849cf6b0a3a..880c67130a9fc 100644
--- a/drivers/net/dsa/b53/b53_regs.h
+++ b/drivers/net/dsa/b53/b53_regs.h
@@ -105,6 +105,8 @@
/* Power-down mode control */
#define B53_PD_MODE_CTRL_25 0x0f
+#define B53_PD_MODE_PORT_MIN 1
+#define B53_PD_MODE_PORT_MAX 4
/* IP Multicast control (8 bit) */
#define B53_IP_MULTICAST_CTRL 0x21
--
2.39.5
next prev parent reply other threads:[~2025-06-03 20:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-03 20:48 [RFC PATCH net-next v2 00/10] net: dsa: b53: fix BCM5325 support Álvaro Fernández Rojas
2025-06-03 20:48 ` [RFC PATCH net-next v2 01/10] net: dsa: b53: add support for FDB operations on 5325/5365 Álvaro Fernández Rojas
2025-06-03 22:10 ` Florian Fainelli
2025-06-04 6:32 ` Jonas Gorski
2025-06-11 7:55 ` Álvaro Fernández Rojas
2025-06-03 20:48 ` [RFC PATCH net-next v2 02/10] net: dsa: b53: prevent FAST_AGE access on BCM5325 Álvaro Fernández Rojas
2025-06-03 20:48 ` [RFC PATCH net-next v2 03/10] net: dsa: b53: prevent SWITCH_CTRL " Álvaro Fernández Rojas
2025-06-03 20:48 ` [RFC PATCH net-next v2 04/10] net: dsa: b53: fix IP_MULTICAST_CTRL " Álvaro Fernández Rojas
2025-06-03 20:48 ` [RFC PATCH net-next v2 05/10] net: dsa: b53: prevent DIS_LEARNING access " Álvaro Fernández Rojas
2025-06-03 20:48 ` [RFC PATCH net-next v2 06/10] net: dsa: b53: prevent BRCM_HDR " Álvaro Fernández Rojas
2025-06-04 18:05 ` Jonas Gorski
2025-06-03 20:48 ` [RFC PATCH net-next v2 07/10] net: dsa: b53: prevent GMII_PORT_OVERRIDE_CTRL " Álvaro Fernández Rojas
2025-06-03 20:48 ` [RFC PATCH net-next v2 08/10] net: dsa: b53: fix unicast/multicast flooding " Álvaro Fernández Rojas
2025-06-03 20:48 ` [RFC PATCH net-next v2 09/10] net: dsa: b53: fix b53_imp_vlan_setup for BCM5325 Álvaro Fernández Rojas
2025-06-03 20:48 ` Álvaro Fernández Rojas [this message]
2025-06-04 18:20 ` [RFC PATCH net-next v2 10/10] net: dsa: b53: ensure BCM5325 PHYs are enabled Florian Fainelli
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=20250603204858.72402-11-noltari@gmail.com \
--to=noltari@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=dgcbueu@gmail.com \
--cc=edumazet@google.com \
--cc=florian.fainelli@broadcom.com \
--cc=jonas.gorski@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=vivien.didelot@gmail.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 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.