Skip to content

Commit efa7057

Browse files
ffainelligregkh
authored andcommitted
net: dsa: bcm_sf2: Fix IMP setup for port different than 8
[ Upstream commit 5fc0f21 ] Since it became possible for the DSA core to use a CPU port different than 8, our bcm_sf2_imp_setup() function was broken because it assumes that registers are applicable to port 8. In particular, the port's MAC is going to stay disabled, so make sure we clear the RX_DIS and TX_DIS bits if we are not configured for port 8. Fixes: 9f91484 ("net: dsa: make "label" property optional for dsa2") Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4e568f6 commit efa7057

1 file changed

Lines changed: 21 additions & 15 deletions

File tree

‎drivers/net/dsa/bcm_sf2.c‎

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,11 @@ static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port)
3737
unsigned int i;
3838
u32 reg, offset;
3939

40-
if (priv->type == BCM7445_DEVICE_ID)
41-
offset = CORE_STS_OVERRIDE_IMP;
42-
else
43-
offset = CORE_STS_OVERRIDE_IMP2;
44-
4540
/* Enable the port memories */
4641
reg = core_readl(priv, CORE_MEM_PSM_VDD_CTRL);
4742
reg &= ~P_TXQ_PSM_VDD(port);
4843
core_writel(priv, reg, CORE_MEM_PSM_VDD_CTRL);
4944

50-
/* Enable Broadcast, Multicast, Unicast forwarding to IMP port */
51-
reg = core_readl(priv, CORE_IMP_CTL);
52-
reg |= (RX_BCST_EN | RX_MCST_EN | RX_UCST_EN);
53-
reg &= ~(RX_DIS | TX_DIS);
54-
core_writel(priv, reg, CORE_IMP_CTL);
55-
5645
/* Enable forwarding */
5746
core_writel(priv, SW_FWDG_EN, CORE_SWMODE);
5847

@@ -71,10 +60,27 @@ static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port)
7160

7261
b53_brcm_hdr_setup(ds, port);
7362

74-
/* Force link status for IMP port */
75-
reg = core_readl(priv, offset);
76-
reg |= (MII_SW_OR | LINK_STS);
77-
core_writel(priv, reg, offset);
63+
if (port == 8) {
64+
if (priv->type == BCM7445_DEVICE_ID)
65+
offset = CORE_STS_OVERRIDE_IMP;
66+
else
67+
offset = CORE_STS_OVERRIDE_IMP2;
68+
69+
/* Force link status for IMP port */
70+
reg = core_readl(priv, offset);
71+
reg |= (MII_SW_OR | LINK_STS);
72+
core_writel(priv, reg, offset);
73+
74+
/* Enable Broadcast, Multicast, Unicast forwarding to IMP port */
75+
reg = core_readl(priv, CORE_IMP_CTL);
76+
reg |= (RX_BCST_EN | RX_MCST_EN | RX_UCST_EN);
77+
reg &= ~(RX_DIS | TX_DIS);
78+
core_writel(priv, reg, CORE_IMP_CTL);
79+
} else {
80+
reg = core_readl(priv, CORE_G_PCTL_PORT(port));
81+
reg &= ~(RX_DIS | TX_DIS);
82+
core_writel(priv, reg, CORE_G_PCTL_PORT(port));
83+
}
7884
}
7985

8086
static void bcm_sf2_gphy_enable_set(struct dsa_switch *ds, bool enable)

0 commit comments

Comments
 (0)