Porting guide ar71xx to ath79?

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

Can you share a complete boot log of wr841v9 ar71xx (4.9 kernel)...?

here

Summary
Starting kernel ...

[    0.000000] Linux version 4.4.92 (buildbot@builds-02.infra.lede-project.org) (gcc version 5.4.0 (LEDE GCC 5.4.0 r3101-bce140e) ) #0 Tue Oct 17 14:59:45 2017
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019374 (MIPS 24Kc)
[    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] No valid device tree found, continuing without
[    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] 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] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 8128
[    0.000000] Kernel command line:  board=TL-WR841N-v9  console=ttyS0,115200 rootfstype=squashfs,jffs2 noinitrd
[    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: 27864K/32768K available (3076K kernel code, 160K rwdata, 412K rodata, 312K init, 205K bss, 4904K 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] Clocks: CPU:550.000MHz, DDR:393.408MHz, AHB:196.704MHz, Ref:25.000MHz
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6950037990 ns
[    0.000010] sched_clock: 32 bits at 275MHz, resolution 3ns, wraps every 7809031678ns
[    0.008245] Calibrating delay loop... 366.18 BogoMIPS (lpj=1830912)
[    0.071060] pid_max: default: 32768 minimum: 301
[    0.076078] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.083061] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.093384] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.103796] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.111608] NET: Registered protocol family 16
[    0.117873] MIPS: machine is TP-LINK TL-WR841N/ND v9
[    0.558635] Can't analyze schedule() prologue at 800670fc
[    0.574927] clocksource: Switched to clocksource MIPS
[    0.581570] NET: Registered protocol family 2
[    0.587295] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.594658] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.601434] TCP: Hash tables configured (established 1024 bind 1024)
[    0.608270] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.614446] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.621405] NET: Registered protocol family 1
[    0.630787] Crashlog allocated RAM at address 0x1f00000
[    0.652850] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.659073] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.672321] io scheduler noop registered
[    0.676524] io scheduler deadline registered (default)
[    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
[    0.725181] console [ttyS0] enabled
[    0.725181] console [ttyS0] enabled
[    0.732725] bootconsole [early0] disabled
[    0.732725] bootconsole [early0] disabled
[    0.746902] m25p80 spi0.0: found s25sl032p, expected m25p80
[    0.752683] m25p80 spi0.0: s25sl032p (4096 Kbytes)
[    0.758974] 5 tp-link partitions found on MTD device spi0.0
[    0.764743] Creating 5 MTD partitions on "spi0.0":
[    0.769754] 0x000000000000-0x000000020000 : "u-boot"
[    0.776559] 0x000000020000-0x0000001533c8 : "kernel"
[    0.783503] 0x0000001533c8-0x0000003f0000 : "rootfs"
[    0.790526] mtd: device 2 (rootfs) set to be root filesystem
[    0.796490] 1 squashfs-split partitions found on MTD device rootfs
[    0.802885] 0x000000380000-0x0000003f0000 : "rootfs_data"
[    0.810323] 0x0000003f0000-0x000000400000 : "art"
[    0.817165] 0x000000020000-0x0000003f0000 : "firmware"
[    0.847836] libphy: ag71xx_mdio: probed
[    1.437498] ag71xx-mdio.1: Found an AR934X built-in switch
[    1.480925] eth0: Atheros AG71xx at 0xba000000, irq 5, mode:GMII
[    2.077892] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.1:04 [uid=004dd042, driver=Generic PHY]
[    2.088169] eth1: Atheros AG71xx at 0xb9000000, irq 4, mode:MII
[    2.096958] NET: Registered protocol family 10
[    2.106362] NET: Registered protocol family 17
[    2.111041] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[    2.124254] 8021q: 802.1Q VLAN Support v1.8
[    2.135251] VFS: Mounted root (squashfs filesystem) readonly on device 31:2.
[    2.144665] Freeing unused kernel memory: 312K
[    3.195948] init: Console is alive
[    3.199719] init: - watchdog -
[    4.062988] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    4.138029] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    4.156388] init: - preinit -
[    4.703316] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[    4.733313] random: procd: uninitialized urandom read (4 bytes read, 7 bits of entropy available)
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level



