Porting guide ar71xx to ath79?

there are minor changes needed to Makefile, also you need to include the legacy.mk in it otherwise the images will not be created
I'll make a PR or add the patch to the mailing list

Great, i´d like to see it on git to dive into too...

I'm stuck on this

Summary
[    0.000000] Linux version 4.14.37 (build@build) (gcc version 7.3.0 (OpenWrt GCC 7.3.0 r6854-4aacd6388a)) #0 Mon May 7 16:54:23 2018
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019750 (MIPS 74Kc)
[    0.000000] MIPS: machine is TP-Link TL-WR1043ND Version 3
[    0.000000] SoC: Qualcomm Atheros QCA9558 ver 1 rev 0
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] User-defined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] random: get_random_bytes called from start_kernel+0x8c/0x474 with crng_init=0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line: console=ttyS0,115200 root=31:02 rootfstype=jffs2 init=/sbin/init mtdparts=ath-nor0:256k(u-boot),64k(u-boot-env),6336k(rootfs),1408k(uImage),64k(mib0),64k(ART) mem=64M rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 58400K/65536K available (3639K kernel code, 145K rwdata, 868K rodata, 1228K init, 212K bss, 7136K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 51
[    0.000000] CPU clock: 720.000 MHz
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 5309056796 ns
[    0.000008] sched_clock: 32 bits at 360MHz, resolution 2ns, wraps every 5965232126ns
[    0.008300] Calibrating delay loop... 358.80 BogoMIPS (lpj=1794048)
[    0.074992] pid_max: default: 32768 minimum: 301
[    0.080092] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.087128] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.097799] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.108304] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.114863] pinctrl core: initialized pinctrl subsystem
[    0.120858] NET: Registered protocol family 16
[    0.143211] clocksource: Switched to clocksource MIPS
[    0.149493] NET: Registered protocol family 2
[    0.154819] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.162248] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.169055] TCP: Hash tables configured (established 1024 bind 1024)
[    0.175954] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.182174] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.189123] NET: Registered protocol family 1
[    0.196894] Crashlog allocated RAM at address 0x3f00000
[    0.203732] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[    0.214876] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.221076] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.238402] io scheduler noop registered
[    0.242572] io scheduler deadline registered (default)
[    0.249789] pinctrl-single 1804002c.pinmux: 512 pins at pa b804002c size 64
[    0.258095] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.265515] console [ttyS0] disabled
[    0.269352] 18020000.uart: ttyS0 at MMIO 0x18020000 (irq = 8, base_baud = 2500000) is a 16550A
[    0.278571] console [ttyS0] enabled
[    0.278571] console [ttyS0] enabled
[    0.285989] bootconsole [early0] disabled
[    0.285989] bootconsole [early0] disabled
[    0.299205] m25p80 spi0.0: found gd25q64, expected m25p80
[    0.307103] m25p80 spi0.0: gd25q64 (8192 Kbytes)
[    0.311840] 6 fixed-partitions partitions found on MTD device spi0.0
[    0.318321] Creating 6 MTD partitions on "spi0.0":
[    0.323183] 0x000000000000-0x000000020000 : "u-boot"
[    0.328951] 0x000000020000-0x000000172e88 : "kernel"
[    0.334683] 0x000000172e88-0x0000007f0000 : "rootfs"
[    0.340337] mtd: device 2 (rootfs) set to be root filesystem
[    0.346180] mtdsplit: no squashfs found in "rootfs"
[    0.351140] 0x0000006f0000-0x0000007f0000 : "rootfs_data"
[    0.357325] 0x0000007f0000-0x000000800000 : "art"
[    0.362721] 0x000000020000-0x0000007f0000 : "firmware"
[    0.369356] libphy: Fixed MDIO Bus: probed
[    0.375238] ag71xx 19000000.eth: invalid MAC address, using random address
[    1.053548] libphy: mdio: probed
[    1.060300] switch0: Atheros AR8327 rev. 4 switch registered on mdio-bus.0
[    1.067493] ag71xx 19000000.eth: connected to PHY at mdio-bus.0:04 [uid=004dd034, driver=Atheros AR8216/AR8236/AR8316]
[    1.078916] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode:RGMII
[    1.085379] ag71xx 1a000000.eth: invalid MAC address, using random address
[    1.763548] libphy: mdio: probed
[    1.767778] ag71xx 1a000000.eth: connected to PHY at mdio-bus.1:01 [uid=00000000, driver=Generic PHY]
[    1.777716] eth1: Atheros AG71xx at 0xba000000, irq 5, mode:SGMII
[    1.785838] NET: Registered protocol family 10
[    1.794333] Segment Routing with IPv6
[    1.798149] NET: Registered protocol family 17
[    1.802696] 8021q: 802.1Q VLAN Support v1.8
[    1.810082] jffs2: Flash size not aligned to erasesize, reducing to 6592KiB
[    1.817494] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000000: 0x166c instead
[..]
[    1.913694] jffs2: Further such events for this erase block will not be printed

