Page 1 of 1

Slow gigabit network Ronetix SAMA5D3x-CM

Posted: Fri Apr 15, 2016 2:23 pm
by timos
Hello all,

I would like to post a message describing my 2 week journey (and the solution!) of getting reasonable upload performance on my gigabit network. We are using a SAMA5D3-EK main board and an in-house designed main board together with an Atmel SAMA5D35 using a compute module from Ronetix. We use the officially supported Buildroot environment to build our system.

We noticed that the loading performance of the website was terribly slow. Trying to measure delays, find contention locks and looking at Wireshark traces it became clear the board was not transmitting all packets it thought it did (packet loss, especially when the board needed to transmit many small files). Internet searches on 'slow network atmel' gave no clues. But, on the Ronetics website one tiny little patch was posted that fixes the Industrial version of KSZ9021RNI. We are are using the non-industrial version but I tried the patch anyway.

Lo and behold: we now have MB/s when downloading files served by the SAMA5, not KB/s!

Shame on Ronetix for putting this patch in an almost hidden spot and for not pushing it into the AT91.com master. The patch is only to be found as a text file in a plain directory index under http://download.ronetix.info/boards/doc ... U-Bo.patch without a single piece of documentation (no errata, application note or footnote mentions it!).

I created my own patch so it integrates easily into the Buildroot system, see the attachment.
Can some maintainer help me get this patch into the repository?

I hope I can save someone a lot of development time by posting this patch here :)

Code: Select all

diff -Naur linux-master.org/drivers/net/phy/micrel.c linux-master/drivers/net/phy/micrel.c
--- linux-master.org/drivers/net/phy/micrel.c	2016-03-25 16:29:24.000000000 +0100
+++ linux-master/drivers/net/phy/micrel.c	2016-04-15 11:13:22.461745684 +0200
@@ -336,6 +336,14 @@
 
 static int ksz9021_config_init(struct phy_device *phydev)
 {
+#if 1
+	/* make KSZ9021RN(I) work on Ronetix SAMA5D3x-CM */
+	phy_write(phydev, 11, 260 | 0x8000);
+	phy_write(phydev, 12, 0xF0F0);
+	phy_write(phydev, 11, 261 | 0x8000);
+	phy_write(phydev, 12, 0x2222);
+	return 0;
+#else
 	struct device *dev = &phydev->dev;
 	struct device_node *of_node = dev->of_node;
 
@@ -357,6 +365,7 @@
 				    "txd2-skew-ps", "txd3-skew-ps");
 	}
 	return 0;
+#endif
 }
 
 #define MII_KSZ9031RN_MMD_CTRL_REG	0x0d