Porting guide ar71xx to ath79?


And is it intended to have ar71xx_pci_irq_unmask() and ar71xx_pci_irq_mask() identical?


It is mentioned in previous comments that interrupt-map got ignored when interrupt-controller property is defined so they can't be put together. A device node isn't always required and if there is no device node we have no way of configuring interrupts for a device.


they are not identical. mask set one bit to 0 and unmask set one bit to 1.


Well, maybe we don't need the interrupt-map. We could set different interrupts in child nodes, and they will be mapped somehow... It did work before, but with wrong masking.


Oh...my eyes..


As I said before, a device node isn't always required.
BTW we can find many examples of using a subnode for interrupt-controller in upstream kernel but I haven't seen one that used PCI node itself as a interrupt-controller node.


So I want to understand if we lose anything if we remove the subnode... It was not that caused the problem.


Removing that subnode will make the definition for all device nodes required. Currently we define that device node for wireless cards only because they need to load EEPROM from flash.


That makes sense.

Then we need to add the 3rd slot to the map. I have no idea what is it's address. Maybe 0x0000?


So I tried to port by Buffalo WZR-HP-AG300H to the new ath79 target, until I realized -- being the noob that I am in this domain -- that I would need a serial connection for the tftpboot :wink: Since I'm mostly patching stuff together from other ports, I don't feel confident enough to flash this to my device just yet.
Perhaps someone is willing to take a look at my changes and give me some feedback?
The latest commit is here: https://github.com/oxc/openwrt/commit/wzr-hp-ag300h

I have not been able to figure out how to map the mac address location in the art partition (and whether I need to), and whether/how I need to extract the ath9k firmware from the eeprom.

The remaining LEDs might be accessible via pinmux, but I'm just guessing here, and since most other devices seem not to have ported those leds (yet?) either, I'm a bit lost.


The mac issue depends on in which form the address is there. Maybe you need to extract it in userspace, maybe not.

If you have "pci168c,0029" devices, you need to extract data from eeprom.

Are you sure that u-boot doesn't have a resque mode?

Le me see the device description and the mach file.


@oxc Was it ever supported by ar71xx?


Yes, it is supported by ar71xx.


The mach file is here: target/linux/ar71xx/files/arch/mips/ath79/mach-wzr-hp-ag300h.c

The specs are here: https://openwrt.org/toh/buffalo/wzr-hp-ag300h (couldn't link wikidevi as well because my account is too new)


It looks like you don't need to extract mac addresses in userspace. You can use
mtd-mac-address for all 4 interfaces (wired and wireless).

mtd-mac-address-increment is needed for eth1 according to the mach file.

But you need to extract ath9k firmware in userspace. The scripts are already there.


Unfortunaly i fix broken my eth1 - i got old error:

