7a670d7011959ad520c9b68ce1b99e125b83914c
[openwrt/staging/jow.git] /
1 From fc516d3a6aa2c6ffe27d0da8818d13839e023e7e Mon Sep 17 00:00:00 2001
2 From: Florian Fainelli <f.fainelli@gmail.com>
3 Date: Fri, 21 May 2021 10:46:14 -0700
4 Subject: [PATCH] net: dsa: bcm_sf2: Fix bcm_sf2_reg_rgmii_cntrl() call for
5 non-RGMII port
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 We cannot call bcm_sf2_reg_rgmii_cntrl() for a port that is not RGMII,
11 yet we do that in bcm_sf2_sw_mac_link_up() irrespective of the port's
12 interface. Move that read until we have properly qualified the PHY
13 interface mode. This avoids triggering a warning on 7278 platforms that
14 have GMII ports.
15
16 Fixes: 55cfeb396965 ("net: dsa: bcm_sf2: add function finding RGMII register")
17 Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
18 Acked-by: Rafał Miłecki <rafal@milecki.pl>
19 Signed-off-by: David S. Miller <davem@davemloft.net>
20 ---
21 drivers/net/dsa/bcm_sf2.c | 5 ++---
22 1 file changed, 2 insertions(+), 3 deletions(-)
23
24 --- a/drivers/net/dsa/bcm_sf2.c
25 +++ b/drivers/net/dsa/bcm_sf2.c
26 @@ -821,11 +821,9 @@ static void bcm_sf2_sw_mac_link_up(struc
27 bcm_sf2_sw_mac_link_set(ds, port, interface, true);
28
29 if (port != core_readl(priv, CORE_IMP0_PRT_ID)) {
30 - u32 reg_rgmii_ctrl;
31 + u32 reg_rgmii_ctrl = 0;
32 u32 reg, offset;
33
34 - reg_rgmii_ctrl = bcm_sf2_reg_rgmii_cntrl(priv, port);
35 -
36 if (priv->type == BCM4908_DEVICE_ID ||
37 priv->type == BCM7445_DEVICE_ID)
38 offset = CORE_STS_OVERRIDE_GMIIP_PORT(port);
39 @@ -836,6 +834,7 @@ static void bcm_sf2_sw_mac_link_up(struc
40 interface == PHY_INTERFACE_MODE_RGMII_TXID ||
41 interface == PHY_INTERFACE_MODE_MII ||
42 interface == PHY_INTERFACE_MODE_REVMII) {
43 + reg_rgmii_ctrl = bcm_sf2_reg_rgmii_cntrl(priv, port);
44 reg = reg_readl(priv, reg_rgmii_ctrl);
45 reg &= ~(RX_PAUSE_EN | TX_PAUSE_EN);
46