UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 67923

2016.2 PetaLinux Zynq UltraScale+ MPSoC GMII2RGMII on MACB driver

Description

This Answer Record covers how to get GMII2RGMII integrated with an MACB driver for MPSoC in PetaLinux 2016.2.

You will need to have an Ethernet FMC card from https://opsero.com/product/robust-ethernet-fmc/ with 1.8V compatibility.

Solution

The steps below provide a GMII2RGMII solution for PetaLinux 2016.2. Download the files in the zip file attached to this Answer Record.

1) Create the PetaLinux project from the release BSP.


$ petalinux-create -t project -s {PETALINUX_TOOLS_INSTALL}/petalinux-v2016.2_bsps/Xilinx-ZCU102-v2016.2-final.bsp
$ cd {PROJECT_PATH}

2) Copy the Linux kernel source from {PETALINUX_TOOLS_INSTALL}petalinux-v2016.2/petalinux-v2016.2-final/components/linux-kernel/ to {PROJECT_PATH}/components/

{PROJECT_PATH}$ cp -r {PETALINUX_TOOLS_INSTALL}petalinux-v2016.2/petalinux-v2016.2-final/components/linux-kernel/ components/


3) Apply the GMII2RGMII patch 0001-net-macb-Add-support-for-gmii2rgmii-converter-suppor.patch to the local kernel source as shown. Make sure you apply the patch with the --dry-run option which will check for errors.

{PROJECT_PATH}/components/linux-kernel/xlnx-4.4 $ patch -p1 --dry-run < ../0001-net-macb-Add-support-for-gmii2rgmii-converter-suppor.patch 
patching file drivers/net/ethernet/cadence/macb.c
patching file drivers/net/ethernet/cadence/macb.h
{PROJECT_PATH}/components/linux-kernel/xlnx-4.4 $ patch -p1 < ../0001-net-macb-Add-support-for-gmii2rgmii-converter-suppor.patch
patching file drivers/net/ethernet/cadence/macb.c
patching file drivers/net/ethernet/cadence/macb.h
{PROJECT_PATH}/components/linux-kernel/xlnx-4.4 $

4) Use the attached HDF to configure the project. Alternatively you can use the build-zcu102-hpcX.tcl scripts from https://github.com/fpgadeveloper/ethernet-fmc-zynq-gem/tree/master/Vivado to create the design project and generate the HDF.


{PROJECT_PATH}$ petalinux-config --get-hw-description={PATH_TO_HDF_DIRECTORY}


5) Modify the device tree {PROJECT_PATH}/subsystems/linux/configs/device-tree/system-top.dts (see attached system-top.dts) to add gmii2rgmii nodes as show below.

 

&gem0 {
        /*enet-reset = <&gpio0 11 0>;*/
        local-mac-address = [00 0a 35 E0 00 99];
        phy-handle = <&phy1>;
        gmii2rgmii-phy-handle = <&gmii_to_rgmii_0>;
        phy-mode = "rgmii-id";
        status = "okay";
        xlnx,ptp-enet-clock = <0x69f6bcb>;
        xlnx,has-mdio = <0x1>;
        psu_ethernet_0_mdio: mdio {
                #address-cells = <1>;
                #size-cells = <0>;
                phy1: phy@0 {
                        compatible = "marvell,88e1510";
                        device_type = "ethernet-phy";
                        reg = <0>;
                        marvell,reg-init = <2 21 0xffff 0x0030 0 0 0x7fff 0x8000>;
                };
                gmii_to_rgmii_0: phy@8 {
                        device_type = "ethernet-phy";
                        reg = <8>;
                };
        };
};

&gem1 {
        /*enet-reset = <&gpio0 11 0>;*/
        local-mac-address = [00 0a 35 E1 01 88];
        phy-handle = <&phy_fmcport1>;
        gmii2rgmii-phy-handle = <&gmii_to_rgmii_1>;
        phy-mode = "rgmii-id";
        status = "okay";
        xlnx,ptp-enet-clock = <0x69f6bcb>;
        xlnx,has-mdio = <0x1>;
        psu_ethernet_1_mdio: mdio {
                #address-cells = <1>;
                #size-cells = <0>;
                phy_fmcport1: phy@0 {
                        compatible = "marvell,88e1510";
                        device_type = "ethernet-phy";
                        reg = <0>;
                        marvell,reg-init = <2 21 0xffff 0x0030 0 0 0x7fff 0x8000>;
                };
                gmii_to_rgmii_1: phy@8 {
                        device_type = "ethernet-phy";
                        reg = <8>;
                };
        };
};

5) Replace the xfsbl_hooks.c file in {PROJECT_PATH}/components/bootloader/zynqmp_fsbl/ with the version from the attached ZIP file. 

This patch will update the GEM clock control register in the IOU SLCR to change GEM 0 and 1 to be EMIO clocked for RX.


6) Build the PetaLinux project and package the BOOT.bin.


{PROJECT_PATH}$ petalinux-build
{PROJECT_PATH}$ petalinux-package --boot --format BIN --fsbl images/linux/zynqmp_fsbl.elf --fpga images/linux/zcu102_hpc0_qgige_wrapper.bit --u-boot images/linux/u-boot.elf --force

7) Once the target is up and running, ping from network interfaces.

Attachments

Associated Attachments

Name File Size File Type
zcu102-gmii2rgmii.zip 854 KB ZIP
AR# 67923
Date Created 09/23/2016
Last Updated 11/03/2016
Status Active
Type General Article
Devices
  • Zynq UltraScale+ MPSoC
Tools
  • PetaLinux - 2016.2
IP
  • GMII to RGMII
Boards & Kits
  • Zynq UltraScale+ MPSoC ZCU102 Evaluation Kit