cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
MKa
Visitor
Visitor
414 Views
Registered: ‎03-30-2021

Micrel KSZ9131RNX on zynq-7000 custom board not working properly

Jump to solution

We have not managed to get Micrel KSZ9131RNX phy working properly with our custom board based on zynq-7000 device. It is not possible to open ssh session on this board. It turned out that session stops always at the same point by observing communication with tcpdump on the board end and wireshark on the PC end. This happens when both ends starts sharing keys. PC sends first a packet with 1200 bytes then card sends a packet with 664 bytes. This byte never arrives to PC. Card carries on re-sending this packet and they too do not pass to PC. I have studied communication also with telnet by echoing text of various lengths. It seems that breakpoint is around 500 bytes. Strings below 500 bytes pass fine. Little more than 500 bytes trigger repeated messages, but usually they pass. Strings clearly longer than 500 bytes never pass and nothing else after that. However, other direction keeps working. Keys pressed are seen on tcpdump. Also, I can open a new telnet session without problems and that works fine with above limits.

I have also tested connection with tftp transfers. I can "get" Image.ub (4.2MB) from tftp server without problems. Tftp server seems sending the file in 544 byte blocks.

Ifconfig command on the card reports considerable amount of dropped Rx packets. This count seems pretty stable during session, but there can be pretty different between sessions.Count of dropped Rx packets can be like 1/4... more thant 1/2 of Rx bytes.

We have used following device tree set-up for ethernet:

&gem0 {
status = "okay";
phy-mode = "rgmii-id";
phy-handle = <&phy>;
phy: phy@0 {
reg = <0x0>;
};
};

It turned out that driver for this device (https://github.com/Xilinx/linux-xlnx/blob/master/drivers/net/phy/micrel.c) on Petalinux 2020.2 does not have hooks for "rgmii-id" mode. I inserted it from newer version of this driver and also removed ".read_status = ksz9031_read_status" statement from "ksphy_driver" struct regarding PHY_ID_KSZ9131. That statement prevented from starting this driver. Please find the patch file below making these changes and also some debug printing. Unfortunately this was kind of waste of time as it turned out that default mode of this phy really was this "rgmii-id" that was proven by debug printouts so that also generic driver would have worked in the same way.

I get following dmesg messages from the debug prints and other messages related to eth0:
libphy: MACB_mii_bus: probed
#### PHY_INTERFACE_MODE_RGMII_ID
#### KSZ9131RN_RXC_DLL_CTRL: 6d1
#### KSZ9131RN_RXC_DLL_CTRL: 6d1
#### KSZ9131RN_TXC_DLL_CTRL: 6d1
#### KSZ9131RN_TXC_DLL_CTRL: 6d1
#### PHY_INTERFACE_MODE SET
Microchip KSZ9131 Gigabit PHY e000b000.ethernet-ffffffff:00: attached PHY driver [Microchip KSZ9131 Gigabit PHY] (mii_bus:phy_addr=e000b000.ethernet-ffffffff:00, irq=POLL)
macb e000b000.ethernet eth0: Cadence GEM rev 0x00020118 at 0xe000b000 irq 27 (04:a3:0b:00:ea:4e)
macb e000b000.ethernet eth0: link up (1000/Full)

I would rellay appreciate any help on this issue.

Thanks,

Matti

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
nanz
Moderator
Moderator
190 Views
Registered: ‎08-25-2009

Hi @MKa ,

I am not sure I understand the MII register dump info. As far as I can see, there are idle count errors, and "automatic TDR on link down". What do these exactly mean? Have you compared to PHY datasheet to understand better?

It looks like DHCP is not able to assign a valid IP address. Is this for only 100/10Mbps speed? How about 1G as you mentioned that was working?

Have you tried a different version of Petalinux which supports KSZ9131rnx device? Does that work?  That might help narrow down the issue.


-------------------------------------------------------------------------------------------

Don’t forget to reply, kudo, and accept as solution.

If starting with Versal take a look at our Versal Design Process Hub and our Versal Blogs and our Versal Ethernet Sticky Note.

-------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
5 Replies
MKa
Visitor
Visitor
315 Views
Registered: ‎03-30-2021

Some additional information:

1)"0x6b1" is not default value for TXC_DLL_CTRL register. Instead, it is "0x16b1". U-boot clears the "bypass txdll" bit (12).

2) In addition to above described problem that tx direction stalls after trying to send a packet with more than 500 bytes and that only Rx direction reports considerable amount of dropped bytes I also have noticed that card can never get dhcp address in 100Mbits/s and 10Mbits/s modes. In 1000Mbit/s mode it gets it without problem.

Can anyone figure out what could be reason for this kind of behaviour?

Cheers,

Matti

0 Kudos
nanz
Moderator
Moderator
274 Views
Registered: ‎08-25-2009

Hi @MKa ,

Are you not using MDIO? If in uboot doing a mii info, can you grab all PHY register values? When do you dhcp in uboot at 1G speed, what does it show? How did you force the speed to 10Mbps and 100Mbps?

So basically, if we could get the PHY register dump and check if they are as expected, that will be very helpful. 


-------------------------------------------------------------------------------------------

Don’t forget to reply, kudo, and accept as solution.

If starting with Versal take a look at our Versal Design Process Hub and our Versal Blogs and our Versal Ethernet Sticky Note.

-------------------------------------------------------------------------------------------
0 Kudos
MKa
Visitor
Visitor
247 Views
Registered: ‎03-30-2021

Hi @nanz 

Yes, I am using MDIO. Please find mii dump attached. Please find also dhcp and tftp boot sessions attached. Note that I do not have all the necessary files loaded to tftp server for booting. However, tftp boot log shows that file is read correctly. I'm not sure if 10Mbit really was tested. Person measuring waveforms just told that. However, card was connected to a switch not capable of 1000Base. Waveforms I have seen show that clock frequencies are 100MHz. I have limited speed by using "max-speed" parameter in device tree phy setup. Card reported: "Configuring network interfaces... macb e000b000.ethernet eth0: link up (100/Full)" and no IP address was received from server.

It noticed that I did not mention Petalinux 2020.2 not having any support for this ksz9131rnx device. I copied it (micrel_ksz90x1.c) from the latest u-boot version.

I hope this helps you pinpointing the problem.

0 Kudos
nanz
Moderator
Moderator
191 Views
Registered: ‎08-25-2009

Hi @MKa ,

I am not sure I understand the MII register dump info. As far as I can see, there are idle count errors, and "automatic TDR on link down". What do these exactly mean? Have you compared to PHY datasheet to understand better?

It looks like DHCP is not able to assign a valid IP address. Is this for only 100/10Mbps speed? How about 1G as you mentioned that was working?

Have you tried a different version of Petalinux which supports KSZ9131rnx device? Does that work?  That might help narrow down the issue.


-------------------------------------------------------------------------------------------

Don’t forget to reply, kudo, and accept as solution.

If starting with Versal take a look at our Versal Design Process Hub and our Versal Blogs and our Versal Ethernet Sticky Note.

-------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
MKa
Visitor
Visitor
175 Views
Registered: ‎03-30-2021

Hi @nanz 

It turned out that wrong oscillator was assembled on the card (33.0 MHz instead of 33.333 MHz), which made 1% frequency difference between rgmii and tx transmission. That broke packets over 500 bytes. We just got the correct oscillator assembled and now ssh seems working. Thank you for your assistance.

-Matti