Difference between revisions of "BELK-TN-004: Managing both Ethernet ports with U-Boot (BoraEVB/BoraXEVB)"

From DAVE Developer's Wiki
Jump to: navigation, search
(Introduction)
Line 19: Line 19:
 
[[AN-BELK-006:_Enabling_dual_Gigabit_Ethernet_support_on_BoraEVB/BoraXEVB | 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.
 
[[AN-BELK-006:_Enabling_dual_Gigabit_Ethernet_support_on_BoraEVB/BoraXEVB | 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 [mailto:support-bora@dave.eu|technical support].
+
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 [mailto:support-bora@dave.eu|technical support].
  
 
ETH PHY on Bora SOM and BoraEVB through MDIO interfaces under U-boot. Some changes must be made in U-boot sources in order to enable access to both GEM0 and GEM1 Zynq controllers.  
 
ETH PHY on Bora SOM and BoraEVB through MDIO interfaces under U-boot. Some changes must be made in U-boot sources in order to enable access to both GEM0 and GEM1 Zynq controllers.  

Revision as of 15:17, 8 November 2016

Info Box
Bora5-small.jpg Applies to Bora
BORA Xpress.png Applies to BORA Xpress

History[edit | edit source]

Version Date Notes
1.0.0 November 2016 First public release

Introduction[edit | edit source]

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 support.

ETH PHY on Bora SOM and BoraEVB through MDIO interfaces under U-boot. Some changes must be made in U-boot sources in order to enable access to both GEM0 and GEM1 Zynq controllers.

The AN-BELK-006 gives access to both ethernet ports only under U-boot. For some reasons the user may want to fully access the net independently through both ETH connection even by the U-boot bootloader.


The following block diagram shows the Ethernet native Ethernet controllers' and 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.


01-BoraEVB-DUAL-ETH.png


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 all accesses such as loading a file via TFTP are straight forward.

If the user wants to access the LAN through the BoraEVB ethernet interface, some additional initialization commands must be issued. Below these steps are provided.

Issue a net command like ping. This command is used to initialize the Ethernet PHY #2 on the BoraEVB. The ping command fails because the GMII-to-RGMII bridge (PHY #3) is not yet 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 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 steps implies to correctly configure the GMII-to-RGMII bridge. This IP has an internal dummy 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, The user must know the link speed negotiated on this interface before setting the GMII-to-RGMII register. Following are the commands :

    • 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 initiliazed properly, the user can use second Ethernet port:

zynq-uboot> ping 192.168.0.23
Using Gem.e000c000 device
host 192.168.0.23 is alive