net: dsa: b53: prevent GMII_PORT_OVERRIDE_CTRL access on BCM5325
[ Upstream commit 37883bbc45a8555d6eca88d3a9730504d2dac86c ] BCM5325 doesn't implement GMII_PORT_OVERRIDE_CTRL register so we should avoid reading or writing it. PORT_OVERRIDE_RX_FLOW and PORT_OVERRIDE_TX_FLOW aren't defined on BCM5325 and we should use PORT_OVERRIDE_LP_FLOW_25 instead. Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Link: https://patch.msgid.link/20250614080000.1884236-12-noltari@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
2bd780d1f2
commit
515c23c030
@@ -1106,6 +1106,8 @@ static void b53_force_link(struct b53_device *dev, int port, int link)
|
||||
if (port == dev->imp_port) {
|
||||
off = B53_PORT_OVERRIDE_CTRL;
|
||||
val = PORT_OVERRIDE_EN;
|
||||
} else if (is5325(dev)) {
|
||||
return;
|
||||
} else {
|
||||
off = B53_GMII_PORT_OVERRIDE_CTRL(port);
|
||||
val = GMII_PO_EN;
|
||||
@@ -1130,6 +1132,8 @@ static void b53_force_port_config(struct b53_device *dev, int port,
|
||||
if (port == dev->imp_port) {
|
||||
off = B53_PORT_OVERRIDE_CTRL;
|
||||
val = PORT_OVERRIDE_EN;
|
||||
} else if (is5325(dev)) {
|
||||
return;
|
||||
} else {
|
||||
off = B53_GMII_PORT_OVERRIDE_CTRL(port);
|
||||
val = GMII_PO_EN;
|
||||
@@ -1160,10 +1164,19 @@ static void b53_force_port_config(struct b53_device *dev, int port,
|
||||
return;
|
||||
}
|
||||
|
||||
if (rx_pause)
|
||||
reg |= PORT_OVERRIDE_RX_FLOW;
|
||||
if (tx_pause)
|
||||
reg |= PORT_OVERRIDE_TX_FLOW;
|
||||
if (rx_pause) {
|
||||
if (is5325(dev))
|
||||
reg |= PORT_OVERRIDE_LP_FLOW_25;
|
||||
else
|
||||
reg |= PORT_OVERRIDE_RX_FLOW;
|
||||
}
|
||||
|
||||
if (tx_pause) {
|
||||
if (is5325(dev))
|
||||
reg |= PORT_OVERRIDE_LP_FLOW_25;
|
||||
else
|
||||
reg |= PORT_OVERRIDE_TX_FLOW;
|
||||
}
|
||||
|
||||
b53_write8(dev, B53_CTRL_PAGE, off, reg);
|
||||
}
|
||||
|
||||
@@ -92,6 +92,7 @@
|
||||
#define PORT_OVERRIDE_SPEED_10M (0 << PORT_OVERRIDE_SPEED_S)
|
||||
#define PORT_OVERRIDE_SPEED_100M (1 << PORT_OVERRIDE_SPEED_S)
|
||||
#define PORT_OVERRIDE_SPEED_1000M (2 << PORT_OVERRIDE_SPEED_S)
|
||||
#define PORT_OVERRIDE_LP_FLOW_25 BIT(3) /* BCM5325 only */
|
||||
#define PORT_OVERRIDE_RV_MII_25 BIT(4) /* BCM5325 only */
|
||||
#define PORT_OVERRIDE_RX_FLOW BIT(4)
|
||||
#define PORT_OVERRIDE_TX_FLOW BIT(5)
|
||||
|
||||
Reference in New Issue
Block a user