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>,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
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>,
Sneh Shah <quic_snehshah@quicinc.com>,
Vinod Koul <vkoul@kernel.org>
Subject: [PATCH RFC net-next v4 10/14] net: stmmac: move dwmac_ctrl_ane() into stmmac_pcs.c
Date: Mon, 05 Aug 2024 11:25:27 +0100 [thread overview]
Message-ID: <E1sauu7-000tva-N1@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <ZrCoQZKo74zvKMhT@shell.armlinux.org.uk>
Move dwmac_ctrl_ane() into stmmac_pcs.c, changing its arguments to take
the stmmac_priv structure. Update it to use the previously provided
__dwmac_ctrl_ane() function, which makes use of the stmmac_pcs struct
and thus does not require passing the PCS base address offset.
This removes the core-specific functions, instead pointing the method
at the generic method in stmmac_pcs.c.
Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
.../ethernet/stmicro/stmmac/dwmac1000_core.c | 8 +---
.../net/ethernet/stmicro/stmmac/dwmac4_core.c | 12 ++----
.../net/ethernet/stmicro/stmmac/stmmac_pcs.c | 16 ++++++++
.../net/ethernet/stmicro/stmmac/stmmac_pcs.h | 37 ++-----------------
4 files changed, 23 insertions(+), 50 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
index 05b2df08cb0f..d2defa2e4996 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
@@ -365,12 +365,6 @@ static void dwmac1000_set_eee_timer(struct mac_device_info *hw, int ls, int tw)
writel(value, ioaddr + LPI_TIMER_CTRL);
}
-static void dwmac1000_ctrl_ane(struct stmmac_priv *priv, bool ane,
- bool srgmi_ral, bool loopback)
-{
- dwmac_ctrl_ane(priv->ioaddr, GMAC_PCS_BASE, ane, srgmi_ral, loopback);
-}
-
static int dwmac1000_mii_pcs_enable(struct phylink_pcs *pcs)
{
struct stmmac_pcs *spcs = phylink_pcs_to_stmmac_pcs(pcs);
@@ -527,7 +521,7 @@ const struct stmmac_ops dwmac1000_ops = {
.set_eee_timer = dwmac1000_set_eee_timer,
.set_eee_pls = dwmac1000_set_eee_pls,
.debug = dwmac1000_debug,
- .pcs_ctrl_ane = dwmac1000_ctrl_ane,
+ .pcs_ctrl_ane = dwmac_ctrl_ane,
.set_mac_loopback = dwmac1000_set_mac_loopback,
};
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
index 0d261709bee6..2f02bb47c952 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
@@ -750,12 +750,6 @@ static void dwmac4_flow_ctrl(struct mac_device_info *hw, unsigned int duplex,
}
}
-static void dwmac4_ctrl_ane(struct stmmac_priv *priv, bool ane, bool srgmi_ral,
- bool loopback)
-{
- dwmac_ctrl_ane(priv->ioaddr, GMAC_PCS_BASE, ane, srgmi_ral, loopback);
-}
-
static int dwmac4_mii_pcs_enable(struct phylink_pcs *pcs)
{
struct stmmac_pcs *spcs = phylink_pcs_to_stmmac_pcs(pcs);
@@ -1227,7 +1221,7 @@ const struct stmmac_ops dwmac4_ops = {
.set_eee_lpi_entry_timer = dwmac4_set_eee_lpi_entry_timer,
.set_eee_timer = dwmac4_set_eee_timer,
.set_eee_pls = dwmac4_set_eee_pls,
- .pcs_ctrl_ane = dwmac4_ctrl_ane,
+ .pcs_ctrl_ane = dwmac_ctrl_ane,
.debug = dwmac4_debug,
.set_filter = dwmac4_set_filter,
.set_mac_loopback = dwmac4_set_mac_loopback,
@@ -1271,7 +1265,7 @@ const struct stmmac_ops dwmac410_ops = {
.set_eee_lpi_entry_timer = dwmac4_set_eee_lpi_entry_timer,
.set_eee_timer = dwmac4_set_eee_timer,
.set_eee_pls = dwmac4_set_eee_pls,
- .pcs_ctrl_ane = dwmac4_ctrl_ane,
+ .pcs_ctrl_ane = dwmac_ctrl_ane,
.debug = dwmac4_debug,
.set_filter = dwmac4_set_filter,
.flex_pps_config = dwmac5_flex_pps_config,
@@ -1319,7 +1313,7 @@ const struct stmmac_ops dwmac510_ops = {
.set_eee_lpi_entry_timer = dwmac4_set_eee_lpi_entry_timer,
.set_eee_timer = dwmac4_set_eee_timer,
.set_eee_pls = dwmac4_set_eee_pls,
- .pcs_ctrl_ane = dwmac4_ctrl_ane,
+ .pcs_ctrl_ane = dwmac_ctrl_ane,
.debug = dwmac4_debug,
.set_filter = dwmac4_set_filter,
.safety_feat_config = dwmac5_safety_feat_config,
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.c
index 292c039c9778..e435facc9849 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.c
@@ -30,6 +30,22 @@ static void __dwmac_ctrl_ane(struct stmmac_pcs *spcs, bool ane, bool srgmi_ral,
writel(val, spcs->pcs_base + GMAC_AN_CTRL(0));
}
+/**
+ * dwmac_ctrl_ane - To program the AN Control Register.
+ * @priv: pointer to &struct stmmac_priv
+ * @ane: to enable the auto-negotiation
+ * @srgmi_ral: to manage MAC-2-MAC SGMII connections.
+ * @loopback: to cause the PHY to loopback tx data into rx path.
+ * Description: this is the main function to configure the AN control register
+ * and init the ANE, select loopback (usually for debugging purpose) and
+ * configure SGMII RAL.
+ */
+void dwmac_ctrl_ane(struct stmmac_priv *priv, bool ane, bool srgmi_ral,
+ bool loopback)
+{
+ __dwmac_ctrl_ane(&priv->hw->mac_pcs, ane, srgmi_ral, loopback);
+}
+
int dwmac_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
phy_interface_t interface,
const unsigned long *advertising,
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h
index f0d6442711ff..083128e0013c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h
@@ -89,40 +89,6 @@ static inline void dwmac_pcs_isr(void __iomem *ioaddr, u32 reg,
}
}
-/**
- * dwmac_ctrl_ane - To program the AN Control Register.
- * @ioaddr: IO registers pointer
- * @reg: Base address of the AN Control Register.
- * @ane: to enable the auto-negotiation
- * @srgmi_ral: to manage MAC-2-MAC SGMII connections.
- * @loopback: to cause the PHY to loopback tx data into rx path.
- * Description: this is the main function to configure the AN control register
- * and init the ANE, select loopback (usually for debugging purpose) and
- * configure SGMII RAL.
- */
-static inline void dwmac_ctrl_ane(void __iomem *ioaddr, u32 reg, bool ane,
- bool srgmi_ral, bool loopback)
-{
- u32 value = readl(ioaddr + GMAC_AN_CTRL(reg));
-
- /* Enable and restart the Auto-Negotiation */
- if (ane)
- value |= GMAC_AN_CTRL_ANE | GMAC_AN_CTRL_RAN;
- else
- value &= ~GMAC_AN_CTRL_ANE;
-
- /* In case of MAC-2-MAC connection, block is configured to operate
- * according to MAC conf register.
- */
- if (srgmi_ral)
- value |= GMAC_AN_CTRL_SGMRAL;
-
- if (loopback)
- value |= GMAC_AN_CTRL_ELE;
-
- writel(value, ioaddr + GMAC_AN_CTRL(reg));
-}
-
static inline bool dwmac_rs_decode_stat(struct phylink_link_state *state,
uint16_t rs_stat)
{
@@ -154,6 +120,9 @@ static inline bool dwmac_rs_decode_stat(struct phylink_link_state *state,
return true;
}
+void dwmac_ctrl_ane(struct stmmac_priv *priv, bool ane, bool srgmi_ral,
+ bool loopback);
+
int dwmac_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
phy_interface_t interface,
const unsigned long *advertising,
--
2.30.2
next prev parent reply other threads:[~2024-08-05 10:25 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-05 10:24 [PATCH RFC net-next v4 00/14] net: stmmac: convert stmmac "pcs" to phylink Russell King (Oracle)
2024-08-05 10:24 ` [PATCH RFC net-next v4 01/14] net: stmmac: qcom-ethqos: add ethqos_pcs_set_inband() Russell King (Oracle)
2024-08-05 10:24 ` [PATCH RFC net-next v4 02/14] net: stmmac: replace ioaddr with stmmac_priv for pcs_set_ane() method Russell King (Oracle)
2024-08-05 10:24 ` [PATCH RFC net-next v4 03/14] net: stmmac: remove pcs_get_adv_lp() support Russell King (Oracle)
2024-08-05 10:24 ` [PATCH RFC net-next v4 04/14] net: stmmac: add infrastructure for hwifs to provide PCS Russell King (Oracle)
2024-08-05 10:25 ` [PATCH RFC net-next v4 05/14] net: stmmac: provide core phylink PCS infrastructure Russell King (Oracle)
2024-08-05 10:25 ` [PATCH RFC net-next v4 06/14] net: stmmac: dwmac1000: convert sgmii/rgmii "pcs" to phylink Russell King (Oracle)
2024-08-05 10:25 ` [PATCH RFC net-next v4 07/14] net: stmmac: dwmac1000: move PCS interrupt control Russell King (Oracle)
2024-08-05 10:25 ` [PATCH RFC net-next v4 08/14] net: stmmac: dwmac4: convert sgmii/rgmii "pcs" to phylink Russell King (Oracle)
2024-08-05 10:25 ` [PATCH RFC net-next v4 09/14] net: stmmac: dwmac4: move PCS interrupt control Russell King (Oracle)
2024-08-05 10:25 ` Russell King (Oracle) [this message]
2024-08-05 10:25 ` [PATCH RFC net-next v4 11/14] net: stmmac: pass stmmac_pcs into dwmac_pcs_isr() Russell King (Oracle)
2024-08-05 10:25 ` [PATCH RFC net-next v4 12/14] net: stmmac: rename PCS registers Russell King (Oracle)
2024-08-05 10:25 ` [PATCH RFC net-next v4 13/14] net: stmmac: remove obsolete pcs methods and associated code Russell King (Oracle)
2024-08-05 10:25 ` [PATCH RFC net-next v4 14/14] net: stmmac: Activate Inband/PCS flag based on the selected iface Russell King
2024-08-06 18:56 ` [PATCH RFC net-next v4 00/14] net: stmmac: convert stmmac "pcs" to phylink Serge Semin
2024-08-07 9:21 ` Russell King (Oracle)
2024-08-08 20:42 ` Serge Semin
2024-09-04 21:26 ` Andrew Halaney
2024-09-05 21:00 ` Andrew Lunn
2024-09-05 21:16 ` Andrew Halaney
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=E1sauu7-000tva-N1@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=bartosz.golaszewski@linaro.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=quic_snehshah@quicinc.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;
as well as URLs for NNTP newsgroup(s).