Commit 5997c86b authored by Antoine Tenart's avatar Antoine Tenart Committed by David S. Miller

net: mvpp2: make the phy optional

There is not necessarily a PHY between the GoP and the physical port.
However, the driver currently makes the "phy" property mandatory,
contrary to what is stated in the device tree bindings. This patch makes
the PHY optional, and aligns the PPv2 driver on its device tree
documentation. However if a PHY is provided, the GoP link interrupt
won't be used.

With this patch switches directly connected to the serdes lanes and SFP
ports on the Armada 8040-db and Armada 7040-db can be used if the link
interrupt is described in the device tree.
Signed-off-by: default avatarAntoine Tenart <antoine.tenart@free-electrons.com>
Tested-by: default avatarMarcin Wojtas <mw@semihalf.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1df2270d
...@@ -6475,6 +6475,7 @@ static void mvpp2_start_dev(struct mvpp2_port *port) ...@@ -6475,6 +6475,7 @@ static void mvpp2_start_dev(struct mvpp2_port *port)
mvpp2_port_mii_set(port); mvpp2_port_mii_set(port);
mvpp2_port_enable(port); mvpp2_port_enable(port);
if (ndev->phydev)
phy_start(ndev->phydev); phy_start(ndev->phydev);
netif_tx_start_all_queues(port->dev); netif_tx_start_all_queues(port->dev);
} }
...@@ -6501,6 +6502,7 @@ static void mvpp2_stop_dev(struct mvpp2_port *port) ...@@ -6501,6 +6502,7 @@ static void mvpp2_stop_dev(struct mvpp2_port *port)
mvpp2_egress_disable(port); mvpp2_egress_disable(port);
mvpp2_port_disable(port); mvpp2_port_disable(port);
if (ndev->phydev)
phy_stop(ndev->phydev); phy_stop(ndev->phydev);
phy_power_off(port->comphy); phy_power_off(port->comphy);
} }
...@@ -6558,6 +6560,10 @@ static int mvpp2_phy_connect(struct mvpp2_port *port) ...@@ -6558,6 +6560,10 @@ static int mvpp2_phy_connect(struct mvpp2_port *port)
{ {
struct phy_device *phy_dev; struct phy_device *phy_dev;
/* No PHY is attached */
if (!port->phy_node)
return 0;
phy_dev = of_phy_connect(port->dev, port->phy_node, mvpp2_link_event, 0, phy_dev = of_phy_connect(port->dev, port->phy_node, mvpp2_link_event, 0,
port->phy_interface); port->phy_interface);
if (!phy_dev) { if (!phy_dev) {
...@@ -6578,6 +6584,9 @@ static void mvpp2_phy_disconnect(struct mvpp2_port *port) ...@@ -6578,6 +6584,9 @@ static void mvpp2_phy_disconnect(struct mvpp2_port *port)
{ {
struct net_device *ndev = port->dev; struct net_device *ndev = port->dev;
if (!ndev->phydev)
return;
phy_disconnect(ndev->phydev); phy_disconnect(ndev->phydev);
} }
...@@ -7340,12 +7349,6 @@ static int mvpp2_port_probe(struct platform_device *pdev, ...@@ -7340,12 +7349,6 @@ static int mvpp2_port_probe(struct platform_device *pdev,
return -ENOMEM; return -ENOMEM;
phy_node = of_parse_phandle(port_node, "phy", 0); phy_node = of_parse_phandle(port_node, "phy", 0);
if (!phy_node) {
dev_err(&pdev->dev, "missing phy\n");
err = -ENODEV;
goto err_free_netdev;
}
phy_mode = of_get_phy_mode(port_node); phy_mode = of_get_phy_mode(port_node);
if (phy_mode < 0) { if (phy_mode < 0) {
dev_err(&pdev->dev, "incorrect phy mode\n"); dev_err(&pdev->dev, "incorrect phy mode\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment