From patchwork Sun Sep 28 18:13:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 394208 X-Patchwork-Delegate: ijc@hellion.org.uk Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 820BD14009C for ; Mon, 29 Sep 2014 04:13:46 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 68685A7438; Sun, 28 Sep 2014 20:13:44 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zi+Y+93NNhKp; Sun, 28 Sep 2014 20:13:43 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5CB68A7427; Sun, 28 Sep 2014 20:13:43 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C73DAA7427 for ; Sun, 28 Sep 2014 20:13:40 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1VUYv7petWSE for ; Sun, 28 Sep 2014 20:13:40 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by theia.denx.de (Postfix) with ESMTPS id 5E832A7425 for ; Sun, 28 Sep 2014 20:13:36 +0200 (CEST) Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8SIDOh2012899 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 28 Sep 2014 14:13:24 -0400 Received: from shalem.localdomain.com (vpn1-4-209.ams2.redhat.com [10.36.4.209]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s8SIDMco027021; Sun, 28 Sep 2014 14:13:23 -0400 From: Hans de Goede To: Ian Campbell Date: Sun, 28 Sep 2014 20:13:21 +0200 Message-Id: <1411928001-3455-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 Cc: Karsten Merker , u-boot@lists.denx.de, linux-sunxi@googlegroups.com Subject: [U-Boot] [PATCH] sunxi: Fix gmac not working reliable on the Bananapi X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.13 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de In order for the gmac nic to work reliable on the Bananapi, we need to poke these 2 undocumented bits in the gmac clk register. Since these are undocumented, this commit only sets these bits on the Bananapi for now. I'll contact Allwinner to try and get these bits documented, once they are documented we can hopefully replace this hack with a better patch. Reported-by: Karsten Merker Signed-off-by: Hans de Goede Tested-by: Karsten Merker Tested-by: Zoltan HERPAI Acked-by: Ian Campbell --- board/sunxi/gmac.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/board/sunxi/gmac.c b/board/sunxi/gmac.c index e7ff952..f58c963 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 + /* + * HdG: this is necessary to get GMAC to work reliable on the + * Bananapi. We don't know what these undocumented bits do, so this + * is a Bananapi specific hack for now. + */ +#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