From: Vladimir Oltean <olteanv@gmail.com>
To: davem@davemloft.net, jakub.kicinski@netronome.com,
linux@armlinux.org.uk, andrew@lunn.ch, f.fainelli@gmail.com,
vivien.didelot@gmail.com
Cc: alexandru.marginean@nxp.com, claudiu.manoil@nxp.com,
xiaoliang.yang_1@nxp.com, yangbo.lu@nxp.com,
netdev@vger.kernel.org, alexandre.belloni@bootlin.com,
horatiu.vultur@microchip.com, UNGLinuxDriver@microchip.com,
Vladimir Oltean <vladimir.oltean@nxp.com>
Subject: [PATCH v3 net-next 09/11] net: mscc: ocelot: make phy_mode a member of the common struct ocelot_port
Date: Fri, 27 Dec 2019 23:36:24 +0200 [thread overview]
Message-ID: <20191227213626.4404-10-olteanv@gmail.com> (raw)
In-Reply-To: <20191227213626.4404-1-olteanv@gmail.com>
From: Vladimir Oltean <vladimir.oltean@nxp.com>
The Ocelot switchdev driver and the Felix DSA one need it for different
reasons. Felix (or at least the VSC9959 instantiation in NXP LS1028A) is
integrated with the traditional NXP Layerscape PCS design which does not
support runtime configuration of SerDes protocol. So it needs to
pre-validate the phy-mode from the device tree and prevent PHYLINK from
attempting to change it. For this, it needs to cache it in a private
variable.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
Changes in v3:
- None.
drivers/net/ethernet/mscc/ocelot.c | 7 ++++---
drivers/net/ethernet/mscc/ocelot.h | 1 -
drivers/net/ethernet/mscc/ocelot_board.c | 4 ++--
include/soc/mscc/ocelot.h | 2 ++
4 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c
index 985b46d7e3d1..86d543ab1ab9 100644
--- a/drivers/net/ethernet/mscc/ocelot.c
+++ b/drivers/net/ethernet/mscc/ocelot.c
@@ -500,13 +500,14 @@ EXPORT_SYMBOL(ocelot_port_enable);
static int ocelot_port_open(struct net_device *dev)
{
struct ocelot_port_private *priv = netdev_priv(dev);
- struct ocelot *ocelot = priv->port.ocelot;
+ struct ocelot_port *ocelot_port = &priv->port;
+ struct ocelot *ocelot = ocelot_port->ocelot;
int port = priv->chip_port;
int err;
if (priv->serdes) {
err = phy_set_mode_ext(priv->serdes, PHY_MODE_ETHERNET,
- priv->phy_mode);
+ ocelot_port->phy_mode);
if (err) {
netdev_err(dev, "Could not set mode of SerDes\n");
return err;
@@ -514,7 +515,7 @@ static int ocelot_port_open(struct net_device *dev)
}
err = phy_connect_direct(dev, priv->phy, &ocelot_port_adjust_link,
- priv->phy_mode);
+ ocelot_port->phy_mode);
if (err) {
netdev_err(dev, "Could not attach to PHY\n");
return err;
diff --git a/drivers/net/ethernet/mscc/ocelot.h b/drivers/net/ethernet/mscc/ocelot.h
index c259114c48fd..7b77d44ed7cf 100644
--- a/drivers/net/ethernet/mscc/ocelot.h
+++ b/drivers/net/ethernet/mscc/ocelot.h
@@ -68,7 +68,6 @@ struct ocelot_port_private {
u8 vlan_aware;
- phy_interface_t phy_mode;
struct phy *serdes;
struct ocelot_port_tc tc;
diff --git a/drivers/net/ethernet/mscc/ocelot_board.c b/drivers/net/ethernet/mscc/ocelot_board.c
index 2da8eee27e98..b38820849faa 100644
--- a/drivers/net/ethernet/mscc/ocelot_board.c
+++ b/drivers/net/ethernet/mscc/ocelot_board.c
@@ -402,9 +402,9 @@ static int mscc_ocelot_probe(struct platform_device *pdev)
of_get_phy_mode(portnp, &phy_mode);
- priv->phy_mode = phy_mode;
+ ocelot_port->phy_mode = phy_mode;
- switch (priv->phy_mode) {
+ switch (ocelot_port->phy_mode) {
case PHY_INTERFACE_MODE_NA:
continue;
case PHY_INTERFACE_MODE_SGMII:
diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h
index 64cbbbe74a36..068f96b1a83e 100644
--- a/include/soc/mscc/ocelot.h
+++ b/include/soc/mscc/ocelot.h
@@ -420,6 +420,8 @@ struct ocelot_port {
u8 ptp_cmd;
struct sk_buff_head tx_skbs;
u8 ts_id;
+
+ phy_interface_t phy_mode;
};
struct ocelot {
--
2.17.1
next prev parent reply other threads:[~2019-12-27 21:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-27 21:36 [PATCH v3 net-next 00/11] Convert Felix DSA switch to PHYLINK Vladimir Oltean
2019-12-27 21:36 ` [PATCH v3 net-next 01/11] mii: Add helpers for parsing SGMII auto-negotiation Vladimir Oltean
2019-12-27 21:36 ` [PATCH v3 net-next 02/11] net: phylink: make QSGMII a valid PHY mode for in-band AN Vladimir Oltean
2019-12-27 21:36 ` [PATCH v3 net-next 03/11] net: phylink: add support for polling MAC PCS Vladimir Oltean
2019-12-27 21:36 ` [PATCH v3 net-next 04/11] net: dsa: Pass pcs_poll flag from driver to PHYLINK Vladimir Oltean
2019-12-27 21:36 ` [PATCH v3 net-next 05/11] net: phy: Add a property for controlling in-band auto-negotiation Vladimir Oltean
2019-12-28 12:17 ` Vladimir Oltean
2019-12-27 21:36 ` [PATCH v3 net-next 06/11] net: phy: vsc8514: configure explicit in-band SGMII auto-negotiation settings Vladimir Oltean
2019-12-27 21:36 ` [PATCH v3 net-next 07/11] enetc: Make MDIO accessors more generic and export to include/linux/fsl Vladimir Oltean
2019-12-27 21:36 ` [PATCH v3 net-next 08/11] enetc: Set MDIO_CFG_HOLD to the recommended value of 2 Vladimir Oltean
2019-12-27 21:36 ` Vladimir Oltean [this message]
2019-12-27 21:36 ` [PATCH v3 net-next 10/11] net: mscc: ocelot: export ANA, DEV and QSYS registers to include/soc/mscc Vladimir Oltean
2019-12-27 21:36 ` [PATCH v3 net-next 11/11] net: dsa: felix: Add PCS operations for PHYLINK 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=20191227213626.4404-10-olteanv@gmail.com \
--to=olteanv@gmail.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=alexandru.marginean@nxp.com \
--cc=andrew@lunn.ch \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=horatiu.vultur@microchip.com \
--cc=jakub.kicinski@netronome.com \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=vivien.didelot@gmail.com \
--cc=vladimir.oltean@nxp.com \
--cc=xiaoliang.yang_1@nxp.com \
--cc=yangbo.lu@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).