I think that patch-cmdline is not working either

I'll upload a bit later

Is patch cmd line needed?
Though all would be defined in dts

don't know exactly, but the cmdline is different than in 4.9, no sure it will fix the

[    0.340337] mtd: device 2 (rootfs) set to be root filesystem
[    0.346180] mtdsplit: no squashfs found in "rootfs"

here:

You could define cmdline with choosen node...

Eg.:

chosen {
    bootargs = "console=ttyS0,115200";
};

yes I was about to try that, thanks

https://github.com/openwrt/openwrt/pull/931

so if somebody has an idea with the switch part, don't hesitate :slight_smile:

I manage to get the QCA8337 working! :smiley:
I also wrote this in a comment of the pull request(https://github.com/openwrt/openwrt/pull/931#issuecomment-388234537)
However I want to share with you the magic of the offload and 4.14 kernel:

WITHOUT offload (option flow_offloading 0)

root@root:~# iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 192.168.1.103, port 57241
[  5] local 192.168.1.201 port 5201 connected to 192.168.1.103 port 57242
[ ID] Interval           Transfer     Bandwidth
[  5]   0.00-1.00   sec  55.8 MBytes   468 Mbits/sec
[  5]   1.00-2.00   sec  57.1 MBytes   479 Mbits/sec
[  5]   2.00-3.00   sec  56.6 MBytes   475 Mbits/sec
[  5]   3.00-4.00   sec  61.2 MBytes   513 Mbits/sec
[  5]   4.00-5.00   sec  60.3 MBytes   506 Mbits/sec
[  5]   5.00-6.00   sec  61.4 MBytes   515 Mbits/sec
[  5]   6.00-7.00   sec  60.3 MBytes   506 Mbits/sec
[  5]   7.00-8.00   sec  61.0 MBytes   512 Mbits/sec
[  5]   8.00-9.00   sec  60.6 MBytes   508 Mbits/sec
[  5]   9.00-10.00  sec  61.1 MBytes   512 Mbits/sec
[  5]  10.00-10.03  sec  1.97 MBytes   510 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  5]   0.00-10.03  sec   597 MBytes   499 Mbits/sec    0             sender
[  5]   0.00-10.03  sec   597 MBytes   499 Mbits/sec                  receiver

WITH offload (option flow_offloading 1)

root@root:~# iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 192.168.1.103, port 57270
[  5] local 192.168.1.201 port 5201 connected to 192.168.1.103 port 57271
[ ID] Interval           Transfer     Bandwidth
[  5]   0.00-1.00   sec   109 MBytes   911 Mbits/sec
[  5]   1.00-2.00   sec   111 MBytes   930 Mbits/sec
[  5]   2.00-3.00   sec   112 MBytes   939 Mbits/sec
[  5]   3.00-4.00   sec   111 MBytes   932 Mbits/sec
[  5]   4.00-5.00   sec   112 MBytes   940 Mbits/sec
[  5]   5.00-6.00   sec   110 MBytes   922 Mbits/sec
[  5]   6.00-7.00   sec   111 MBytes   929 Mbits/sec
[  5]   7.00-8.00   sec   111 MBytes   931 Mbits/sec
[  5]   8.00-9.00   sec   112 MBytes   940 Mbits/sec
[  5]   9.00-10.00  sec   111 MBytes   932 Mbits/sec
[  5]  10.00-10.03  sec  3.54 MBytes   940 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  5]   0.00-10.03  sec  1.09 GBytes   931 Mbits/sec    0             sender
[  5]   0.00-10.03  sec  1.09 GBytes   931 Mbits/sec                  receiver

I nearly doubled my bandwidth!!! :smiley: Thank you guys!

2 Likes

Ethernet speeds could probably be improved by tweaking the Ethernet driver as well. Hacking on the driver is quite annoying though.

Have any of the new ath79 target builds turned up at https://downloads.openwrt.org/snapshots/targets/ ? I seem to be unable to find them in that snapshot download directory.
Building them manually works fine, though.

