1 From 4eecebbe332e3cfd8d0aaeb39d764748f25259f1 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
3 Date: Fri, 30 May 2025 23:33:13 +0200
4 Subject: [RFC PATCH net-next v2 07/10] net: dsa: b53: prevent
5 GMII_PORT_OVERRIDE_CTRL access on BCM5325
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
10 BCM5325 doesn't implement GMII_PORT_OVERRIDE_CTRL register so we should
11 avoid reading or writing it.
12 PORT_OVERRIDE_RX_FLOW and PORT_OVERRIDE_TX_FLOW aren't defined on BCM5325
13 and we should use PORT_OVERRIDE_LP_FLOW_25 instead.
15 Fixes: 5e004460f874 ("net: dsa: b53: Add helper to set link parameters")
16 Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
17 Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
19 drivers/net/dsa/b53/b53_common.c | 21 +++++++++++++++++----
20 drivers/net/dsa/b53/b53_regs.h | 1 +
21 2 files changed, 18 insertions(+), 4 deletions(-)
23 --- a/drivers/net/dsa/b53/b53_common.c
24 +++ b/drivers/net/dsa/b53/b53_common.c
25 @@ -1278,6 +1278,8 @@ static void b53_force_link(struct b53_de
26 if (port == dev->imp_port) {
27 off = B53_PORT_OVERRIDE_CTRL;
28 val = PORT_OVERRIDE_EN;
29 + } else if (is5325(dev)) {
32 off = B53_GMII_PORT_OVERRIDE_CTRL(port);
34 @@ -1302,6 +1304,8 @@ static void b53_force_port_config(struct
35 if (port == dev->imp_port) {
36 off = B53_PORT_OVERRIDE_CTRL;
37 val = PORT_OVERRIDE_EN;
38 + } else if (is5325(dev)) {
41 off = B53_GMII_PORT_OVERRIDE_CTRL(port);
43 @@ -1332,10 +1336,19 @@ static void b53_force_port_config(struct
48 - reg |= PORT_OVERRIDE_RX_FLOW;
50 - reg |= PORT_OVERRIDE_TX_FLOW;
53 + reg |= PORT_OVERRIDE_LP_FLOW_25;
55 + reg |= PORT_OVERRIDE_RX_FLOW;
60 + reg |= PORT_OVERRIDE_LP_FLOW_25;
62 + reg |= PORT_OVERRIDE_TX_FLOW;
65 b53_write8(dev, B53_CTRL_PAGE, off, reg);
67 --- a/drivers/net/dsa/b53/b53_regs.h
68 +++ b/drivers/net/dsa/b53/b53_regs.h
70 #define PORT_OVERRIDE_SPEED_10M (0 << PORT_OVERRIDE_SPEED_S)
71 #define PORT_OVERRIDE_SPEED_100M (1 << PORT_OVERRIDE_SPEED_S)
72 #define PORT_OVERRIDE_SPEED_1000M (2 << PORT_OVERRIDE_SPEED_S)
73 +#define PORT_OVERRIDE_LP_FLOW_25 BIT(3) /* BCM5325 only */
74 #define PORT_OVERRIDE_RV_MII_25 BIT(4) /* BCM5325 only */
75 #define PORT_OVERRIDE_RX_FLOW BIT(4)
76 #define PORT_OVERRIDE_TX_FLOW BIT(5)