Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp713958imm; Thu, 13 Sep 2018 06:42:52 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbjost6waXlPfiqzlW2ssuUPr+P+uuzLz1+uKvPxYGknG88b6Gzp+LHv5vit8xfY5LAlfdZ X-Received: by 2002:a17:902:a405:: with SMTP id p5-v6mr7391690plq.222.1536846172882; Thu, 13 Sep 2018 06:42:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536846172; cv=none; d=google.com; s=arc-20160816; b=PbfxbLDZQT9DLy5Vlpw4euNSxdLvLYo4IQCG8VZK98b94D4htjIsHp6KMT5BJ14P7/ tDLg6/EGoWKL8zfc8WC7IODFZjSsWAYKeDUHR7M6cMO8Igp4CBq7NQixo2iY7p7VPcrH yzBOv9e+T+BD458GLTY0DhKfWeEwlI34FCxufbI9Qv2cj6g5vVql9oe72b8vM8s6OhWe oKF9DD1h2FgJROTbH4OPTAxtw/y/zN/eHhQ1o+EJAwLYqFFMVlT/u1GjvWN+Q6WFMT7y +8KCllbBZ26j8Enjt3J95uTNwq9o/DLHUQmRQ0UrA3GR48LsjJk9ORoOsY3jQ/uDHZSr r21A== 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=miucxeTz/iQyQDk4jv7L3QJi6ghQiCH78EFdgnMwBnk=; b=vG39fc4D01irG++vCcuXHSdbL95gj3mzwKgDlDgfNNmsF7Fye5iyDSzDIFF/EoOK7U su2wYGJ+EwEH8Eua+GReUbqZUrb9Y6oZduoM+fEQomPTkQX+YEbWtq9m3427pKK+qrFK kYzrtayOrEQ0oYI9UtEKd6gH+hFNyOnfnZyPjWELFTUcCDey7aaE1+OTP4+eem33Qhpk FP4YIfpbSvYEF6ne5hKn5Cpk5vB1PQHfWMA0NbSylw5ysv879HkFXayIT6i+D/4XlN8/ 2TcIrK9TPv1MEH98M6Muezq1Q21fFZNhyVpfu5/peR8ZqeBvqyTudOQsb0u6/eQqT5EK o8GA== 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 o6-v6si4176324plh.226.2018.09.13.06.42.37; Thu, 13 Sep 2018 06:42:52 -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 S1729706AbeIMSvf (ORCPT + 99 others); Thu, 13 Sep 2018 14:51:35 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60096 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729122AbeIMSve (ORCPT ); Thu, 13 Sep 2018 14:51:34 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 4A1FAD19; Thu, 13 Sep 2018 13:42:03 +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.14 004/115] net: macb: do not disable MDIO bus at open/close time Date: Thu, 13 Sep 2018 15:30:24 +0200 Message-Id: <20180913131823.647389795@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131823.327472833@linuxfoundation.org> References: <20180913131823.327472833@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.14-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 @@ -1884,14 +1884,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); @@ -2070,7 +2073,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