KV260-SOM:如何在u-boot里使用ethernet

作者:Davis Zhang

KV260 petalinux BSP在u-boot device tree中disable了GEM3,也就是说ethernet在u-boot中不建议使用ethernet。
如果有特殊需要在u-boot中使用ethernet,可以用一下方法来使能它。

1. 在u-boot设备树种enable GEM3和它的phy node

KV260 Petalinux BSP使能了这个配置, petalinux-config --> u-boot Configuration --> u-boot-ext-dtb
就是说u-boot有自己单独的设备树,我们需要在它的设备数里enable GEM3和phy node。

project-spec/meta-user/recipes-bsp/uboot-device-tree/files/system-user.dtsi
配置GEM3 node如下,
&gem3 { /* required by spec */
status = "okay";
local-mac-address = [00 0a 35 00 22 01];
phy-handle = ;
phy-mode = "rgmii-id";

phy0: ethernet-phy@1 {
reg = ;
ti,rx-internal-delay = ;
ti,tx-internal-delay = ;
ti,fifo-depth = ;
ti,dp83867-rxctrl-strap-quirk;
};
};

2. 除了设备树里的配置外,要让GEM3对应的phy正常工作

我们还要disable MIO 71/73/75的internal pullup/pulldown,使用MIO38来复位一下PHY。可以在u-boot里这样操作。

a. Check if MIO 71/73/75 internal pull up/down is disabled. With the value 0x0357ffff, it has been disabled by u-boot.
ZynqMP> md 0xFF180180 1
ff180180: 0357ffff

b. Check if MIO38 is set as output and enabled. U-boot configures MIO38 as input. We need change it manually.
ZynqMP> md 0xFF0A0244 1
ff0a0244: 00000000
ZynqMP> md 0xFF0A0248 1
ff0a0248: 00000000

c. Configure MIO38 as output and enable it. Assert MIO38 low and high. Then, gem3 will work with phy addr 0x1.
ZynqMP> mw 0xFF0A0244 0x1000
ZynqMP> mw 0xFF0A0248 0x1000
ZynqMP> mw 0xFF0A0008 0x0000
ZynqMP> mw 0xFF0A0008 0x1000
ZynqMP> setenv ipaddr 192.168.1.10
ZynqMP> ping 192.168.1.100

ZYNQ GEM: ff0e0000, mdio bus ff0e0000, phyaddr 1, interface rgmii-id
ethernet@ff0e0000 Waiting for PHY auto negotiation to complete....... done
Using ethernet@ff0e0000 device
host 192.168.1.100 is alive
ZynqMP>

最新文章