From patchwork Wed Apr 22 06:48:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 463587 X-Patchwork-Delegate: trini@ti.com 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 C9701140133 for ; Wed, 22 Apr 2015 16:48:44 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EF8EB620B9; Wed, 22 Apr 2015 08:48:42 +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 zBWrSMmzri6o; Wed, 22 Apr 2015 08:48:42 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 61B44620B0; Wed, 22 Apr 2015 08:48:42 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3C121620B0 for ; Wed, 22 Apr 2015 08:48: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 Wqy0kb35jCun for ; Wed, 22 Apr 2015 08:48: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 B4E07620AE for ; Wed, 22 Apr 2015 08:48:35 +0200 (CEST) Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id CFCC8A12C3; Wed, 22 Apr 2015 06:48:33 +0000 (UTC) Received: from shalem.localdomain (vpn1-5-245.ams2.redhat.com [10.36.5.245]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3M6mVEI006304 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 22 Apr 2015 02:48:32 -0400 Message-ID: <5537443F.1090305@redhat.com> Date: Wed, 22 Apr 2015 08:48:31 +0200 From: Hans de Goede User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Tom Rini References: <20150421140338.GG16702@bill-the-cat> <55365A96.8040701@redhat.com> <20150421145740.GL16702@bill-the-cat> In-Reply-To: <20150421145740.GL16702@bill-the-cat> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 Cc: u-boot@lists.denx.de, Ian Campbell Subject: Re: [U-Boot] Ethernet problem on A20 Lime2 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Hi Tom, On 21-04-15 16:57, Tom Rini wrote: > On Tue, Apr 21, 2015 at 04:11:34PM +0200, Hans de Goede wrote: >> Hi Tom, >> >> On 21-04-15 16:03, Tom Rini wrote: >>> Hey, >>> >>> I've run into a problem with ethernet on the A20 Lime2: >>> sunxi# setenv autoload no >>> sunxi# dhcp >>> Speed: 1000, full duplex >>> BOOTP broadcast 1 >>> DHCP client bound to address 192.168.0.185 (13 ms) >>> sunxi# tftp test/u-boot-sunxi-with-spl.bin >>> Speed: 1000, full duplex >>> Using dwmac.1c50000 device >>> TFTP from server 192.168.0.3; our IP address is 192.168.0.185 >>> Filename 'test/u-boot-sunxi-with-spl.bin'. >>> Load address: 0x42000000 >>> Loading: ################################################################# >>> ######### >>> 23.4 KiB/s >>> done >>> Bytes transferred = 377028 (5c0c4 hex) >>> sunxi# crc32 $fileaddr $filesize >>> CRC32 for 42000000 ... 4205c0c3 ==> afa0edfb >>> $ rhash -C /tftpboot/test/u-boot-sunxi-with-spl.bin >>> ; Generated by RHash v1.2.8 on 2015-04-21 at 10:01.53 >>> ; Written by Aleksey (Akademgorodok) - http://rhash.sourceforge.net/ >>> ; >>> ; 377028 09:52.08 2015-04-21 /tftpboot/test/u-boot-sunxi-with-spl.bin >>> /tftpboot/test/u-boot-sunxi-with-spl.bin A16F5564 >>> >>> So a non-crc32 match. If I load that same file off of SD card: >>> sunxi# mmc read 43000000 10 400 >>> >>> MMC read: dev # 0, block # 16, count 1024 ... 1024 blocks read: OK >>> sunxi# cmp 42000000 43000000 $filesize >>> word at 0x42001544 (0x605a0200) != word at 0x43001544 (0x605a0201) >>> Total of 1361 word(s) were the same >>> >>> I haven't had a chance to bisect this but it might have been around for >>> a little while. >> >> Chances are this has never worked 100% reliable, on most boards some >> tweaking of the GMAC clk delays is necessary. >> >> Try setting >> >> CONFIG_GMAC_TX_DELAY=1 >> >> In the defconfig for your board, that helps with similar issues on >> the Cubietruck (which also has gbit ethernet) Valid values are >> 0 - 3. > > 1 2 and 3 all failed :( Bummer. There also is an rx delay, which is something which we've never had to use but you could try that, e.g. do something like this: And then play with 1 - 3 in the place of the 1, although since things do mostly work I would expect 1 to be the best candidate to make things better. Regards, Hans --- a/board/sunxi/gmac.c +++ b/board/sunxi/gmac.c @@ -25,7 +25,7 @@ int sunxi_gmac_initialize(bd_t *bis) setbits_le32(&ccm->gmac_clk_cfg, CCM_GMAC_CTRL_TX_CLK_SRC_INT_RGMII | CCM_GMAC_CTRL_GPIT_RGMII); setbits_le32(&ccm->gmac_clk_cfg, - CCM_GMAC_CTRL_TX_CLK_DELAY(CONFIG_GMAC_TX_DELAY)); + CCM_GMAC_CTRL_RX_CLK_DELAY(1)); #else setbits_le32(&ccm->gmac_clk_cfg, CCM_GMAC_CTRL_TX_CLK_SRC_MII | CCM_GMAC_CTRL_GPIT_MII);