]> git.ipfire.org Git - thirdparty/openwrt.git/blob
17489e9b9fac00f57c267aced5ecaf6889200179
[thirdparty/openwrt.git] /
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
5
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.
8
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.
11
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>
17 ---
18 drivers/net/dsa/b53/b53_common.c | 22 ++++++++--------------
19 1 file changed, 8 insertions(+), 14 deletions(-)
20
21 --- a/drivers/net/dsa/b53/b53_common.c
22 +++ b/drivers/net/dsa/b53/b53_common.c
23 @@ -22,6 +22,7 @@
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)
33 {
34 struct b53_device *dev = ds->priv;
35 - u8 rgmii_ctrl = 0, off;
36 -
37 - if (port == dev->imp_port)
38 - off = B53_RGMII_CTRL_IMP;
39 - else
40 - off = B53_RGMII_CTRL_P(port);
41 + u8 rgmii_ctrl = 0;
42
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);
46
47 - if (port != dev->imp_port) {
48 - if (is63268(dev))
49 - rgmii_ctrl |= RGMII_CTRL_MII_OVERRIDE;
50 + if (is63268(dev))
51 + rgmii_ctrl |= RGMII_CTRL_MII_OVERRIDE;
52
53 - rgmii_ctrl |= RGMII_CTRL_ENABLE_GMII;
54 - }
55 + rgmii_ctrl |= RGMII_CTRL_ENABLE_GMII;
56
57 - b53_write8(dev, B53_CTRL_PAGE, off, rgmii_ctrl);
58 + b53_write8(dev, B53_CTRL_PAGE, B53_RGMII_CTRL_P(port), rgmii_ctrl);
59
60 dev_dbg(ds->dev, "Configured port %d for %s\n", port,
61 phy_modes(interface));
62 @@ -1490,7 +1484,7 @@ static void b53_phylink_mac_config(struc
63 struct b53_device *dev = ds->priv;
64 int port = dp->index;
65
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);
69
70 if (mode == MLO_AN_FIXED) {