wn578A2 repeater support

The boot via tftp and a long press due power up works. But the first boot takes some time.
The LEDs are working, the switch slider doesn't. I guess some offset is needed. So far this ends in a frozen system at the end of the boot.

and for the switch (maybe this could be useful):

9 repeater mode on (1 on)
10 access point mode on (1 on)

the preconfigured wifi can be gathered if you place the needed file under <buildroot>files/etc/config/wireless
[Edit: fix wrong path]

config wifi-device 'radio0'
        option type 'mac80211'
        option channel '11'
        option hwmode '11g'
        option path 'platform/10300000.wmac'
        option htmode 'HT20'
        option disabled '0'

config wifi-iface 'default_radio0'
        option device 'radio0'
        option network 'lan'
        option mode 'ap'
        option ssid 'OpenWrt'
        option encryption 'none'

config wifi-device 'radio1'
        option type 'mac80211'
        option channel '36'
        option hwmode '11a'
        option path 'pci0000:00/0000:00:00.0/0000:01:00.0'
        option htmode 'VHT80'
        option disabled '0'

config wifi-iface 'default_radio1'
        option device 'radio1'
        option network 'lan'
        option mode 'ap'
        option ssid 'OpenWrt'
        option encryption 'none'

the switch and vlan config is this:

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '4 6t'

This needs a little bit work.

I would call this so far a RC:

Working:

  • both wifi
  • LAN port
  • all leds
  • gpio are mapped to the switch

Not working:

  • rssimon to 5 led bar
  • slider switch action [not implemented]

kernellog:

[    0.000000] Linux version 5.4.110 (build@build-xubuntu-VM) (gcc version 8.4.0 (OpenWrt GCC 8.4.0 r16435-f2c8c62d98)) #0 Tue Apr 13 15:20:55 2021
[    0.000000] Board has DDR2
[    0.000000] Analog PMU set to hw control
[    0.000000] Digital PMU set to hw control
[    0.000000] SoC Type: MediaTek MT7628AN ver:1 eco:2
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019655 (MIPS 24KEc)
[    0.000000] MIPS: machine is WAVLINK WL-WN576A2
[    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, PIPT, no 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] On node 0 totalpages: 16384
[    0.000000]   Normal zone: 144 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 16384 pages, LIFO batch:3
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16240
[    0.000000] Kernel command line: console=ttyS0,57600 rootfstype=squashfs,jffs2
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes, linear)
[    0.000000] Writing ErrCtl register=0007dfb0
[    0.000000] Readback ErrCtl register=0007dfb0
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 57452K/65536K available (4737K kernel code, 202K rwdata, 1048K rodata, 1172K init, 197K bss, 8084K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 256
[    0.000000] intc: using register map from devicetree
[    0.000000] random: get_random_bytes called from start_kernel+0x308/0x4fc with crng_init=0
[    0.000000] CPU Clock: 580MHz
[    0.000000] timer_probe: no matching timers found
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6590553264 ns
[    0.000010] sched_clock: 32 bits at 290MHz, resolution 3ns, wraps every 7405115902ns
[    0.015376] Calibrating delay loop... 385.02 BogoMIPS (lpj=770048)
[    0.059451] pid_max: default: 32768 minimum: 301
[    0.068781] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.083116] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.104951] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.124155] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.137670] pinctrl core: initialized pinctrl subsystem
[    0.149047] NET: Registered protocol family 16
[    0.267138] mt7620-pci 10140000.pcie: Port 0 N_FTS = 1b105000
[    0.427975] PCI host bridge /pcie@10140000 ranges:
[    0.437320]  MEM 0x0000000020000000..0x000000002fffffff
[    0.447630]   IO 0x0000000010160000..0x000000001016ffff
[    0.481034] PCI host bridge to bus 0000:00
[    0.489085] pci_bus 0000:00: root bus resource [mem 0x20000000-0x2fffffff]
[    0.502591] pci_bus 0000:00: root bus resource [io  0xffffffff]
[    0.514288] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    0.527703] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    0.543415] pci 0000:00:00.0: [14c3:0801] type 01 class 0x060400
[    0.555261] pci 0000:00:00.0: reg 0x10: [mem 0x00000000-0x7fffffff]
[    0.567616] pci 0000:00:00.0: reg 0x14: [mem 0x20200000-0x2020ffff]
[    0.580079] pci 0000:00:00.0: supports D1
[    0.587902] pci 0000:00:00.0: PME# supported from D0 D1 D3hot
[    0.601062] pci 0000:01:00.0: [14c3:7650] type 00 class 0x028000
[    0.612902] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x000fffff]
[    0.625354] pci 0000:01:00.0: PME# supported from D0 D3hot D3cold
[    0.637592] pci 0000:01:00.1: [14c3:8650] type 00 class 0x0d1100
[    0.649421] pci 0000:01:00.1: reg 0x10: [mem 0x00000000-0x000fffff]
[    0.661881] pci 0000:01:00.1: supports D1
[    0.669666] pci 0000:01:00.1: PME# supported from D0 D1 D3hot D3cold
[    0.683929] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
[    0.696915] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 01
[    0.709991] pci 0000:00:00.0: BAR 0: no space for [mem size 0x80000000]
[    0.723028] pci 0000:00:00.0: BAR 0: failed to assign [mem size 0x80000000]
[    0.736793] pci 0000:00:00.0: BAR 8: assigned [mem 0x20000000-0x201fffff]
[    0.750209] pci 0000:00:00.0: BAR 1: assigned [mem 0x20200000-0x2020ffff]
[    0.763633] pci 0000:01:00.0: BAR 0: assigned [mem 0x20000000-0x200fffff]
[    0.777046] pci 0000:01:00.1: BAR 0: assigned [mem 0x20100000-0x201fffff]
[    0.790459] pci 0000:00:00.0: PCI bridge to [bus 01]
[    0.800263] pci 0000:00:00.0:   bridge window [mem 0x20000000-0x201fffff]
[    0.813793] workqueue: max_active 576 requested for napi_workq is out of range, clamping between 1 and 512
[    0.837078] clocksource: Switched to clocksource MIPS
[    0.848418] NET: Registered protocol family 2
[    0.857877] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.874362] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.889430] TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.903358] TCP: Hash tables configured (established 1024 bind 1024)
[    0.916063] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.928912] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.942953] NET: Registered protocol family 1
[    0.951559] PCI: CLS 0 bytes, default 32
[    0.963922] workingset: timestamp_bits=14 max_order=14 bucket_order=0
[    0.985308] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.996741] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    1.033456] mt7621_gpio 10000600.gpio: registering 32 gpios
[    1.044721] mt7621_gpio 10000600.gpio: registering 32 gpios
[    1.055940] mt7621_gpio 10000600.gpio: registering 32 gpios
[    1.067207] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
[    1.080902] printk: console [ttyS0] disabled
[    1.089345] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 28, base_baud = 2500000) is a 16550A
[    1.107149] printk: console [ttyS0] enabled
[    1.123624] printk: bootconsole [early0] disabled
[    1.143505] spi-mt7621 10000b00.spi: sys_freq: 193333333
[    1.162346] spi-nor spi0.0: gd25q64 (8192 Kbytes)
[    1.171741] 4 fixed-partitions partitions found on MTD device spi0.0
[    1.184330] Creating 4 MTD partitions on "spi0.0":
[    1.193832] 0x000000000000-0x000000030000 : "u-boot"
[    1.204747] 0x000000030000-0x000000040000 : "u-boot-env"
[    1.216352] 0x000000040000-0x000000050000 : "factory"
[    1.227450] 0x000000050000-0x000000800000 : "firmware"
[    1.242048] 2 uimage-fw partitions found on MTD device firmware
[    1.253840] Creating 2 MTD partitions on "firmware":
[    1.263705] 0x000000000000-0x0000001e7380 : "kernel"
[    1.274629] 0x0000001e7380-0x0000007b0000 : "rootfs"
[    1.285591] mtd: device 5 (rootfs) set to be root filesystem
[    1.298588] 1 squashfs-split partitions found on MTD device rootfs
[    1.310918] 0x0000004f0000-0x0000007b0000 : "rootfs_data"
[    1.323471] libphy: Fixed MDIO Bus: probed
[    1.342972] rt3050-esw 10110000.esw: link changed 0x00
[    1.355216] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
[    1.373666] NET: Registered protocol family 10
[    1.386711] Segment Routing with IPv6
[    1.394178] NET: Registered protocol family 17
[    1.403066] 8021q: 802.1Q VLAN Support v1.8
[    1.418506] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
[    1.439130] Freeing unused kernel memory: 1172K
[    1.448126] This architecture does not have kernel memory protection.
[    1.460880] Run /sbin/init as init process
[    1.701132] random: fast init done
[    2.118985] init: Console is alive
[    2.126090] init: - watchdog -
[    2.909528] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    3.038871] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    3.063774] init: - preinit -
[    4.691276] random: jshn: uninitialized urandom read (4 bytes read)
[    4.754308] random: jshn: uninitialized urandom read (4 bytes read)
[    4.827590] random: jshn: uninitialized urandom read (4 bytes read)
[    5.199026] rt3050-esw 10110000.esw: link changed 0x00
[    8.835389] rt3050-esw 10110000.esw: link changed 0x10
[    9.568307] mount_root: jffs2 not ready yet, using temporary tmpfs overlay
[    9.586614] urandom-seed: Seed file not found (/etc/urandom.seed)
[    9.712381] procd: - early -
[    9.718398] procd: - watchdog -
[   10.299538] procd: - watchdog -
[   10.306494] procd: - ubus -
[   10.391824] urandom_read: 1 callbacks suppressed
[   10.391833] random: ubusd: uninitialized urandom read (4 bytes read)
[   10.416212] random: ubusd: uninitialized urandom read (4 bytes read)
[   10.433223] random: ubusd: uninitialized urandom read (4 bytes read)
[   10.449048] procd: - init -
[   11.611775] kmodloader: loading kernel modules from /etc/modules.d/*
[   11.671569] Loading modules backported from Linux version v5.10.16-0-gde53befa79cf
[   11.686659] Backport generated by backports.git v5.10.16-1-0-g21d2a1d2
[   11.779692] xt_time: kernel timezone is -0000
[   11.933430] mt76_wmac 10300000.wmac: ASIC revision: 76280001
[   12.072535] urngd: v1.0.2 started.
[   12.281169] random: crng init done
[   12.287930] random: 3 urandom warning(s) missed due to ratelimiting
[   12.979386] mt76_wmac 10300000.wmac: Firmware Version: 20151201
[   12.991195] mt76_wmac 10300000.wmac: Build Time: 20151201183641
[   13.049103] mt76_wmac 10300000.wmac: firmware init done
[   13.233707] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[   13.373130] PPP generic driver version 2.4.2
[   13.394147] NET: Registered protocol family 24
[   13.443053] mt76x0e 0000:01:00.0: card - bus=0x1, slot = 0x0 irq=4
[   13.455616] mt76x0e 0000:01:00.0: ASIC revision: 76100002
[   13.761816] mt76x0e 0000:01:00.0: Firmware Version: 0.1.00
[   14.065773] mt76x0e 0000:01:00.0: EEPROM ver:01 fae:00
[   14.078822] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht'
[   14.107903] kmodloader: done loading kernel modules from /etc/modules.d/*
[   32.300233] rt3050-esw 10110000.esw: link changed 0x00
[   36.002976] rt3050-esw 10110000.esw: link changed 0x10
[   38.377302] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
[   38.413133] jffs2_build_filesystem(): unlocking the mtd device... 
[   38.413201] done.
[   38.429269] jffs2_build_filesystem(): erasing all blocks after the end marker... 
[   39.615123] br-lan: port 1(eth0.1) entered blocking state
[   39.640696] br-lan: port 1(eth0.1) entered disabled state
[   39.651850] device eth0.1 entered promiscuous mode
[   39.661392] device eth0 entered promiscuous mode
[   39.846368] br-lan: port 1(eth0.1) entered blocking state
[   39.857105] br-lan: port 1(eth0.1) entered forwarding state
[   40.619086] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   48.904090] done.
[   48.907963] jffs2: notice: (1869) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[   49.113151] overlayfs: upper fs does not support tmpfile.
[ 1896.096154] rt3050-esw 10110000.esw: link changed 0x00
[ 1897.260570] br-lan: port 2(wlan0) entered blocking state
[ 1897.271200] br-lan: port 2(wlan0) entered disabled state
[ 1897.282137] device wlan0 entered promiscuous mode
[ 1897.314715] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[ 1897.327623] br-lan: port 2(wlan0) entered blocking state
[ 1897.338208] br-lan: port 2(wlan0) entered forwarding state
[ 1899.752078] rt3050-esw 10110000.esw: link changed 0x10
[ 2059.423568] rt3050-esw 10110000.esw: link changed 0x00
[ 2059.463149] device wlan0 left promiscuous mode
[ 2059.472178] br-lan: port 2(wlan0) entered disabled state
[ 2062.438258] wlan0: authenticate with 3a:10:d5:12:a2:ea
[ 2062.454787] wlan0: send auth to 3a:10:d5:12:a2:ea (try 1/3)
[ 2062.468731] wlan0: authenticated
[ 2062.477130] wlan0: associate with 3a:10:d5:12:a2:ea (try 1/3)
[ 2062.493388] wlan0: RX AssocResp from 3a:10:d5:12:a2:ea (capab=0x31 status=0 aid=4)
[ 2062.508656] wlan0: associated
[ 2062.528708] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[ 2063.817117] rt3050-esw 10110000.esw: link changed 0x10

Here's my diff: https://pastebin.com/tj3ZE779

The switch works for me (using the above diff), though I have only tested it by running cat /sys/kernel/debug/gpio. I presume it's possible to make it functional using openwrt-slide-switch and procd buttons, though that's left up to the end user and not something we really should care about.

Do you mean <buildroot>/files/etc/config/wireless? While editing that would technically work, it would also enable WiFi for all other builds. We should find a solution that would only enable WiFi for only specific devices, as not to break anything (and so that the patches will actually be accepted lol).

Btw, looking through your diff, your change to 02_network would break the devices listed before it. The lines ending |\ means 'or', so multiple devices can have the same config. You've accidentally changed the config for the two devices before it.

Make sure to add the rssileds package to DEVICE_PACKAGES (or install it with opkg later, though the first is preferred for obvious reasons), otherwise rssi won't work. I made that mistake too.

1 Like
<buildroot>/files/etc/config/wireless

Correct, I fixed that. But I do not want to add this, I just mentioned it. It is not necessary because the lan port works now.

Thanks for the bug searching, I will fix and test this.

the missing openwrt-slide-switch code snippet [/openwrt-slide-switch/blob/master/src/usr/share/slide-switch/switch-data.json-cut]

"wavlink,wn576a2": {
		"switch": {
			"gpios": [ 41,42 ],
			"codes": [ "BTN_0", "BTN_1" ],
			"positions": {
				"lo_hi": "accesspoint",
				"hi_lo": "repeater"
			}
		}
	},

It cold be useful if this slider change an overlay with the corresponding configs. But hey, the device is working. Much more than I expected

I assume that the definitions need some work. Out of the box they do not work, I would assume a preconfigured setting in the file /etc/config/system.

1 Like

Hi guys great work on this crappy Repeater (by the way to configure the original device i had to make a hard binding of the URL "repeater.setup" to the IP Adress of the device) nevertheless openwrt would be really nice on the device.

Is the issue

" So far this ends in a frozen system at the end of the boot."

fixed ? Is it worth to build a firmware with your code ? (maybe you can provide a bin to test )

To be fair, the device isn't all too bad. It's about as much as I would expect for £20. The original firmware is terrible though.

I haven't had mine freeze, though I have obviously been working on my own patch alongside @coelner.

Both of us have posted our diffs earlier, you can download and apply them. Which device is it you have? The SWV 733 B1 (WN576A2) or WN578A2 (same as mine)?

@stardust42 Yes, this fixed. The issue was caused by the wrong gpio 9 and 10, there was the offset 32 missing.
I uploaded my last build, build against the main branch. (SWV 733 B1 (WN576A2)). You find the output without the package folder

1 Like

Thank's a lot, I will try and give feedback

Hi, great work, installed the image via tftp, worked out of the box, no problems so far.
:+1:

Going back to the wifi default on thing, you might want to look at the raspi zero w. Afaik that has wifi enabled as default, though I have not had time to look into that. Ofc as you said, with the ethernet port being set to LAN, this isn't really necessary. But it would be useful to have. Then again, wifi is disabled in all other OpenWRT builds by default for a reason.. security.

I have fixed a few minor issues with my previous diff, and will send my patch soon.

Yeah, these thoughts could be omitted if the switch would configure the device accordingly:
AP:
AP active
WAN active

Repeater
AP disable
LAN active

However, I will not implement this. I'm going to create a pull request for this device. But due to the fact that I'm not using this device activly, I will not spent much time into this.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.