stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Julien Beraud <julien.beraud@orolia.com>,
	"David S. Miller" <davem@davemloft.net>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 4.14 09/22] net: stmmac: fix enabling socfpgas ptp_ref_clock
Date: Fri,  8 May 2020 14:35:21 +0200	[thread overview]
Message-ID: <20200508123035.066280486@linuxfoundation.org> (raw)
In-Reply-To: <20200508123033.915895060@linuxfoundation.org>

From: Julien Beraud <julien.beraud@orolia.com>

[ Upstream commit 15ce30609d1e88d42fb1cd948f453e6d5f188249 ]

There are 2 registers to write to enable a ptp ref clock coming from the
fpga.
One that enables the usage of the clock from the fpga for emac0 and emac1
as a ptp ref clock, and the other to allow signals from the fpga to reach
emac0 and emac1.
Currently, if the dwmac-socfpga has phymode set to PHY_INTERFACE_MODE_MII,
PHY_INTERFACE_MODE_GMII, or PHY_INTERFACE_MODE_SGMII, both registers will
be written and the ptp ref clock will be set as coming from the fpga.
Separate the 2 register writes to only enable signals from the fpga to
reach emac0 or emac1 when ptp ref clock is not coming from the fpga.

Signed-off-by: Julien Beraud <julien.beraud@orolia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index 5b3b06a0a3bf5..33407df6bea69 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -274,16 +274,19 @@ static int socfpga_dwmac_set_phy_mode(struct socfpga_dwmac *dwmac)
 	    phymode == PHY_INTERFACE_MODE_MII ||
 	    phymode == PHY_INTERFACE_MODE_GMII ||
 	    phymode == PHY_INTERFACE_MODE_SGMII) {
-		ctrl |= SYSMGR_EMACGRP_CTRL_PTP_REF_CLK_MASK << (reg_shift / 2);
 		regmap_read(sys_mgr_base_addr, SYSMGR_FPGAGRP_MODULE_REG,
 			    &module);
 		module |= (SYSMGR_FPGAGRP_MODULE_EMAC << (reg_shift / 2));
 		regmap_write(sys_mgr_base_addr, SYSMGR_FPGAGRP_MODULE_REG,
 			     module);
-	} else {
-		ctrl &= ~(SYSMGR_EMACGRP_CTRL_PTP_REF_CLK_MASK << (reg_shift / 2));
 	}
 
+	if (dwmac->f2h_ptp_ref_clk)
+		ctrl |= SYSMGR_EMACGRP_CTRL_PTP_REF_CLK_MASK << (reg_shift / 2);
+	else
+		ctrl &= ~(SYSMGR_EMACGRP_CTRL_PTP_REF_CLK_MASK <<
+			  (reg_shift / 2));
+
 	regmap_write(sys_mgr_base_addr, reg_offset, ctrl);
 
 	/* Deassert reset for the phy configuration to be sampled by
-- 
2.20.1




  parent reply	other threads:[~2020-05-08 13:02 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-08 12:35 [PATCH 4.14 00/22] 4.14.180-rc1 review Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.14 01/22] vhost: vsock: kick send_pkt worker once device is started Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.14 02/22] powerpc/pci/of: Parse unassigned resources Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.14 03/22] ASoC: topology: Check return value of pcm_new_ver Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.14 04/22] selftests/ipc: Fix test failure seen after initial test run Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.14 05/22] ASoC: sgtl5000: Fix VAG power-on handling Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.14 06/22] ASoC: rsnd: Fix HDMI channel mapping for multi-SSI mode Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.14 07/22] ASoC: codecs: hdac_hdmi: Fix incorrect use of list_for_each_entry Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.14 08/22] wimax/i2400m: Fix potential urb refcnt leak Greg Kroah-Hartman
2020-05-08 12:35 ` Greg Kroah-Hartman [this message]
2020-05-08 12:35 ` [PATCH 4.14 10/22] net: stmmac: Fix sub-second increment Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.14 11/22] cifs: protect updating server->dstaddr with a spinlock Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.14 12/22] s390/ftrace: fix potential crashes when switching tracers Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.14 13/22] scripts/config: allow colons in option strings for sed Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.14 14/22] net: dsa: b53: Rework ARL bin logic Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.14 15/22] lib/mpi: Fix building for powerpc with clang Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.14 16/22] net: bcmgenet: suppress warnings on failed Rx SKB allocations Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.14 17/22] net: systemport: " Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.14 18/22] sctp: Fix SHUTDOWN CTSN Ack in the peer restart case Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.14 19/22] tracing: Reverse the order of trace_types_lock and event_mutex Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.14 20/22] ALSA: hda: Match both PCI ID and SSID for driver blacklist Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.14 21/22] mac80211: add ieee80211_is_any_nullfunc() Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.14 22/22] cgroup, netclassid: remove double cond_resched Greg Kroah-Hartman
2020-05-08 21:05 ` [PATCH 4.14 00/22] 4.14.180-rc1 review Guenter Roeck
2020-05-09  9:12 ` Naresh Kamboju
2020-05-11 16:54 ` shuah

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200508123035.066280486@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=davem@davemloft.net \
    --cc=julien.beraud@orolia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).