Dual Microchip KSZ9031 PHY Ethernet problem for ZYNQ

本文介绍了解决Xilinx Zynq平台上的双网口PHY共享MDIO问题的方法,通过特定补丁及设备树配置实现了两个网口的同时工作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

xilinx

Dual Microchip KSZ9031 PHY Ethernet problem for ZYNQ

						        Alvin.lu@avnet.com
                                                                 2017.8.17

The problem is dual ethernet phy shared mdio,and only one ethernet can works.

Patch is applicable ONLY to the 2017.2 kernel

Now do as follows:

1.checkout, patch, and build 2017.2 kernel

$ git clone --branch xilinx-v2017.2 --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

$ make ARCH=arm xilinx_zynq_defconfig

$ make ARCH=arm UIMAGE_LOADADDR=0x8000 uImage -j4

  1. modify your device tree file as follows:

2a. Add mdio in the top level:

/ {

    cpus {

            cpu@0 { 

                    operating-points = <500000 1000000 250000 1000000>;

            };

    };

    chosen {

            bootargs = "console=ttyPS0,115200";

    };

    aliases {

            ethernet0 = &gem0;

            ethernet1 = &gem1;

            serial0 = &uart0;

            serial1 = &axi_uart16550_2;

            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@3 {

          device_type = "ethernet-phy";

          reg = <3>;

                } ;

     phy1: phy@7 {

          device_type = "ethernet-phy";

          reg = <7>;

                } ;

   };

};

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 = <0x4f790d8>;

    phy-handle = <&phy0>;

};

&gem1 {

    local-mac-address = [00 0a 35 00 00 05];

    phy-mode = "rgmii-id";

    status = "okay";

    xlnx,ptp-enet-clock = <0x4f790d8>;

    phy-handle = <&phy1>;

};

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

$ dtc -I dts -O dtb -o system.dtb system.dts

Tips:

Both controllers provide MDIO interfaces, however, only one interface is needed to control both of the external PHYs.

MDIO bus supports multiple slaves. Make sure the two PHY devices have different PHY addresses. (Some of the PHY devices can support PHY address configurable).

Connect one MDIO to MIO 52 53 in Zynq Configuration GUI, leave the other MDIO unconnected.

Connect Zynq MDIO pins and two PHY devices as one master and two slaves on board.

The patch is availble for both zynq and MPSOC.

The patch is availble for other ethernet phy devices.

You can download dts and kernel source code from my git

git clone git@github.com:alvin-luhao/xilinx.git

You should not add ( "compatible = "micrel,ksz9031") to the devicetree.Otherwise,the error log as "can not find the phy device" will appear.

I have already patched for linux-xlnx.You don't have to do it again.

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值