Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2232793ybi; Thu, 20 Jun 2019 11:17:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqx7qUD6Xlb5czPNtK9JPJZDu7EBqdvWWXZerjGxBT1DGph4IdbRb3jivPTf+umJHmTcn+mS X-Received: by 2002:a17:90a:b294:: with SMTP id c20mr1069238pjr.16.1561054675035; Thu, 20 Jun 2019 11:17:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561054675; cv=none; d=google.com; s=arc-20160816; b=0hNgdJt9ZEqhO/X83UQCuwm6YxSXpZQ5iej13WEwaB9GWaGtDw0l6i/on1UgL5VF9n CVO788x6fY5FVgPv/J3XFT8iL7AQ6C71u4hludHD0E6ax7dNLfu17f2BMZ1/Yrgr2c4y r2opTl6+u1tqCTD7Y4Mh4X7UJXv+rFXZqOOtOSCouSUSSObGLlOKVeJ47W/ZkD87HenM CKr/4cC3zb2CVqiV63EKFyQy9yjgFljD4C7uglVZYsZo8+DhV5nFrlhNV3/R8nKf3qYD WSGdJapFNCXkz79tlG1g/GNQH6dZhGgPyk5vYq8Dtegbov7OheabvbOSbjlHfD1He6x1 EXpA== 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:dkim-signature; bh=JQqLfsFqtnDys8rm7oh8lkI+HkBj3mrpipVkNdp+uXg=; b=pQbxhCES8bp7BmLEkY6ZSs9XkZOv10bbsmYnSkmMA6md6rGu9pxik8T1qXAMPCmTC4 GHzlhCr9SG+2S1zojCJcc3kxr3dW8W5SnpLZUhHNjLVt5OqqXjKd+TEM+HW6DPHT3lSv xC9dIuxEOuTNtbp/RBbZUYeKH1lSRJzvWkeCk73AdaSIoRIb1RyOwBhOFgAy60mlcQ8t YYTNjVz6TGKUFxM1UBq6Dkr+nw5tTv7RrxtD7nAKV2rkb4Wl7fgBwkQqMbYnJYb+Rikj hY5UnWfMfuGk1xzntDJ0NE8gGr0AKDGcWWV8i0ceJY5SfyQKo8a1Uig1dzQH23RRF++P 6AHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ITpe2A0g; 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 be11si320955plb.218.2019.06.20.11.17.40; Thu, 20 Jun 2019 11:17: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; dkim=pass header.i=@kernel.org header.s=default header.b=ITpe2A0g; 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 S1729462AbfFTSRf (ORCPT + 99 others); Thu, 20 Jun 2019 14:17:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:46842 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729325AbfFTSRb (ORCPT ); Thu, 20 Jun 2019 14:17:31 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BBF3B20675; Thu, 20 Jun 2019 18:17:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561054650; bh=mxK99+BLhjXNn3KE3rJwylPGhy0O02z5VWo0afUUWCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ITpe2A0guuHlTtu5iBWNUVpOtS8sGPi+OpMzSUL6mzJTW8KjsmdBVT/en79wJqSZ1 GDgDDI2mUw9TlgU59PWC/+sx63DdZuFu2UB88LHbaox5QLX2pqPPVQEpE69BrDgAgG fROZAboMoRBdThUQFrFLgBpSSfdxgGhQ7VLs4oF8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yoshihiro Shimoda , "David S. Miller" , Sasha Levin Subject: [PATCH 5.1 82/98] net: sh_eth: fix mdio access in sh_eth_close() for R-Car Gen2 and RZ/A1 SoCs Date: Thu, 20 Jun 2019 19:57:49 +0200 Message-Id: <20190620174353.435256920@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190620174349.443386789@linuxfoundation.org> References: <20190620174349.443386789@linuxfoundation.org> User-Agent: quilt/0.66 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 [ Upstream commit 315ca92dd863fecbffc0bb52ae0ac11e0398726a ] The sh_eth_close() resets the MAC and then calls phy_stop() so that mdio read access result is incorrect without any error according to kernel trace like below: ifconfig-216 [003] .n.. 109.133124: mdio_access: ee700000.ethernet-ffffffff read phy:0x01 reg:0x00 val:0xffff According to the hardware manual, the RMII mode should be set to 1 before operation the Ethernet MAC. However, the previous code was not set to 1 after the driver issued the soft_reset in sh_eth_dev_exit() so that the mdio read access result seemed incorrect. To fix the issue, this patch adds a condition and set the RMII mode register in sh_eth_dev_exit() for R-Car Gen2 and RZ/A1 SoCs. Note that when I have tried to move the sh_eth_dev_exit() calling after phy_stop() on sh_eth_close(), but it gets worse (kernel panic happened and it seems that a register is accessed while the clock is off). Signed-off-by: Yoshihiro Shimoda Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/renesas/sh_eth.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index e33af371b169..48967dd27bbf 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c @@ -1594,6 +1594,10 @@ static void sh_eth_dev_exit(struct net_device *ndev) sh_eth_get_stats(ndev); mdp->cd->soft_reset(ndev); + /* Set the RMII mode again if required */ + if (mdp->cd->rmiimode) + sh_eth_write(ndev, 0x1, RMIIMODE); + /* Set MAC address again */ update_mac_address(ndev); } -- 2.20.1