Skip to contentSkip to conversation

sunxi: Fix gmac not working reliable on the Bananapi

PATCH New Hans de Goede 3 participants 4 messages Sep 30, 2014 – Oct 10, 2014 Arm/Allwinner sunXi SoC support

lore
Share & tools
lore
#0 lore raw

cover sunxi: Fix gmac not working reliable on the Bananapi

Hi Tom,

Here is a last minute sunxi bug-fix for v2014.10, which fixes the ethernet on the bananapi being unusable.

Ian and I (the sunxi custodians) would like to see this included in v2014.10, can you please apply it to master before the release ?

Thanks & Regards,

Hans

#1 lore raw

PATCH 1/1 sunxi: Fix gmac not working reliable on the Bananapi

In order for the gmac nic to work reliable on the Bananapi, we need to set bits 10-12 GTXDC "GMAC Transmit Clock Delay Chain" of the GMAC clk register (0x01c20164) to 3.

Without this about 9 out of 10 ethernet packets get lost, with this setting there is no packet loss.

So far setting these bits is only necessary on the Bananapi, so this commit solves this with a bit of #ifdef CONFIG_BANANAPI code. If in the future we need to do something similar for other boards, we can create a specific CONFIG_FOO option for this then.

---
 board/sunxi/gmac.c | 9 +++++++++
 1 file changed, 9 insertions(+)
board/sunxi/gmac.c +9 -0
index e7ff952..6348d27 100644
@@ -24,6 +24,15 @@ int sunxi_gmac_initialize(bd_t *bis)
 		CCM_GMAC_CTRL_GPIT_MII);
 #endif
 
+	/*
+	 * In order for the gmac nic to work reliable on the Bananapi, we
+	 * need to set bits 10-12 GTXDC "GMAC Transmit Clock Delay Chain"
+	 * of the GMAC clk register to 3.
+	 */
+#ifdef CONFIG_BANANAPI
+	setbits_le32(&ccm->gmac_clk_cfg, 0x3 << 10);
+#endif
+
 	/* Configure pin mux settings for GMAC */
 	for (pin = SUNXI_GPA(0); pin <= SUNXI_GPA(16); pin++) {
 #ifdef CONFIG_RGMII
Signature · 1 line
2.1.0
#2 lore raw
Quoted 12 lines · Hans de Goede

In order for the gmac nic to work reliable on the Bananapi, we need to set bits 10-12 GTXDC "GMAC Transmit Clock Delay Chain" of the GMAC clk register (0x01c20164) to 3.

Without this about 9 out of 10 ethernet packets get lost, with this setting there is no packet loss.

So far setting these bits is only necessary on the Bananapi, so this commit solves this with a bit of #ifdef CONFIG_BANANAPI code. If in the future we need to do something similar for other boards, we can create a specific CONFIG_FOO option for this then.

Quoted 6 lines

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141010/06416b64/attachment.pgp>
#3 lore raw

cover sunxi: Fix gmac not working reliable on the Bananapi

In reply to Hans de Goede
Quoted 7 lines · Hans de Goede

Hi Tom,

Here is a last minute sunxi bug-fix for v2014.10, which fixes the ethernet on the bananapi being unusable.

Ian and I (the sunxi custodians) would like to see this included in v2014.10, can you please apply it to master before the release ?

Hello,

as the planned release date of u-boot v2014.10 is just one week away, may I ping you on this issue?

Kind regards,
Karsten

Signature · 3 lines
Gem. Par. 28 Abs. 4 Bundesdatenschutzgesetz widerspreche ich der Nutzung
sowie der Weitergabe meiner personenbezogenen Daten f?r Zwecke der
Werbung sowie der Markt- oder Meinungsforschung.