How to proceed with mainline Ethernet on sun8i?


Recommended Posts

Please see the boot log of Orange Pi PC, FEL/NFS booting kernel 4.6-rc1 with (mostly) working Ethernet:

 

 

 

U-Boot SPL 2016.03-armbian (Apr 02 2016 - 13:09:08)
DRAM: 1024 MiB
Trying to boot from 


U-Boot 2016.03-armbian (Apr 02 2016 - 13:09:08 +0200) Allwinner Technology

CPU:   Allwinner H3 (SUN8I 1680)
Model: Xunlong Orange Pi PC
I2C:   ready
DRAM:  1 GiB
MMC:   SUNXI SD/MMC: 0
Card did not respond to voltage select!
*** Warning - MMC init failed, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   No ethernet found.
starting USB...
USB0:   USB EHCI 1.00
USB1:   USB OHCI 1.0
USB2:   USB EHCI 1.00
USB3:   USB OHCI 1.0
USB4:   USB EHCI 1.00
USB5:   USB OHCI 1.0
scanning bus 0 for devices... 1 USB Device(s) found
scanning bus 2 for devices... unable to get device descriptor (error=-1)
1 USB Device(s) found
scanning bus 4 for devices... EHCI timed out on TD - token=0x80008c80
EHCI timed out on TD - token=0x80008c80
EHCI timed out on TD - token=0x80008c80
2 USB Device(s) found
Hit any key to stop autoboot:  0 
(FEL boot)
## Executing script at 43100000
gpio: pin PL10 (gpio 298) value is 1
gpio: pin PG11 (gpio 203) value is 1
Kernel image @ 0x42000000 [ 0x000000 - 0x5742c0 ]
## Flattened Device Tree blob at 43000000
   Booting using the fdt blob at 0x43000000
   Using Device Tree in place at 43000000, end 43006db5
