]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: mscc: ocelot: make phy_mode a member of the common struct ocelot_port
authorVladimir Oltean <vladimir.oltean@nxp.com>
Mon, 6 Jan 2020 01:34:15 +0000 (03:34 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 6 Jan 2020 07:22:33 +0000 (23:22 -0800)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mscc/ocelot.c
drivers/net/ethernet/mscc/ocelot.h
drivers/net/ethernet/mscc/ocelot_board.c
include/soc/mscc/ocelot.h

index 985b46d7e3d12e786bded167e54fe66bb0bf05a1..86d543ab1ab9307c2ac790bd6368cedd67d0386c 100644 (file)
@@ -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;
index c259114c48fd68499fac1b6af36be8da2ea9aea9..7b77d44ed7cf0992287d11e43c3e4f1d3f7d03cf 100644 (file)
@@ -68,7 +68,6 @@ struct ocelot_port_private {
 
        u8 vlan_aware;
 
-       phy_interface_t phy_mode;
        struct phy *serdes;
 
        struct ocelot_port_tc tc;
index 2da8eee27e98551e480d49d19dd3cb48d9943524..b38820849faab9d23bcd7f06e2a0637819c96647 100644 (file)
@@ -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:
index 64cbbbe74a36173bded9ee8dc827c57b53803460..068f96b1a83e7b396c811c7014b5a22df1b04232 100644 (file)
@@ -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 {