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: 
Scholar wzab
Scholar
5,324 Views
Registered: ‎08-24-2011

Petalinux - U-Boot does not support XILINX_PHY (PCS/PMA) - no network booting possible when only PCS/PMA connected Ethernet is available

I'm developing firmware for the board, where Ethernet is connected only via Xilinx PCS/PMA IP core connected to the SFP transceiver on one side and via EMIO to the GEM MAC in the UltraScale+ PS.

As a prototype I use the ZCU102 board (ignoring its external PHY).

After a few attempts I have got Ethernets working, hower still without support for autonegotiations and 10 or 100 Mb/s rates.

Now  would like to allow my board to boot via U-Boot, using one of SFP-connected Ethernets.

Unfortunately it appeared, that U-Boot does not support Xilinx PCS/PMA PHY (no XILINX_PHY in cofiguration after "petalinux-config -c u-boot").

 

How difficult it would be to add the PCS/PMA support to the Petalinux U-Boot?

 

TIA & Regards,

Wojtek

0 Kudos
11 Replies
Scholar wzab
Scholar
5,317 Views
Registered: ‎08-24-2011

Re: Petalinux - U-Boot does not support XILINX_PHY (PCS/PMA) - no network booting possible when only PCS/PMA connected Ethernet is available

I have found a relatively old patch that I expexted to solve my problem:

https://lists.denx.de/pipermail/u-boot/2016-February/245574.html

 

I have followed the procedure described on page 80 of the Petalinux Reference:

  • I have extracted the patch to the pcs_pma.patch file in the <plnx-proj-root>/project-spec/meta-user/recipes-bsp/u-boot/files/ directory
  • I have modified the <plnx-proj-root>/project-spec/meta-user/recipes-bsp/u-boot/u-boo
    t-xlnx_%.bbappend file:
SRC_URI_append = " file://platform-top.h"
SRC_URI_append = " file://pcs_pma.patch"

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

However, after i ran the "petalinux-config -c u-boot", I get the following error:

 

ERROR: u-boot-xlnx-v2016.07-xilinx+gitAUTOINC+0b94ce5ed4-r0 do_patch: Command Error: 'quilt --quiltrc /tmp/yyyy4321/sysroots/x86_64-linux/etc/quiltrc push' exited with 1  Output:
Applying patch pcs_pma.patch
patching file drivers/net/phy/Makefile
Hunk #1 FAILED at 25.
1 out of 1 hunk FAILED -- rejects in file drivers/net/phy/Makefile
patching file drivers/net/phy/phy.c
Hunk #1 succeeded at 512 with fuzz 2 (offset 9 lines).
The next patch would create the file drivers/net/phy/xilinx_phy.c,
which already exists!  Applying it anyway.
patching file drivers/net/phy/xilinx_phy.c
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- rejects in file drivers/net/phy/xilinx_phy.c
patching file include/phy.h
Hunk #1 FAILED at 264.
1 out of 1 hunk FAILED -- rejects in file include/phy.h
Patch pcs_pma.patch can be reverse-applied
ERROR: u-boot-xlnx-v2016.07-xilinx+gitAUTOINC+0b94ce5ed4-r0 do_patch: Function failed: patch_do_patch
ERROR: Logfile of failure stored in: /tmp/yyyy4321/work/plnx_aarch64-xilinx-linux/u-boot-xlnx/v2016.07-xilinx+gitAUTOINC+0b94ce5ed4-r0/temp/log.do_patch.25668
ERROR: Task 1 (/home/xl/petalinux-v2016.4/components/yocto/source/aarch64/layers/meta-xilinx/recipes-bsp/u-boot/u-boot-xlnx_2016.07.bb, do_patch) failed with exit code '1'

Maybe the patch is simply outdated? Looks like it is prepared for U-Boot 1.9.1, while Petalinux 2016.4 probaly uses a newer one?

 

0 Kudos
Scholar wzab
Scholar
5,315 Views
Registered: ‎08-24-2011

