From: Vladimir Oltean <olteanv@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org
Cc: Wong Vee Khee <vee.khee.wong@linux.intel.com>,
Ong Boon Leong <boon.leong.ong@intel.com>,
Michael Sit Wei Hong <michael.wei.hong.sit@intel.com>,
Giuseppe Cavallaro <peppe.cavallaro@st.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Jose Abreu <joabreu@synopsys.com>,
Jose Abreu <Jose.Abreu@synopsys.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King - ARM Linux admin <linux@armlinux.org.uk>,
Florian Fainelli <f.fainelli@gmail.com>,
Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
Vladimir Oltean <vladimir.oltean@nxp.com>
Subject: [PATCH v2 net-next 09/13] net: pcs: xpcs: export xpcs_do_config and xpcs_link_up
Date: Thu, 10 Jun 2021 21:14:06 +0300 [thread overview]
Message-ID: <20210610181410.1886658-10-olteanv@gmail.com> (raw)
In-Reply-To: <20210610181410.1886658-1-olteanv@gmail.com>
From: Vladimir Oltean <vladimir.oltean@nxp.com>
The sja1105 hardware has a quirk in that some changes require a switch
reset, which loses all configuration. When the reset is initiated,
everything needs to be reprogrammed, including the MACs and the PCS.
This is currently done in sja1105_static_config_reload() - we manually
call sja1105_adjust_port_config(), sja1105_sgmii_pcs_config() and
sja1105_sgmii_pcs_force_speed() which are all internal functions.
There is a desire for sja1105 to use the common xpcs driver, and that
means that the equivalents of those functions, xpcs_do_config() and
xpcs_link_up() respectively, will no longer be local functions.
Forcing phylink to retrigger a resolve somehow, say by doing dev_close()
followed by dev_open() is not really an option, because the CPU port
might have a PCS as well, and there is no net device which we can close
and reopen for that. Additionally, the dev_close/dev_open sequence might
force a renegotiation of the copper-side link for SGMII ports connected
to a PHY, and this is undesirable as well, because the switch reset is
much quicker than a PHY autoneg, so we would have a lot more downtime.
The only solution I see is for the sja1105 driver to keep doing what
it's doing, and that means we need to export the equivalents from xpcs
for sja1105_sgmii_pcs_config and sja1105_sgmii_pcs_force_speed, and call
them directly in sja1105_static_config_reload(). This will be done
during the conversion patch.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
v1->v2: none
drivers/net/pcs/pcs-xpcs.c | 10 ++++++----
include/linux/pcs/pcs-xpcs.h | 4 ++++
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c
index b66e46fc88dc..63fda3fc40aa 100644
--- a/drivers/net/pcs/pcs-xpcs.c
+++ b/drivers/net/pcs/pcs-xpcs.c
@@ -757,8 +757,8 @@ static int xpcs_config_2500basex(struct dw_xpcs *xpcs)
return xpcs_write(xpcs, MDIO_MMD_VEND2, DW_VR_MII_MMD_CTRL, ret);
}
-static int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface,
- unsigned int mode)
+int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface,
+ unsigned int mode)
{
const struct xpcs_compat *compat;
int ret;
@@ -797,6 +797,7 @@ static int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface,
return 0;
}
+EXPORT_SYMBOL_GPL(xpcs_do_config);
static int xpcs_config(struct phylink_pcs *pcs, unsigned int mode,
phy_interface_t interface,
@@ -945,8 +946,8 @@ static void xpcs_link_up_sgmii(struct dw_xpcs *xpcs, unsigned int mode,
pr_err("%s: xpcs_write returned %pe\n", __func__, ERR_PTR(ret));
}
-static void xpcs_link_up(struct phylink_pcs *pcs, unsigned int mode,
- phy_interface_t interface, int speed, int duplex)
+void xpcs_link_up(struct phylink_pcs *pcs, unsigned int mode,
+ phy_interface_t interface, int speed, int duplex)
{
struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs);
@@ -955,6 +956,7 @@ static void xpcs_link_up(struct phylink_pcs *pcs, unsigned int mode,
if (interface == PHY_INTERFACE_MODE_SGMII)
return xpcs_link_up_sgmii(xpcs, mode, speed, duplex);
}
+EXPORT_SYMBOL_GPL(xpcs_link_up);
static u32 xpcs_get_id(struct dw_xpcs *xpcs)
{
diff --git a/include/linux/pcs/pcs-xpcs.h b/include/linux/pcs/pcs-xpcs.h
index dae7dd8ac683..add077a81b21 100644
--- a/include/linux/pcs/pcs-xpcs.h
+++ b/include/linux/pcs/pcs-xpcs.h
@@ -27,6 +27,10 @@ struct dw_xpcs {
};
int xpcs_get_an_mode(struct dw_xpcs *xpcs, phy_interface_t interface);
+void xpcs_link_up(struct phylink_pcs *pcs, unsigned int mode,
+ phy_interface_t interface, int speed, int duplex);
+int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface,
+ unsigned int mode);
void xpcs_validate(struct dw_xpcs *xpcs, unsigned long *supported,
struct phylink_link_state *state);
int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns,
--
2.25.1
next prev parent reply other threads:[~2021-06-10 18:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-10 18:13 [PATCH v2 net-next 00/13] Port the SJA1105 DSA driver to XPCS Vladimir Oltean
2021-06-10 18:13 ` [PATCH v2 net-next 01/13] net: pcs: xpcs: rename mdio_xpcs_args to dw_xpcs Vladimir Oltean
2021-06-10 18:13 ` [PATCH v2 net-next 02/13] net: stmmac: reverse Christmas tree notation in stmmac_xpcs_setup Vladimir Oltean
2021-06-10 18:14 ` [PATCH v2 net-next 03/13] net: stmmac: reduce indentation when calling stmmac_xpcs_setup Vladimir Oltean
2021-06-10 18:14 ` [PATCH v2 net-next 04/13] net: pcs: xpcs: move register bit descriptions to a header file Vladimir Oltean
2021-06-10 18:14 ` [PATCH v2 net-next 05/13] net: pcs: xpcs: add support for sgmii with no inband AN Vladimir Oltean
2021-06-10 18:14 ` [PATCH v2 net-next 06/13] net: pcs: xpcs: also ignore phy id if it's all ones Vladimir Oltean
2021-06-10 18:14 ` [PATCH v2 net-next 07/13] net: pcs: xpcs: add support for NXP SJA1105 Vladimir Oltean
2021-06-10 18:14 ` [PATCH v2 net-next 08/13] net: pcs: xpcs: add support for NXP SJA1110 Vladimir Oltean
2021-06-10 18:14 ` Vladimir Oltean [this message]
2021-06-10 18:14 ` [PATCH v2 net-next 10/13] net: dsa: sja1105: migrate to xpcs for SGMII Vladimir Oltean
2021-06-10 18:14 ` [PATCH v2 net-next 11/13] net: dsa: sja1105: register the PCS MDIO bus for SJA1110 Vladimir Oltean
2021-06-10 18:14 ` [PATCH v2 net-next 12/13] net: dsa: sja1105: SGMII and 2500base-x on the SJA1110 are 'special' Vladimir Oltean
2021-06-10 18:14 ` [PATCH v2 net-next 13/13] net: dsa: sja1105: plug in support for 2500base-x Vladimir Oltean
2021-06-11 11:44 ` [PATCH v2 net-next 00/13] Port the SJA1105 DSA driver to XPCS Vladimir Oltean
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=20210610181410.1886658-10-olteanv@gmail.com \
--to=olteanv@gmail.com \
--cc=Jose.Abreu@synopsys.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew@lunn.ch \
--cc=boon.leong.ong@intel.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=joabreu@synopsys.com \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mcoquelin.stm32@gmail.com \
--cc=michael.wei.hong.sit@intel.com \
--cc=netdev@vger.kernel.org \
--cc=peppe.cavallaro@st.com \
--cc=vee.khee.wong@linux.intel.com \
--cc=vivien.didelot@gmail.com \
--cc=vladimir.oltean@nxp.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).