Difference between revisions of "BELK-AN-006: Enabling dual Gigabit Ethernet support on BoraEVB/BoraXEVB"

From DAVE Developer's Wiki
Jump to: navigation, search
(Enabling dual Ethernet configuration in linux kernel)
Line 36: Line 36:
 
The following picture shows the block diagram of the Vivado project:  
 
The following picture shows the block diagram of the Vivado project:  
  
[[File:An-belk-005-02.png|800px]]
+
[[File:An-belk-006-01.png|800px]]
  
 
==Enabling dual Ethernet configuration in linux kernel==
 
==Enabling dual Ethernet configuration in linux kernel==
To enable frame buffer driver user need to:
+
To enable dual Ethernet user need to:
* get the pre-built binaries from this [http://www.dave.eu/system/files/area-riservata/AN-BELK-005-sw.zip link].
+
* get the pre-built binaries from this [http://www.dave.eu/system/files/area-riservata/AN-BELK-006-sw.zip link].
  
 
Kernel and device tree can also be built with the following procedure:
 
Kernel and device tree can also be built with the following procedure:
 
* update Bora kernel repository (as described [[Bora_Embedded_Linux_Kit_(BELK)#Updating_the_repositories_from_BELK_2.1.0_to_BELK_2.2.0|here]])
 
* update Bora kernel repository (as described [[Bora_Embedded_Linux_Kit_(BELK)#Updating_the_repositories_from_BELK_2.1.0_to_BELK_2.2.0|here]])
* checkout ''bora-feat-lcd-support'' branch (using ''git checkout bora-feat-lcd-support'' command)
+
* apply the patch ''0001-dts-bora-add-ETH1-phy-support.patch'' included in the pre-build binaries package
 
* build the updated kernel source as usual
 
* build the updated kernel source as usual
 +
 +
Here is the patch to enable dual Ethernet:
 +
<pre>
 +
From 8807f6acb794acafbe0f08efbacf4b7cfd2c18f5 Mon Sep 17 00:00:00 2001
 +
From: Matteo Geromin <matteo.geromin@dave.eu>
 +
Date: Fri, 11 Sep 2015 17:48:46 +0200
 +
Subject: [PATCH] dts: bora: add ETH1 phy support
 +
 +
---
 +
arch/arm/boot/dts/bora.dts |  19 +++++++++++++++++++
 +
1 file changed, 19 insertions(+)
 +
 +
diff --git a/arch/arm/boot/dts/bora.dts b/arch/arm/boot/dts/bora.dts
 +
index 654770e..35697cd 100644
 +
--- a/arch/arm/boot/dts/bora.dts
 +
+++ b/arch/arm/boot/dts/bora.dts
 +
@@ -59,6 +59,25 @@
 +
        };
 +
};
 +
 +
+&gem1 {
 +
+      status = "okay";
 +
+      phy-mode = "rgmii-id";
 +
+      phy-handle = <&phy1>;
 +
+      gmii2rgmii-phy-handle = <&phy2>;
 +
+
 +
+      phy1: phy@6 {
 +
+              compatible = "micrel,ksz9031";
 +
+              device_type = "ethernet-phy";
 +
+              rxc-skew-ps = <1860>;
 +
+              txc-skew-ps = <1860>;
 +
+              reg = <6>;
 +
+      };
 +
+
 +
+      phy2: phy@8 {
 +
+              reg = <8>;
 +
+      };
 +
+};
 +
+
 +
&sdhci0 {
 +
        status = "okay";
 +
        broken-cd = <0x1>;
 +
--
 +
1.7.9.5
 +
 +
</pre>
  
 
Put the binaries on the first (FAT32) partition of your BELK 2.2.0 SD card, overwriting the original one if needed. Please note that you need the following files:
 
Put the binaries on the first (FAT32) partition of your BELK 2.2.0 SD card, overwriting the original one if needed. Please note that you need the following files:
Line 56: Line 102:
 
Insert the SD card into BoraEVB and turn on the board.
 
Insert the SD card into BoraEVB and turn on the board.
  
During kernel bootstrap, the following messages are printed out on console, indicating framebuffer driver has been loaded succesfully:
+
During kernel boot, user can check if the second ethernet interface has been loaded succesfully:
 +
<pre>
 +
root@bora:~# ifconfig -a
 +
can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
 +
          NOARP  MTU:16  Metric:1
 +
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
 +
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
 +
          collisions:0 txqueuelen:10
 +
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
 +
          Interrupt:60
 +
 
 +
eth0      Link encap:Ethernet  HWaddr 00:50:C2:B9:CF:82
 +
          inet addr:192.168.0.209  Bcast:192.168.0.255  Mask:255.255.255.0
 +
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
 +
          RX packets:8424 errors:5 dropped:418 overruns:0 frame:0
 +
          TX packets:5964 errors:0 dropped:0 overruns:0 carrier:0
 +
          collisions:0 txqueuelen:1000
 +
          RX bytes:7562500 (7.2 MiB)  TX bytes:922668 (901.0 KiB)
 +
          Interrupt:54 Base address:0xb000
 +
 
 +
eth1      Link encap:Ethernet  HWaddr 66:94:55:CB:B1:3E
 +
          BROADCAST MULTICAST  MTU:1500  Metric:1
 +
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
 +
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
 +
          collisions:0 txqueuelen:1000
 +
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
 +
          Interrupt:77 Base address:0xc000
  
<pre>
+
lo        Link encap:Local Loopback
[    0.600553] borafb_lum borafb_lum.0: fb0: Virtual frame buffer device, using 16384K of video memory @ phys 2d900000
+
          inet addr:127.0.0.1  Mask:255.0.0.0
 +
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
 +
          RX packets:11 errors:0 dropped:0 overruns:0 frame:0
 +
          TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
 +
          collisions:0 txqueuelen:0
 +
          RX bytes:788 (788.0 B)  TX bytes:788 (788.0 B)
 +
 
 +
root@bora:~#
 +
root@bora:~# ifconfig eth1 192.168.12.209
 +
root@bora:~#
 +
root@bora:~# [  228.492886] xemacps e000c000.ethernet: Set clk to 0 Hz
 +
[  228.498079] xemacps e000c000.ethernet: link up (1000/FULL)
 +
 
 +
root@bora:~#
 
</pre>
 
</pre>
 
You will also see two [https://en.wikipedia.org/wiki/Tux Tuxes] on the top left corner of the LCD, indicating that this Linux system has two cores:
 
[[File:An-belk-005-03.jpg|thumb|center|400px]]
 
  
 
===Performance test===
 
===Performance test===
 
TBD
 
TBD

Revision as of 16:07, 11 September 2015

Info Box
Bora5-small.jpg Applies to Bora

History[edit | edit source]

Version Date BELK version Notes
1.0.0 2.2.0 First release

Introduction[edit | edit source]

Thanks to the migration to linux kernel 3.10.17, BELK 2.2.0 allows to cleanly support dual Gigabit Ethernet configuration on BoraEVB. This application note describes how to implement such configuration, providing a reference design for Vivado 2014.4 and linux kernel configuration instructions.

Block diagram[edit | edit source]

Simplified block diagram of dual Ethernet configuration is shown in the following picture.


An-belk-006-bd.png


First Ethernet port refers to J8 connector of BoraEVB carrier board and is based on Zynq's Gigabit Ethernet Controller 0 (Gem0). This controller is mapped at physical address 0xE000B000.

Second Ethernet port refers to J9 connector of BoraEVB carrier board and is based on Zynq's Gigabit Ethernet Controller 1 (Gem1). This controller is mapped at physical address 0xE000C000.

The fundamental difference between the two interfaces is the PHY interfacing. In case of Gem0, PHY is mounted on Bora SoM and it is interfaced directly to Processor Subsystem (PS) via MIO pads. In case of Gem1 instead, PHY is populated on BoraEVB (U9) and it is interfaced to Programmable Logic (PL) pads that belong to bank #34. Thus it is necessary to enable EMIO routing and to instantiate a GMII to RGMII bridge in PL as per PHY's interface requirement. Since bank #34 is powered at 3.3V (High Range I/O mode), RGMII duty cycle distortion specification is not matched. In case of carrier board designed for production environments, it is recommended to use a lower voltage levels and thus a different PL bank. For more details please see section I/O Standard and Placement of PG160 GMII to RGMII LogiCORE IP Product Guide and this page.

Vivado design[edit | edit source]

The following picture shows the block diagram of the Vivado project:

An-belk-006-01.png

Enabling dual Ethernet configuration in linux kernel[edit | edit source]

To enable dual Ethernet user need to:

  • get the pre-built binaries from this link.

Kernel and device tree can also be built with the following procedure:

  • update Bora kernel repository (as described here)
  • apply the patch 0001-dts-bora-add-ETH1-phy-support.patch included in the pre-build binaries package
  • build the updated kernel source as usual

Here is the patch to enable dual Ethernet:

From 8807f6acb794acafbe0f08efbacf4b7cfd2c18f5 Mon Sep 17 00:00:00 2001
From: Matteo Geromin <matteo.geromin@dave.eu>
Date: Fri, 11 Sep 2015 17:48:46 +0200
Subject: [PATCH] dts: bora: add ETH1 phy support

---
 arch/arm/boot/dts/bora.dts |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm/boot/dts/bora.dts b/arch/arm/boot/dts/bora.dts
index 654770e..35697cd 100644
--- a/arch/arm/boot/dts/bora.dts
+++ b/arch/arm/boot/dts/bora.dts
@@ -59,6 +59,25 @@
        };
 };

+&gem1 {
+       status = "okay";
+       phy-mode = "rgmii-id";
+       phy-handle = <&phy1>;
+       gmii2rgmii-phy-handle = <&phy2>;
+
+       phy1: phy@6 {
+               compatible = "micrel,ksz9031";
+               device_type = "ethernet-phy";
+               rxc-skew-ps = <1860>;
+               txc-skew-ps = <1860>;
+               reg = <6>;
+       };
+
+       phy2: phy@8 {
+               reg = <8>;
+       };
+};
+
 &sdhci0 {
        status = "okay";
        broken-cd = <0x1>;
--
1.7.9.5

Put the binaries on the first (FAT32) partition of your BELK 2.2.0 SD card, overwriting the original one if needed. Please note that you need the following files:

  • boot.bin
  • bora.dtb
  • uImage
  • fpga.bin
  • uEnv.txt

Insert the SD card into BoraEVB and turn on the board.

During kernel boot, user can check if the second ethernet interface has been loaded succesfully:

root@bora:~# ifconfig -a
can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          NOARP  MTU:16  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:10
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:60

eth0      Link encap:Ethernet  HWaddr 00:50:C2:B9:CF:82
          inet addr:192.168.0.209  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8424 errors:5 dropped:418 overruns:0 frame:0
          TX packets:5964 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:7562500 (7.2 MiB)  TX bytes:922668 (901.0 KiB)
          Interrupt:54 Base address:0xb000

eth1      Link encap:Ethernet  HWaddr 66:94:55:CB:B1:3E
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:77 Base address:0xc000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:11 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:788 (788.0 B)  TX bytes:788 (788.0 B)

root@bora:~#
root@bora:~# ifconfig eth1 192.168.12.209
root@bora:~#
root@bora:~# [  228.492886] xemacps e000c000.ethernet: Set clk to 0 Hz
[  228.498079] xemacps e000c000.ethernet: link up (1000/FULL)

root@bora:~#

Performance test[edit | edit source]

TBD