cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
9,684 Views
Registered: ‎12-17-2012

Zynq 702 xilinx_emacps TB-FMCL-GLAN-B PHY

Hello,

 

I'm trying to get the Zynq linux release 14.2 working with the Intrevium TB-FMCL-GLAN-B phy.  Has anyone attempted this with success?  

 

I've verified the hardware and FMC phy connections are working by testing with the SDK generated baremetal TCP lwIP Echo server.  With baremetal I'm able to transmit and receive with no issues.  

 

The problem with Zynq linux release 14.2 is the phy is recognized at boot but does not transmit or receive after bring the interface up. Below is the kernel init prints:

 

GEM: lp->tx_bd ffdfb000 lp->tx_bd_dma 2e9c4000 lp->tx_skb ef0fe400
GEM: lp->rx_bd ffdfc000 lp->rx_bd_dma 2f27b000 lp->rx_skb ef0fe000
GEM: MAC 0x00350a00, 0x00002201, 00:0a:35:00:01:22
GEM: phydev ef2c4c00, phydev->phy_id 0x1410cc2, phydev->addr 0x0
eth0, phy_addr 0x0, phy_id 0x01410cc2
eth0, attach [Marvell 88E1111] phy driver

 

Issueing ifconfig eth0 shows the RX and TX packet counts stuck at zero. Doing cat /proc/interrupts shows I'm getting eth0 interrupts. The 88E1111 phy shows RX activity through the RX LED.  I looked into the xilinx_emacps.c driver and debugged to confirm the xemacps_interrupt() service routine is getting hit and it is.  The  read of the Interrupt Status reg is always 1 so no "schedule RX softirq" is never scheduled and xemacps_tx_poll() is never called.

 

I did need to update the zynq-zc702.dts to use the correct phy address.  My dts is attached.  Perhaps I am missing another step.  Thanks in advance for any assistance.

 

0 Kudos
10 Replies
Highlighted
Xilinx Employee
Xilinx Employee
9,674 Views
Registered: ‎09-04-2012

Is your PHY interface to the FMC GMII or RGMII?

 

I have the same configuration working in GMII mode. For GMII you would need a Linux patch to set the PHY to GMII mode since the default mode is RGMII. Open a case to get the patch. I don't think it has made it to the tree. 

 

If you are using RGMII, make sure that your FPGA constraints are correct since it is a DDR interface. In this case you would not need a patch.

 

0 Kudos
Highlighted
Visitor
Visitor
9,666 Views
Registered: ‎12-17-2012

I'm using GMII.  Is this a patch to the xilinx_emacps.c driver?   I will try to open a case.  Thanks for the tip!

0 Kudos
Highlighted
Adventurer
Adventurer
9,662 Views
Registered: ‎05-16-2012

I am having the same issue and also opened a case, weeks ago. Let me know if you get any helpful response!

0 Kudos
Highlighted
Observer
Observer
9,625 Views
Registered: ‎08-16-2007

Hello cch,

 

Where/who did you get this patch from?

 

Thanks,

--cjn

0 Kudos
Highlighted
Adventurer
Adventurer
9,616 Views
Registered: ‎05-16-2012

Hello cjn,

 

I got the patch as well.

The patch midifies the kernel, so that it uses the phy-interface identifier from the Devicetree instead of the interface mode being hard-coded into the kernel.

I received the patch from Colin Kinnear and I guess it was written by John Linn.

The thing is that I could not apply the patch so easily, as it was for a specific GIT-revision. So it was necessary to apply it by hand (not that hard).

 

But unfortunately this didn't make any changes for me, but this could be a problem for our project only.

Good Luck!

 

Regards

0 Kudos
Highlighted
Visitor
Visitor
9,608 Views
Registered: ‎12-17-2012

I haven't received any patch yet but I did have luck with another work around.  The linux Generic PHY driver initializes the TB-FMCL-GLAN-B phy correctly.  To get linux to use the Generic PHY I removed the Marvell PHY driver from the kernel (Device Drivers->Network Device support ->Drivers for Marvell PHYS)

0 Kudos
Highlighted
Observer
Observer
9,579 Views
Registered: ‎08-16-2007

Are you ok to move forward?

 

0 Kudos
Highlighted
Visitor
Visitor
9,568 Views
Registered: ‎12-17-2012

Yes I can work with this but it would be nice to know what this other patch is doing.

0 Kudos
Highlighted
Adventurer
Adventurer
9,553 Views
Registered: ‎05-16-2012

As I said,

The patch makes the Kernel use the PHY-Interface Mode from the devicetree instead of the hard-coded RGMII.

 

This is what I got:

1. If you save the attached patch in the root of the kernel, then run dos2unix <patch name> on it, then you can apply it with git (git am <patch name>).