Re: Petalinux - U-Boot does not support XILINX_PHY (PCS/PMA) - no network booting possible when only PCS/PMA connected Ethernet is available

I have checked the sources of the Xilinx U-Boot, and I have found, that there is support for Xilinx PCS/PMA available:

https://github.com/Xilinx/u-boot-xlnx/blob/master/drivers/net/phy/xilinx_phy.c

In the https://github.com/Xilinx/u-boot-xlnx/blob/master/drivers/net/phy/Makefile file I can see:

obj-$(CONFIG_PHY_XILINX) += xilinx_phy.o

The above are even in the branch 2016.4:

https://github.com/Xilinx/u-boot-xlnx/blob/xilinx-v2016.4/drivers/net/phy/xilinx_phy.c

https://github.com/Xilinx/u-boot-xlnx/blob/xilinx-v2016.4/drivers/net/phy/Makefile

However, none of the Kconfig files contain the "CONFIG_XILINX_PHY" definition.

 

 

0 Kudos
Scholar wzab
Scholar
5,297 Views
Registered: ‎08-24-2011

Re: Petalinux - U-Boot does not support XILINX_PHY (PCS/PMA) - no network booting possible when only PCS/PMA connected Ethernet is available

Well, probably I have found the right solution. I can simply add

#define CONFIG_XILINX_PHY

in the <plnx-proj-root>/project-spec/meta-user/recipes-bsp/u-boot/files/platform-top.h file, right after

#include <configs/platform-auto.h>

 Update:

I have modifed the platforrm-top.h so that it explicitly defines th PHY and the interface:

#include <configs/platform-auto.h>

#define CONFIG_XILINX_PHY
/* #define CONFIG_PHY_TI */
#define CONFIG_ZYNQ_GEM_INTERFACE       PHY_INTERFACE_MODE_GMII

#define CONFIG_ZYNQ_I2C0
[...]

However, the U-Boot still does not recognize the PHY

U-Boot 2016.07-00070-g0b94ce5-dirty (Jun 07 2017 - 00:45:12 +0200) Xilinx ZynqMP ZCU102

I2C:   ready
DRAM:  4 GiB
EL Level:       EL2
Chip ID:        xczu9eg
MMC:   sdhci@ff170000: 0
SF: Detected N25Q512A with page size 512 Bytes, erase size 128 KiB, total 128 MiB
In:    serial
Out:   serial
Err:   serial
Net:   ZYNQ GEM: ff0b0000, phyaddr -1, interface gmii
PHY is not detected
GEM PHY init failed
No ethernet found.
Hit any key to stop autoboot:  0 
ZynqMP> 

The strangest thing is that mii commands seem to see the PHY:

ZynqMP> mii device
MII devices: 'gem' 
Current device: 'gem'
ZynqMP> mii info 6
PHY 0x06: OUI = 0x5D03, Model = 0x00, Rev = 0x00, 1000baseX, FDX
ZynqMP> mii info 0
PHY 0x00: OUI = 0x5D03, Model = 0x00, Rev = 0x00, 1000baseX, FDX
0 Kudos
Scholar wzab
Scholar
5,268 Views
Registered: ‎08-24-2011

Re: Petalinux - U-Boot does not support XILINX_PHY (PCS/PMA) - no network booting possible when only PCS/PMA connected Ethernet is available

I have found a mistake. It should be "CONFIG_PHY_XILINX" defined in platform-top.h, not "CONFIG_XILINX_PHY".

However after correcting that I have got strictly the same results.

0 Kudos
Scholar wzab
Scholar
5,258 Views
Registered: ‎08-24-2011

Re: Petalinux - U-Boot does not support XILINX_PHY (PCS/PMA) - no network booting possible when only PCS/PMA connected Ethernet is available

I have checked the Xilinx U-Boot sources, and found that the CONFIG_ZYNQ_GEM_INTERFACE is not used at all.

