Askey RAC2V1K / RT4230W REV6 Support

@lmore377 -

wifi speeds are on-target:
ACN radio: 300 up/16 down (compared to 360/16 for wire)
BGN radio: 90/15

range is not what i had before - harder to quantify

uboot and ubi tools wold be great to include. i ran into signficant verion mismatchs trying to add modules via opkg.

thank you!

update: your build has uboot-envtools, but the config file is missing.
this makes it work:

echo /dev/mtd9 0x0 0x40000 0x00020000 2 >/etc/fw_env.config

That would need adding to the PR, e.g. like:

--- a/package/boot/uboot-envtools/files/ipq806x
+++ b/package/boot/uboot-envtools/files/ipq806x
@@ -31,6 +31,9 @@ ubootenv_mtdinfo () {
 }
 
 case "$board" in
+askey,rt4230w-rev6)
+       ubootenv_add_uci_config "/dev/mtd9" "0x0" "0x40000" "0x20000"
+       ;;
 linksys,ea8500)
        ubootenv_add_uci_config "/dev/mtd10" "0x0" "0x20000" "0x20000"
        ;;

Thanks I'll add that asap.

Can people tell me what packages they want me to build images with before uploading? I've been including luci and usb storage but I'm not sure if you guys want anything else.

Also, I'm trying to get this pulled into the snapshot builds and almost everything's done, just putting some finishing touches and I'm trying to get it working on the 5.4 kernel (something's different with the dts structure and it causes kernel warnings and if flashed to nand causes a kernel panic).If you want to push any changes, here's the github repo. The branch is askey_rt4230w_support

and here;s the pull request: https://github.com/openwrt/openwrt/pull/3115

@lmore377-
this is great progress.
please check the mtd mappings. when i go to the system->backup->save mtd options in luci, and download the mtd blocks, many are 0 length files. im not sure if this is a problem or not, but it might limit subsequent flashing.

as for packages, these are ones that i commonly use (all dependencies not included):

luci-app-uhttpd
openssl-util
luci-ssl

luci-app-ddns
ddns-scripts

luci-app-sqm

luci-app-advanced-reboot
luci-app-commands

luci-app-statistics
collectd
collectd-mod-rrdtool
collectd-mod-sensors
collectd-mod-interface
collectd-mod-load
collectd-mod-memory
collectd-mod-network

nlbwmon
luci-app-nlbwmon

vnstat2
luci-app-vnstat2

That's weird. Can you try to do cat /dev/mtdX and put the number of the mtd you're trying to read? If a lot of garbled characters show up, then that means it's reading fine and the issue probably is on your end (try a different web browser maybe)

Alright I got the 5,14 kernel booting with pcie working (got it working by running bootipq (which fails of course) before actually running anything else because bootipq initializes pcie propertly) and now I'm just trying to get rid of some kernel warnings. They're posted here in case anyone can help: https://pastebin.com/j1hkVZLz

at drivers/opp/of.c:688 _of_add_opp_table_v2.part.2+0x43c/0x4ac

that file https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/opp/of.c?h=linux-5.4.y

has

/* There should be one of more OPP defined */

the OPP is documented at https://www.kernel.org/doc/Documentation/devicetree/bindings/opp/opp.txt
its a Frequency - Voltage Table - dont know if its missing or if there is some error
Might be because you are using an incompatible dts from vendor with different bindings to drivers

Edit: first post stated in bootlog:
cpu cpu0: dev_pm_opp_get_opp_count: device OPP not found (-19)

Edit2: OPP table in OpenWrt dts for that part might be those like:
https://github.com/openwrt/openwrt/blob/master/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064.dtsi

are you using those?

mentioned it in IRC - just to document things here too:
https://lore.kernel.org/patchwork/patch/1050393/ , https://patchwork.kernel.org/patch/11310803/
both seem to deal with quirks of the qcom pcie - that maybe should have fixed the pcie issue - subsystem maintainers probably know more about that or why its not working in your case

Oh I didn't even notice that you were in the irc channel. With the pcie issue, I think the problem was less kernel related and more U-Boot related. I'm about 85% sure the U-Boot on this platform just doesn't fully configure pcie until you run the bootipq command I mentioned earlier but because 4.14 doesn't have strict checking to make sure everything is set up correctly. On the other hand, 5.4 actually checks that it's configured correctly and fails because it's not. Give me a second to paste the output of pci long before and after running bootipq so you can see what I mean.

For the opp part of the dts, I don't have anything defined so shouldn't it just use the defaults?

Edit: this is before bootipq: https://pastebin.com/3bVc4GB2
after running bootipq, pci 0 and pci 3 just come up empty and pci 1 and pci 3 hang uboot. I don't know what's happening but it works so yeah. Also it seems like other ipq806x devices don't have this issue because they're flashed in a way that's compatible with bootipq. With the way I'm doing it, bootcmd needs to be changed to manually initialize the ubi parts and load it into memory then boot. While inconvenient, it allows openwrt to access about 355M of the nand instead of about 180M because it's one big partition instead of the 2 separate ones that the oem fw has for redundancy.