Using machid 0x1029 from environment

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[    0.000000] Linux version 4.6.0-rc1-sunxi (root@armbian) (gcc version 5.3.1 20160205 (Ubuntu/Linaro 5.3.1-8ubuntu2) ) #5 SMP Sat Ap6
[    0.000000] Kernel command line: console=tty1 console=ttyS0,115200 root=/dev/nfs nfsroot=192.168.83.120:/raid-0/Armbian_Cache/sdcare
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xf0800000 - 0xff800000   ( 240 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xf0000000   ( 768 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0008000 - 0xc0b9fc4c   (11872 kB)
[    0.000000]       .init : 0xc0c00000 - 0xc0d00000   (1024 kB)
[    0.000000]       .data : 0xc0d00000 - 0xc0d49f00   ( 296 kB)
[    0.000000]        .bss : 0xc0d4b000 - 0xc0d96690   ( 302 kB)
[    0.001814] /cpus/cpu@0 missing clock-frequency property
[    0.001837] /cpus/cpu@1 missing clock-frequency property
[    0.001852] /cpus/cpu@2 missing clock-frequency property
[    0.001867] /cpus/cpu@3 missing clock-frequency property
[    3.133868] SCSI subsystem initialized
[    3.149082] Initialise system trusted keyring
[    3.149565] workingset: timestamp_bits=12 max_order=18 bucket_order=6
[    3.160980] NFS: Registering the id_resolver key type
[    3.161047] Key type id_resolver registered
[    3.161058] Key type id_legacy registered
[    3.179479] gpiod_to_irq: invalid GPIO
[    3.179496] gpiod_to_irq: invalid GPIO
[    3.711721] Key type dns_resolver registered
[    3.716370] Registering SWP/SWPB emulation handler
[    3.721997] Loading compiled-in X.509 certificates
[    3.730361] Key type encrypted registered
[    4.938304] scsi 0:0:0:0: Direct-Access     Generic  STORAGE DEVICE   9451 PQ: 0 ANSI: 0
[    4.947300] sd 0:0:0:0: Attached scsi generic sg0 type 0
[    5.201893] sd 0:0:0:0: [sda] 30228480 512-byte logical blocks: (15.5 GB/14.4 GiB)
[    5.210879] sd 0:0:0:0: [sda] Write Protect is off
[    5.217005] sd 0:0:0:0: [sda] No Caching mode page found
[    5.222327] sd 0:0:0:0: [sda] Assuming drive cache: write through
[    5.239135] sd 0:0:0:0: [sda] Attached SCSI removable disk
[    7.856668] Sending DHCP requests ., OK
[   18.291810] random: systemd urandom read with 56 bits of entropy available

Welcome to Debian GNU/Linux 8 (jessie)!

[   19.115585] systemd[1]: Cannot add dependency job for unit display-manager.service, ignoring: Unit display-manager.service failed t.
         Expecting device dev-ttyS0.device...
[  OK  ] Reached target Remote File Systems (Pre).
[  OK  ] Reached target Paths.
[  OK  ] Reached target Encrypted Volumes.
[  OK  ] Set up automount Arbitrary Executable File Formats F...utomount Point.
[  OK  ] Reached target Swap.
[  OK  ] Created slice Root Slice.
[  OK  ] Listening on Delayed Shutdown Socket.
[  OK  ] Listening on /dev/initctl Compatibility Named Pipe.
[  OK  ] Listening on Journal Socket (/dev/log).
[  OK  ] Created slice User and Session Slice.
[  OK  ] Listening on udev Control Socket.
[  OK  ] Listening on udev Kernel Socket.
[  OK  ] Listening on Journal Socket.
[  OK  ] Created slice System Slice.
         Starting Increase datagram queue length...
         Starting Restore / save the current clock...
         Starting udev Coldplug all Devices...
         Starting Create list of required static device nodes...rrent kernel...
         Mounting Debug File System...
         Mounting POSIX Message Queue File System...
         Starting LSB: Set keymap...
[  OK  ] Created slice system-serial\x2dgetty.slice.
[  OK  ] Created slice system-getty.slice.
         Starting Load Kernel Modules...
[  OK  ] Reached target Slices.
[  OK  ] Mounted POSIX Message Queue File System.
[  OK  ] Mounted Debug File System.
[  OK  ] Started Increase datagram queue length.
[  OK  ] Started Restore / save the current clock.
[  OK  ] Started Create list of required static device nodes ...current kernel.
[  OK  ] Started LSB: Set keymap.
[  OK  ] Started Load Kernel Modules.
[  OK  ] Started udev Coldplug all Devices.
         Mounting FUSE Control File System...
         Starting Apply Kernel Variables...
         Starting Create Static Device Nodes in /dev...
[  OK  ] Listening on Syslog Socket.
         Starting Journal Service...
[  OK  [   20.150735] random: nonblocking pool is initialized
] Started Journal Service.
[  OK  ] Mounted FUSE Control File System.
[  OK  ] Started Apply Kernel Variables.
[  OK  ] Started Create Static Device Nodes in /dev.
         Starting udev Kernel Device Manager...
[  OK  ] Started udev Kernel Device Manager.
         Starting Copy rules generated while the root was ro...
         Starting LSB: Tune IDE hard disks...
         Starting LSB: Set preliminary keymap...
[  OK  ] Started Copy rules generated while the root was ro.
[  OK  ] Started LSB: Tune IDE hard disks.
[   20.931083] cpu cpu0: failed to get clock: -2
[   20.935485] cpufreq-dt: probe of cpufreq-dt failed with error -2
[  OK  ] Found device /dev/ttyS0.
[  OK  ] Created slice system-ifup.slice.
[  OK  ] Started LSB: Set preliminary keymap.
         Starting Remount Root and Kernel File Systems...
[  OK  ] Started Remount Root and Kernel File Systems.
         Starting Various fixups to make systemd work better on Debian...
[  OK  ] Reached target Local File Systems (Pre).
         Mounting /tmp...
         Starting Load/Save Random Seed...
[  OK  ] Started Various fixups to make systemd work better on Debian.
[  OK  ] Mounted /tmp.
[  OK  ] Started Load/Save Random Seed.
[  OK  ] Reached target Local File Systems.
         Starting Create Volatile Files and Directories...
         Starting LSB: Raise network interfaces....
[  OK  ] Reached target Remote File Systems.
         Starting Trigger Flushing of Journal to Persistent Storage...
         Starting LSB: Prepare console...
[  OK  ] Started Create Volatile Files and Directories.
[  OK  ] Started Trigger Flushing of Journal to Persistent Storage.
         Starting Update UTMP about System Boot/Shutdown...
[  OK  ] Started Update UTMP about System Boot/Shutdown.
[  OK  ] Started LSB: Prepare console.
         Starting LSB: Set console font and keymap...
[  OK  ] Started LSB: Raise network interfaces..
         Starting ifup for eth0...
[  OK  ] Started ifup for eth0.
[  OK  ] Reached target Network.
[  OK  ] Reached target Network is Online.
[  OK  ] Started LSB: Set console font and keymap.
[  OK  ] Reached target System Initialization.
[  OK  ] Listening on D-Bus System Message Bus Socket.
[  OK  ] Reached target Sockets.
[  OK  ] Reached target Timers.
[  OK  ] Reached target Basic System.
         Starting Entropy daemon using the HAVEGE algorithm...
[  OK  ] Started Entropy daemon using the HAVEGE algorithm.
         Starting OpenBSD Secure Shell server...
[  OK  ] Started OpenBSD Secure Shell server.
         Starting System Logging Service...
         Starting Regular background program processing daemon...
[  OK  ] Started Regular background program processing daemon.
         Starting /etc/rc.local Compatibility...
         Starting D-Bus System Message Bus...
[  OK  ] Started D-Bus System Message Bus.
         Starting Login Service...
         Starting Permit User Sessions...
         Starting LSB: Starts LIRC daemon....
         Starting LSB: disk temperature monitoring daemon...
         Starting LSB: Advanced IEEE 802.11 management daemon...
         Starting LSB: Load kernel modules needed to enable cpufreq scaling...
         Starting LSB: Start NTP daemon...
         Starting LSB: Armbian gathering informations about hardware...
[  OK  ] Started System Logging Service.
[  OK  ] Started /etc/rc.local Compatibility.
[  OK  ] Started Permit User Sessions.
[  OK  ] Started LSB: disk temperature monitoring daemon.
[  OK  ] Started LSB: Advanced IEEE 802.11 management daemon.
[  OK  ] Started LSB: Start NTP daemon.
[  OK  ] Started Login Service.
[  OK  ] Started LSB: Starts LIRC daemon..
         Starting Serial Getty on ttyS0...
[  OK  ] Started Serial Getty on ttyS0.
         Starting Getty on tty1...
[  OK  ] Started Getty on tty1.
[  OK  ] Reached target Login Prompts.
[  OK  ] Started LSB: Load kernel modules needed to enable cpufreq scaling.
         Starting LSB: set CPUFreq kernel parameters...
[  OK  ] Started LSB: set CPUFreq kernel parameters.
         Starting LSB: Set sysfs variables from /etc/sysfs.conf...
[  OK  ] Started LSB: Set sysfs variables from /etc/sysfs.conf.
[  OK  ] Started LSB: Armbian gathering informations about hardware.
         Starting LSB: PLEASE BE PATIENT AND DO NOT INTERRUPT...FIRST REBOOT...

Debian GNU/Linux 8 orangepih3 ttyS0

orangepih3 login: [  OK  ] Removed slice system-ifup.slice.
         Stopping LSB: PLEASE BE PATIENT AND DO NOT INTERRUPT...FIRST REBOOT...
[  OK  ] Stopped target Graphical Interface.
         Stopping Entropy daemon using the HAVEGE algorithm...
[  OK  ] Stopped target Multi-User System.
         Stopping LSB: Set sysfs variables from /etc/sysfs.conf...
         Stopping LSB: Starts LIRC daemon....
         Stopping LSB: disk temperature monitoring daemon...
         Stopping LSB: Advanced IEEE 802.11 management daemon...
         Stopping LSB: Start NTP daemon...
         Stopping OpenBSD Secure Shell server...
         Stopping Regular background program processing daemon...
         Stopping Login Service...
[  OK  ] Stopped target Login Prompts.
         Sto         Stopping Getty on tty1...
         Stopping D-Bus System Message Bus...
         Stopping System Logging Service...
         Starting Store Sound Card State...
         Starting Unattended Upgrades...
[  OK  ] Stopped Entropy daemon using the HAVEGE algorithm.
[  OK  ] Stopped System Logging Service.
[  OK  ] Stopped Regular background program processing daemon.
[  OK  ] Stopped D-Bus System Message Bus.
[  OK  ] Stopped Login Service.
[  OK  ] Stopped Serial Getty on ttyS0.
[  OK  ] Stopped Getty on tty1.
[  OK  ] Stopped OpenBSD Secure Shell server.
[  OK  ] Stopped LSB: PLEASE BE PATIENT AND DO NOT INTERRUPT THE FIRST REBOOT.
[  OK  ] Stopped LSB: Set sysfs variables from /etc/sysfs.conf.
[  OK  ] Stopped LSB: Starts LIRC daemon..
[  OK  ] Stopped LSB: disk temperature monitoring daemon.
[  OK  ] Stopped LSB: Advanced IEEE 802.11 management daemon.
[  OK  ] Stopped LSB: Start NTP daemon.
[FAILED] Failed to start Store Sound Card State.
See 'systemctl status alsa-store.service' for details.
[  OK  ] Stopped target Network is Online.
         Stopping LSB: set CPUFreq kernel parameters...
         Stopping LSB: Armbian gathering informations about hardware...
[  OK  ] Removed slice system-getty.slice.
[  OK  ] Removed slice system-serial\x2dgetty.slice.
         Stopping /etc/rc.local Compatibility...
[  OK  ] Stopped /etc/rc.local Compatibility.
[  OK  ] Stopped target Network.
         Stopping Permit User Sessions...
[  OK  ] Stopped LSB: set CPUFreq kernel parameters.
[  OK  ] Stopped Permit User Sessions.
         Stopping LSB: Load kernel modules needed to enable cpufreq scaling...
[  OK  ] Stopped LSB: Load kernel modules needed to enable cpufreq scaling.
[  OK  ] Stopped target Remote File Systems.
[  OK  ] Stopped target Remote File Systems (Pre).
[  OK  ] Started Unattended Upgrades.
[  OK  ] Stopped LSB: Armbian gathering informations about hardware.
[  OK  ] Stopped target Basic System.
[  OK  ] Stopped target Slices.
[  OK  ] Removed slice User and Session Slice.
[  OK  ] Stopped target Paths.
[  OK  ] Stopped target Timers.
[  OK  ] Stopped target Sockets.
[  OK  ] Closed D-Bus System Message Bus Socket.
[  OK  ] Closed Syslog Socket.
[  OK  ] Stopped target System Initialization.
         Stopping Restore / save the current clock...
         Stopping Apply Kernel Variables...
[  OK  ] Stopped Apply Kernel Variables.
[  OK  ] Stopped target Encrypted Volumes.
         Stopping LSB: Raise network interfaces....
[  OK  ] Stopped target Swap.
         Stopping Update UTMP about System Boot/Shutdown...
         Stopping Load Kernel Modules...
[  OK  ] Stopped Load Kernel Modules.
[  OK  ] Stopped Restore / save the current clock.
[  OK  ] Stopped LSB: Raise network interfaces..
[  OK  ] Stopped Update UTMP about System Boot/Shutdown.
         Stopping Create Volatile Files and Directories...
[  OK  ] Stopped Create Volatile Files and Directories.
         Stopping Load/Save Random Seed...
[  OK  ] Stopped target Local File Systems.
         Unmounting /tmp...
[  OK  ] Stopped Load/Save Random Seed.
[  OK  ] Failed unmounting /tmp.
[  OK  ] Reached target Unmount All Filesystems.
[  OK  ] Stopped target Local File Systems (Pre).
         Stopping Create Static Device Nodes in /dev...
[  OK  ] Stopped Create Static Device Nodes in /dev.
         Stopping Remount Root and Kernel File Systems...
[  OK  ] Stopped Remount Root and Kernel File Systems.
[  OK  ] Reached target Shutdown.
[   61.722061] watchdog: watchdog0: watchdog did not stop!
[   61.831041] reboot: Restarting system 

 

 

 

 

Method of choice: Using dev branch (which requires fixes in configuration.sh), disabling all our current patches and simply using wens' h3-emac kernel branch. The whole procedure is described here (making use of userpatches since I don't want to destroy everything as last time): http://forum.armbian.com/index.php/topic/932-appletalk-on-an-orange-pi-one/#entry7170

 

Should we rely on wens' branch in the meantime? And decrease maximum cpufreq in u-boot to 816MHz now (just in case since running demanding workloads with more than this clockspeed on all 4 cores might damage H3)?

Link to post
Share on other sites
Armbian is a community driven open source project. Do you like to contribute your code?

Some impressions (most notably our broken auto detection ;) :

 

 ____                                  ____  _   __  __ ____       

| __ )  __ _ _ __   __ _ _ __   __ _  |  _ \(_) |  \/  |___ \  _   