No, because those are not built automatically, yet.

It is currently even marked "source only".
https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/ath79/Makefile;hb=HEAD#l9

It is still work in progress and no yet meant for general populace for downloading.

I would expect that at least the fixes at mkresin's staging tree should get merged first, before any images are provided for general populace. https://git.openwrt.org/?p=openwrt/staging/mkresin.git;a=shortlog

There is also no support for soc wireless currently...
Only pci attached wireless did work...

I started the work for TL-WR841N/ND V9 if someone is interested in helping I'll make a PR

on the first run I have this error and garbage after serial initialization

Summary
tarting kernel ...

[    0.000000] Linux version 4.14.37 (build@build) (gcc version 7.3.0 (OpenWrt GCC 7.3.0 r6854-4aacd6388a)) #0 Thu May 10 08:22:19 2018
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019374 (MIPS 24Kc)
[    0.000000] MIPS: machine is TP-Link TL-WR841N/ND Version 9
[    0.000000] SoC: Qualcomm Atheros QCA9533 ver 1 rev 1
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 02000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000001ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000001ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000001ffffff]
[    0.000000] random: get_random_bytes called from 0x8046a73c with crng_init=0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 8128
[    0.000000] Kernel command line: console=ttyS0,115200n8 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 128 (order: -3, 512 bytes)
[    0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 26492K/32768K available (3533K kernel code, 139K rwdata, 456K rodata, 1176K init, 207K bss, 6276K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 51
[    0.000000] CPU clock: 600.366 MHz
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6366979692 ns
[    0.000009] sched_clock: 32 bits at 300MHz, resolution 3ns, wraps every 7153909758ns
[    0.007564] Calibrating delay loop... 398.13 BogoMIPS (lpj=1990656)
[    0.073607] pid_max: default: 32768 minimum: 301
[    0.078297] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.084691] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.095704] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.105260] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.111241] pinctrl core: initialized pinctrl subsystem
[    0.116845] NET: Registered protocol family 16
[    0.121698] Can't analyze schedule() prologue at 803cf07c
[    0.129099] ------------[ cut here ]------------
[    0.133569] WARNING: CPU: 0 PID: 1 at kernel/irq/irqdomain.c:522 0x800b57c4
[    0.140335] error: hwirq 0x2b is too large for :ahb:apb:interrupt-controller@18060010
[    0.147889] Modules linked in:
[    0.150847] CPU: 0 PID: 1 Comm: swapper Not tainted 4.14.37 #0
[    0.156473] Stack : 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    0.164556]         00000000 00000000 00000000 00000000 00000000 00000001 81825940 e9938325
[    0.172628]         818259d8 00000000 00000000 00000dc8 00000038 803cd1b8 00000007 00000000
[    0.180707]         00000033 c1cd6000 00000032 00000000 81825920 00000000 8040323c 800b57c4
[    0.188779]         00000009 0000020a 81881400 00000001 00000001 80061440 00000000 80590000
[    0.196858]         ...
[    0.199214] Call Trace:
[    0.199226] [<803cd1b8>] 0x803cd1b8
[    0.204935] [<800b57c4>] 0x800b57c4
[    0.208303] [<80061440>] 0x80061440
[    0.211665] [<8006a29c>] 0x8006a29c
[    0.215026] [<8006a2a4>] 0x8006a2a4
[    0.218395] [<800801d0>] 0x800801d0
[    0.221757] [<800b57c4>] 0x800b57c4
[    0.225118] [<80080234>] 0x80080234
[    0.228487] [<800b57c4>] 0x800b57c4
[    0.231847] [<800b6000>] 0x800b6000
[    0.235209] [<802960e0>] 0x802960e0
[    0.238578] [<800b6104>] 0x800b6104
[    0.241941] [<800b6384>] 0x800b6384
[    0.245302] [<800b64cc>] 0x800b64cc
[    0.248670] [<8029c8f4>] 0x8029c8f4
[    0.252031] [<80299460>] 0x80299460
[    0.255393] [<8029c9b0>] 0x8029c9b0
[    0.258761] [<8029b780>] 0x8029b780
[    0.262123] [<8029bdf4>] 0x8029bdf4
[    0.265484] [<8029b780>] 0x8029b780
[    0.268855] [<8029c9f4>] 0x8029c9f4
[    0.272214] [<8029bf08>] 0x8029bf08
[    0.275576] [<8029cad0>] 0x8029cad0
[    0.278945] [<80298afc>] 0x80298afc
[    0.282306] [<80296374>] 0x80296374
[    0.285669] [<80298cd8>] 0x80298cd8
[    0.289035] [<80295f54>] 0x80295f54
[    0.292397] [<80298f04>] 0x80298f04
[    0.295759] [<802962f0>] 0x802962f0
[    0.299129] [<80298f3c>] 0x80298f3c
[    0.302489] [<802962f0>] 0x802962f0
[    0.305852] [<80298f3c>] 0x80298f3c
[    0.309219] [<801b7a94>] 0x801b7a94
[    0.312582] [<8046a248>] 0x8046a248
[    0.315941] [<80299148>] 0x80299148
[    0.319310] [<8046a248>] 0x8046a248
[    0.322671] [<80297464>] 0x80297464
[    0.326033] [<800ae464>] 0x800ae464
[    0.329402] [<8047dab4>] 0x8047dab4
[    0.332764] [<8047db20>] 0x8047db20
[    0.336124] [<803cf07c>] 0x803cf07c
[    0.339493] [<803cf07c>] 0x803cf07c
[    0.342854] [<803d0000>] 0x803d0000
[    0.346216] [<80060960>] 0x80060960
[    0.349590] [<8046ac74>] 0x8046ac74
[    0.352955] [<8046a248>] 0x8046a248
[    0.356315] [<803cd4cc>] 0x803cd4cc
[    0.359685] [<803cd4dc>] 0x803cd4dc
[    0.363046] [<803cd4cc>] 0x803cd4cc
[    0.366406] [<80065478>] 0x80065478
[    0.369780]
[    0.371216] ---[ end trace 11bc4ea8cf981742 ]---
[    0.391048] clocksource: Switched to clocksource MIPS
[    0.396945] NET: Registered protocol family 2
[    0.402053] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.408802] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.415011] TCP: Hash tables configured (established 1024 bind 1024)
[    0.421327] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.426985] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.433375] NET: Registered protocol family 1
[    0.441371] Crashlog allocated RAM at address 0x1f00000
[    0.447604] workingset: timestamp_bits=30 max_order=13 bucket_order=0
[    0.459108] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.464788] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.482639] io scheduler noop registered
[    0.486432] io scheduler deadline registered (default)
[    0.493539] pinctrl-single 1804002c.pinmux: 512 pins at pa b804002c size 64
[    0.501395] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.508274] console [ttyS0] disabled
[    0.511837] 18020000.uart: ttyS0 at MMIO 0x18020000 (irq = 8, base_baud = 2500000) is a 16550A
¦2
¦Br¦
L"¦L2¦p~¦N|~¦N¦¦N¦¦¦¦r2L2L¦|2B¦N?¦rL¦r<
<<¦²¦<¦¦p¦<<¦r¦p~¦?¦¦pN¦¦N¦¦¦¦rrLrL¦|N¦ppN¦0N@¦2

