dwmac-sun8i  driver ..... v6


Recommended Posts

For who is interested in the dwmac-sun8i  driver for Ethernet on the Orange Pi H3 family. It is an alternative driver for sun8i_emac driver.

 

I have good results with it. No multicast problems and 24x7 uptime ( no RX errors).

The maintainer Coretin mailed me today about an update. Tommorrow version v6 will be updated.

 

Quote

 

The latest v6 need some patch on top of mainline stmmac. (rework of adjust_link that could be found at https://lkml.org/lkml/2017/5/24/104)

Since the patch was just accepted today, I will update my v6 branch tomorow on top of latest linux-next.

 

 

Link to post
Share on other sites
Donate and support the project!


It is not my patch. I use a different driver as the on the standard Armbian images.


You can read about it f.i. on: https://lwn.net/Articles/714717/

Best thing is to install a test Armbian image, f.i an dev. version from the nightly builds.

 

https://dl.armbian.com/orangepipc/nightly/

 

Then install the files I compiled. On the Orange Pi you do this as root:

 

#wget http://cdn.macip.net/dwmac-sun8i.zip
#unzip dwmac-sun8i.zip
#cd debs
#dpkg -i *.deb
#reboot

On installation on my Orange Pi One it had some install errors, but it worked out fine..... I guess you wont have these errors on your Orange Pi PC.

 

You can also download the complete image of my web site, but the nyou have a MacIPpi. Not sure if you want that, but it can be adjusted to your needs.

It can be found here:

http://cdn.macip.net/MacIPpi-V4.01.img.7z

 

Link to post
Share on other sites

I now succesfully compiled for the second time v6 of the dwmac-sun8i. https://github.com/montjoie/linux/tree/dwmac-sun8i-v6. Always nice if you can repeat what you did and have the same outcome.... I was kind of lucky the first time... and the linux-dtb-dev-sun8i .. file was missing. Now I have all.

 

I had a problem with a error about creating the sun8i-h3-nanopi-m1.dtb

 

 x Error: arch/arm/boot/dts/sun8i-h3-nanopi.dtsi:107.1-6 Label or path cpu0 not found                                                                  x
  x Error: arch/arm/boot/dts/sun8i-h3-nanopi.dtsi:150.28-29 syntax error                                                                                x
  x FATAL ERROR: Unable to parse input tree                                                                                                             x
  x scripts/Makefile.lib:328: recipe for target 'arch/arm/boot/dts/sun8i-h3-nanopi-m1.dtb' failed                                                       x
  x make[3]: *** [arch/arm/boot/dts/sun8i-h3-nanopi-m1.dtb] Error 1                                                                                     x
  x arch/arm/Makefile:351: recipe for target 'dtbs' failed                                                                                              x
  x make[2]: *** [dtbs] Error 2                                                                                                                         x
  x scripts/package/Makefile:97: recipe for target 'bindeb-pkg' failed                                                                                  x
  x make[1]: *** [bindeb-pkg] Error 2                                                                                                                   x
  x Makefile:1343: recipe for target 'bindeb-pkg' failed                                                                                                x
  x make: *** [bindeb-pkg] Error 2  

 

I edited:

 

sources/linux-sun8i-mainline-montjoie-patched-with-v6/dwmac-sun8i-v6/arch/arm/boot/dts/Makefile

And removed the line with sun8i-h3-nanopi-m1.dtb in it. Saved and recompiled. ( happend with an other board too..removed it too)

 

I now get all the wanted files:

 

-rw-r--r-- 1 root root    57606 Jun 18 20:12 linux-dtb-dev-sun8i_5.31_armhf.deb
-rw-r--r-- 1 root root    55930 Jun 18 20:12 linux-firmware-image-dev-sun8i_5.31_armhf.deb
-rw-r--r-- 1 root root 10752416 Jun 18 20:12 linux-headers-dev-sun8i_5.31_armhf.deb
-rw-r--r-- 1 root root 14373350 Jun 18 20:12 linux-image-dev-sun8i_5.31_armhf.deb
-rw-r--r-- 1 root root   163818 Jun 18 20:12 linux-u-boot-dev-orangepione_5.31_armhf.deb

 

 

It seems to work fine. Will do some more testing this week:

 

root@orangepione:~# dmesg|grep dwmac
[    3.585349] dwmac-sun8i 1c30000.ethernet: PTP uses main clock
[    3.585380] dwmac-sun8i 1c30000.ethernet: No regulator found
[    3.585415] dwmac-sun8i 1c30000.ethernet: Will use internal PHY
[    3.585471] dwmac-sun8i 1c30000.ethernet: Current syscon value is not the default 148000 (expect 58000)
[    3.585483] dwmac-sun8i 1c30000.ethernet: Chain mode enabled
[    3.585489] dwmac-sun8i 1c30000.ethernet: No HW DMA feature register supported
[    3.585493] dwmac-sun8i 1c30000.ethernet: Normal descriptors
[    3.585499] dwmac-sun8i 1c30000.ethernet: RX Checksum Offload Engine supported
[    3.585503] dwmac-sun8i 1c30000.ethernet: COE Type 2
[    3.585509] dwmac-sun8i 1c30000.ethernet: TX Checksum insertion supported
[    9.666982] dwmac-sun8i 1c30000.ethernet eth0: No MAC Management Counters available
[    9.666992] dwmac-sun8i 1c30000.ethernet eth0: PTP not supported by HW
[   11.759291] dwmac-sun8i 1c30000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx

 

See logs:

 

http://sprunge.us/fTFf

 

root@orangepione:~/debs-montjoie-v6-def-03/debs/xenial# cat /etc/armbian-release

# PLEASE DO NOT EDIT THIS FILE
BOARD=orangepione
BOARD_NAME="Orange Pi One"
VERSION=5.31
LINUXFAMILY=sun8i
BRANCH=dev
ARCH=arm
IMAGE_TYPE=stable

 

AppleTalk (multicast) is also doing fine on version v6. ( like on v5...)

 

root@orangepione:~# tcpdump -i eth0 atalk
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
21:40:21.995663 AT 1.174.253 > 0.nis:  nbp-lkup 2: "BasiliskII:  Macintosh@*"
21:40:22.061236 AT 65508.22.254 > 0.nis:  nbp-lkup 98: "192.168.178.1:IPADDRESS@*"
21:40:22.108447 AT 1.174.253 > 0.nis:  nbp-lkup 2: "BasiliskII:  Macintosh@*"
21:40:22.859392 AT 65508.22.254 > 0.nis:  nbp-lkup 98: "192.168.178.1:IPADDRESS@*"
21:40:23.268886 AT 1.174.253 > 0.nis:  nbp-lkup 3: "BasiliskII:PPCToolBox@*"
21:40:23.388646 AT 1.174.253 > 0.nis:  nbp-lkup 3: "BasiliskII:PPCToolBox@*"
21:40:23.493086 AT 1.174.253 > 0.nis:  nbp-lkup 3: "BasiliskII:PPCToolBox@*"
21:40:23.657416 AT 65508.22.254 > 0.nis:  nbp-lkup 98: "192.168.178.1:IPADDRESS@*"
21:40:24.266095 AT 1.174.253 > 0.nis:  nbp-lkup 4: "BasiliskII:AFPServer@*"
21:40:24.837975 AT 65508.22.254 > 0.nis:  nbp-lkup 99: "192.168.178.1:IPADDRESS@*"
21:40:25.095331 AT 1.174.253 > 0.nis:  nbp-lkup 4: "BasiliskII:AFPServer@*"
21:40:25.636242 AT 65508.22.254 > 0.nis:  nbp-lkup 99: "192.168.178.1:IPADDRESS@*"
21:40:25.928937 AT 1.174.253 > 0.nis:  nbp-lkup 4: "BasiliskII:AFPServer@*"
21:40:26.434136 AT 65508.22.254 > 0.nis:  nbp-lkup 99: "192.168.178.1:IPADDRESS@*"
21:40:26.760165 AT 1.174.253 > 0.nis:  nbp-lkup 4: "BasiliskII:AFPServer@*"
21:40:27.614627 AT 65508.22.254 > 0.nis:  nbp-lkup 100: "192.168.178.1:IPADDRESS@*"
21:40:28.412723 AT 65508.22.254 > 0.nis:  nbp-lkup 100: "192.168.178.1:IPADDRESS@*"
21:40:29.210829 AT 65508.22.254 > 0.nis:  nbp-lkup 100: "192.168.178.1:IPADDRESS@*"
21:40:30.408235 AT 65508.22.254 > 0.nis:  nbp-lkup 101: "192.168.178.1:IPADDRESS@*"
21:40:31.206058 AT 65508.22.254 > 0.nis:  nbp-lkup 101: "192.168.178.1:IPADDRESS@*"
21:40:32.004199 AT 65508.22.254 > 0.nis:  nbp-lkup 101: "192.168.178.1:IPADDRESS@*"
21:40:33.184656 AT 65508.22.254 > 0.nis:  nbp-lkup 102: "192.168.178.1:IPADDRESS@*"
21:40:33.982773 AT 65508.22.254 > 0.nis:  nbp-lkup 102: "192.168.178.1:IPADDRESS@*"

 

 

Link to post
Share on other sites

Unfortunately this didn't sound good:

06:06 <montjoie> raaaaaah mdio-mux-syscon does not load at the correct time when external PHY is used 

But anyway the driver is present in the kernel and it works with some patches to activate it. Support was reverted just to avoid breaking DT backwards compatibility in some weird cases that don't affect any existing devices but may happen in theory in the future.

Link to post
Share on other sites

Then we will use the Armbian patch :)