[   52.118021] WARNING: CPU: 0 PID: 1752 at net/sched/sch_generic.c:320 dev_watchdog+0x164/0x274
[   52.126564] NETDEV WATCHDOG: eth1 (ag71xx): transmit queue 0 timed out
[   52.133074] Modules linked in: ath9k ath9k_common pppoe ppp_async ath9k_hw ath pptp pppox ppp_mppe ppp_generic mac80211 iptable_nat ipt_REJECT ipt_MASQUERADE cfg80211 xt_time xt_tcpudp xt_tcpmss xt_statistic xt_state xt_recent xt_nat xt_multiport xt_mark xt_mac xt_limit xt_length xt_hl xt_helper xt_esp xt_ecn xt_dscp xt_conntrack xt_connmark xt_connlimit xt_connbytes xt_comment xt_TCPMSS xt_REDIRECT xt_LOG xt_HL xt_FLOWOFFLOAD xt_DSCP xt_CLASSIFY usbserial slhc owl_loader nf_reject_ipv4 nf_nat_rtsp nf_nat_redirect nf_nat_masquerade_ipv4 nf_conntrack_ipv4 nf_nat_ipv4 nf_log_ipv4 nf_flow_table_hw nf_flow_table nf_defrag_ipv4 nf_conntrack_rtsp nf_conntrack_rtcache nf_conntrack_netlink iptable_mangle iptable_filter ipt_ah ipt_ECN ip_tables crc_ccitt compat sch_cake act_skbedit act_mirred em_u32 cls_u32
[   52.203774]  cls_tcindex cls_flow cls_route cls_fw sch_tbf sch_htb sch_hfsc sch_ingress ledtrig_usbport xt_set ip_set_list_set ip_set_hash_netiface ip_set_hash_netport ip_set_hash_netnet ip_set_hash_net ip_set_hash_netportnet ip_set_hash_mac ip_set_hash_ipportnet ip_set_hash_ipportip ip_set_hash_ipport ip_set_hash_ipmark ip_set_hash_ip ip_set_bitmap_port ip_set_bitmap_ipmac ip_set_bitmap_ip ip_set nfnetlink ip6t_NPT ip6t_MASQUERADE nf_nat_masquerade_ipv6 ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 nf_nat nf_conntrack ip6t_REJECT nf_reject_ipv6 nf_log_ipv6 nf_log_common ip6table_mangle ip6table_filter ip6_tables x_tables msdos ip_gre gre ifb sit tunnel4 ip_tunnel tun vfat fat ntfs hfsplus cifs nls_utf8 nls_iso8859_15 nls_iso8859_1 nls_cp850 nls_cp437 nls_cp1250 sha256_generic sha1_generic
[   52.274714]  md5 md4 hmac ecb des_generic usb_storage ohci_platform ohci_hcd ehci_platform sd_mod scsi_mod ehci_hcd gpio_button_hotplug ext4 jbd2 mbcache usbcore nls_base usb_common crc16 aead crypto_null cryptomgr crc32c_generic crypto_hash
[   52.296122] CPU: 0 PID: 1752 Comm: openssl Not tainted 4.14.63 #0
[   52.302199] Stack : 00000000 00000000 80647522 00000035 839518d4 804ef907 80498144 000006d8
[   52.310569]         80643670 00000140 804fad14 804facd4 804facc0 00000001 83809db8 fdb30c93
[   52.318947]         00000000 00000000 80640000 000055b0 00000000 00000000 00000007 00000000
[   52.327304]         00000116 6b964336 00000115 00000000 80000000 00000000 804bf310 8031002c
[   52.335668]         00000009 00000140 804fad14 804facd4 00000000 8025ec04 00000000 80640000
[   52.344034]         ...
[   52.346480] Call Trace:
[   52.348932] [<8006a90c>] show_stack+0x58/0x100
[   52.353396] [<80080900>] __warn+0xe4/0x118
[   52.357499] [<80080964>] warn_slowpath_fmt+0x30/0x3c
[   52.362457] [<8031002c>] dev_watchdog+0x164/0x274
[   52.367182] [<800b99f0>] call_timer_fn.isra.4+0x24/0x84
[   52.372417] [<800b9bc0>] run_timer_softirq+0x170/0x1e8
[   52.377560] [<80403f48>] __do_softirq+0xe8/0x2bc
[   52.382195] [<8020ed60>] plat_irq_dispatch+0xc0/0x120
[   52.387249] [<800658f8>] handle_int+0x138/0x144
[   52.391768] ---[ end trace d89761d8021f3514 ]---
[   52.396398] eth1: tx timeout

This is output from devmen:
devmem 0x18070004
0x00000021 it is wong, soud be 0x00000020 ( only with this value eth1 works on my wndr3700v2 ).
But there is advice for this error: if I in terminal change this value and reload network service eth1 start working !
devmem 0x18070004 32 0x20
devmem 0x18070004

cat /proc/interrupts
  3:          0      MIPS   3  ehci_hcd:usb1
  4:      27927      MIPS   4  19000000.eth
  5:       6733      MIPS   5  1a000000.eth
  7:     286148      MIPS   7  timer
  8:         15      MISC   3  ttyS0
 11:          0      MISC   6  ohci_hcd:usb2
 12:     218324  AR71XX PCI   1  ath9k
 13:     200462  AR71XX PCI   2  ath9k
ERR:         59

So please fixit it in source code - I'm to noob for this :slight_smile:


And also mac addresses for wireless devices are already there.
You don't actually need to define them in dts.

So it is something like
mtd-mac-address = <&art 0x20c>;

mtd-mac-address = <&art 0x20c>;
mtd-mac-address-increment = <1>;

The wifi firmware is at art 0x1000 and 0x5000 offsets. You can add your device to the script.
Same as WNDR3x00


What is the link speed: 100 or 1000 Mbit?
I was wrong here. It should be 0x20 for 1000 and 0x10 for 100.


@yabba I'll fix it. It is a minor problem. RGMII is not set in dts.


Oh, this is the thing @981213 has fixed already, but it hasn't been merged yet.
You can apply this, and all should be OK.