The interface used to connect the PHY is taken from the Device Tree.

When i have changed it to "sgmii":

&gem0 {
        local-mac-address = [00 0a 35 00 02 90];
        phy-mode = "sgmii";
        clocks = <&clk125>, <&clk125>, <&gem0_emio_mux>;
};

the U-Boot messages have changed:

U-Boot 2016.07-00070-g0b94ce5-dirty (Jun 07 2017 - 12:24:14 +0200) Xilinx ZynqMP ZCU102

I2C:   ready
DRAM:  4 GiB
EL Level:       EL2
Chip ID:        xczu9eg
MMC:   sdhci@ff170000: 0
SF: Detected N25Q512A with page size 512 Bytes, erase size 128 KiB, total 128 MiB
In:    serial
Out:   serial
Err:   serial
Net:   ZYNQ GEM: ff0b0000, phyaddr -1, interface sgmii
Could not get PHY for gem: addr -1
No ethernet found.
Hit any key to stop autoboot:  0 
0 Kudos
Scholar wzab
Scholar
5,254 Views
Registered: ‎08-24-2011

Re: Petalinux - U-Boot does not support XILINX_PHY (PCS/PMA) - no network booting possible when only PCS/PMA connected Ethernet is available

I have finally found, why for the "phy-mode" set to "gmii", I get the following results:

Net:   ZYNQ GEM: ff0b0000, phyaddr -1, interface gmii
PHY is not detected
GEM PHY init failed
No ethernet found.

While obviously I can access the PHY via MII:

ZynqMP> mii info -1 
PHY 0x00: OUI = 0x5D03, Model = 0x00, Rev = 0x00, 1000baseX, FDX
ZynqMP> mii read 0 1
01EC

Looking into the code of the Zynq GEM driver I can see

debug("detecting phy address\n");
	if (priv->phyaddr == -1) {
		/* detect the PHY address */
		for (i = 31; i >= 0; i--) {
			phyread(priv, i, PHY_DETECT_REG, &phyreg);
			if ((phyreg != 0xFFFF) &&
			    ((phyreg & PHY_DETECT_MASK) == PHY_DETECT_MASK)) {
				/* Found a valid PHY address */
				priv->phyaddr = i;
				debug("Found valid phy address, %d\n", i);
				return 0;
			}
		}
	}
	printf("PHY is not detected\n");
	return -1;
}

The "PHY_DETECT_MASK" is set to 0x1808:

 

/* Mask used to verify certain PHY features (or register contents)
 * in the register above:
 *  0x1000: 10Mbps full duplex support
 *  0x0800: 10Mbps half duplex support
 *  0x0008: Auto-negotiation support
 */
#define PHY_DETECT_MASK 0x1808

However the PCS/PMA reports 0x01EC. Therefore, to ensure the correct detection, I must change the mask.

 

0 Kudos
Scholar wzab
Scholar
5,248 Views
Registered: ‎08-24-2011

Re: Petalinux - U-Boot does not support XILINX_PHY (PCS/PMA) - no network booting possible when only PCS/PMA connected Ethernet is available

I have set the PHY_DETECT_MASK to 0x0 and left only 1000 Mbps with full duplex mode (see attached patch).

Now the PHY gets recognized, but the old problems related to incorrect handling of multiple Ethernet MACs appeared again:

U-Boot 2016.07-00070-g0b94ce5-dirty (Jun 07 2017 - 13:38:02 +0200) Xilinx ZynqMP ZCU102

I2C:   ready
DRAM:  4 GiB
EL Level:       EL2
Chip ID:        xczu9eg
MMC:   sdhci@ff170000: 0
SF: Detected N25Q512A with page size 512 Bytes, erase size 128 KiB, total 128 MiB
In:    serial
Out:   serial
Err:   serial
Net:   ZYNQ GEM: ff0b0000, phyaddr -1, interface gmii
eth0: ethernet@ff0b0000ZYNQ GEM: ff0c0000, phyaddr -1, interface gmii
mdio_register: non unique device name 'gem'

