Skip to content

Commit 75f4f7b

Browse files
KanjiMonsterPaolo Abeni
authored andcommitted
net: dsa: b53: do not configure bcm63xx's IMP port interface
The IMP port is not a valid RGMII interface, but hard wired to internal, so we shouldn't touch the undefined register B53_RGMII_CTRL_IMP. While this does not seem to have any side effects, let's not touch it at all, so limit RGMII configuration on bcm63xx to the actual RGMII ports. Fixes: ce3bf94 ("net: dsa: b53: add support for BCM63xx RGMIIs") Signed-off-by: Jonas Gorski <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 4af5235 commit 75f4f7b

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

drivers/net/dsa/b53/b53_common.c

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <linux/gpio.h>
2323
#include <linux/kernel.h>
2424
#include <linux/math.h>
25+
#include <linux/minmax.h>
2526
#include <linux/module.h>
2627
#include <linux/platform_data/b53.h>
2728
#include <linux/phy.h>
@@ -1322,24 +1323,17 @@ static void b53_adjust_63xx_rgmii(struct dsa_switch *ds, int port,
13221323
phy_interface_t interface)
13231324
{
13241325
struct b53_device *dev = ds->priv;
1325-
u8 rgmii_ctrl = 0, off;
1326+
u8 rgmii_ctrl = 0;
13261327

1327-
if (port == dev->imp_port)
1328-
off = B53_RGMII_CTRL_IMP;
1329-
else
1330-
off = B53_RGMII_CTRL_P(port);
1331-
1332-
b53_read8(dev, B53_CTRL_PAGE, off, &rgmii_ctrl);
1328+
b53_read8(dev, B53_CTRL_PAGE, B53_RGMII_CTRL_P(port), &rgmii_ctrl);
13331329
rgmii_ctrl &= ~(RGMII_CTRL_DLL_RXC | RGMII_CTRL_DLL_TXC);
13341330

1335-
if (port != dev->imp_port) {
1336-
if (is63268(dev))
1337-
rgmii_ctrl |= RGMII_CTRL_MII_OVERRIDE;
1331+
if (is63268(dev))
1332+
rgmii_ctrl |= RGMII_CTRL_MII_OVERRIDE;
13381333

1339-
rgmii_ctrl |= RGMII_CTRL_ENABLE_GMII;
1340-
}
1334+
rgmii_ctrl |= RGMII_CTRL_ENABLE_GMII;
13411335

1342-
b53_write8(dev, B53_CTRL_PAGE, off, rgmii_ctrl);
1336+
b53_write8(dev, B53_CTRL_PAGE, B53_RGMII_CTRL_P(port), rgmii_ctrl);
13431337

13441338
dev_dbg(ds->dev, "Configured port %d for %s\n", port,
13451339
phy_modes(interface));
@@ -1484,7 +1478,7 @@ static void b53_phylink_mac_config(struct phylink_config *config,
14841478
struct b53_device *dev = ds->priv;
14851479
int port = dp->index;
14861480

1487-
if (is63xx(dev) && port >= B53_63XX_RGMII0)
1481+
if (is63xx(dev) && in_range(port, B53_63XX_RGMII0, 4))
14881482
b53_adjust_63xx_rgmii(ds, port, interface);
14891483

14901484
if (mode == MLO_AN_FIXED) {

0 commit comments

Comments
 (0)