|  _ \ / _` | '_ \ / _` | '_ \ / _` | | |_) | | | |\/| | __) || |_ 

| |_) | (_| | | | | (_| | | | | (_| | |  __/| | | |  | |/ __/_   _|

|____/ \__,_|_| |_|\__,_|_| |_|\__,_| |_|   |_| |_|  |_|_____||_|  

                                                                   

 

Welcome to ARMBIAN Debian GNU/Linux 8 (jessie) 4.6.0-rc1-sunxi 

 

System load:   0.28            Up time:       1 min

Memory usage:  4 % of 1002Mb IP:            192.168.83.137

Usage of /:    32% of 3.5G   

 

Last login: Sat Apr  2 13:46:30 2016

tk@orangepipc:~$ lsusb

Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 003 Device 004: ID 05ac:0304 Apple, Inc. Optical USB Mouse [Mitsumi]

Bus 003 Device 003: ID 05ac:0250 Apple, Inc. Aluminium Keyboard (ISO)

Bus 003 Device 002: ID 05ac:1006 Apple, Inc. Hub in Aluminum Keyboard

Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

tk@orangepipc:~$ ls -la /sys/class/leds/

total 0

drwxr-xr-x  2 root root 0 Apr  2 13:47 .

drwxr-xr-x 51 root root 0 Jan  1  1970 ..

lrwxrwxrwx  1 root root 0 Apr  2 13:47 input1::capslock -> ../../devices/platform/soc/1c1d000.usb/usb3/3-1/3-1.2/3-1.2:1.0/0003:05AC:0250.0001/input/input1/input1::capslock

lrwxrwxrwx  1 root root 0 Apr  2 13:47 input1::compose -> ../../devices/platform/soc/1c1d000.usb/usb3/3-1/3-1.2/3-1.2:1.0/0003:05AC:0250.0001/input/input1/input1::compose

lrwxrwxrwx  1 root root 0 Apr  2 13:47 input1::kana -> ../../devices/platform/soc/1c1d000.usb/usb3/3-1/3-1.2/3-1.2:1.0/0003:05AC:0250.0001/input/input1/input1::kana

lrwxrwxrwx  1 root root 0 Apr  2 13:47 input1::numlock -> ../../devices/platform/soc/1c1d000.usb/usb3/3-1/3-1.2/3-1.2:1.0/0003:05AC:0250.0001/input/input1/input1::numlock

lrwxrwxrwx  1 root root 0 Apr  2 13:47 input1::scrolllock -> ../../devices/platform/soc/1c1d000.usb/usb3/3-1/3-1.2/3-1.2:1.0/0003:05AC:0250.0001/input/input1/input1::scrolllock

lrwxrwxrwx  1 root root 0 Jan  1  1970 orangepi:green:pwr -> ../../devices/platform/leds/leds/orangepi:green:pwr

lrwxrwxrwx  1 root root 0 Jan  1  1970 orangepi:red:status -> ../../devices/platform/leds/leds/orangepi:red:status

 

tk@orangepipc:/sys/class/leds/orangepi:green:pwr$ cat trigger 

[none] rc-feedback kbd-scrollock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock mmc0 heartbeat cpu0 cpu1 cpu2 cpu3 default-on

 

Support output: http://sprunge.us/QTfT

Link to post
Share on other sites

@tkaiser,

I see that you still setting gpio in U-Boot. That is not necessary anymore. It is correctly described in dts and executed during kernel boot. At least if you are using mripard's sunxi-next branch.

 

Anyway, did you managed to set up ethernet on Plus with wens code? I didn't managed to get it working with montjoie's code.

Link to post
Share on other sites

Anyway, did you managed to set up ethernet on Plus with wens code? I didn't managed to get it working with montjoie's code.

 

I have no Plus (but SinoVoip said they send me a Banana Pi M2+ which is a 99% clone using almost all pin mappings identical) so maybe I give it a try then. AFAIK montjoie doesn't deal with external PHY at the moment? Did you have a look at wens' a83-emac branch? At least there the necessary RGMII stuff seems to be defined already.

 

Regarding leds and u-boot: IMO the sooner the green led lights the better (I already thought about disabling USB in u-boot since we do not use and it delays boot/led by a few seconds)

Link to post
Share on other sites

AFAIK montjoie doesn't deal with external PHY at the moment? Did you have a look at wens' a83-emac branch? At least there the necessary RGMII stuff seems to be defined already.

 

Montjoie also implemented some things for different phy options, but nobody managed to get it working on Plus AFAIK. Wens branch seems also worth a try, but currently I'm unable to, so I thought that you did. I will definetly try.

 

Regarding leds and u-boot: IMO the sooner the green led lights the better (I already thought about disabling USB in u-boot since we do not use and it delays boot/led by a few seconds)

In that case it is better to put LED code in board init function, so it will lit almost instantly after power on and it would be defined through dts (which already is).

Link to post
Share on other sites

Hi

 

I have some question about new ephy driver by linux sunxi (Chen-Yu Tsai - montjoie).

I see the driver is unstable for the moment so i try to use with stmmac emac driver.
There is an mdio support and sunxi A20 glue working, A31 seem to be working also...

The fact is "allwinner,sun8i-h3-ephy" is loaded as ethernet phy and stmmac try to handle it as phy...and make probleme because 0x01c00030 is just an "EMAC clock register".

I see in A31, this emac register is handle by "allwinner,sun7i-a20-gmac-clk" in clk@01c200d0 area. H3 seem have the exactly same registers in 0x01c00030 plus some registers handled with succes with "allwinner,sun8i-h3-ephy" (when i plug an eth cable, and ping to op pc, led blink with pinging so phy is working).

Maybe it 's possible to merge this 2 drivers allwinner,sun7i-a20-gmac-clk and allwinner,sun8i-h3-ephy to be new one for H3 and keep generic stmmac (dwmac-sunxi) to handle EMAC?

Or there is one good reason to not doing like that?

ps : i try with 4.5.3 and uboot2016-03

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