All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Jonathan McDowell <noodles@earth.li>,
	"David S . Miller" <davem@davemloft.net>,
	Sasha Levin <sashal@kernel.org>,
	netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 4.19 13/17] net: ethernet: stmmac: Enable interface clocks on probe for IPQ806x
Date: Thu, 28 May 2020 07:57:20 -0400	[thread overview]
Message-ID: <20200528115724.1406376-13-sashal@kernel.org> (raw)
In-Reply-To: <20200528115724.1406376-1-sashal@kernel.org>

From: Jonathan McDowell <noodles@earth.li>

[ Upstream commit a96ac8a0045e3cbe3e5af6d1b3c78c6c2065dec5 ]

The ipq806x_gmac_probe() function enables the PTP clock but not the
appropriate interface clocks. This means that if the bootloader hasn't
done so attempting to bring up the interface will fail with an error
like:

[   59.028131] ipq806x-gmac-dwmac 37600000.ethernet: Failed to reset the dma
[   59.028196] ipq806x-gmac-dwmac 37600000.ethernet eth1: stmmac_hw_setup: DMA engine initialization failed
[   59.034056] ipq806x-gmac-dwmac 37600000.ethernet eth1: stmmac_open: Hw setup failed

This patch, a slightly cleaned up version of one posted by Sergey
Sergeev in:

https://forum.openwrt.org/t/support-for-mikrotik-rb3011uias-rm/4064/257

correctly enables the clock; we have already configured the source just
before this.

Tested on a MikroTik RB3011.

Signed-off-by: Jonathan McDowell <noodles@earth.li>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c
index 0d21082ceb93..4d75158c64b2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c
@@ -318,6 +318,19 @@ static int ipq806x_gmac_probe(struct platform_device *pdev)
 	/* Enable PTP clock */
 	regmap_read(gmac->nss_common, NSS_COMMON_CLK_GATE, &val);
 	val |= NSS_COMMON_CLK_GATE_PTP_EN(gmac->id);
+	switch (gmac->phy_mode) {
+	case PHY_INTERFACE_MODE_RGMII:
+		val |= NSS_COMMON_CLK_GATE_RGMII_RX_EN(gmac->id) |
+			NSS_COMMON_CLK_GATE_RGMII_TX_EN(gmac->id);
+		break;
+	case PHY_INTERFACE_MODE_SGMII:
+		val |= NSS_COMMON_CLK_GATE_GMII_RX_EN(gmac->id) |
+				NSS_COMMON_CLK_GATE_GMII_TX_EN(gmac->id);
+		break;
+	default:
+		/* We don't get here; the switch above will have errored out */
+		unreachable();
+	}
 	regmap_write(gmac->nss_common, NSS_COMMON_CLK_GATE, val);
 
 	if (gmac->phy_mode == PHY_INTERFACE_MODE_SGMII) {
-- 
2.25.1


  parent reply	other threads:[~2020-05-28 11:58 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-28 11:57 [PATCH AUTOSEL 4.19 01/17] ARC: Fix ICCM & DCCM runtime size checks Sasha Levin
2020-05-28 11:57 ` Sasha Levin
2020-05-28 11:57 ` [PATCH AUTOSEL 4.19 02/17] ARC: [plat-eznps]: Restrict to CONFIG_ISA_ARCOMPACT Sasha Levin
2020-05-28 11:57   ` Sasha Levin
2020-05-28 11:57 ` [PATCH AUTOSEL 4.19 03/17] evm: Fix RCU list related warnings Sasha Levin
2020-05-28 11:57 ` [PATCH AUTOSEL 4.19 04/17] i2c: altera: Fix race between xfer_msg and isr thread Sasha Levin
2020-05-28 11:57 ` [PATCH AUTOSEL 4.19 05/17] net sched: fix reporting the first-time use timestamp Sasha Levin
2020-05-28 11:57 ` [PATCH AUTOSEL 4.19 06/17] x86/mmiotrace: Use cpumask_available() for cpumask_var_t variables Sasha Levin
2020-05-28 11:57 ` [PATCH AUTOSEL 4.19 07/17] net: bmac: Fix read of MAC address from ROM Sasha Levin
2020-05-28 11:57 ` [PATCH AUTOSEL 4.19 08/17] r8152: support additional Microsoft Surface Ethernet Adapter variant Sasha Levin
2020-05-28 11:57 ` [PATCH AUTOSEL 4.19 09/17] drm/edid: Add Oculus Rift S to non-desktop list Sasha Levin
2020-05-28 11:57   ` Sasha Levin
2020-05-28 11:57 ` [PATCH AUTOSEL 4.19 10/17] s390/mm: fix set_huge_pte_at() for empty ptes Sasha Levin
2020-05-28 11:57 ` [PATCH AUTOSEL 4.19 11/17] null_blk: return error for invalid zone size Sasha Levin
2020-05-28 11:57 ` [PATCH AUTOSEL 4.19 12/17] net/ethernet/freescale: rework quiesce/activate for ucc_geth Sasha Levin
2020-05-28 11:57   ` Sasha Levin
2020-05-28 11:57 ` Sasha Levin [this message]
2020-05-28 11:57 ` [PATCH AUTOSEL 4.19 14/17] net: sun: fix missing release regions in cas_init_one() Sasha Levin
2020-05-28 11:57 ` [PATCH AUTOSEL 4.19 15/17] net/mlx5: Add command entry handling completion Sasha Levin
2020-05-28 11:57 ` [PATCH AUTOSEL 4.19 16/17] net/mlx4_core: fix a memory leak bug Sasha Levin
2020-05-28 11:57 ` [PATCH AUTOSEL 4.19 17/17] net: smsc911x: Fix runtime PM imbalance on error Sasha Levin

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=20200528115724.1406376-13-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=noodles@earth.li \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.