net: dsa: mv88e6xxx: Cache the port cmode
[linux-2.6-block.git] / drivers / net / dsa / bcm_sf2.c
index 02e8982519cebcfad46f21dbc6c53d605e6b6f8a..e0066adcd2f3d6ffd8e8ea6baba94337df0cd457 100644 (file)
@@ -166,6 +166,11 @@ static int bcm_sf2_port_setup(struct dsa_switch *ds, int port,
        reg &= ~P_TXQ_PSM_VDD(port);
        core_writel(priv, reg, CORE_MEM_PSM_VDD_CTRL);
 
+       /* Enable learning */
+       reg = core_readl(priv, CORE_DIS_LEARN);
+       reg &= ~BIT(port);
+       core_writel(priv, reg, CORE_DIS_LEARN);
+
        /* Enable Broadcom tags for that port if requested */
        if (priv->brcm_tag_mask & BIT(port))
                b53_brcm_hdr_setup(ds, port);
@@ -220,10 +225,15 @@ static void bcm_sf2_port_disable(struct dsa_switch *ds, int port,
                                 struct phy_device *phy)
 {
        struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
-       u32 off, reg;
+       u32 reg;
 
-       if (priv->wol_ports_mask & (1 << port))
+       /* Disable learning while in WoL mode */
+       if (priv->wol_ports_mask & (1 << port)) {
+               reg = core_readl(priv, CORE_DIS_LEARN);
+               reg |= BIT(port);
+               core_writel(priv, reg, CORE_DIS_LEARN);
                return;
+       }
 
        if (port == priv->moca_port)
                bcm_sf2_port_intr_disable(priv, port);
@@ -231,11 +241,6 @@ static void bcm_sf2_port_disable(struct dsa_switch *ds, int port,
        if (priv->int_phy_mask & 1 << port && priv->hw_params.num_gphy == 1)
                bcm_sf2_gphy_enable_set(ds, false);
 
-       if (dsa_is_cpu_port(ds, port))
-               off = CORE_IMP_CTL;
-       else
-               off = CORE_G_PCTL_PORT(port);
-
        b53_disable_port(ds, port, phy);
 
        /* Power down the port memory */