A20-Lime2 image ethernet broken, uses emac instead of gmac

Started by ghherlin, October 07, 2014, 07:31:16 PM

Previous topic - Next topic

ghherlin

Hallo,

I have just unpacked 2 A20-LIME2 boards.

I downloaded the a20_Lime_debian_3.4.90_release_1.img image, dd'd it onto a uSD, started it up... it comes up. Good.

But a bit later, I notice in the serial debug console, a string of messages:
...
<3>sunxi_emac sunxi_emac.0: tx time out, resetting emac
[ 1008.972674] sunxi_emac sunxi_emac.0: tx time out, resetting emac

...

dmesg | grep mac yields
[    1.680245] sunxi_emac Using mii phy on PortA
[    1.699289] sunxi_emac Using MAC from SID: 02:08:08:80:9d:34
[   18.985704] sunxi_emac sunxi_emac.0: eth0: link up, 100Mbps, full-duplex, lpa 0xC5E1
[   29.066232] NETDEV WATCHDOG: eth0 (sunxi_emac): transmit queue 0 timed out
[   29.358665] sunxi_emac sunxi_emac.0: tx time out, resetting emac
[   35.043762] sunxi_emac sunxi_emac.0: tx time out, resetting emac

....and so on.
unplugged the link and plugged it back in, and got:
[  556.977344] sunxi_emac sunxi_emac.0: eth0: link down
[  558.980096] sunxi_emac sunxi_emac.0: eth0: link up, 100Mbps, full-duplex, lpa 0xC5E1
[  788.980369] sunxi_emac sunxi_emac.0: tx time out, resetting emac

...

After a bit of reading around, it seems that the A20 LIME2 board uses gmac, not emac, and that the physical port setup is different to that for the LIME board.

Is that correct?
And how can I fix the image? Or is there a specific A20 LIME2 image?
Lastly, are there any other usable images (Arch or whatever...) for this board?

Thanks in advance

George




ghherlin

Hello, Gerrit...

I have been trying that... I have created a new fex file by making a copy of the a20...lime.fex and replaced the emac entries in the fex file with those for the a20-SOM (essentially identical to those posted for the CB2, and, I guess the guys at Olimex are into hardware design reuse), and recompiled everything.

The new kernel says:
...
<4>emac_init fetch emac using configuration failed
[    1.732499] emac_init fetch emac using configuration failed
<6>emac driver is disabled
[    1.740532] emac driver is disabled

...

I have disabled emac and enabled gmac; took me forever to find the appropriate menuconfig items!

Now recompiling, will start afresh with uSD and will keep you posted.

Any other tips?

Gerrit

Hi George,

If you change the entries in the old fex, make sure beside changing e_mac to g_mac also change <2> into <5> If you want to test with the original Olimex image ,sunxi_gmac is available as a module you could try to do a sudo modprobe sunxi_gmac to get the the eth0 up.

Gerrit

progmetalbg

I think u-boot should also be replaced because LIME is using a single 512 MB chip with 16-bit bus width and LIME2 has 2 memory chips and 32 bit bus width and memory is initialized in u-boot.
U-Boot patch adding support for A20-OLinuXino-LIME2:
https://www.mail-archive.com/u-boot@lists.denx.de/msg148521.html

Gerrit

progmetalbg you are right i modified the Olimex Image in the following way

git clone -b sunxi https://github.com/linux-sunxi/u-boot-sunxi.git

replace
u-boot-sunxi/board/sunxi/dram_a20_olinuxino_lime.c

with:

/* this file is generated, don't edit it yourself */

#include <common.h>
#include <asm/arch/dram.h>

static struct dram_para dram_para = {
        .clock = 480,
        .type = 3,
        .rank_num = 1,
        .density = 4096,
        .io_width = 16,
        .bus_width = 32,
        .cas = 9,
        .zq = 0x7f,
        .odt_en = 0,
        .size = 1024,
        .tpr0 = 0x42d899b7,
        .tpr1 = 0xa090,
        .tpr2 = 0x22a00,
        .tpr3 = 0,
        .tpr4 = 0,
        .tpr5 = 0,
        .emr1 = 0x4,
        .emr2 = 0x10,
        .emr3 = 0,
};

unsigned long sunxi_dram_init(void)
{
        return dramc_init(&dram_para);
}


cd u-boot-sunxi

