diff mbox

[net-next,1/3] net: fec: reset fep link status in suspend function

Message ID 1418205289-7730-2-git-send-email-b38611@freescale.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Nimrod Andy Dec. 10, 2014, 9:54 a.m. UTC
On some i.MX6 serial boards, phy power and refrence clock are supplied
or controlled by SOC. When do suspend/resume test, the power and clock
are disabled, so phy device link down.

For current driver, fep->link is still up status, which cause extra operation
like below code. To avoid the dumy operation, we set fep->link to down when
phy device is real down.
...
if (fep->link) {
	napi_disable(&fep->napi);
	netif_tx_lock_bh(ndev);
	fec_stop(ndev);
	netif_tx_unlock_bh(ndev);
	napi_enable(&fep->napi);
	fep->link = phy_dev->link;
	status_change = 1;
}
...

Signed-off-by: Fugang Duan <B38611@freescale.com>
---
 drivers/net/ethernet/freescale/fec_main.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

Comments

David Miller Dec. 10, 2014, 7:54 p.m. UTC | #1
From: Fugang Duan <b38611@freescale.com>
Date: Wed, 10 Dec 2014 17:54:47 +0800

> +	/*
> +	 * SOC supply clock to phy, when clock is disabled, phy link down
> +	 * SOC control phy regulator, when regulator is disabled, phy link down
> +	 */

Comments in the networking should be of the form:

	/* Like
	 * this.
	 */

Not:

	/*
	 * Like
	 * this.
	 */
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Fugang Duan Dec. 11, 2014, 1:40 a.m. UTC | #2
From: David Miller <davem@davemloft.net> Sent: Thursday, December 11, 2014 3:54 AM
> To: Duan Fugang-B38611
> Cc: netdev@vger.kernel.org; bhutchings@solarflare.com;
> stephen@networkplumber.org
> Subject: Re: [PATCH net-next 1/3] net: fec: reset fep link status in
> suspend function
> 
> From: Fugang Duan <b38611@freescale.com>
> Date: Wed, 10 Dec 2014 17:54:47 +0800
> 
> > +	/*
> > +	 * SOC supply clock to phy, when clock is disabled, phy link down
> > +	 * SOC control phy regulator, when regulator is disabled, phy link
> down
> > +	 */
> 
> Comments in the networking should be of the form:
> 
> 	/* Like
> 	 * this.
> 	 */
> 
> Not:
> 
> 	/*
> 	 * Like
> 	 * this.
> 	 */

Thanks for your comment. I will change it and send V2 version.

Regards,
Andy
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index fee2afe..e8c7c82 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -3332,6 +3332,13 @@  static int __maybe_unused fec_suspend(struct device *dev)
 	if (fep->reg_phy)
 		regulator_disable(fep->reg_phy);
 
+	/*
+	 * SOC supply clock to phy, when clock is disabled, phy link down
+	 * SOC control phy regulator, when regulator is disabled, phy link down
+	 */
+	if (fep->clk_enet_out || fep->reg_phy)
+		fep->link = 0;
+
 	return 0;
 }