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

* Re: [PATCH v2][Nios2-dev] Altera TSE: Add missing phydev
  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
  0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2015-01-02 20:45 UTC (permalink / raw)
  To: bkostya; +Cc: nios2-dev, netdev

From: Kostya Belezko <bkostya@hotmail.com>
Date: Tue, 30 Dec 2014 12:27:09 -0500

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

I'll apply this, but I'm pretty sure the phy_disconnect() is down
so that the PHY is powered down when the device is not up.

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

* RE: [PATCH v2][Nios2-dev] Altera TSE: Add missing phydev
  2015-01-02 20:45 ` David Miller
@ 2015-01-02 20:57   ` Kostya Belezko
  2015-01-02 21:07     ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Kostya Belezko @ 2015-01-02 20:57 UTC (permalink / raw)
  To: David Miller; +Cc: nios2-dev@lists.rocketboards.org, netdev@vger.kernel.org

----------------------------------------
> Date: Fri, 2 Jan 2015 15:45:00 -0500
> To: bkostya@hotmail.com
> CC: nios2-dev@lists.rocketboards.org; netdev@vger.kernel.org
> Subject: Re: [PATCH v2][Nios2-dev] Altera TSE: Add missing phydev
> From: davem@davemloft.net
>
> From: Kostya Belezko <bkostya@hotmail.com>
> Date: Tue, 30 Dec 2014 12:27:09 -0500
>
>> 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>
>
> I'll apply this, but I'm pretty sure the phy_disconnect() is down
> so that the PHY is powered down when the device is not up.

Hi David,
What do you mean by phy_disconnect() is down?
Originally priv->phydev is NULL (and remains null forever) right after 'ifdown eth0'


 		 	   		  

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

* Re: [PATCH v2][Nios2-dev] Altera TSE: Add missing phydev
  2015-01-02 20:57   ` Kostya Belezko
@ 2015-01-02 21:07     ` David Miller
  2015-01-02 21:16       ` Kostya Belezko
  0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2015-01-02 21:07 UTC (permalink / raw)
  To: bkostya; +Cc: nios2-dev, netdev

From: Kostya Belezko <bkostya@hotmail.com>
Date: Fri, 2 Jan 2015 15:57:29 -0500

> What do you mean by phy_disconnect() is down?
> Originally priv->phydev is NULL (and remains null forever) right after 'ifdown eth0'

I'm saying that the code should probably keep phydev non-NULL and just
take the PHY down/up during these events.

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

* RE: [PATCH v2][Nios2-dev] Altera TSE: Add missing phydev
  2015-01-02 21:07     ` David Miller
@ 2015-01-02 21:16       ` Kostya Belezko
  2015-01-02 21:26         ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Kostya Belezko @ 2015-01-02 21:16 UTC (permalink / raw)
  To: David Miller; +Cc: nios2-dev@lists.rocketboards.org, netdev@vger.kernel.org



----------------------------------------
> Date: Fri, 2 Jan 2015 16:07:03 -0500
> To: bkostya@hotmail.com
> CC: nios2-dev@lists.rocketboards.org; netdev@vger.kernel.org
> Subject: Re: [PATCH v2][Nios2-dev] Altera TSE: Add missing phydev
> From: davem@davemloft.net
>
> From: Kostya Belezko <bkostya@hotmail.com>
> Date: Fri, 2 Jan 2015 15:57:29 -0500
>
>> What do you mean by phy_disconnect() is down?
>> Originally priv->phydev is NULL (and remains null forever) right after 'ifdown eth0'
>
> I'm saying that the code should probably keep phydev non-NULL and just
> take the PHY down/up during these events.

Yes, this is what the patch intends to achieve. It keeps phydev non-NULL and calls phy_stop, shy_start respectively.
phy_disconnect is called upon rmmod.
 		 	   		  

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

* Re: [PATCH v2][Nios2-dev] Altera TSE: Add missing phydev
  2015-01-02 21:16       ` Kostya Belezko
@ 2015-01-02 21:26         ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2015-01-02 21:26 UTC (permalink / raw)
  To: bkostya; +Cc: nios2-dev, netdev

From: Kostya Belezko <bkostya@hotmail.com>
Date: Fri, 2 Jan 2015 16:16:34 -0500

> Yes, this is what the patch intends to achieve. It keeps phydev
> non-NULL and calls phy_stop, shy_start respectively.  phy_disconnect
> is called upon rmmod.

Aha, ok I see.  Looks good to me.

^ permalink raw reply	[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).