public inbox for linux-arm-msm@vger.kernel.org
 help / color / mirror / Atom feed
From: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
To: Serge Semin <fancer.lancer@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Andrew Halaney <ahalaney@redhat.com>,
	bpf@vger.kernel.org, Daniel Borkmann <daniel@iogearbox.net>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	Jose Abreu <joabreu@synopsys.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-arm-msm@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	netdev@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>,
	Vinod Koul <vkoul@kernel.org>
Subject: [PATCH net-next 14/14] net: stmmac: Activate Inband/PCS flag based on the selected iface
Date: Fri, 02 Aug 2024 11:47:37 +0100	[thread overview]
Message-ID: <E1sZpov-000eI5-KP@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <Zqy4wY0Of8noDqxt@shell.armlinux.org.uk>

From: Serge Semin <fancer.lancer@gmail.com>

The HWFEATURE.PCSSEL flag is set if the PCS block has been synthesized
into the DW GMAC controller. It's always done if the controller supports
at least one of the SGMII, TBI, RTBI PHY interfaces. If none of these
interfaces support was activated during the IP-core synthesize the PCS
block won't be activated either and the HWFEATURE.PCSSEL flag won't be
set. Based on that the RGMII in-band status detection procedure
implemented in the driver hasn't been working for the devices with the
RGMII interface support and with none of the SGMII, TBI, RTBI PHY
interfaces available in the device.

Fix that just by dropping the dma_cap.pcs flag check from the conditional
statement responsible for the In-band/PCS functionality activation. If the
RGMII interface is supported by the device then the in-band link status
detection will be also supported automatically (it's always embedded into
the RGMII RTL code). If the SGMII interface is supported by the device
then the PCS block will be supported too (it's unconditionally synthesized
into the controller). The later is also correct for the TBI/RTBI PHY
interfaces.

Note while at it drop the netdev_dbg() calls since at the moment of the
stmmac_check_pcs_mode() invocation the network device isn't registered. So
the debug prints will be for the unknown/NULL device.

Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
[rmk: fix build errors, only use PCS for SGMII if priv->dma_cap.pcs is set]
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 .../net/ethernet/stmicro/stmmac/stmmac_main.c    | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 3e43f2d6d49f..a9b5e2a34b10 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1133,18 +1133,10 @@ static void stmmac_check_pcs_mode(struct stmmac_priv *priv)
 {
 	int interface = priv->plat->mac_interface;
 
-	if (priv->dma_cap.pcs) {
-		if ((interface == PHY_INTERFACE_MODE_RGMII) ||
-		    (interface == PHY_INTERFACE_MODE_RGMII_ID) ||
-		    (interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
-		    (interface == PHY_INTERFACE_MODE_RGMII_TXID)) {
-			netdev_dbg(priv->dev, "PCS RGMII support enabled\n");
-			priv->hw->pcs = STMMAC_PCS_RGMII;
-		} else if (interface == PHY_INTERFACE_MODE_SGMII) {
-			netdev_dbg(priv->dev, "PCS SGMII support enabled\n");
-			priv->hw->pcs = STMMAC_PCS_SGMII;
-		}
-	}
+	if (phy_interface_mode_is_rgmii(interface))
+		priv->hw->pcs = STMMAC_PCS_RGMII;
+	else if (priv->dma_cap.pcs && interface == PHY_INTERFACE_MODE_SGMII)
+		priv->hw->pcs = STMMAC_PCS_SGMII;
 }
 
 /**
-- 
2.30.2


  parent reply	other threads:[~2024-08-02 10:56 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-02 10:45 [PATCH RFC v3 0/14] net: stmmac: convert stmmac "pcs" to phylink Russell King (Oracle)
2024-08-02 10:46 ` [PATCH net-next 01/14] net: stmmac: qcom-ethqos: add ethqos_pcs_set_inband() Russell King (Oracle)
2024-08-02 17:55   ` Andrew Halaney
2024-08-02 10:46 ` [PATCH net-next 02/14] net: stmmac: replace ioaddr with stmmac_priv for pcs_set_ane() method Russell King (Oracle)
2024-08-02 18:01   ` Andrew Halaney
2024-08-02 10:46 ` [PATCH net-next 03/14] net: stmmac: remove pcs_get_adv_lp() support Russell King (Oracle)
2024-08-02 18:08   ` Andrew Halaney
2024-08-02 10:46 ` [PATCH net-next 04/14] net: stmmac: add infrastructure for hwifs to provide PCS Russell King (Oracle)
2024-08-02 18:27   ` Andrew Halaney
2024-08-02 10:46 ` [PATCH net-next 05/14] net: stmmac: provide core phylink PCS infrastructure Russell King (Oracle)
2024-08-02 10:46 ` [PATCH net-next 06/14] net: stmmac: dwmac1000: convert sgmii/rgmii "pcs" to phylink Russell King (Oracle)
2024-08-02 10:47 ` [PATCH net-next 07/14] net: stmmac: dwmac1000: move PCS interrupt control Russell King (Oracle)
2024-08-02 10:47 ` [PATCH net-next 08/14] net: stmmac: dwmac4: convert sgmii/rgmii "pcs" to phylink Russell King (Oracle)
2024-08-02 10:47 ` [PATCH net-next 09/14] net: stmmac: dwmac4: move PCS interrupt control Russell King (Oracle)
2024-08-02 10:47 ` [PATCH net-next 10/14] net: stmmac: move dwmac_ctrl_ane() into stmmac_pcs.c Russell King (Oracle)
2024-08-02 18:45   ` Andrew Halaney
2024-08-02 10:47 ` [PATCH net-next 11/14] net: stmmac: pass stmmac_pcs into dwmac_pcs_isr() Russell King (Oracle)
2024-08-02 18:52   ` Andrew Halaney
2024-08-02 10:47 ` [PATCH net-next 12/14] net: stmmac: rename PCS registers Russell King (Oracle)
2024-08-02 10:47 ` [PATCH net-next 13/14] net: stmmac: remove obsolete pcs methods and associated code Russell King (Oracle)
2024-08-02 19:02   ` Andrew Halaney
2024-08-02 19:22     ` Russell King (Oracle)
2024-08-05 15:07       ` Andrew Halaney
2024-08-02 10:47 ` Russell King [this message]
2024-08-02 19:12   ` [PATCH net-next 14/14] net: stmmac: Activate Inband/PCS flag based on the selected iface Andrew Halaney
2024-08-02 19:31     ` Russell King (Oracle)
2024-08-02 19:52 ` [PATCH RFC v3 0/14] net: stmmac: convert stmmac "pcs" to phylink Andrew Halaney
2024-08-02 22:48 ` Jakub Kicinski
2024-08-05 10:11 ` Bartosz Golaszewski
2024-08-05 10:14 ` Bartosz Golaszewski

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=E1sZpov-000eI5-KP@rmk-PC.armlinux.org.uk \
    --to=rmk+kernel@armlinux.org.uk \
    --cc=ahalaney@redhat.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fancer.lancer@gmail.com \
    --cc=hawk@kernel.org \
    --cc=joabreu@synopsys.com \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=vkoul@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