forked from Poco-Ye/rk-ethernet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
disable_eee_4.4.diff
69 lines (63 loc) · 1.98 KB
/
disable_eee_4.4.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 22748ea..70e8f90 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -124,6 +124,7 @@ static void stmmac_exit_fs(struct net_device *dev);
#define STMMAC_COAL_TIMER(x) (jiffies + usecs_to_jiffies(x))
+static int phy_disable_eee(struct phy_device *phydev);
/**
* stmmac_verify_args - verify the driver parameters.
* Description: it checks the driver parameters and set a default in case of
@@ -873,6 +874,7 @@ static int stmmac_init_phy(struct net_device *dev)
" Link = %d\n", dev->name, phydev->phy_id, phydev->link);
priv->phydev = phydev;
+ phy_disable_eee(phydev);
return 0;
}
@@ -2834,6 +2836,39 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
return 0;
}
+static int phy_disable_eee(struct phy_device *phydev)
+{
+ if (phydev->phy_id == 0x001cc816) { // rtl8201
+ printk("%s in\n", __func__);
+ phy_write(phydev, 31, 0x0004);
+ mdelay(10);
+ phy_write(phydev, 16, 0x4077);
+ phy_write(phydev, 31, 0x0000);
+ phy_write(phydev, 13, 0x0007);
+ phy_write(phydev, 14, 0x003C);
+ phy_write(phydev, 13, 0x4007);
+ phy_write(phydev, 14, 0x0000);
+ phy_write(phydev, 0, 0x1200);
+ } else if (phydev->phy_id == 0x001cc915) { // rtl8211e
+ printk("%s in\n", __func__);
+ phy_write(phydev, 31, 0x0000);
+ phy_write(phydev, 0, 0x8000);
+ mdelay(20);
+ phy_write(phydev, 31, 0x0a4b);
+ phy_write(phydev, 17, 0x1110);
+ phy_write(phydev, 31, 0x0000);
+ phy_write(phydev, 13, 0x0007);
+ phy_write(phydev, 14, 0x003c);
+ phy_write(phydev, 13, 0x4007);
+ phy_write(phydev, 14, 0x0000);
+ }
+
+ return 0;
+}
+
+
+
+
/**
* stmmac_dvr_probe
* @device: device pointer
@@ -3151,6 +3186,8 @@ int stmmac_resume(struct device *dev)
if (priv->phydev)
phy_start(priv->phydev);
+ phy_disable_eee(priv->phydev);
+
return 0;
}
EXPORT_SYMBOL_GPL(stmmac_resume);