Good news, it boots fine, everything works, and ethernet is at full speed with sofware offloading (wifi is still a tad bit slow tho). gonna stress test it for a day or 2 before uploading an image here.

@lmore377 - regarding mtd dump from gui - good advice. all mtd blocks except mtd25 can be read and writtne as expected from the cli.

from reading your above posts about mtd / bootipq: would there be an option to maintain the dual-boot mapping and use the 'advanced-reboot' tools to flip between active partitions boot_part environment vars?
i dont know if this is a back-track or for possible subsequent development. this is not a complaint!

anyway -thanks so much for your development efforts.i'd be happy to test your k5. update.

@ghoffman are you sure you're using my image? Mine only goes up to mtd20. We probably could retain dual boot functionality but the problem is that I didn't see any environment variables to select which partition to boot to. Also if there was two separate partitions, the space available would be smaller.

well, i might have some frankenbuild going on.
i sysupgraded with your most recent image and now can't boot, but failsafe mode works.
in failsafe, build is OpenWrt 19.07.3, r11063-85e04e9f46

mtd map is:

root@(none):~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00020000 "0:SBL1"
mtd1: 00140000 00020000 "0:MIBIB"
mtd2: 00140000 00020000 "0:SBL2"
mtd3: 00280000 00020000 "0:SBL3"
mtd4: 00120000 00020000 "0:DDRCONFIG"
mtd5: 00120000 00020000 "0:SSD"
mtd6: 00280000 00020000 "0:TZ"
mtd7: 00280000 00020000 "0:RPM"
mtd8: 00500000 00020000 "0:APPSBL"
mtd9: 00080000 00020000 "0:APPSBLENV"
mtd10: 00140000 00020000 "0:ART"
mtd11: 00060000 00020000 "0:BOOTCONFIG"
mtd12: 00140000 00020000 "0:SBL2_1"
mtd13: 00280000 00020000 "0:SBL3_1"
mtd14: 00120000 00020000 "0:DDRCONFIG_1"
mtd15: 00120000 00020000 "0:SSD_1"
mtd16: 00280000 00020000 "0:TZ_1"
mtd17: 00280000 00020000 "0:RPM_1"
mtd18: 00060000 00020000 "0:BOOTCONFIG1"
mtd19: 00500000 00020000 "0:APPSBL_1"
mtd20: 08000000 00020000 "rootfs"
mtd21: 08000000 00020000 "rootfs_1"
mtd22: 0a000000 00020000 "ubifs"
mtd23: 00326000 0001f000 "ubi_rootfs"
root@(none):~#

env vars, including bootdmd:

root@(none):~# cat /dev/mtd9|strings
baudrate=115200
bootargs=console=ttyMSM0,115200n8
bootcmd=bootipq
bootdelay=2
eth1addr=94:91:7f:c4:fa:a4
ethact=eth1
ethaddr=94:91:7f:c4:fa:a3
fileaddr=44000000
filesize=660000
ipaddr=192.168.1.1
machid=177d
mtddevname=firmware
mtddevnum=0
mtdids=nand0=nand0
mtdparts=mtdparts=nand0:0x1A000000@0x2400000(firmware)
netmask=255.255.255.0
partition=nand0,0
serverip=192.168.1.9
stderr=serial
stdin=serial
stdout=serial

of course, i just put my router back together .... any suggestion to get out of this without serial access?

Yeah that's definitely not my image. Just completely reflash it with the instructions here https://github.com/lmore377/openwrt-rt4230w

Edit: make sure you set the wifi country. Some channels aren't available unless you do and it lets you crank the tx power all the way up to 1 watt (30dBm)

i'm hoping your next build has a factory image that works - otherwise it's back to the serial console.
but i wonder if ths will be the limitation of the 2-stage mtd/ubi mapping. at some point we (you!) will have to figure out how to flash a factory image onto a mtd without first booting a ramfs image from u-boot.

I had it working at one point but then it just stopped. Also, why do we need a factory image?

@lmore377-
my attempt to use sysupgrade from the openwrt commadn line after failsafe boot did not work.
it was my understanding that a' factory' image is what is needed to write a flash using mtd tools (or dd) from the openwrt command line, when sysupgrade does not work.

The factory image is used to flash the firmware using an interface provided by the manufacturer (like the firmware update on Netgear routers). I think the reason the sysupgrade failed is because you had ondr3j's image installed which has a different mtd layout. His image only flashes one of the 2 stock fw sections but mine overrides both for more storage space.

So there's an empty header with the same number of pins as a micro sd card and it has some ground pads that look like they'd exactly fit this type of micro sd card holder. I've tried soldering a micro sd card with some wires before but it didn't work, but I just noticed some empty resistor pads right next to the header. I think there's a possibility of having some internal storage here for extroot or something. What do you all think?