全志H616芯片 以太网模块初始化失败如何解决?

2024-02-02 16:54:24 浏览数 (1)

1.【问题现象】

执行ifconfig -a/ifconfig eth0/ifconfig eth0 up命令,找不到eth0设备,有如下类似打印:

代码语言:javascript复制
root@TinaLinux:/# ifconfig -a
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:6480 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6480 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:505440 (493.5 KiB)  TX bytes:505440 (493.5 KiB)

root@TinaLinux:/# 
root@TinaLinux:/# ifconfig eth0
ifconfig: eth0: error fetching interface information: Device not found
root@TinaLinux:/# 
root@TinaLinux:/# ifconfig eth0 up
ifconfig: SIOCGIFFLAGS: No such device
2.【问题分析】

以太网模块配置未生效或存在GPIO冲突

3.【排查步骤】
  • 步骤1:抓取内核启动log,搜索"gmac"关键字段,检查gmac驱动是否probe成功;
  • 步骤2:若内核启动log显示probe失败,常见原因是GPIO资源冲突导致,有如下类似打印:
代码语言:javascript复制
sun50iw10p1-pinctrl pio: pin PH0 already requested by twi0; cannot claim for gmac0
sun50iw10p1-pinctrl pio: pin-224 (gmac0) status -22
sun50iw10p1-pinctrl pio: could not request pin 224 (PH0) from group PH0  on device pio
sunxi-gmac gmac0: Error applying setting, reverse things back
sunxi-gmac: probe of gmac0 failed with error -22
  • 步骤3:若内核启动log无gmac相关打印,则需要确认以太网配置是否生效。
4.【解决办法】

4.1 GPIO冲突 (1) 首先,结合内核启动log定位与哪个模块存在GPIO冲突,有如下类似打印:

代码语言:javascript复制
sun50iw10p1-pinctrl pio: pin PH0 already requested by twi0; cannot claim for gmac0

(2) 然后,确认该模块GPIO配置是否有误或者是否可以关闭该模块。

4.2 以太网配置未生效 (1) 首先,确认内核menuconfig以太网模块配置是否打开,路径及截图如下:

代码语言:javascript复制
menuconfig -> Device Drivers -> Network device support -> Ethernet driver support

(2) 然后,确认board.dts/sys_config.fex中GMAC模块是否打开,board.dts配置示例如下:

代码语言:javascript复制
gmac0: eth@05020000{
    phy-mode = "rgmii";
    use_ephy25m = <1>;
    tx-delay = <7>;
    rx-delay = <0>;
    status = "okay";
};

注:

  • status = “okay"代表打开该模块,status = “disabled"代表关闭该模块;
  • 确保PHY与GMAC之间物理接口与软件配置相匹配,对于RGMII接口phy-mode配置为"rgmii”,RMII接口phy-mode配置为"rmii”; © use_ephy25m=1代表PHY使用SOC内部EPHY_25M时钟,use_ephy25m=0或者不配置该参数,代表PHY不使用SOC内部EPHY_25M时钟, 需外部挂载25M晶振为PHY提供时钟;

原贴链接:https://bbs.aw-ol.com/topic/2582/

0 人点赞