I don't know if it could be related but with the H5 WIP kernel 4.11.10 the IPv6 has some problem, on my system I cannot get an IPv6 address from DHCP, which was working before (I think it was 4.11.4)

Also, one or two time per day the ethernet connection stalls, in the dmesg I get:

 

[204415.013774] sun8i-emac 1c30000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off
[204779.569976] sun8i-emac 1c30000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
[205879.382799] sun8i-emac 1c30000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off
[206191.713237] sun8i-emac 1c30000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
[247047.620571] sun8i-emac 1c30000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off
[248221.164245] sun8i-emac 1c30000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off

 

Link to post
Share on other sites
On 28.8.2017 at 12:09 AM, zador.blood.stained said:

Unfortunately this didn't sound good: But anyway the driver is present in the kernel and it works with some patches to activate it. Support was reverted just to avoid breaking DT backwards compatibility in some weird cases that don't affect any existing devices but may happen in theory in the future.

 

Yeah, seems the support is back: http://lists.infradead.org/pipermail/linux-arm-kernel/2017-September/530590.html

Just built full orangepi plus image using Igors marvellous build system selecting "next" kernel 4.13.3, pushed it onto the sd card and tadaa:

root@orangepiplus:~# uname -a
Linux orangepiplus 4.13.3-sunxi #1 SMP Sat Sep 23 16:37:58 CEST 2017 armv7l GNU/Linux
...
[Sat Sep 23 20:12:03 2017] dwmac-sun8i 1c30000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx

Feels like I've been waiting years for this moment ... no 3.x kernel anymore on my orange pi :) Many thanx to all involved people who made this possible!

Link to post
Share on other sites

On the whole the driver is good.  One thing I noticed on the Orange Pi One was it doesn't work optimally when plugged into a gigabit switch.  The eth interface on the Pi One is 100Mb/s and it works perfect when attached to a switch that is 100Mb/s.
 

When attached to a 1000Mb/s switch:

[112776.347520] dwmac-sun8i 1c30000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off

When attached to a 100Mb/s switch:

[112882.431555] dwmac-sun8i 1c30000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx

 

Tested on kernels 4.13 - 4.14.

Not sure where to do a proper bug report, but figured I'd mention in case someone else has noticed anything.

Link to post
Share on other sites
Guest
This topic is now closed to further replies.