0bcb617ba1ad73d5d791998f4d2007765583b110
[openwrt/openwrt.git] / target / linux / ramips / patches-4.14 / 0034-NET-multi-phy-support.patch
1 From 0b6eb1e68290243d439ee330ea8d0b239a5aec69 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 34/53] 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 @@ -984,7 +984,10 @@ 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 - phy_link_down(phydev, true);
19 + if (!phydev->no_auto_carrier_off)
20 + phy_link_down(phydev, true);
21 + else
22 + phy_link_down(phydev, false);
23 break;
24 }
25
26 @@ -1071,7 +1074,10 @@ void phy_state_machine(struct work_struc
27 phy_link_up(phydev);
28 } else {
29 phydev->state = PHY_NOLINK;
30 - phy_link_down(phydev, true);
31 + if (!phydev->no_auto_carrier_off)
32 + phy_link_down(phydev, true);
33 + else
34 + phy_link_down(phydev, false);
35 }
36
37 if (phy_interrupt_is_valid(phydev))
38 @@ -1081,7 +1087,10 @@ void phy_state_machine(struct work_struc
39 case PHY_HALTED:
40 if (phydev->link) {
41 phydev->link = 0;
42 - phy_link_down(phydev, true);
43 + if (!phydev->no_auto_carrier_off)
44 + phy_link_down(phydev, true);
45 + else
46 + phy_link_down(phydev, false);
47 do_suspend = true;
48 }
49 break;
50 --- a/include/linux/phy.h
51 +++ b/include/linux/phy.h
52 @@ -412,6 +412,7 @@ struct phy_device {
53 bool suspended;
54 bool sysfs_links;
55 bool loopback_enabled;
56 + bool no_auto_carrier_off;
57
58 enum phy_state state;
59