Trying to backport sun4i-emac to work on 3.10 (cubie2)

59 views
Skip to first unread message

merio...@gmail.com

unread,
Dec 8, 2014, 6:00:20 AM12/8/14
to linux...@googlegroups.com
Hi,

I am trying to run kernel 3.10 (I know, it's old and experimental, but I need it) on Cubieboard2. I referenced linux-sunxi's "experimental/sunxi-3.10" branch, and took some patch out of it concerning pinctrl, clk, and dts.

I gave up trying to backport mmc support from 3.16 since it's too far, so I am trying to enable emac to boot from NFS. I saw EMAC "enable" patch on experimental/sunxi-3.10, and tried it on. Since nothing yet under driver/net/ethernet/allwinner on 3.10, I copied the code for sun4i-emac driver from 3.11.

Running on initramfs, the emac driver loaded and the link is on (eth0 shown on ifconfig), but dhcp cannot retreive ip address. I tried setting the ip manually, but I can't seem to connect to the network. No ping reached.

So I tried debugging sun4i-emac, I figured that :
1. emac_tx_done is called after emac_start_xmit, but not sure if it's sent out
of PHY
2. emac_rx is called from ISR, however the packet is always removed from
FIFO after failing to check the EMAC_UNDOCUMENTED_MAGIC on the packet header.
It always show the same value: 7fbb7dbe

Has anyone tried experimental-3.10 on cubieboard2 and ran emac before?

Thanks.

merio...@gmail.com

unread,
Dec 9, 2014, 10:05:03 PM12/9/14
to linux...@googlegroups.com, merio...@gmail.com

One more thing, I compiled the kernel in BIG ENDIAN mode.

Maxime Ripard

unread,
Dec 12, 2014, 4:10:05 AM12/12/14
to linux...@googlegroups.com, merio...@gmail.com
On Tue, Dec 09, 2014 at 07:05:03PM -0800, merio...@gmail.com wrote:
> One more thing, I compiled the kernel in BIG ENDIAN mode.

Here be dragons....


--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
signature.asc

Maxime Ripard

unread,
Dec 12, 2014, 4:10:06 AM12/12/14
to linux...@googlegroups.com
Hi,
I would seriously advise against using the experimental-3.10
kernel. On top of being experimental, it's not (and never has been)
actively maintained, is mostly untested, and you'll encounter such
things.

Why do you absolutely need such an old kernel?

Do you have the same behaviour if you take a mainline 3.10 and
backport the patches?

Maxime
signature.asc

Isa Ansharullah

unread,
Dec 12, 2014, 4:25:09 AM12/12/14
to linux...@googlegroups.com
Hi maxime,

I actually didn't use experimental-3.10 (sorry if I said it wrongly), 
I only took some patches which relate to sun4i-emac and applied it against mainline 3.10.

Two days ago I gave up emac and continued on stmmac. I picked early stmmac patches
from arm mailing list and applied it on mainline 3.10. It behaved the same way as sun4i-emac,
the driver got probed, but can't send or receive packet (thus can't udhcpc or ping).

I figured out it was because I built the kernel on big endian mode.
When I built it on little endian mode, dhcp could work. However, I needed big endian.
I don't know why the driver does not work accordingly on big endian kernel..
(I wasn't trying to understand how these driver work, so maybe I missed something)

Yes, I absolutely need 3.10 since I am trying to port an already established system 
that has user applications compiled on big endian mode. I only need the rootfs to get working
either via NFS or MMC. 

Isa







--
You received this message because you are subscribed to a topic in the Google Groups "linux-sunxi" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/linux-sunxi/3H_cAHr2apc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to linux-sunxi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Isa Ansharullah
aLab, inc.
Tokyo, Shibuya-ku, Yoyogi
1-42-10
Brooklyn Court 2F

Isa Ansharullah

unread,
Dec 12, 2014, 4:26:36 AM12/12/14
to linux...@googlegroups.com
>> One more thing, I compiled the kernel in BIG ENDIAN mode.

> Here be dragons....

I thought so too >_<

mike...@gmail.com

unread,
Dec 12, 2014, 10:45:46 AM12/12/14
to linux...@googlegroups.com, merio...@gmail.com
On Friday, December 12, 2014 10:25:09 AM UTC+1, Isa Ansharullah wrote:

> I figured out it was because I built the kernel on big endian mode.
> When I built it on little endian mode, dhcp could work. However, I needed big endian.
>
> I don't know why the driver does not work accordingly on big endian kernel..
> (I wasn't trying to understand how these driver work, so maybe I missed something)
>

I can't shake the though: "why on earth whould you need big-endian?". BE Is almost exclusively used in/by big "old" UNIX machines/companies, HP-UX, AIX, Solaris (SPARC), Linux on IBM p/z-series HW (PowerPC). I'm surprised that ARM is even capable of procession BE.

I'd think that as these driver are probably not used in those environments and that the drivers are heavily adjusted to sunxi BE has simple not been tested, or even thought about when developing them.

Good luck though.
Reply all
Reply to author
Forward
0 new messages