e3347be9a2a7f87a0078a2da5edc4eac8f71f2dd
[openwrt/openwrt.git] / target / linux / mediatek / patches-4.9 / 0001-NET-multi-phy-support.patch
1 From 1e021917e634b173d466bf0dd3d2ae84e51a77ff 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 001/102] 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 --- a/drivers/net/phy/phy.c
13 +++ b/drivers/net/phy/phy.c
14 @@ -1032,7 +1032,8 @@ void phy_state_machine(struct work_struc
15 /* If the link is down, give up on negotiation for now */
16 if (!phydev->link) {
17 phydev->state = PHY_NOLINK;
18 - netif_carrier_off(phydev->attached_dev);
19 + if (!phydev->no_auto_carrier_off)
20 + netif_carrier_off(phydev->attached_dev);
21 phydev->adjust_link(phydev->attached_dev);
22 break;
23 }
24 @@ -1115,7 +1116,8 @@ void phy_state_machine(struct work_struc
25 netif_carrier_on(phydev->attached_dev);
26 } else {
27 phydev->state = PHY_NOLINK;
28 - netif_carrier_off(phydev->attached_dev);
29 + if (!phydev->no_auto_carrier_off)
30 + netif_carrier_off(phydev->attached_dev);
31 }
32
33 phydev->adjust_link(phydev->attached_dev);
34 @@ -1127,7 +1129,8 @@ void phy_state_machine(struct work_struc
35 case PHY_HALTED:
36 if (phydev->link) {
37 phydev->link = 0;
38 - netif_carrier_off(phydev->attached_dev);
39 + if (!phydev->no_auto_carrier_off)
40 + netif_carrier_off(phydev->attached_dev);
41 phydev->adjust_link(phydev->attached_dev);
42 do_suspend = true;
43 }
44 --- a/include/linux/phy.h
45 +++ b/include/linux/phy.h
46 @@ -373,6 +373,7 @@ struct phy_device {
47 bool is_pseudo_fixed_link;
48 bool has_fixups;
49 bool suspended;
50 + bool no_auto_carrier_off;
51
52 enum phy_state state;
53