bnx2x: Fix chip hanging due to TX pipe stall.
[firefly-linux-kernel-4.4.55.git] / drivers / net / bnx2x / bnx2x_link.c
index aa9958e37445a3934f56f1f272ac491e98c60ba2..0a7091d3de2966f8ce9627a5ddd005d854295c70 100644 (file)
@@ -1667,10 +1667,20 @@ static void bnx2x_xmac_disable(struct link_params *params)
 {
        u8 port = params->port;
        struct bnx2x *bp = params->bp;
-       u32 xmac_base = (port) ? GRCBASE_XMAC1 : GRCBASE_XMAC0;
+       u32 pfc_ctrl, xmac_base = (port) ? GRCBASE_XMAC1 : GRCBASE_XMAC0;
 
        if (REG_RD(bp, MISC_REG_RESET_REG_2) &
            MISC_REGISTERS_RESET_REG_2_XMAC) {
+               /*
+                * Send an indication to change the state in the NIG back to XON
+                * Clearing this bit enables the next set of this bit to get
+                * rising edge
+                */
+               pfc_ctrl = REG_RD(bp, xmac_base + XMAC_REG_PFC_CTRL_HI);
+               REG_WR(bp, xmac_base + XMAC_REG_PFC_CTRL_HI,
+                      (pfc_ctrl & ~(1<<1)));
+               REG_WR(bp, xmac_base + XMAC_REG_PFC_CTRL_HI,
+                      (pfc_ctrl | (1<<1)));
                DP(NETIF_MSG_LINK, "Disable XMAC on port %x\n", port);
                REG_WR(bp, xmac_base + XMAC_REG_CTRL, 0);
                usleep_range(1000, 1000);