1 From 75f4f7b2b13008803f84768ff90396f9d7553221 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jonas.gorski@gmail.com>
3 Date: Mon, 2 Jun 2025 21:39:51 +0200
4 Subject: [PATCH] net: dsa: b53: do not configure bcm63xx's IMP port interface
6 The IMP port is not a valid RGMII interface, but hard wired to internal,
7 so we shouldn't touch the undefined register B53_RGMII_CTRL_IMP.
9 While this does not seem to have any side effects, let's not touch it at
10 all, so limit RGMII configuration on bcm63xx to the actual RGMII ports.
12 Fixes: ce3bf94871f7 ("net: dsa: b53: add support for BCM63xx RGMIIs")
13 Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
14 Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
15 Link: https://patch.msgid.link/20250602193953.1010487-4-jonas.gorski@gmail.com
16 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
18 drivers/net/dsa/b53/b53_common.c | 22 ++++++++--------------
19 1 file changed, 8 insertions(+), 14 deletions(-)
21 --- a/drivers/net/dsa/b53/b53_common.c
22 +++ b/drivers/net/dsa/b53/b53_common.c
24 #include <linux/gpio.h>
25 #include <linux/kernel.h>
26 #include <linux/math.h>
27 +#include <linux/minmax.h>
28 #include <linux/module.h>
29 #include <linux/platform_data/b53.h>
30 #include <linux/phy.h>
31 @@ -1322,24 +1323,17 @@ static void b53_adjust_63xx_rgmii(struct
32 phy_interface_t interface)
34 struct b53_device *dev = ds->priv;
35 - u8 rgmii_ctrl = 0, off;
38 - if (port == dev->imp_port)
39 - off = B53_RGMII_CTRL_IMP;
41 - off = B53_RGMII_CTRL_P(port);
43 - b53_read8(dev, B53_CTRL_PAGE, off, &rgmii_ctrl);
44 + b53_read8(dev, B53_CTRL_PAGE, B53_RGMII_CTRL_P(port), &rgmii_ctrl);
45 rgmii_ctrl &= ~(RGMII_CTRL_DLL_RXC | RGMII_CTRL_DLL_TXC);
47 - if (port != dev->imp_port) {
49 - rgmii_ctrl |= RGMII_CTRL_MII_OVERRIDE;
51 + rgmii_ctrl |= RGMII_CTRL_MII_OVERRIDE;
53 - rgmii_ctrl |= RGMII_CTRL_ENABLE_GMII;
55 + rgmii_ctrl |= RGMII_CTRL_ENABLE_GMII;
57 - b53_write8(dev, B53_CTRL_PAGE, off, rgmii_ctrl);
58 + b53_write8(dev, B53_CTRL_PAGE, B53_RGMII_CTRL_P(port), rgmii_ctrl);
60 dev_dbg(ds->dev, "Configured port %d for %s\n", port,
61 phy_modes(interface));
62 @@ -1484,7 +1478,7 @@ static void b53_phylink_mac_config(struc
63 struct b53_device *dev = ds->priv;
66 - if (is63xx(dev) && port >= B53_63XX_RGMII0)
67 + if (is63xx(dev) && in_range(port, B53_63XX_RGMII0, 4))
68 b53_adjust_63xx_rgmii(ds, port, interface);
70 if (mode == MLO_AN_FIXED) {