1 Star 0 Fork 9

Lin/rk-ethernet

forked from byxlk/rk-ethernet 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
disable_eee.diff 1.95 KB
一键复制 编辑 原始数据 按行查看 历史
iamgeeklike 提交于 2019-08-05 15:35 . Add files via upload
diff --git a/kernel/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/kernel/drivers/net/ethernet//stmicro/stmmac/stmmac_main.c
index ad0003a..989c9fb 100755
--- a/kernel/drivers/net/ethernet/rockchip/gmac/stmmac_main.c
+++ b/kernel/drivers/net/ethernet/rockchip/gmac/stmmac_main.c
@@ -149,6 +149,8 @@ static void stmmac_exit_fs(void);
#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 verifies if some wrong parameter is passed to the driver.
@@ -945,6 +947,8 @@ 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);
gmac_create_sysfs(phydev);
@@ -2748,6 +2752,24 @@ 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
@@ -3012,6 +3034,8 @@ int stmmac_resume(struct net_device *ndev)
if (priv->phydev)
phy_start(priv->phydev);
+
+ phy_disable_eee(priv->phydev);
return 0;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mrlinjh/rk-ethernet.git
[email protected]:mrlinjh/rk-ethernet.git
mrlinjh
rk-ethernet
rk-ethernet
master

搜索帮助