netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2][Nios2-dev] Altera TSE: Add missing phydev
@ 2014-12-30 17:27 Kostya Belezko
  2015-01-02 20:45 ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Kostya Belezko @ 2014-12-30 17:27 UTC (permalink / raw)
  To: Nios2-dev; +Cc: netdev, Kostya Belezko

Altera network device doesn't come up after
 
ifconfig eth0 down
ifconfig eth0 up
 
The reason behind is clearing priv->phydev during tse_shutdown().
The phydev is not restored back at tse_open().

Resubmiting as to follow Tobias Klauser suggestion.
phy_start/phy_stop are called on each ifup/ifdown and
phy_disconnect is called once during the module removal. 

Signed-off-by: Kostya Belezko <bkostya@hotmail.com>

---
 drivers/net/ethernet/altera/altera_tse_main.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c
index 4efc435..720db5f 100644
--- a/drivers/net/ethernet/altera/altera_tse_main.c
+++ b/drivers/net/ethernet/altera/altera_tse_main.c
@@ -1170,10 +1170,6 @@ tx_request_irq_error:
 init_error:
 	free_skbufs(dev);
 alloc_skbuf_error:
-	if (priv->phydev) {
-		phy_disconnect(priv->phydev);
-		priv->phydev = NULL;
-	}
 phy_error:
 	return ret;
 }
@@ -1186,12 +1182,9 @@ static int tse_shutdown(struct net_device *dev)
 	int ret;
 	unsigned long int flags;
 
-	/* Stop and disconnect the PHY */
-	if (priv->phydev) {
+	/* Stop the PHY */
+	if (priv->phydev)
 		phy_stop(priv->phydev);
-		phy_disconnect(priv->phydev);
-		priv->phydev = NULL;
-	}
 
 	netif_stop_queue(dev);
 	napi_disable(&priv->napi);
@@ -1525,6 +1518,10 @@ err_free_netdev:
 static int altera_tse_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
+	struct altera_tse_private *priv = netdev_priv(ndev);
+
+	if (priv->phydev)
+		phy_disconnect(priv->phydev);
 
 	platform_set_drvdata(pdev, NULL);
 	altera_tse_mdio_destroy(ndev);
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-01-02 21:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-30 17:27 [PATCH v2][Nios2-dev] Altera TSE: Add missing phydev Kostya Belezko
2015-01-02 20:45 ` David Miller
2015-01-02 20:57   ` Kostya Belezko
2015-01-02 21:07     ` David Miller
2015-01-02 21:16       ` Kostya Belezko
2015-01-02 21:26         ` David Miller

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).