From: Serge Semin <fancer.lancer@gmail.com>
To: Russell King <linux@armlinux.org.uk>,
Andrew Halaney <ahalaney@redhat.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Jose Abreu <joabreu@synopsys.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
Jesper Dangaard Brouer <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
Daniel Borkmann <daniel@iogearbox.net>,
linux-arm-kernel@lists.infradead.org,
linux-stm32@st-md-mailman.stormreply.com, bpf@vger.kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH RFC net-next v2 15/17] net: stmmac: Move internal PCS ISR to stmmac_pcs.c
Date: Mon, 24 Jun 2024 16:26:32 +0300 [thread overview]
Message-ID: <20240624132802.14238-7-fancer.lancer@gmail.com> (raw)
In-Reply-To: <Zlmzu7/ANyZxOOQL@shell.armlinux.org.uk>
Similarly to the PHYLINK PCS ops, the STMMAC PCS ISR can be now fully
implemented in the stmmac_pcs.c file. As before this change the resultant
method will be called from the DW GMAC and DW QoS Eth core interrupt
handlers.
Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
---
Note the AN Complete and Link state changes now cause the PHYLINK PCS
state update.
---
.../ethernet/stmicro/stmmac/dwmac1000_core.c | 9 +----
.../net/ethernet/stmicro/stmmac/dwmac4_core.c | 9 +----
.../net/ethernet/stmicro/stmmac/stmmac_pcs.c | 33 +++++++++++++++++++
.../net/ethernet/stmicro/stmmac/stmmac_pcs.h | 31 ++---------------
4 files changed, 38 insertions(+), 44 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
index 332018ecd624..2d77ffd16f0a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
@@ -296,14 +296,7 @@ static int dwmac1000_irq_status(struct mac_device_info *hw,
x->irq_rx_path_exit_lpi_mode_n++;
}
- dwmac_pcs_isr(hw->priv->pcsaddr, intr_status, x);
-
- if (intr_status & PCS_RGSMIIIS_IRQ) {
- /* TODO Dummy-read to clear the IRQ status */
- readl(ioaddr + GMAC_RGSMIIIS);
- phylink_pcs_change(&hw->mac_pcs, false);
- x->irq_rgmii_n++;
- }
+ dwmac_pcs_isr(hw, intr_status, x);
return ret;
}
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
index 1487f5cc5249..c58dc20eddeb 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
@@ -860,14 +860,7 @@ static int dwmac4_irq_status(struct mac_device_info *hw,
x->irq_rx_path_exit_lpi_mode_n++;
}
- dwmac_pcs_isr(hw->priv->pcsaddr, intr_status, x);
-
- if (intr_status & PCS_RGSMIIIS_IRQ) {
- /* TODO Dummy-read to clear the IRQ status */
- readl(ioaddr + GMAC_PHYIF_CONTROL_STATUS);
- phylink_pcs_change(&hw->mac_pcs, false);
- x->irq_rgmii_n++;
- }
+ dwmac_pcs_isr(hw, intr_status, x);
return ret;
}
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.c
index 24b95d1fdb64..aac49f6472f0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.c
@@ -134,3 +134,36 @@ const struct phylink_pcs_ops dwmac_pcs_ops = {
.pcs_get_state = dwmac_pcs_get_state,
};
+
+void dwmac_pcs_isr(struct mac_device_info *hw, unsigned int intr_status,
+ struct stmmac_extra_stats *x)
+{
+ struct stmmac_priv *priv = hw->priv;
+ bool an_status = false, sr_status = false;
+
+ if (intr_status & PCS_ANE_IRQ) {
+ x->irq_pcs_ane_n++;
+ an_status = true;
+ }
+
+ if (intr_status & PCS_LINK_IRQ) {
+ x->irq_pcs_link_n++;
+ an_status = true;
+ }
+
+ if (intr_status & PCS_RGSMIIIS_IRQ) {
+ x->irq_rgmii_n++;
+ sr_status = true;
+ }
+
+ /* Read the AN and SGMII/RGMII/SMII status regs to clear IRQ */
+ if (an_status)
+ readl(priv->pcsaddr + PCS_AN_STATUS);
+
+ if (sr_status)
+ readl(priv->pcsaddr + PCS_SRGMII_CSR);
+
+ /* Any PCS event shall trigger the PHYLINK PCS state update */
+ if (an_status || sr_status)
+ phylink_pcs_change(&hw->mac_pcs, false);
+}
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h
index 2baebb92bea7..6e364285a4ef 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h
@@ -23,6 +23,7 @@
#define PCS_ANE_LPA 0x0c /* ANE link partener ability */
#define PCS_ANE_EXP 0x10 /* ANE expansion */
#define PCS_TBI_EXT 0x14 /* TBI extended status */
+#define PCS_SRGMII_CSR 0x18 /* SGMII/RGMII/SMII CSR */
/* AN Configuration defines */
#define PCS_AN_CTRL_RAN BIT(9) /* Restart Auto-Negotiation */
@@ -57,33 +58,7 @@
#define PCS_CFG_JABTO BIT(4) /* Jabber Timeout (SMII only) */
#define PCS_CFG_FALSCARDET BIT(5) /* False Carrier (SMII only) */
-/**
- * dwmac_pcs_isr - TBI, RTBI, or SGMII PHY ISR
- * @ioaddr: IO registers pointer
- * @intr_status: GMAC core interrupt status
- * @x: pointer to log these events as stats
- * Description: it is the ISR for PCS events: Auto-Negotiation Completed and
- * Link status.
- */
-static inline void dwmac_pcs_isr(void __iomem *pcsaddr,
- unsigned int intr_status,
- struct stmmac_extra_stats *x)
-{
- u32 val = readl(pcsaddr + PCS_AN_STATUS);
-
- if (intr_status & PCS_ANE_IRQ) {
- x->irq_pcs_ane_n++;
- if (val & PCS_AN_STATUS_ANC)
- pr_info("stmmac_pcs: ANE process completed\n");
- }
-
- if (intr_status & PCS_LINK_IRQ) {
- x->irq_pcs_link_n++;
- if (val & PCS_AN_STATUS_LS)
- pr_info("stmmac_pcs: Link Up\n");
- else
- pr_info("stmmac_pcs: Link Down\n");
- }
-}
+void dwmac_pcs_isr(struct mac_device_info *hw, unsigned int intr_status,
+ struct stmmac_extra_stats *x);
#endif /* __STMMAC_PCS_H__ */
--
2.43.0
next prev parent reply other threads:[~2024-06-24 13:28 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-31 11:25 [PATCH RFC v2 0/8] net: stmmac: convert stmmac "pcs" to phylink Russell King (Oracle)
2024-05-31 11:26 ` [PATCH RFC net-next v2 1/8] net: stmmac: add infrastructure for hwifs to provide PCS Russell King (Oracle)
2024-06-05 19:57 ` Andrew Halaney
2024-06-10 9:16 ` Russell King (Oracle)
2024-05-31 11:26 ` [PATCH RFC net-next v2 2/8] net: stmmac: provide core phylink PCS infrastructure Russell King (Oracle)
2024-05-31 11:26 ` [PATCH RFC net-next v2 3/8] net: stmmac: dwmac1000: convert sgmii/rgmii "pcs" to phylink Russell King (Oracle)
2024-06-05 20:05 ` Andrew Halaney
2024-06-05 21:59 ` Andrew Halaney
2024-06-10 9:24 ` Russell King (Oracle)
2024-06-10 9:19 ` Russell King (Oracle)
2024-06-11 12:25 ` Serge Semin
2024-06-12 22:04 ` Russell King (Oracle)
2024-06-13 21:14 ` Serge Semin
2024-06-18 10:26 ` Serge Semin
2024-06-24 1:32 ` Serge Semin
2024-06-24 13:40 ` Serge Semin
2024-05-31 11:26 ` [PATCH RFC net-next v2 4/8] net: stmmac: dwmac1000: move PCS interrupt control Russell King (Oracle)
2024-05-31 11:26 ` [PATCH RFC net-next v2 5/8] net: stmmac: dwmac4: convert sgmii/rgmii "pcs" to phylink Russell King (Oracle)
2024-06-05 22:35 ` Andrew Halaney
2024-06-11 18:22 ` Abhishek Chauhan (ABC)
2024-05-31 11:26 ` [PATCH RFC net-next v2 6/8] net: stmmac: dwmac4: move PCS interrupt control Russell King (Oracle)
2024-05-31 11:26 ` [PATCH RFC net-next v2 7/8] net: stmmac: remove obsolete pcs methods and associated code Russell King (Oracle)
2024-06-05 22:09 ` Andrew Halaney
2024-05-31 11:26 ` [PATCH RFC net-next v2 8/8] net: stmmac: Activate Inband/PCS flag based on the selected iface Russell King
2024-06-03 21:39 ` [PATCH RFC v2 0/8] net: stmmac: convert stmmac "pcs" to phylink Andrew Halaney
2024-06-24 13:26 ` [PATCH RFC net-next v2 09/17] net: stmmac: Introduce mac_device_info::priv pointer Serge Semin
2024-06-24 13:26 ` [PATCH RFC net-next v2 10/17] net: stmmac: Introduce internal PCS offset-based CSR access Serge Semin
2024-06-28 14:54 ` Russell King (Oracle)
2024-07-03 18:03 ` Serge Semin
2024-06-24 13:26 ` [PATCH RFC net-next v2 11/17] net: stmmac: Introduce internal PCS config register getter Serge Semin
2024-06-24 13:26 ` [PATCH RFC net-next v2 12/17] net: stmmac: Introduce internal PCS IRQ enable/disable methods Serge Semin
2024-06-24 13:26 ` [PATCH RFC net-next v2 13/17] net: stmmac: Move internal PCS ANE-control method to dwmac-qcom-ethqos.c Serge Semin
2024-06-24 13:26 ` [PATCH RFC net-next v2 14/17] net: stmmac: Move internal PCS PHYLINK ops to stmmac_pcs.c Serge Semin
2024-06-28 15:07 ` Russell King (Oracle)
2024-07-03 19:08 ` Serge Semin
2024-07-03 20:07 ` Russell King (Oracle)
2024-07-04 19:56 ` Serge Semin
2024-06-24 13:26 ` Serge Semin [this message]
2024-06-24 13:26 ` [PATCH RFC net-next v2 16/17] net: stmmac: Move internal PCS init method " Serge Semin
2024-06-28 14:36 ` Russell King (Oracle)
2024-07-04 12:55 ` Serge Semin
2024-06-24 13:26 ` [PATCH RFC net-next v2 17/17] net: stmmac: pcs: Drop the _SHIFT macros Serge Semin
2024-06-28 14:42 ` Russell King (Oracle)
2024-07-04 13:19 ` Serge Semin
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=20240624132802.14238-7-fancer.lancer@gmail.com \
--to=fancer.lancer@gmail.com \
--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=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-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux@armlinux.org.uk \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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).