netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/3] net: fec: driver code clean and bug fix
@ 2014-12-11  1:20 Fugang Duan
  2014-12-11  1:20 ` [PATCH net-next v2 1/3] net: fec: reset fep link status in suspend function Fugang Duan
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Fugang Duan @ 2014-12-11  1:20 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.

V2:
- Modify the comment form from David's suggestion.

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] 5+ messages in thread

* [PATCH net-next v2 1/3] net: fec: reset fep link status in suspend function
  2014-12-11  1:20 [PATCH net-next v2 0/3] net: fec: driver code clean and bug fix Fugang Duan
@ 2014-12-11  1:20 ` Fugang Duan
  2014-12-11  1:20 ` [PATCH net-next v2 2/3] net: fec: clear all interrupt events to support i.MX6SX Fugang Duan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Fugang Duan @ 2014-12-11  1:20 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 |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index fee2afe..b118b7d 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -3332,6 +3332,12 @@ 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] 5+ messages in thread

* [PATCH net-next v2 2/3] net: fec: clear all interrupt events to support i.MX6SX
  2014-12-11  1:20 [PATCH net-next v2 0/3] net: fec: driver code clean and bug fix Fugang Duan
  2014-12-11  1:20 ` [PATCH net-next v2 1/3] net: fec: reset fep link status in suspend function Fugang Duan
@ 2014-12-11  1:20 ` Fugang Duan
  2014-12-11  1:20 ` [PATCH net-next v2 3/3] net: fec: only enable mdio interrupt before phy device link up Fugang Duan
  2014-12-11  4:37 ` [PATCH net-next v2 0/3] net: fec: driver code clean and bug fix David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Fugang Duan @ 2014-12-11  1:20 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 b118b7d..85c955e 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] 5+ messages in thread

* [PATCH net-next v2 3/3] net: fec: only enable mdio interrupt before phy device link up
  2014-12-11  1:20 [PATCH net-next v2 0/3] net: fec: driver code clean and bug fix Fugang Duan
  2014-12-11  1:20 ` [PATCH net-next v2 1/3] net: fec: reset fep link status in suspend function Fugang Duan
  2014-12-11  1:20 ` [PATCH net-next v2 2/3] net: fec: clear all interrupt events to support i.MX6SX Fugang Duan
@ 2014-12-11  1:20 ` Fugang Duan
  2014-12-11  4:37 ` [PATCH net-next v2 0/3] net: fec: driver code clean and bug fix David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Fugang Duan @ 2014-12-11  1:20 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 85c955e..8c5b15e 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] 5+ messages in thread

* Re: [PATCH net-next v2 0/3] net: fec: driver code clean and bug fix
  2014-12-11  1:20 [PATCH net-next v2 0/3] net: fec: driver code clean and bug fix Fugang Duan
                   ` (2 preceding siblings ...)
  2014-12-11  1:20 ` [PATCH net-next v2 3/3] net: fec: only enable mdio interrupt before phy device link up Fugang Duan
@ 2014-12-11  4:37 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2014-12-11  4:37 UTC (permalink / raw)
  To: b38611; +Cc: netdev, bhutchings, stephen

From: Fugang Duan <b38611@freescale.com>
Date: Thu, 11 Dec 2014 09:20:30 +0800

> 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.
> 
> V2:
> - Modify the comment form from David's suggestion.

Series applied, thanks.

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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-11  1:20 [PATCH net-next v2 0/3] net: fec: driver code clean and bug fix Fugang Duan
2014-12-11  1:20 ` [PATCH net-next v2 1/3] net: fec: reset fep link status in suspend function Fugang Duan
2014-12-11  1:20 ` [PATCH net-next v2 2/3] net: fec: clear all interrupt events to support i.MX6SX Fugang Duan
2014-12-11  1:20 ` [PATCH net-next v2 3/3] net: fec: only enable mdio interrupt before phy device link up Fugang Duan
2014-12-11  4:37 ` [PATCH net-next v2 0/3] net: fec: driver code clean and bug fix 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).