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!

cancel
Showing results for 
Search instead for 
Did you mean: 
Participant jonbacon
Participant
11,598 Views
Registered: ‎08-06-2015

Ethernet not working when using AXI Ethernet Subsystem IP block

Hi,

 

I am attempting to use the AXI Ethernet Subsystem IP block to access ethernet connection on an FMC card (http://ethernetfmc.com/) and I'm unable to bring the interface up. I keep getting an of_phy_connect() failure.

 

I am using the ZC706 dev board, running the example hardware from the above site and petalinux 2015.2.1

 

I've had to add a section for the PHY to the dts file to get as far as I am, but I can't help but thingk I'm missing something obvious.

 

Any ideas?

 

dts addition:

 

&axi_ethernet_0_eth_buf {
	local-mac-address = [00 0a 35 00 1e 55];
	phy-handle = <&phy3>;
	phy-mode = "rgmii-id";
	
	axi_ethernet_0_eth_buf_mdio: mdio {
            phy3: phy@3{
                compatible = "marvell,88e1510";
                device_type = "ethernet-phy";
                marvell,reg-init = <3 16 0xff00 0x1e 3 17 0xfff0 0x00>;
                reg = <3>;
            };
        };
};

 

0 Kudos
11 Replies
Xilinx Employee
Xilinx Employee
11,586 Views
Registered: ‎09-10-2008

Re: Ethernet not working when using AXI Ethernet Subsystem IP block

Hi,

 

It seems like this could be a h/w or s/w issue but let's check the s/w side 1st.

 

Can you also put in your pl.dtsi file so we can make sure RGMII got set up?

 

The driver probe function does need this also and it needs to be RGMII.

 

https://github.com/Xilinx/linux-xlnx/blob/xilinx-v2015.2.01/drivers/net/ethernet/xilinx/xilinx_axienet_main.c

 

    of_property_read_u32(pdev->dev.of_node, "xlnx,phy-type", &lp->phy_type);

 

And if the wrong type that could cause a failure.

 

if (lp->phy_node && !lp->is_10Gmac) {
  if (lp->phy_type == XAE_PHY_TYPE_GMII ||
      lp->phy_type == XAE_PHY_TYPE_1000BASE_X) {
  lp->phy_dev = of_phy_connect(lp->ndev, lp->phy_node,
       axienet_adjust_link, 0,
       PHY_INTERFACE_MODE_GMII);
  } else if (lp->phy_type == XAE_PHY_TYPE_RGMII_2_0) {
  lp->phy_dev = of_phy_connect(lp->ndev, lp->phy_node,
       axienet_adjust_link, 0,
       PHY_INTERFACE_MODE_RGMII_ID);
  }
   
  if (!lp->phy_dev)
  dev_err(lp->dev, "of_phy_connect() failed\n");
  else
  phy_start(lp->phy_dev);
  }

 

The phy types are in https://github.com/Xilinx/linux-xlnx/blob/xilinx-v2015.2.01/drivers/net/ethernet/xilinx/xilinx_axienet.h

 

/* Defines for different options for C_PHY_TYPE parameter in Axi Ethernet IP */
  #define XAE_PHY_TYPE_MII 0
  #define XAE_PHY_TYPE_GMII 1
  #define XAE_PHY_TYPE_RGMII_1_3 2
  #define XAE_PHY_TYPE_RGMII_2_0 3
  #define XAE_PHY_TYPE_SGMII 4
  #define XAE_PHY_TYPE_1000BASE_X 5

 

Thanks

John

0 Kudos
Participant jonbacon
Participant
11,560 Views
Registered: ‎08-06-2015

Re: Ethernet not working when using AXI Ethernet Subsystem IP block

Hi,

 

Thanks for the response. Here's the relevant section of the pl.dtsi:

 

amba_pl: amba_pl {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "simple-bus";
		ranges ;
		axi_ethernet_0_dma: dma@40400000 {
			axistream-connected = <&axi_ethernet_0_eth_buf>;
			axistream-control-connected = <&axi_ethernet_0_eth_buf>;
			compatible = "xlnx,axi-dma";
			interrupt-parent = <&intc>;
			interrupts = <0 29 4 0 30 4>;
			reg = <0x40400000 0x10000>;
		};
		axi_ethernet_0_eth_buf: ethernet@41000000 {
			axistream-connected = <&axi_ethernet_0_dma>;
			axistream-control-connected = <&axi_ethernet_0_dma>;
			clock-frequency = <50000000>;
			clock-names = "ref_clk";
			clocks = <&clkc 0>;
			compatible = "xlnx,axi-ethernet-1.00.a";
			device_type = "network";
			interrupt-parent = <&intc>;
			interrupts = <0 53 4>;
			reg = <0x41000000 0x40000>;
			xlnx,avb = <0x0>;
			xlnx,enable-lvds = <0x0>;
			xlnx,mcast-extend = <0x0>;
			xlnx,phy-type = <0x3>;
			xlnx,phyaddr = <0x1>;
			xlnx,rxcsum = <0x0>;
			xlnx,rxmem = <0x1000>;
			xlnx,rxvlan-strp = <0x0>;
			xlnx,rxvlan-tag = <0x0>;
			xlnx,rxvlan-tran = <0x0>;
			xlnx,simulation = <0x0>;
			xlnx,stats = <0x1>;
			xlnx,temac-addr-width = <0xc>;
			xlnx,txcsum = <0x0>;
			xlnx,txmem = <0x1000>;
			xlnx,txvlan-strp = <0x0>;
			xlnx,txvlan-tag = <0x0>;
			xlnx,txvlan-tran = <0x0>;
			xlnx,type = <0x1>;
			axi_ethernet_0_eth_buf_mdio: mdio {
				#address-cells = <1>;
				#size-cells = <0>;
			};
		};

I think xlnx,phy-type = <0x3>; means that it's set to XAE_PHY_TYPE_RGMII_2_0, so unfortunately that's not the issue.

 

 

Thanks though

0 Kudos
Participant jonbacon
Participant
11,552 Views
Registered: ‎08-06-2015

Re: Ethernet not working when using AXI Ethernet Subsystem IP block

If it helps any, i've tried a bare metal app (using the SDK standalone OS) and it seems to work. So I think it's a software config issue, I'm just no closer to understnading what that might be.

0 Kudos
Participant jonbacon
Participant
11,529 Views
Registered: ‎08-06-2015

Re: Ethernet not working when using AXI Ethernet Subsystem IP block

I finally figured this out, I needed to turn off a delay in the PHY and then issue a software reset, I was able to do thuis by setting the reg-init value in the dts to:

 

marvell,reg-init = <2 21 0xffef 0x00 0 0 0x7fff 0x8000>;

 

0 Kudos
Xilinx Employee
Xilinx Employee
11,523 Views
Registered: ‎09-10-2008

Re: Ethernet not working when using AXI Ethernet Subsystem IP block

Thanks for saying what fixed it. I forgot about the delay with RGMII and should have mentioned it, my apologies as I'm sure it consumed some time to figure this out.  There can be timing issues with the clock to data and the PHY allows you to add delay to help compensate for that. 

 

You can also do this with the phy-mode in the device tree.  The value rgmii-id causes both transmit and receive delays while other values can cause the delays for transmit only or receive only.  You can see those values in the following header file.

http://lxr.free-electrons.com/source/include/linux/phy.h

 

I forgot about this ethernet training that we did that does have details like this.

 

http://www.xilinx.com/member/zynq_videos/pdf/Linux-Networking-Focused-on-Ethernet.pdf

 

Thanks

John

0 Kudos
Explorer
Explorer
9,154 Views
Registered: ‎10-14-2015

Re: Ethernet not working when using AXI Ethernet Subsystem IP block

Hello,

I'm having the same problem (of_phy_connect() failed) but with vivado 2016.2/petalinux2016.1

 

More precisely, I have the error every time I power up my custom board, but if I then issue a software reboot, everything works fine!

 

I can't apply the solution you have suggested as the phy is different (see device tree below).

 

I have copied the device tree settings from xapp1082 version 4 (2015.4 tools) but neither this solution worked.

 

Any idea why it works with a software reset and how can I modified the soltuion you have found for the marvell device for the Xilinx PCS/PMA PHY.

 

following the relative node in the device tree:

 

in pl.dtsi:

 AXI_Ethernet: ethernet@43c00000 {
axistream-connected = <&AXI_DMA>;
axistream-control-connected = <&AXI_DMA>;
clock-frequency = <100000000>;
clock-names = "ref_clk";
clocks = <&clkc 0>;
compatible = "xlnx,axi-ethernet-1.00.a";
device_type = "network";
interrupt-parent = <&intc>;
interrupts = <0 31 4>;
phy-handle = <&phy3>;
phy-mode = "sgmii";
reg = <0x43c00000 0x40000>;
xlnx = <0x0>;
xlnx,axiliteclkrate = <0x0>;
xlnx,axisclkrate = <0x0>;
xlnx,gt-type = <0x0>;
xlnx,gtinex = <0x0>;
xlnx,phy-type = <0x5>;
xlnx,phyaddr = <0x3>;
xlnx,rable = <0x0>;
xlnx,rxcsum = <0x1>;
xlnx,rxlane0-placement = <0x0>;
xlnx,rxlane1-placement = <0x0>;
xlnx,rxmem = <0x4000>;
xlnx,rxnibblebitslice0used = <0x1>;
xlnx,tx-in-upper-nibble = <0x1>;
xlnx,txcsum = <0x1>;
xlnx,txlane0-placement = <0x0>;
xlnx,txlane1-placement = <0x0>;
AXI_Ethernet_mdio: mdio {
#address-cells = <1>;
#size-cells = <0>;
phy3: phy@3 {
compatible = "Xilinx PCS/PMA PHY";
device_type = "ethernet-phy";
reg = <3>;
};
};
};

 

 

in system-top.dts as copied from xapp1082:

&AXI_Ethernet{

axistream-connected = <&AXI_DMA>;
axistream-control-connected = <&AXI_DMA>;
clock-frequency = <76923080>;
compatible = "xlnx,axi-ethernet-3.01.a", "xlnx,axi-ethernet-1.00.a";
device_type = "network";
interrupt-parent = <&intc>;
interrupts = < 0 31 4 >;
local-mac-address = [ 00 0a 35 04 05 06 ];
reg = < 0x43C00000 0x40000 >;
xlnx,avb = <0x0>;
xlnx,halfdup = <0x0>;
xlnx,include-io = <0x0>;
xlnx,mcast-extend = <0x0>;
xlnx,phy-type = <0x5>;
xlnx,phyaddr = <0x3>;
xlnx,rxcsum = <0x2>;
xlnx,rxmem = <0x8000>;
xlnx,temac-type = <5>;
xlnx,rxvlan-strp = <0x0>;
xlnx,rxvlan-tag = <0x0>;
xlnx,rxvlan-tran = <0x0>;
xlnx,stats = <0x1>;
xlnx,txcsum = <0x2>;
xlnx,txmem = <0x8000>;
xlnx,txvlan-strp = <0x0>;
xlnx,txvlan-tag = <0x0>;
xlnx,txvlan-tran = <0x0>;
xlnx,type = <0x1>;
phy-mode = "sgmii";
phy-handle = <&phy1>;
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy1: phy@3 {
compatible = "Xilinx PCS/PMA PHY";
device_type = "ethernet-phy";
reg = <3>;
} ;
} ;
} ;

 

thank you very much

0 Kudos
Participant jonbacon
Participant
9,138 Views
Registered: ‎08-06-2015

Re: Ethernet not working when using AXI Ethernet Subsystem IP block

Sorry I'm not familiar with Xilinx PHYs, but the delay I needed to turn off is called "RGMII Transmit Timing Control" and I set it to "Transmit clock not internally delayed", presumably the Xilinx PHYs will have a similar register.

0 Kudos
Explorer
Explorer
9,120 Views
Registered: ‎10-14-2015

Re: Ethernet not working when using AXI Ethernet Subsystem IP block

I'm doing some debug of the driver and it seems that at power up the structure mdio_bus_type has just one phy node that doesn't match with the phy of PL_Ethernet port, probably is the phy of PS_Ethernet_0, while after a software reboot there are two nodes in the structure.
Precisely, the function that fails is bus_find_device(&mdio_bus_type, NULL, phy_np, of_phy_match) called in drivers/of/of_mdio.c module and defined in drivers/base/bus.c
this function iterates on mdio_bus_type->p->klist_devices and compare each devices with phy_np argument through the function of_phy_match reported below:
static int of_phy_match(struct device *dev, void *phy_np)
{
return dev->of_node == phy_np;
}
at power up this function is called just one with the following values:
dev_node=ef7f04d0 py_np= ef7f3980 (and returns 0 causing the "of_phy_connect() failed" error)

when I issue a software reset this function is called twice with the following values:
dev_node=ef7f04d0 py_np= ef7f3980
dev_node=ef7f3980 phy_np= ef7f3980

any idea what can casue the problem? how can I investigate more the problem?

Regards,
Rocco

0 Kudos
5,442 Views
Registered: ‎03-10-2017

Re: Ethernet not working when using AXI Ethernet Subsystem IP block

Hi Rocco,

 

I'm wondering you find a solution for this problem.

It seems I may have a similar problem. 

When a bit file (FPGA+echo_server elf) is downloaded and processor is reset, everything works fine.

However, the same bit file is stored in the flash and FPGA is powered up, it got stuck in the initialization.

 

It would be much appreciated, if you could share the solution.

 

Thanks,

0 Kudos
Explorer
Explorer
3,440 Views
Registered: ‎10-14-2015

Re: Ethernet not working when using AXI Ethernet Subsystem IP block

I haven't found any solution.

As workaround I am not using macb drivers and I keep using XAPP1082 patch

0 Kudos
3,052 Views
Registered: ‎02-07-2008

Re: Ethernet not working when using AXI Ethernet Subsystem IP block

Just a "heads up" for users of PetaLinux 2017.1 and newer - this issue will pop up again even if you use the marvell,reg-init register writes to correctly configure the PHY.

 

The only way that I have found to get around this is to modify the AXI Ethernet driver:

 

https://github.com/Xilinx/linux-xlnx/blob/master/drivers/net/ethernet/xilinx/xilinx_axienet_main.c

 

On line 2199, change PHY_INTERFACE_MODE_RGMII_ID to lp->phy_interface. This will configure the PHY with the PHY interface that you have chosen in the device tree using phy-mode, either "rgmii-id", "rgmii-rxid", "rgmii-txid" or "rgmii". If you are using the Ethernet FMC with AXI Ethernet Subsystem, then you need to be using "rgmii-rxid" in your device tree.

 

This issue with the AXI Ethernet driver has been raised before by John Linn (@linnj) but it hasn't been fixed yet:

 

https://patchwork.ozlabs.org/patch/468121/

 

By the way, if you're not sure whether you have this problem or not, one test is to try the Ethernet link at 10Mbps or 100Mbps. If it works at those speeds but not at 1Gbps, then you're most likely not using the right configuration of the RGMII RX and TX clock skews. If you are also using AXI Ethernet and Linux, then this issue is likely to be the cause of your problem.

 

Jeff