Porting guide ar71xx to ath79?

does it work for you?

Yes, it works at me.
Just same as @musashino.

I suggest to add

mtd-mac-address-increment = <1>;

for eth1 to match the factory address.

Oh, indeed. I missed the offset in ath79_init_mac(ath79_eth1_data.mac_addr, mac2, 1); in mach-wzr-hp-ag300h.c.
Thank you!

i opened a PR to add syscon to ar7100.dtsi here: https://github.com/openwrt/openwrt/pull/1340

i still think the driver should be fixed to not panic, so i would suggest opening a PR for that as well, but i'll leave that to you since it's your code :wink:

edit: per drvlabo the patch has been added as a second commit in the same PR

1 Like

I figured out why the mac address is not loaded correctly:

  • ... because the art partition is not found
  • ... because the virtual mtd-concat flash device is not loaded yet
  • ... because its probe got defered when it first ran (by returning -EPROBE_DEFER when one of the child devices cannot be found)
  • ... because the spi flash devices were not registered yet
  • ... because the virtual flash driver is loaded in the kernel before the spi drivers and thus gets matched to its platform device first

Reordering the virtualflash into the &spi node, as @juppin and I pondered before, unfortunately does not work either, because then it will get probed as a spi device, not a platform device.
Additionally, the probe order of platform devices defined in the tree does not seem to be dependent on the position defined in the tree, but on the order in which the platform device module drivers got registered. This is why moving the mtd-concat driver to after the spi-nor directory in the Makefile prevents this issue from happening.

I believe the best solution might be after all to move the driver to the end of the mtd Makefile. Perhaps contained in a "composite" directory? In any case a comment should mark why it is there at the very end.

Does anyone have a better idea how to solve this nicely?

Hey guys, I am seeing these errors in dmesg. No idea if they're critical. Running on a WNDR3700 v1. Latest master.

root@OpenWrt:~# dmesg -l err
[    0.601917] ar7100-usb-phy 18030000.usb-phy: phy reset is missing
[    0.735469] rtl8366s rtl8366s: cannot find mdio node phandle

The second msg is OK. mdio is not used and it falls back to gpio lines.
The first one can be seen on all devices. I plan to find out why this happens. Resets seem to be OK.
Both are not critical and don't affect performance.


For the WZR-HP-AGH300H, I can get the ethernet wan port up and running both by using either

&mdio0 {
	// ...
	phy0: ethernet-phy@0 {
		reg = <0>;
		phy-mode = "rgmii";
&eth0 {
	// ...
	phy-handle: <&phy0>;

which results in

ar8316: Using port 4 as switch port
ag71xx 19000000.eth: connected to PHY at mdio-bus.0:00 [uid=004dd041, driver=Atheros AR8216/AR8236/AR8316]


&eth0 {
	// ...
	fixed-link {
		speed = <1000>;

which results in

ag71xx 19000000.eth: connected to PHY at fixed-0:00 [uid=00000000, driver=Generic PHY]

The old ar71xx target produced the first output.

ar8316: Using port 4 as switch port
ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.0:00 [uid=004dd041, driver=Atheros AR8216/AR8236/AR8316]

So which is "better"?

If eth0 is really connected to switch, then fixed-link is better. We don't need phy in this case.


I've created a pull request for the WZR-HP-AG300H: https://github.com/openwrt/openwrt/pull/1345

@drvlabo, @musashino, perhaps you want to confirm that everything works for you?

Thanks for all the input in this thread, this was a great help!

Sorry for the noob question: why ath79 targets are not available in openwrt snapshot builds ?

Because it is still highly experimental. Some devices work ok, others need modifications. It is not yet ready for general end-user usage.


Hi, I fancy having a crack at porting ath79 for one of these:


What's the latest advice for a starting point?

Hi, I found that initramfs images for WNDR3800 stopped booting for some time.
I think it was introduced by commit b58df9919ef827e4d591e8b1990f0d306f7bdb5f.

I would like then to suggest the following patch. It fixed the issue for me.

diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk
index e968dcf..7b4f17f 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -235,6 +235,7 @@ TARGET_DEVICES += pcs_cr5000
 define Device/netgear_wndr3x00
   ATH_SOC := ar7161
   KERNEL := kernel-bin | append-dtb | lzma -d20 | netgear-uImage lzma
+  KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma -d20 | netgear-uImage lzma
   IMAGES := sysupgrade.bin factory.img
   IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | netgear-squashfs | append-rootfs | pad-rootfs
   IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | check-size $$$$(IMAGE_SIZE)

I removed that initramfs recipe, as @mkresin suggested that in https://github.com/openwrt/openwrt/pull/1270#issuecomment-412298618

Hi @hnyman, I tested the same version (r8053-9926f7c) without the patch and it doesn't boot at all.

Boot not Ok

ar7100> bootm
## Booting image at 81000000 ...
Bad Magic Number
Trying eth0

Boot Ok

ar7100> bootm
## Booting image at 81000000 ...
   Image Name:   MIPS OpenWrt Linux-4.14.68
   Created:      2018-09-10  15:50:40 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    3532473 Bytes =  3.4 MB
   Load Address: 80060000
   Entry Point:  80060000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80060000) ...
## Giving linux memsize in bytes, 134217728

Starting kernel ...


Ath79 snapshot r8064, wifi not working with AG300H/600DHP. Anyone can confirm ?

Didn't try r8064, but r8061 worked for me on the following device:

You need clean config files and run wifi after first flash on ath79.

Thank for the tips. On ar7xx build radio0 is 2.4ghz, radio1 is 5ghz. Ath79 build is reversed, that's why wifi not work.