make CROSS_COMPILE=arm-linux-gnueabihf- A20-OLinuXino-Lime_config
make CROSS_COMPILE=arm-linux-gnueabihf-

dd if=spl/sunxi-spl.bin of=/dev/sdb bs=1024 seek=8
dd if=u-boot.img of=/dev/sdb bs=1024 seek=40

( change /dev/sdb in what ever you use)

This got me the extra memory

ivg

I'm having the same issue with olinuxino lime2. I'ts a bit unfortunate there is no image released that would support all features of this board.

If anyone managed to build a kernel with correct drivers maybe could share the image?


ivg


ghherlin

Dear all,

I too found that resource, after having wasted 12 hours trying to do this from scratch with too little information, and browsing their site in desperation.

That (well hidden) torrent file gives us a working gmac on the lime2 board.

Maybe we should suggest that Olimex centralise the working images for all of their boards in one place?
In addition, I think we should request that they publish the .fex files in that place too, for those of us who would like to move on to other things.

In any case many thanks for your collective assistance and your attention.

Over and out.
George

brt

Robert Nelson has instructions that work for LIME2 at http://eewiki.net/display/linuxonarm/A20-OLinuXino-LIME. Those are currently for a recent mainline kernel (currently 3.17/3.18), not for the Allwinner 3.4 kernel.

Be careful that if you use the 3.18-rc1 or later, you update the device tree dtb file, sun7i-a20-olinuxino-lime2.dtb too. To get it in the first place, you need a small patch to the 3.18-rc1 kernel tree: http://www.spinics.net/lists/arm-kernel/msg369040.html . Then do 'make dtbs'.

The dtb for 3.18 and later is not compatible with the one for 3.17 and earlier. This goes for both lime and lime2. If you use an earlier one with 3.18 it will hang in the boot process with famous last words: sunxi-mmc 1c0f000.mmc: Got CD GPIO

ipaton

Quote from: brt on October 24, 2014, 04:23:46 PM
The dtb for 3.18 and later is not compatible with the one for 3.17 and earlier. This goes for both lime and lime2. If you use an earlier one with 3.18 it will hang in the boot process with famous last words: sunxi-mmc 1c0f000.mmc: Got CD GPIO

Strictly speaking, there is no dtb for lime2 until 3.19 as it won't get merged until then. See http://www.spinics.net/lists/arm-kernel/msg369202.html

The 'Got CD GPIO' problem only exists in a relatively small range of linux-next kernels and is fixed by https://www.mail-archive.com/linux-mmc@vger.kernel.org/msg28751.html it shouldn't affect any released kernels - I've used essentially the same dtb on 3.16, 3.17, and I'm currently running it on 3.18-rc2 as of the 1st of November.

The biggest problem you're likely to see with Lime2 dtb on older kernels is due to the i2c speed not being defined in the dts and on older kernels that causes i2c not to work.

You'll need to backport this fix for older kernels https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/i2c/busses/i2c-mv64xxx.c?id=0ce4bc1dbdd911ae1763e2d4ff36bd1b214a59f7

ipaton

Quote from: progmetalbg on October 09, 2014, 10:56:01 AM
U-Boot patch adding support for A20-OLinuXino-LIME2:
https://www.mail-archive.com/u-boot@lists.denx.de/msg148521.html

Just to clarify one small point, that patch is for mainline u-boot. Currently mainline u-boot doesn't boot 3.4.x kernels, only mainline kernels.

For 3.4.x kernels, you need u-boot-sunxi with this commit https://github.com/linux-sunxi/u-boot-sunxi/commit/82504cd6f4e12445b0e7ca58878b54dea82c8a7c

Alternatively there are some patches floating around on the linux-sunxi mailing list to allow mainline u-boot to boot the old 3.4.x kernels. You probably need something like these:
https://github.com/ssvb/u-boot-sunxi-dram/commit/d15cdfbc19311a234de7d2d38cdb73b7b3e3f6ee
https://github.com/ssvb/u-boot-sunxi-dram/commit/6a4f29248f94867d22fcb5f86ec816c4f7183829
https://github.com/ssvb/u-boot-sunxi-dram/commit/e914abe551e712a59a8fc1ac9a4b8490e8e7c866
https://github.com/ssvb/u-boot-sunxi-dram/commit/f1162401396dbaaf75d0e625dcae82da74b96b95

Or just wait for Hans de Goede to get his 3.4.x support patches into mainline u-boot.