BusyBox v1.25.1 () built-in shell (ash)

     _________
    /        /\      _    ___ ___  ___
   /  LE    /  \    | |  | __|   \| __|
  /    DE  /    \   | |__| _|| |) | _|
 /________/  LE  \  |____|___|___/|___|                      lede-project.org
 \        \   DE /
  \    LE  \    /  -----------------------------------------------------------
   \  DE    \  /    Reboot (17.01.4, r3560-79f57e422d)
    \________\/    -----------------------------------------------------------

root@LEDE:/# [  323.946478] eth1: link down
[  323.954860] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
[  324.398529] eth1: link up (100Mbps/Full duplex)
[  324.403271] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready

You should set ref clock to 25000000 (25MHz) as in my dtsi and dts for wr841v8 and your serial will work...
Probably you shouldnĀ“t use qca9557 as base for qca953x because they are very different...
qca953x is more similar to ar934x.

If you have QCA9531 dtsi you can use that as 9533 is the same just without USB

If I had it maybe it booted from the first time :slight_smile:

ref clock worked

sidenote, I've read that

		compatible = "gpio-keys-polled";
		poll-interval = <20>;

are deprecated in favor of only

compatible = "gpio-keys";

1 Like

but now, the cpu clock is only 375 Mhz

Thanks.

did you change compatible of pll node to "qca,ar9340-pll"? This should be set to this...
compatible = "qca,ar9553-pll", "qca,qca9550-pll"; would be wrong...
take a look into "Documentation/devicetree/bindings/clock/qca,ath79-pll.txt" for valid values...

Correctly should it be set to compatible = "qca,ar9530-pll", "qca,ar9340-pll";

Probably reading of device tree binding could help you on your way...
cd to the linux-4.14.X directory and do find Documentation/devicetree/bindings/ -iname "*ath79*" for some ath79 specific dt bindings...

yes, I know the folder I've read for usb
using the 9340 pll is giving me 400 mhz, but that means that the device can be overclocked without u-boot :slight_smile:
as I saw my first boot had 600 mhz vs 550 mhz the default

i dont think so, only the calculated and shown cpu clock would be wrong...

Incorrect. It's just your clocks running faster. You will notice timing drift the longer the router is on.

so I fixed the oops, the pll, I have leds and yet again no traffic
can't figure out how to swap the devices
if I swap phy's on ethx directive they wont connect

[    1.241995] ag71xx 19000000.eth: connected to PHY at mdio-bus.0:00 [uid=00000000, driver=Generic PHY]
[    1.256261] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode:GMII
[    1.936115] libphy: mdio: probed
[    1.949098] mdio-bus.1: Found an AR934X built-in switch
[    2.004014] ag71xx 1a000000.eth: connected to PHY at mdio-bus.1:04 [uid=004dd042, driver=Generic PHY]
[    2.018224] eth1: Atheros AG71xx at 0xba000000, irq 5, mode:MII

swaped

[    1.232000] ag71xx 19000000.eth: Could not connect to PHY device
[    1.916101] libphy: mdio: probed
[    1.929083] mdio-bus.1: Found an AR934X built-in switch
[    1.982057] ag71xx 1a000000.eth: Could not connect to PHY device

ar71xx

[    0.899820] libphy: ag71xx_mdio: probed
[    1.528442] ag71xx-mdio.1: Found an AR934X built-in switch
[    1.581882] eth0: Atheros AG71xx at 0xba000000, irq 5, mode:GMII
[    2.218846] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.1:04 [uid=004dd042, driver=Generic PHY]
[    2.229123] eth1: Atheros AG71xx at 0xb9000000, irq 4, mode:MII

swconfig shows the switch connected to eth0 on ar71xx and on mine on eth1

maybe I need to use the gmac directive ?

the mach file has this

	ath79_setup_ar933x_phy4_switch(false, false);

	ath79_register_mdio(0, 0x0);

	/* LAN */
	ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
	ath79_eth1_data.duplex = DUPLEX_FULL;
	ath79_switch_data.phy_poll_mask |= BIT(4);
	ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
	ath79_register_eth(1);

	/* WAN */
	ath79_switch_data.phy4_mii_en = 1;
	ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
	ath79_eth0_data.duplex = DUPLEX_FULL;
	ath79_eth0_data.speed = SPEED_100;
	ath79_eth0_data.phy_mask = BIT(4);
	ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
	ath79_register_eth(0);

I've updated the dts[i] files, they are messy