]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
Revert "net: dsa: bcm_sf2: Defer port enabling to calling port_enable"
authorFlorian Fainelli <f.fainelli@gmail.com>
Thu, 28 Sep 2017 18:19:06 +0000 (11:19 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 1 Oct 2017 03:01:29 +0000 (04:01 +0100)
This reverts commit e85ec74ace29 ("net: dsa: bcm_sf2: Defer port
enabling to calling port_enable") because this now makes an unbind
followed by a bind to fail connecting to the ingrated PHY.

What this patch missed is that we need the PHY to be enabled with
bcm_sf2_gphy_enable_set() before probing it on the MDIO bus. This is
correctly done in the ops->setup() function, but by the time
ops->port_enable() runs, this is too late. Upon unbind we would power
down the PHY, and so when we would bind again, the PHY would be left
powered off.

Fixes: e85ec74ace29 ("net: dsa: bcm_sf2: Defer port enabling to calling port_enable")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/bcm_sf2.c

index 898d5642b516b8fd7f4821549dcba08e95d78ba1..7aecc98d0a189d80c98e829ef147a09cff387c65 100644 (file)
@@ -754,11 +754,14 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds)
        struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
        unsigned int port;
 
-       /* Disable unused ports and configure IMP port */
+       /* Enable all valid ports and disable those unused */
        for (port = 0; port < priv->hw_params.num_ports; port++) {
-               if (dsa_is_cpu_port(ds, port))
+               /* IMP port receives special treatment */
+               if ((1 << port) & ds->enabled_port_mask)
+                       bcm_sf2_port_setup(ds, port, NULL);
+               else if (dsa_is_cpu_port(ds, port))
                        bcm_sf2_imp_setup(ds, port);
-               else if (!((1 << port) & ds->enabled_port_mask))
+               else
                        bcm_sf2_port_disable(ds, port, NULL);
        }