2. Add phy-mode="gmii" to the Ethernet node to use it.

(You need to add phy-mode="gmii" or "rgmii" to the device tree for ethernet.)

 

The Patch looks like the following but has to be applied by hand, as it does not work with the Kernel from end of December!

From 8dbc43c8ac3bd3751e3370b49b4282ea589525f8 Mon Sep 17 00:00:00 2001
From: John Linn <john.linn@xilinx.com>
Date: Tue, 21 Aug 2012 18:25:08 -0700
Subject: [PATCH] Xilinx: ARM: EMAC: get phy mode from dt (prototype only)

This is a temporary released patch for testing
the ability to get the "phy-mode" property from
the device tree such that multiple phys which are
different modes can be supported.

Signed-off-by: John Linn <john.linn@xilinx.com>
---
 drivers/net/ethernet/xilinx/xilinx_emacps.c |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/xilinx/xilinx_emacps.c b/drivers/net/ethernet/xilinx/xilinx_emacps.c
index 27db6f9..92fa950 100755
--- a/drivers/net/ethernet/xilinx/xilinx_emacps.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emacps.c
@@ -48,6 +48,7 @@
 #ifdef CONFIG_OF
 #include <linux/of_address.h>
 #include <linux/of_mdio.h>
+#include <linux/of_net.h>
 #endif
 
 /************************** Constant Definitions *****************************/
@@ -584,6 +585,7 @@ struct net_local {
 	struct mii_bus         *mii_bus;
 	struct phy_device      *phy_dev;
 	unsigned int           link;
+	phy_interface_t	       phy_interface;
 	unsigned int           speed;
 	unsigned int           duplex;
 	/* RX ip/tcp/udp checksum */
@@ -812,6 +814,16 @@ static void xemacps_adjust_link(struct net_device *ndev)
 	}
 }
 
+static int __devinit get_phy_mode_dt(struct platform_device *pdev)
+{
+	struct device_node *np = pdev->dev.of_node;
+
+	if (np)
+		return of_get_phy_mode(np);
+
+	return -ENODEV;
+}
+
 /**
  * xemacps_mii_probe - probe mii bus, find the right bus_id to register
  * phy callback function.
@@ -832,7 +844,7 @@ static int xemacps_mii_probe(struct net_device *ndev)
 					lp->phy_node,
 					xemacps_adjust_link,
 					0,
-					PHY_INTERFACE_MODE_RGMII_ID);
+					lp->phy_interface);
 	}
 	if (!phydev) {
 		printk(KERN_ERR "%s: no PHY found\n", ndev->name);
@@ -852,7 +864,7 @@ static int xemacps_mii_probe(struct net_device *ndev)
 	}
 
 	phydev = phy_connect(ndev, dev_name(&phydev->dev),
-		&xemacps_adjust_link, 0, PHY_INTERFACE_MODE_RGMII_ID);
+		&xemacps_adjust_link, 0, lp->phy_interface);
 
 	if (IS_ERR(phydev)) {
 		printk(KERN_ERR "%s: can not connect phy\n", ndev->name);
@@ -3078,6 +3090,15 @@ static int __init xemacps_probe(struct platform_device *pdev)
 	regval = XEMACPS_NWCTRL_MDEN_MASK;
 	xemacps_write(lp->baseaddr, XEMACPS_NWCTRL_OFFSET, regval);
 
+	/* get the phy mode and if the mode was not found then default to 
+	 * RGMII_ID for backward compatibility.
+	 */
+	rc = get_phy_mode_dt(lp->pdev);
+	if (rc < 0) 
+		lp->phy_interface = PHY_INTERFACE_MODE_RGMII_ID;
+	else 
+		lp->phy_interface = rc;
+	
 	if (xemacps_mii_init(lp) != 0) {
 		printk(KERN_ERR "%s: error in xemacps_mii_init\n", ndev->name);
 		goto err_out_unregister_netdev;
-- 
1.5.4.7

 I hope this helps.

 

@Xilinx

Is this patch going to be added to the Standard-Kernel?

0 Kudos
Highlighted
Explorer
Explorer
2,524 Views
Registered: ‎03-26-2010

I am having some trouble getting a GMII Micrel KSZ9021GN PHY to work as well, except the issues I'm having begin earlier - in u-boot. I can read MDIO registers of the PHY just fine in u-boot, but when I ping the host the ping fails. The code runs on ZED board fine, and LwIP works on my custom board fine.

 

does anyone have an XPS project with the GMII interface built that I could take a look at? Not sure where the problem lies as the hardware pings great in LwIP, and the right #defines to include the Micrel driver in u-boot are set.

0 Kudos