当前位置:网站首页>The connection of imx6 network port is unstable after power on
The connection of imx6 network port is unstable after power on
2022-04-23 18:15:00 【Talent、me】
chip :LAN8720A
problem : Network instability , After inserting the network cable , repeated link up,link down
fec 2188000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
fec 2188000.ethernet eth0: Link is Down
IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
fec 2188000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
fec 2188000.ethernet eth0: Link is Down
IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
General solution :
1、 If using CPU The internal clock is provided to LAN8720 Chip work , In the face of the above problems , It can be supplied to... By changing to an external crystal oscillator LAN8720.
2、 Adjust the power on timing of the reset pin , from fec_main.c In the document static void fec_reset_phy(struct platform_device *pdev) The function interface , Default delay 1ms,
On the Internet, most people say that the delay time can be increased .( I tested , The situation I encountered this time is not good )
From the device tree fec Add the following parameters to the network interface node :
phy-reset-gpios = <&gpio3 16 GPIO_ACTIVE_LOW>;
phy-reset-duration = <1>;
static void fec_reset_phy(struct platform_device *pdev)
{
int err;
int phy_reset;
int msec = 1;
struct device_node *np = pdev->dev.of_node;
if (!np)
return;
err = of_property_read_u32(np, "phy-reset-duration", &msec);
/* A sane reset duration should not be longer than 1s */
if (!err && msec > 1000)
msec = 1;
phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0);
if (!gpio_is_valid(phy_reset))
return;
err = devm_gpio_request_one(&pdev->dev, phy_reset,
GPIOF_OUT_INIT_LOW, "phy-reset");
if (err) {
dev_err(&pdev->dev, "failed to get phy-reset-gpios: %d\n", err);
return;
}
msleep(msec);
gpio_set_value(phy_reset, 1);
}
3、 Through the test with the hardware engineer , After the system is fully up , Put the chip reset The pin is pulled down again , Reset the hardware , Then it can run normally . So by printing information , Locate where you need to add a reset function .
static int fec_enet_mii_probe(struct net_device *ndev)
Add the following code
static void fec_enet_hyb_reset(void)
{
printk("%s:%d\n",__FUNCTION__,phy_reset);
msleep(1);
gpio_set_value(phy_reset, 0);
msleep(30);
gpio_set_value(phy_reset, 1);
}
static int resetCnt = 0;// Define a static global variable
static int fec_enet_mii_probe(struct net_device *ndev)
{
.......
if (resetCnt == 0) {
// Hardware reset only once
resetCnt++;
fec_enet_hyb_reset();
}
.......
}
版权声明
本文为[Talent、me]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210610470997.html
边栏推荐
- 【ACM】376. 摆动序列
- Log4j2 cross thread print traceid
- Climbing watermelon video URL
- Multi thread crawling Marco Polo network supplier data
- 深度学习经典网络解析目标检测篇(一):R-CNN
- 【ACM】455. Distribute Biscuits (1. Give priority to big biscuits to big appetite; 2. Traverse two arrays with only one for loop (use subscript index -- to traverse another array))
- Refcell in rust
- Realization of consumer gray scale
- MATLAB小技巧(6)七种滤波方法比较
- positioner
猜你喜欢
Jenkspy package installation
SSD硬盘SATA接口和M.2接口区别(详细)总结
PowerDesigner various font settings; Preview font setting; SQL font settings
How to restore MySQL database after win10 system is reinstalled (mysql-8.0.26-winx64. Zip)
【ACM】376. 摆动序列
Robocode Tutorial 4 - robocode's game physics
MATLAB小技巧(6)七种滤波方法比较
Jeecg boot microservice architecture
Spark performance optimization guide
多功能工具箱微信小程序源码
随机推荐
Selenium + webdriver + chrome realize Baidu to search for pictures
Linux installs MySQL in RPM (super simple)
Crack sliding verification code
登录和发布文章功能测试
Classes and objects
In shell programming, the shell file with relative path is referenced
How to ensure the security of futures accounts online?
Resolve the error Max virtual memory areas VM max_ map_ count [65530] is too low, increase to at least [262144]
Robocode tutorial 7 - Radar locking
Notepad + + replaces tabs with spaces
word frequency count
Refcell in rust
MATLAB从入门到精通(二)
Stanford machine learning course summary
Gson fastjason Jackson of object to JSON difference modifies the field name
【ACM】70. 爬楼梯
Flash - Middleware
Permission management with binary
WIN1 remote "this may be due to credssp encryption Oracle correction" solution
Pointers in rust: box, RC, cell, refcell