Ethernet

= Configuration =

Setting the MAC address
By default both EMAC and GMAC use random MAC addresses that change with each reboot, but this can be fixed.

The Bash script below will generate a unicast, locally administered, random MAC address. The first octet has bit 0 unset for unicast and bit 1 set for local administration so will be either X2, X6 , Xa or Xe :

printf "%02x" $((RANDOM%256 & 254 | 2));hexdump -n 5 -e '""5/1 ":%02x""\n"' /dev/urandom

This MAC address can be loaded on each boot using one of the methods below to give a static MAC address.

For alternative sources of MAC addresses the FAQ [http://www.denx.de/wiki/view/DULG/WhereCanIGetAValidMACAddress 14.2.14. Where Can I Get a Valid MAC Address from?] at the U-Boot website may help.

Through script.bin
the Allwinner way, adding the value to your script.bin [dynamic] MAC = "XXXXXXXXXXXX"

U-boot
the bootloader to append mac_addr=XX:XX:XX:XX:XX:XX

Through ifconfig
ifconfig eth0 hw ether XX:XX:XX:XX:XX:XX

debian ifupdown
= Hardware =

EMAC
Allwinner's A10 and F20 SoCs include a MAC unit called EMAC but it's available on very few devices, most notably the Mele A1000, A2000 and A100 HTPC and the cubieboard. Due to driver similarities it's believed to be based on DM9000.

Performance issues
It has been discovered that the EMAC device (or its current Linux kernel driver) have a number of performance issues: slow RX performance (only 40-60 Mbit, compared to 90+ Mbit TX), active TX affecting RX rate way too much.

It seems that in some cases performance degrades only if the A10 device has been warm-rebooted prior to that; and speeds restore to immensely better levels after a full power-off/power-on cycle.

See the following discussions for details:


 * Uploading affects Downloading. Ethernet performance issue?
 * Something is still wrong with WEMAC
 * Low ethernet speeds after reboot (a power cycle restores normal speeds)
 * Slow network (receive, cable)

Mainline Kernel driver
EMAC driver is included in the Debian kernel sources (3.10~rc7-1~exp1)

GMAC
Allwinner's A20, A31, and the upcoming A80 contain a MAC unit called GMAC. The controller supports MII and RGMII modes. On the A20 it is pin compatible with the EMAC in MII mode. The controller is an early version of the Synopsys DWMAC (DesignWare MAC), with some hardware specific glue.

Mainline Kernel driver
DWMAC is supported by the stmmac driver. Platform glue for sunxi was merged in 3.14. Device tree patches for supported A20 devices were merged in 3.15.

ICplus IP101A
The ICplus IP101A is a RMII 10/100 Ethernet PHY.

ICplus IP101GA
The ICplus IP101GA is a RMII 10/100 Ethernet PHY.

Realtek RTL8201CP
The Realtek RTL8201CP is a MII mode 10/100 Ethernet PHY. It is very very common and supported by just about any kernel out there, either with the generic phy driver or the realtek one.

Oliver broke his PHY and ended up replacing it with another one. Here are some pictures.

Realtek RTL8211E
The Realtek RTL8211E is a RGMII 10/100/1000 Ethernet PHY, which is gigabit capable. It is commonly paired with GMAC for gigabit speeds. Generic PHY support is enough to make it work.

Realtek RTL8211CL
= Devices =

The following devices all come with an ethernet port.