Hit any key to stop autoboot:  0 
ZYNQ GEM: ff0c0000, phyaddr -1, interface gmii
mdio_register: non unique device name 'gem'
ZYNQ GEM: ff0d0000, phyaddr -1, interface gmii
mdio_register: non unique device name 'gem'
Device 'ethernet@ff0e0000': seq 0 is in use by 'ethernet@ff0b0000'
ZYNQ GEM: ff0e0000, phyaddr -1, interface gmii
mdio_register: non unique device name 'gem'
BOOTP broadcast 1
BOOTP broadcast 2

Retry time exceeded
*** ERROR: `ipaddr' not set
Wrong Image Format for bootm command
ERROR: can't get kernel image!
ZynqMP> 
0 Kudos
Scholar wzab
Scholar
5,244 Views
Registered: ‎08-24-2011

Re: Petalinux - U-Boot does not support XILINX_PHY (PCS/PMA) - no network booting possible when only PCS/PMA connected Ethernet is available

In the Device Tree I have disabled all Ethernets but eth0. Now there are no messages about non-unique device names, but the device still does not transmit:

 

U-Boot 2016.07-00070-g0b94ce5-dirty (Jun 07 2017 - 14:42:42 +0200) Xilinx ZynqMP ZCU102

I2C:   ready
DRAM:  4 GiB
EL Level:       EL2
Chip ID:        xczu9eg
MMC:   sdhci@ff170000: 0
SF: Detected N25Q512A with page size 512 Bytes, erase size 128 KiB, total 128 MiB
In:    serial
Out:   serial
Err:   serial
Net:   ZYNQ GEM: ff0b0000, phyaddr -1, interface gmii
eth0: ethernet@ff0b0000
Hit any key to stop autoboot:  0 
ethernet@ff0b0000 Waiting for PHY auto negotiation to complete..... done
BOOTP broadcast 1
BOOTP broadcast 2

Retry time exceeded
*** ERROR: `ipaddr' not set
Wrong Image Format for bootm command
ERROR: can't get kernel image!
ZynqMP> 
0 Kudos
Newbie mujicad93
Newbie
4,763 Views
Registered: ‎07-27-2017

Re: Petalinux - U-Boot does not support XILINX_PHY (PCS/PMA) - no network booting possible when only PCS/PMA connected Ethernet is available

Did you try setting the uboot environment variable?

setevn ipaddr <your_ip_addr>
saveenv

Or you can set it in zynq-common.h where they are preloading some environment variables too.

0 Kudos
Scholar wzab
Scholar
2,227 Views
Registered: ‎08-24-2011

Re: Petalinux - U-Boot does not support XILINX_PHY (PCS/PMA) - no network booting possible when only PCS/PMA connected Ethernet is available

0 Kudos
Visitor fircrestsk8
Visitor
1,760 Views
Registered: ‎03-14-2016

Re: Petalinux - U-Boot does not support XILINX_PHY (PCS/PMA) - no network booting possible when only PCS/PMA connected Ethernet is available

FYI for those trying to use TFTP boot (or any u-boot ethernet) while following along with XAPP1305 and using the PS GEM routed to a PCS/PMA 1G/2.5G IP block in the PL:

 

It won't work in 2017.3.

 

The issue can be tracked to a bug in the u-boot Xilinx zynq gem driver that has already been resolved in more recent versions of u-boot (not sure exactly when, probably 2018.1). Specifically this line:

 

https://github.com/Xilinx/u-boot-xlnx/blob/da811c4511ef9caeb95f9a22fe49d38bd8e56ded/drivers/net/zynq_gem.c#L331

 

It should be:

 

if ((priv->interface != PHY_INTERFACE_MODE_SGMII) &&
    (priv->interface != PHY_INTERFACE_MODE_GMII)) {

 

Just figured I'd document this for others.

 

0 Kudos