]> git.baikalelectronics.ru Git - kernel.git/commitdiff
Revert "net: bcmgenet: use RGMII loopback for MAC reset"
authorDoug Berger <opendmb@gmail.com>
Mon, 16 Mar 2020 21:44:55 +0000 (14:44 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 18 Mar 2020 04:00:15 +0000 (21:00 -0700)
This reverts commit 56f03c5959772d547060e55cf33da85b9246b9a3.

This is not a good solution when connecting to an external switch
that may not support the isolation of the TXC signal resulting in
output driver contention on the pin.

A different solution is necessary.

Signed-off-by: Doug Berger <opendmb@gmail.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/genet/bcmgenet.c
drivers/net/ethernet/broadcom/genet/bcmmii.c

index e50a15397e113012b6232df9df4b1f8f973786f0..c8ac2d83208fad2e582250e19becc4585a5bb9e8 100644 (file)
@@ -1989,6 +1989,8 @@ static void reset_umac(struct bcmgenet_priv *priv)
 
        /* issue soft reset with (rg)mii loopback to ensure a stable rxclk */
        bcmgenet_umac_writel(priv, CMD_SW_RESET | CMD_LCL_LOOP_EN, UMAC_CMD);
+       udelay(2);
+       bcmgenet_umac_writel(priv, 0, UMAC_CMD);
 }
 
 static void bcmgenet_intr_disable(struct bcmgenet_priv *priv)
index 10244941a7a604fc51f2d3182034b4a93e681ee2..69e80fb6e03968dd96012760d50dc141490c00d3 100644 (file)
@@ -181,38 +181,8 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
        const char *phy_name = NULL;
        u32 id_mode_dis = 0;
        u32 port_ctrl;
-       int bmcr = -1;
-       int ret;
        u32 reg;
 
-       /* MAC clocking workaround during reset of umac state machines */
-       reg = bcmgenet_umac_readl(priv, UMAC_CMD);
-       if (reg & CMD_SW_RESET) {
-               /* An MII PHY must be isolated to prevent TXC contention */
-               if (priv->phy_interface == PHY_INTERFACE_MODE_MII) {
-                       ret = phy_read(phydev, MII_BMCR);
-                       if (ret >= 0) {
-                               bmcr = ret;
-                               ret = phy_write(phydev, MII_BMCR,
-                                               bmcr | BMCR_ISOLATE);
-                       }
-                       if (ret) {
-                               netdev_err(dev, "failed to isolate PHY\n");
-                               return ret;
-                       }
-               }
-               /* Switch MAC clocking to RGMII generated clock */
-               bcmgenet_sys_writel(priv, PORT_MODE_EXT_GPHY, SYS_PORT_CTRL);
-               /* Ensure 5 clks with Rx disabled
-                * followed by 5 clks with Reset asserted
-                */
-               udelay(4);
-               reg &= ~(CMD_SW_RESET | CMD_LCL_LOOP_EN);
-               bcmgenet_umac_writel(priv, reg, UMAC_CMD);
-               /* Ensure 5 more clocks before Rx is enabled */
-               udelay(2);
-       }
-
        switch (priv->phy_interface) {
        case PHY_INTERFACE_MODE_INTERNAL:
                phy_name = "internal PHY";
@@ -282,10 +252,6 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
 
        bcmgenet_sys_writel(priv, port_ctrl, SYS_PORT_CTRL);
 
-       /* Restore the MII PHY after isolation */
-       if (bmcr >= 0)
-               phy_write(phydev, MII_BMCR, bmcr);
-
        priv->ext_phy = !priv->internal_phy &&
                        (priv->phy_interface != PHY_INTERFACE_MODE_MOCA);