Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp725056imm; Thu, 13 Sep 2018 06:52:55 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZTYFsTmmw/5/33UJRx9e9yZA326/GyK5vQui2mCclJZKyoWLAesze0I49N+H17dPlhblqZ X-Received: by 2002:a17:902:bc41:: with SMTP id t1-v6mr7565914plz.52.1536846775669; Thu, 13 Sep 2018 06:52:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536846775; cv=none; d=google.com; s=arc-20160816; b=G7gXNRAxpGQBvUomswIUtD/4gZja1/SJFWMQdPM/BMSO66g0SUSirB1vFNjVzQTmMJ bWpDlqV4TpbvzNtPjI1JNEDzOkshMAw0ArpdFb3tytHqn64C/7aEFelFj/1yvFo0gmD5 TbvEOMdLHmm4F3ES9ILPp81JcMrtoP6Ak9TnqCiQDSXwXe8qxrm6WeFXWyH5+VmKdLzG udfe6fO96Vt0RSlcdR9dbeqIgnFusY3K15JrsC+luE6mKB9loBVzyfwbU4znJarTC8L+ U55RdK5Us83P6P/5A2Pj0FCxq0Yyq94VMxF4CV+lltZIjqPrQvTFEKaHuSsWa8BqcFSl xrBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=BMT+/y6cChvbIF3k19W80pshzdb24X6+7G78qUK9C0k=; b=ygZP5utN4ze2A532HJDl5crGW6vLuyp/wo7EN8XWVQ+cWt9GCvKYycsA38X9MF27KC KUBoO1GbOPg74bazKJVcm7oiR6pZTmptQkjoa5v01Y6ywNK9nbyjhC1xrJ3mHV/jPUam M2OBIbFyagFyB8BKId6hVkVWVEKrtFL8KF+yMQoYGSXqoE0NkzfCc5ct/DVa1CE9MTVH T7Wf8RMpniOMIB0pULFaHucGDPJhlnmjPkuX1EeCGBWNHxMFtyqnWvzO7lV38VqaFK7H j8BgUHHUKBEUBzZ7B5lXLbwc7ZrpI4H+XbmVlxNjLFjjrKFCIR3i/1IIuNlQS8NgL4ON 0dQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z4-v6si3967660pgf.193.2018.09.13.06.52.40; Thu, 13 Sep 2018 06:52:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730946AbeIMTBw (ORCPT + 99 others); Thu, 13 Sep 2018 15:01:52 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33456 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730119AbeIMTBw (ORCPT ); Thu, 13 Sep 2018 15:01:52 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7E253CDB; Thu, 13 Sep 2018 13:52:16 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anssi Hannula , Claudiu Beznea , "David S. Miller" Subject: [PATCH 4.18 004/197] net: macb: do not disable MDIO bus at open/close time Date: Thu, 13 Sep 2018 15:29:13 +0200 Message-Id: <20180913131841.741954631@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131841.568116777@linuxfoundation.org> References: <20180913131841.568116777@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Anssi Hannula [ Upstream commit 0da70f808029476001109b6cb076737bc04cea2e ] macb_reset_hw() is called from macb_close() and indirectly from macb_open(). macb_reset_hw() zeroes the NCR register, including the MPE (Management Port Enable) bit. This will prevent accessing any other PHYs for other Ethernet MACs on the MDIO bus, which remains registered at macb_reset_hw() time, until macb_init_hw() is called from macb_open() which sets the MPE bit again. I.e. currently the MDIO bus has a short disruption at open time and is disabled at close time until the interface is opened again. Fix that by only touching the RE and TE bits when enabling and disabling RX/TX. v2: Make macb_init_hw() NCR write a single statement. Fixes: 6c36a7074436 ("macb: Use generic PHY layer") Signed-off-by: Anssi Hannula Reviewed-by: Claudiu Beznea Tested-by: Claudiu Beznea Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/cadence/macb_main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -1957,14 +1957,17 @@ static void macb_reset_hw(struct macb *b { struct macb_queue *queue; unsigned int q; + u32 ctrl = macb_readl(bp, NCR); /* Disable RX and TX (XXX: Should we halt the transmission * more gracefully?) */ - macb_writel(bp, NCR, 0); + ctrl &= ~(MACB_BIT(RE) | MACB_BIT(TE)); /* Clear the stats registers (XXX: Update stats first?) */ - macb_writel(bp, NCR, MACB_BIT(CLRSTAT)); + ctrl |= MACB_BIT(CLRSTAT); + + macb_writel(bp, NCR, ctrl); /* Clear all status flags */ macb_writel(bp, TSR, -1); @@ -2152,7 +2155,7 @@ static void macb_init_hw(struct macb *bp } /* Enable TX and RX */ - macb_writel(bp, NCR, MACB_BIT(RE) | MACB_BIT(TE) | MACB_BIT(MPE)); + macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(RE) | MACB_BIT(TE)); } /* The hash address register is 64 bits long and takes up two