netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] net: fec: driver code clean and bug fix
@ 2014-12-10  9:54 Fugang Duan
  2014-12-10  9:54 ` [PATCH net-next 1/3] net: fec: reset fep link status in suspend function Fugang Duan
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Fugang Duan @ 2014-12-10  9:54 UTC (permalink / raw)
  To: davem; +Cc: netdev, bhutchings, stephen, b38611

The patch serial include code clean and bug fix:
Patch#1: avoid dummy operation during suspend/resume test.
Patch#2: bug fix for i.MX6SX SOC that clean all interrupt events during MAC initial process.
Patch#3: before phy device link status is up, only enable MDIO bus interrupt.

Fugang Duan (3):
  net: fec: reset fep link status in suspend function
  net: fec: clear all interrupt events to support i.MX6SX
  net: fec: only enable mdio interrupt before phy device link up

 drivers/net/ethernet/freescale/fec_main.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

-- 
1.7.8

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

* [PATCH net-next 1/3] net: fec: reset fep link status in suspend function
  2014-12-10  9:54 [PATCH net-next 0/3] net: fec: driver code clean and bug fix Fugang Duan
@ 2014-12-10  9:54 ` Fugang Duan
  2014-12-10 19:54   ` David Miller
  2014-12-10  9:54 ` [PATCH net-next 2/3] net: fec: clear all interrupt events to support i.MX6SX Fugang Duan
  2014-12-10  9:54 ` [PATCH net-next 3/3] net: fec: only enable mdio interrupt before phy device link up Fugang Duan
  2 siblings, 1 reply; 6+ messages in thread
From: Fugang Duan @ 2014-12-10  9:54 UTC (permalink / raw)
  To: davem; +Cc: netdev, bhutchings, stephen, b38611

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

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;
 }
 
-- 
1.7.8

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

* [PATCH net-next 2/3] net: fec: clear all interrupt events to support i.MX6SX
  2014-12-10  9:54 [PATCH net-next 0/3] net: fec: driver code clean and bug fix Fugang Duan
  2014-12-10  9:54 ` [PATCH net-next 1/3] net: fec: reset fep link status in suspend function Fugang Duan
@ 2014-12-10  9:54 ` Fugang Duan
  2014-12-10  9:54 ` [PATCH net-next 3/3] net: fec: only enable mdio interrupt before phy device link up Fugang Duan
  2 siblings, 0 replies; 6+ messages in thread
From: Fugang Duan @ 2014-12-10  9:54 UTC (permalink / raw)
  To: davem; +Cc: netdev, bhutchings, stephen, b38611

For i.MX6SX FEC controller, there have interrupt mask and event
field extension. To support all SOCs FEC, we clear all interrupt
events during MAVC initial process.

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

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index e8c7c82..c045f67 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -940,7 +940,7 @@ fec_restart(struct net_device *ndev)
 	}
 
 	/* Clear any outstanding interrupt. */
-	writel(0xffc00000, fep->hwp + FEC_IEVENT);
+	writel(0xffffffff, fep->hwp + FEC_IEVENT);
 
 	fec_enet_bd_init(ndev);
 
-- 
1.7.8

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

* [PATCH net-next 3/3] net: fec: only enable mdio interrupt before phy device link up
  2014-12-10  9:54 [PATCH net-next 0/3] net: fec: driver code clean and bug fix Fugang Duan
  2014-12-10  9:54 ` [PATCH net-next 1/3] net: fec: reset fep link status in suspend function Fugang Duan
  2014-12-10  9:54 ` [PATCH net-next 2/3] net: fec: clear all interrupt events to support i.MX6SX Fugang Duan
@ 2014-12-10  9:54 ` Fugang Duan
  2 siblings, 0 replies; 6+ messages in thread
From: Fugang Duan @ 2014-12-10  9:54 UTC (permalink / raw)
  To: davem; +Cc: netdev, bhutchings, stephen, b38611

Before phy device link up, we only enable FEC mdio interrupt, which
is more reasonable.

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

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index c045f67..ea71bc8 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1075,7 +1075,10 @@ fec_restart(struct net_device *ndev)
 		fec_ptp_start_cyclecounter(ndev);
 
 	/* Enable interrupts we wish to service */
-	writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
+	if (fep->link)
+		writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
+	else
+		writel(FEC_ENET_MII, fep->hwp + FEC_IMASK);
 
 	/* Init the interrupt coalescing */
 	fec_enet_itr_coal_init(ndev);
-- 
1.7.8

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

* Re: [PATCH net-next 1/3] net: fec: reset fep link status in suspend function
  2014-12-10  9:54 ` [PATCH net-next 1/3] net: fec: reset fep link status in suspend function Fugang Duan
@ 2014-12-10 19:54   ` David Miller
  2014-12-11  1:40     ` fugang.duan
  0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2014-12-10 19:54 UTC (permalink / raw)
  To: b38611; +Cc: netdev, bhutchings, stephen

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.
	 */

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

* RE: [PATCH net-next 1/3] net: fec: reset fep link status in suspend function
  2014-12-10 19:54   ` David Miller
@ 2014-12-11  1:40     ` fugang.duan
  0 siblings, 0 replies; 6+ messages in thread
From: fugang.duan @ 2014-12-11  1:40 UTC (permalink / raw)
  To: David Miller
  Cc: netdev@vger.kernel.org, bhutchings@solarflare.com,
	stephen@networkplumber.org

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

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

end of thread, other threads:[~2014-12-11  1:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-10  9:54 [PATCH net-next 0/3] net: fec: driver code clean and bug fix Fugang Duan
2014-12-10  9:54 ` [PATCH net-next 1/3] net: fec: reset fep link status in suspend function Fugang Duan
2014-12-10 19:54   ` David Miller
2014-12-11  1:40     ` fugang.duan
2014-12-10  9:54 ` [PATCH net-next 2/3] net: fec: clear all interrupt events to support i.MX6SX Fugang Duan
2014-12-10  9:54 ` [PATCH net-next 3/3] net: fec: only enable mdio interrupt before phy device link up Fugang Duan

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