BRX-WP004: Managing both Ethernet ports with U-Boot (BoraEVB/BoraXEVB)
|1.0.0||November 2016||First public release|
AN-BELK-006 shows how to enable second Ethernet interface by the use of native GEM1 controller. That application note allows to support both Ethernet ports in Linux. In some circumstances, it can be required to access second Ethernet port in U-Boot as well.
This white paper describes how to use both Ethernet ports in U-Boot. It is worth remembering that default U-Boot delivered with Bora Embedded Linux Kit or BoraX Embedded Linux Kit does not support second Ethernet interface. A modified version is required to run the examples presented here. For more information please contact technical support.
The following block diagram shows the Ethernet native controllers/PHYs topology as implemented in the AN-BELK-006.
- PHY #1 : is the Ethernet PHY on the Bora SOM
- PHY #2 : is the Ethernet PHY on the BoraEVB
- PHY #3 : is a dummy PHY implemented in the GMII-to-RGMII bridge IP. It has only one register to set the RGMII bus frequency, based on Ethernet link speed.
Following commands show how to initialize second Ethernet port in U-boot and to download a file via TFTP.
At first boot the second Ethernet interface is unable to find MAC address, so it must be set as an environment variable:
U-Boot 2014.07-00002-g61aeb00 (Nov 07 2016 - 14:42:16) [belk-3.0.0] Board: BORA/BORAX Environment: SPI Flash I2C: ready DRAM: ECC disabled 1 GiB NAND: 1024 MiB MMC: zynq_sdhci: 0 SF: Detected S25FL256S_64K with page size 256 Bytes, erase size 64 KiB, total 32 MiB In: serial Out: serial Err: serial SOM ConfigID not found, using default SOM UniqueID not found, using default SOM ConfigID#: ffffffff SOM UniqueID#: ffffffff:ffffffff ds2431_readmem(): error in chip reset ds2431_readmem(): error in reading buffer ds2431_readmem(): error in chip reset ds2431_readmem(): error in reading buffer CB ConfigID CRC mismatch for 0x00000000 (was 0x00000000, expected 0x2144df1c) at block 3 (offset 96): using default CB ConfigID#: ffffffff CB UniqueID#: 00000000:00000000 Net: Gem.e000b000, Gem.e000c000 Warning: failed to set MAC address Hit any key to stop autoboot: 0 zynq-uboot> setenv eth1addr XX:XX:XX:XX:XX:XX zynq-uboot> saveenv Saving Environment to SPI Flash... SF: Detected S25FL256S_64K with page size 256 Bytes, erase size 64 KiB, total 32 MiB Erasing SPI flash...Writing to SPI flash...done Valid environment: 1 zynq-uboot> reset resetting ...
To switch between the two Ethernet interfaces user must set the
ethact environment variable properly (this variable is reset to its default at every system reboot):
- to access GEM0 (Bora SOM ethernet phy):
setenv ethact Gem.e000b000
- to access GEM1 (BoraEVB ethernet phy):
setenv ethact Gem.e000c000
If the user wants to use the Bora SOM Ethernet interface, regular network commands can be used. Instead, If the user wants to access the LAN through the BoraEVB Ethernet interface, some additional initialization commands must be issued, as detailed in the rest of the document.
ethact variable to select second Ethernet port, issue a net command like
ping. This command is just used to initialize the Ethernet PHY #2 and PHY #3 on the BoraEVB. The
ping command fails because the GMII-to-RGMII bridge (PHY #3) is not yet fully initialized:
zynq-uboot> ping 192.168.0.23 Gem.e000c000 Waiting for PHY auto negotiation to complete...... done Using Gem.e000c000 device ping failed; host 192.168.0.23 is not alive
The two PHY #2 and PHY #3 are now partially initialized and, as such, can be listed and accessed via
mii U-boot command:
zynq-uboot> mii info PHY 0x00: OUI = 0x0885, Model = 0x22, Rev = 0x02, 100baseT, FDX PHY 0x06: OUI = 0x0885, Model = 0x22, Rev = 0x02, 100baseT, FDX PHY 0x08: OUI = 0x0000, Model = 0x00, Rev = 0x00, 10baseT, HDX
The last step consists of configuring the GMII-to-RGMII bridge. This IP has an internal dummy (virtual) MDIO PHY at the
0x8 address. Is has only one internal register that is used to set Ethernet link speed and consequently the RGMII interface clock frequency. For more detail about the GMII-to-RGMII bridge IP and the internal register please refer to the Product Guide.
Since the Ethernet PHY on BoraEVB is configured with auto-negotiation enabled by default, user must know the link speed negotiated on this interface before setting the GMII-to-RGMII register. Please use the command associated to the negotiated link speed:
- link @ 10Mbps :
mii write 0x08 0x10 0x0
- link @ 100Mbps :
mii write 0x08 0x10 0x2000
- link @ 1000Mbps :
mii write 0x08 0x10 0x40
Once virtual PHY #3 is fully initialiazed, second Ethernet port is finally available:
zynq-uboot> ping 192.168.0.23 Using Gem.e000c000 device host 192.168.0.23 is alive