summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2018-05-08 16:55:08 +0100
committerRussell King <rmk+kernel@armlinux.org.uk>2019-07-09 12:20:56 +0100
commitc2b76bc435de31d2e410a8a30e7579df86d091ca (patch)
tree437d201d95aab4d6dc3242546de8096ad5839ff3
parent3c4b2328bfcf76e150a8154ce118b19d4a594148 (diff)
net: marvell: mvpp2x: convert to use mainline mvebu-comphy driver
Switch the Marvell MVPP2x driver to use the mainline mvebu-comphy driver instead of the Marvell comphy driver. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r--drivers/net/ethernet/marvell/mvpp2x/mv_pp2x.h2
-rw-r--r--drivers/net/ethernet/marvell/mvpp2x/mv_pp2x_main.c28
2 files changed, 22 insertions, 8 deletions
diff --git a/drivers/net/ethernet/marvell/mvpp2x/mv_pp2x.h b/drivers/net/ethernet/marvell/mvpp2x/mv_pp2x.h
index c2d0382894a9..ff52329701f4 100644
--- a/drivers/net/ethernet/marvell/mvpp2x/mv_pp2x.h
+++ b/drivers/net/ethernet/marvell/mvpp2x/mv_pp2x.h
@@ -22,6 +22,7 @@
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/phy.h>
+#include <linux/phy/phy.h>
#include <linux/string.h>
#include <linux/log2.h>
@@ -627,6 +628,7 @@ struct mv_pp2x_port {
struct mv_pp2x_bm_pool *pool_short; /* Pointer to the short pool_id */
struct phy *comphy; /* comphy handler */
+ enum phy_mode modes[4];
int txq_stop_limit;
u32 num_qvector;
diff --git a/drivers/net/ethernet/marvell/mvpp2x/mv_pp2x_main.c b/drivers/net/ethernet/marvell/mvpp2x/mv_pp2x_main.c
index a9b76eabb787..8ee135090086 100644
--- a/drivers/net/ethernet/marvell/mvpp2x/mv_pp2x_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2x/mv_pp2x_main.c
@@ -1708,7 +1708,7 @@ static bool mv_pp2x_reconfig_port(struct mv_pp2x_port *port,
switch (interface) {
case PHY_INTERFACE_MODE_10GKR:
- com_mode = COMPHY_DEF(COMPHY_SFI_MODE, port->id);
+ com_mode = port->modes[0];
flags &= ~MV_EMAC_F_SGMII2_5;
break;
case PHY_INTERFACE_MODE_SGMII:
@@ -1716,10 +1716,10 @@ static bool mv_pp2x_reconfig_port(struct mv_pp2x_port *port,
case PHY_INTERFACE_MODE_2500BASEX:
interface = PHY_INTERFACE_MODE_SGMII;
if (sgmii_hs) {
- com_mode = COMPHY_DEF(COMPHY_HS_SGMII_MODE, port->id);
+ com_mode = port->modes[1];
flags |= MV_EMAC_F_SGMII2_5;
} else {
- com_mode = COMPHY_DEF(COMPHY_SGMII_MODE, port->id);
+ com_mode = port->modes[2];
flags &= ~MV_EMAC_F_SGMII2_5;
}
break;
@@ -3623,18 +3623,18 @@ static void mv_serdes_port_init(struct mv_pp2x_port *port)
case PHY_INTERFACE_MODE_SGMII:
case PHY_INTERFACE_MODE_QSGMII:
if (port->mac_data.flags & MV_EMAC_F_SGMII2_5)
- mode = COMPHY_DEF(COMPHY_HS_SGMII_MODE, port->id);
+ mode = port->modes[1];
else
- mode = COMPHY_DEF(COMPHY_SGMII_MODE, port->id);
+ mode = port->modes[2];
phy_set_mode(port->comphy, mode);
break;
case PHY_INTERFACE_MODE_XAUI:
case PHY_INTERFACE_MODE_RXAUI:
- mode = COMPHY_DEF(COMPHY_RXAUI_MODE, port->id);
+ mode = port->modes[3];
phy_set_mode(port->comphy, mode);
break;
case PHY_INTERFACE_MODE_10GKR:
- mode = COMPHY_DEF(COMPHY_SFI_MODE, port->id);
+ mode = port->modes[0];
phy_set_mode(port->comphy, mode);
break;
default:
@@ -4944,8 +4944,20 @@ static int mv_pp2x_port_probe(struct platform_device *pdev,
comphy = devm_of_phy_get(&pdev->dev, emac_node, "comphy");
- if (!IS_ERR(comphy))
+ if (!IS_ERR(comphy)) {
port->comphy = comphy;
+ if (!strcmp(comphy->dev.parent->driver->name, "mvebu-comphy")) {
+ port->modes[0] = PHY_MODE_10GKR;
+ port->modes[1] = PHY_MODE_2500SGMII;
+ port->modes[2] = PHY_MODE_SGMII;
+ port->modes[3] = PHY_MODE_INVALID; /* no AUI modes currently supported */
+ } else {
+ port->modes[0] = COMPHY_DEF(COMPHY_SFI_MODE, port->id);
+ port->modes[1] = COMPHY_DEF(COMPHY_HS_SGMII_MODE, port->id);;
+ port->modes[2] = COMPHY_DEF(COMPHY_SGMII_MODE, port->id);
+ port->modes[3] = COMPHY_DEF(COMPHY_RXAUI_MODE, port->id);
+ }
+ }
}
if (port->mac_data.phy_mode == PHY_INTERFACE_MODE_SGMII ||