mediatek: sync patches and add more ethernet stability fixes
[openwrt.git] / target / linux / mediatek / patches-4.4 / 0001-NET-multi-phy-support.patch
1 From c30a296646a42302065ba452abe95b0b4b550883 Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Sun, 27 Jul 2014 09:38:50 +0100
4 Subject: [PATCH 01/91] NET: multi phy support
5
6 Signed-off-by: John Crispin <blogic@openwrt.org>
7 ---
8  drivers/net/phy/phy.c |    9 ++++++---
9  include/linux/phy.h   |    1 +
10  2 files changed, 7 insertions(+), 3 deletions(-)
11
12 diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
13 index 47cd306..f69d12f 100644
14 --- a/drivers/net/phy/phy.c
15 +++ b/drivers/net/phy/phy.c
16 @@ -844,7 +844,8 @@ void phy_state_machine(struct work_struct *work)
17                 /* If the link is down, give up on negotiation for now */
18                 if (!phydev->link) {
19                         phydev->state = PHY_NOLINK;
20 -                       netif_carrier_off(phydev->attached_dev);
21 +                       if (!phydev->no_auto_carrier_off)
22 +                               netif_carrier_off(phydev->attached_dev);
23                         phydev->adjust_link(phydev->attached_dev);
24                         break;
25                 }
26 @@ -927,7 +928,8 @@ void phy_state_machine(struct work_struct *work)
27                         netif_carrier_on(phydev->attached_dev);
28                 } else {
29                         phydev->state = PHY_NOLINK;
30 -                       netif_carrier_off(phydev->attached_dev);
31 +                       if (!phydev->no_auto_carrier_off)
32 +                               netif_carrier_off(phydev->attached_dev);
33                 }
34  
35                 phydev->adjust_link(phydev->attached_dev);
36 @@ -939,7 +941,8 @@ void phy_state_machine(struct work_struct *work)
37         case PHY_HALTED:
38                 if (phydev->link) {
39                         phydev->link = 0;
40 -                       netif_carrier_off(phydev->attached_dev);
41 +                       if (!phydev->no_auto_carrier_off)
42 +                               netif_carrier_off(phydev->attached_dev);
43                         phydev->adjust_link(phydev->attached_dev);
44                         do_suspend = true;
45                 }
46 diff --git a/include/linux/phy.h b/include/linux/phy.h
47 index 05fde31..276ab8a 100644
48 --- a/include/linux/phy.h
49 +++ b/include/linux/phy.h
50 @@ -377,6 +377,7 @@ struct phy_device {
51         bool is_pseudo_fixed_link;
52         bool has_fixups;
53         bool suspended;
54 +       bool no_auto_carrier_off;
55  
56         enum phy_state state;
57  
58 -- 
59 1.7.10.4
60