From patchwork Sun Jun 4 17:53:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Icenowy Zheng X-Patchwork-Id: 9765125 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6BC866032D for ; Sun, 4 Jun 2017 17:54:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E84A27FA9 for ; Sun, 4 Jun 2017 17:54:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 50DDB27FB7; Sun, 4 Jun 2017 17:54:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DBE9227FA9 for ; Sun, 4 Jun 2017 17:54:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=oY+JLSTZBZ0w0JJNSEdaGmtPeEt4YJ2cAtZlxk55qb8=; b=lwF 2M9xQcKS3NH8vtQ39A6d0vTOfqiErKY7nT0n4Kr4yQlSB+YhoaCiu+JY6fxTu+YijZ7DayZclQk8w wogJuwDE/4YCwY512l5z3XaFAWMksl051erZ8jlUmRbjJQm9WPaCIlYqXHl6UlsbOp30h6O7FTnAM ys3MEUWuq+oP4FM6YfS0iEQS+ItfMF6zgSMmXDSXVMUk4Dqyrsqg0MFPF22bpvX5j8z9iJRNeI7wN p02yhyysBPqEleksSRzkALTOQqM74roSboLIBWItlRcvM9ettvbt64teKKa/Qt+Ra2Pm3Nbu5f6DR sOwT2c2M6ABBWwBfCPLL2jbvD9pFmZQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dHZjL-0006Op-JN; Sun, 04 Jun 2017 17:54:23 +0000 Received: from nov-007-i457.relay.mailchannels.net ([46.232.183.11]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dHZjH-0006N4-7r for linux-arm-kernel@lists.infradead.org; Sun, 04 Jun 2017 17:54:22 +0000 X-Sender-Id: lmn-tzduiowcrqmw|x-authsender|icenowy@aosc.io Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 68AF17C45CE; Sun, 4 Jun 2017 17:53:51 +0000 (UTC) Received: from hermes.aosc.io (unknown [100.96.137.70]) (Authenticated sender: lmn-TZDUIOWCRQMW) by relay.mailchannels.net (Postfix) with ESMTPA id C3A447C4852; Sun, 4 Jun 2017 17:53:50 +0000 (UTC) X-Sender-Id: lmn-tzduiowcrqmw|x-authsender|icenowy@aosc.io Received: from hermes.aosc.io (hermes.aosc.io [172.20.104.49]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.9.4); Sun, 04 Jun 2017 17:53:51 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: lmn-tzduiowcrqmw|x-authsender|icenowy@aosc.io X-MailChannels-Auth-Id: lmn-TZDUIOWCRQMW X-Shoe-Cold: 14148e7066e0fcbc_1496598831258_2645474456 X-MC-Loop-Signature: 1496598831258:1350088514 X-MC-Ingress-Time: 1496598831257 Received: from localhost (localhost [127.0.0.1]) (Authenticated sender: icenowy@aosc.io) by hermes.aosc.io (Postfix) with ESMTPSA id DF44E51263; Sun, 4 Jun 2017 17:53:45 +0000 (UTC) From: Icenowy Zheng To: Corentin Labbe , "David S . Miller" Subject: [PATCH] net-next: stmmac: dwmac-sun8i: ensure the EPHY is properly reseted Date: Mon, 5 Jun 2017 01:53:23 +0800 Message-Id: <20170604175323.62124-1-icenowy@aosc.io> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170604_105420_009959_2DE29F35 X-CRM114-Status: UNSURE ( 9.82 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Icenowy Zheng MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The EPHY may be already enabled by bootloaders which have Ethernet capability (e.g. current U-Boot). Thus it should be reseted properly before doing the enabling sequence in the dwmac-sun8i driver, otherwise the EMAC reset process may fail if no cable is plugged, and then fail the dwmac-sun8i probing. Tested on Orange Pi PC, One and Zero. All the boards fail to have dwmac-sun8i probed with "EMAC reset timeout" without cable plugged before, and with this fix they're now all able to successfully probe the EMAC without cable plugged and then use the connection after a cable is hot-plugged in. Fixes: 9f93ac8d408 ("net-next: stmmac: Add dwmac-sun8i") Signed-off-by: Icenowy Zheng Tested-by: Corentin Labbe Acked-by: Corentin Labbe Reviewed-by: Corentin Labbe Acked-by: is not as formal as Signed-off-by:. It is a record that the acker Reviewed-by: is similar. --- drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c index 1a6bfe6c958f..54f93ee53ef7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c @@ -750,6 +750,11 @@ static int sun8i_dwmac_power_internal_phy(struct stmmac_priv *priv) return ret; } + /* Make sure the EPHY is properly reseted, as U-Boot may leave + * it at deasserted state, and thus it may fail to reset EMAC. + */ + reset_control_assert(gmac->rst_ephy); + ret = reset_control_deassert(gmac->rst_ephy); if (ret) { dev_err(priv->device, "Cannot deassert ephy\n");