uboot-tools/0010-sunxi-Fix-gmac-not-working-reliable-on-the-Bananapi.patch

51 lines
1.7 KiB
Diff
Raw Normal View History

2014-10-14 05:46:23 +00:00
From 11c5ff65fbdbea4d4839b9bc34467ebcb2bbf72c Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 30 Sep 2014 18:45:32 +0200
Subject: [PATCH 10/13] 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.
Reported-by: Karsten Merker <merker@debian.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Karsten Merker <merker@debian.org>
Tested-by: Zoltan HERPAI <wigyori@openwrt.org>
Tested-by: Tony Zhang <tony.zhang@lemaker.org>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
---
board/sunxi/gmac.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/board/sunxi/gmac.c b/board/sunxi/gmac.c
index e7ff952..6348d27 100644
--- a/board/sunxi/gmac.c
+++ b/board/sunxi/gmac.c
@@ -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
--
2.1.0