ZYNQ PS端双MAC,MDIO共用,eth0正常,eth1不通

此为转帖,原文:https://forums.xilinx.com/t5/Embedded-Linux/Dual-Marvell-88e1512-PHY-Ethernet-problem-Xilinx-LInux/td-p/682660/highlight/false/page/3

目前已经验证正常,Mark一下!!!

 

Patch files attached. Patch is applicable ONLY to the 2016.1 kernel.

Do as follows:

1. checkout, patch, and build 2016.1 kernel

$ git clone --branch xilinx-v2016.1 --depth 1 https://github.com/Xilinx/linux-xlnx.git
$ cd linux-xlnx
$ git apply 0001-net-macb-Add-MDIO-driver-for-accessing-multiple-PHY-.patch
$ git apply 0002-Documentation-devictree-Add-macb-mdio-bindings.patch
$ make ARCH=arm xilinx_zynq_defconfig
$ make ARCH=arm UIMAGE_LOADADDR=0x8000 uImage

2. modify your device tree file as follows:

2a. Add mdio in the top level:

Note:modify the phy reg to match your design.

 / {
    cpus {
        cpu@0 {
            operating-points = <666666 1000000 333333 1000000>;
        };
    };
    chosen {
        bootargs = "console=ttyPS0,115200";
        stdout-path = "serial0:115200n8";
    };
    aliases {
        ethernet0 = &gem0;
        ethernet1 = &gem1;
        serial0 = &uart0;
        serial1 = &uart1;
        spi0 = &qspi;
    };
    memory {
        device_type = "memory";
        reg = <0x0 0x40000000>;
    };
    mdio {
         compatible = "cdns,macb-mdio";
         reg = <0xe000b000 0x1000>;
         clocks = <&clkc 30>, <&clkc 30>, <&clkc 13>;
         clock-names = "pclk", "hclk", "tx_clk";
         #address-cells = <1>;
         #size-cells = <0>;
         phy0: phy@0 {
              compatible = "marvell";
              device_type = "ethernet-phy";
              reg = <
0>;
        } ;
            phy1: phy@1 {
                 compatible = "marvell";
                 device_type = "ethernet-phy";
                 reg = <
1>;
              } ;
       };
};

2b. Add the phy handle to the gem sections:

&gem0 {
    local-mac-address = [00 0a 35 00 00 00];
    phy-mode = "rgmii-id";
    status = "okay";
    xlnx,ptp-enet-clock = <0x69f6bcb>;
    phy-handle = <&phy0>;
};
&gem1 {
    local-mac-address = [00 0a 35 00 00 01];
    phy-mode = "rgmii-id";
    status = "okay";
    xlnx,ptp-enet-clock = <0x69f6bcb>;
    phy-handle = <&phy1>;
};

3. Build the device tree blob, and copy uImage and the .dtb file to your boot partition.

Here are the patch files.

0001-net-macb-Add-MDIO-driver-for-accessing-multiple-PHY-.patch ‏16 KB

0002-Documentation-devictree-Add-macb-mdio-bindings.patch ‏2 KB

你可能感兴趣的:(zynq)