You could also share it only on your forked openwrt repo and i would take a look into.
How does your soc dtsi for qca9533 does look like?

I have started the work for tl-wr841v8 (ar9341) and tl-wdr3600 (ar9344).
If anyone is interested...
ath79-tl-wr841-v8
ath79-tl-wdr3600

9533 is based on QCA9531 maybe if I find some datasheet, the system is booting and sys led behaves properly, is not restarting but can't figure out the network without serial output
I'll upload to my github

I've put only the dts[i] files https://github.com/lucize/openwrt/tree/ath79841
I've copied the qca9557 to qca9553 and changed in some location but for sure some registers differs from 9557

I have a couple of wr841v11 which are very similar but currently no one with soldered serial...

Did you look into https://github.com/Deoptim/atheros for datasheet?
There is only a ds for qca9531 but should be very similar as you said...

I think you have to set the correct reference clock for a working serial...
base_baud = 2500000 -> looks like ref clock is set to 40MHz and your device uses a 25MHz ref clock or vice versa.

Look for a example into ar934x.dtsi and ar9341_tl-wr841-v8.dts.
Search for "ref" and try to set the clock correct...

the 4.9 kernel has


[    0.000010] sched_clock: 32 bits at 275MHz, resolution 3ns, wraps every 7809031678ns
[..]
[    0.682175] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.692106] console [ttyS0] disabled
¦    0.716066] serial8250.0: ttyS0 at MMIO 0x18020000 (irq = 11, base_baud = 1562500) is a 16550A