zekica
August 16, 2023, 7:29am
1
Hello,
Cudy WR1300 v3 is completely the same as v2 - has the same SoC, same Flash, same Switch, same WiFi hardware, but it has different data in the eeprom for MT7613BE. When loading this eeprom data, the mt7615 driver limits the tx power to 3dBm - it doesn't even look like it tries to set the txpower at all.
I have made a patch to the driver itself and forced it to load eeprom hardcoded data from another (WR1300v2) device. When that patch is applied, the MT7613BE works as it does on v2 - with proper txpower.
However, hardcoding eeprom data is not a proper way to fix this. I think the proper way would be to either:
patch the eeprom mtd partiton - by copying all data from a v2 device except mac address to the v3
create a v3 dts so it provides the v2 eeprom to all v3 devices (using mediatek,eeprom-data ) - still reading the mac address from the actual mtd devices
patch the driver to use the new eeprom data (but I'm not sure that v3 eeprom data is even correct).
What would be a correct way to address this?
zekica
August 18, 2023, 10:49am
2
Hello again,
I would really like to see what the best way forward for this workaround is, and if there even is a way do do this.
There is at least one other person that has exactly the same problem mentioned here and I would like to make that device usable out-of-the-box.
Thank you in advance.
zekica
August 21, 2023, 10:18am
3
Here is a patch to the mt7615 driver so others can use it. I know this is not a proper way to fix this issue, this is just a workarond that works for me with no issues even with >30 days uptime.
cudy-wr1300v3-eeprom.patch
This patch can be cleanly applied on top of 23.05.0-rc3 and it should work fine even with the main branch.
1 Like
NPeca75
September 27, 2023, 7:15am
4
Hi @zekica
tnx for patch
5GHz works as expected
but ...
2.4 (mt7603) is deaf
8.048326] Backport generated by backports.git v5.15.92-1-44-gd6ea70fafd36
[ 8.104518] pci 0000:00:00.0: enabling device (0006 -> 0007)
[ 8.110303] mt7603e 0000:01:00.0: enabling device (0000 -> 0002)
[ 8.116596] mt7603e 0000:01:00.0: ASIC revision: 76030010
[ 8.270183] random: crng init done
[ 8.273607] random: 28 urandom warning(s) missed due to ratelimiting
[ 9.143613] mt7603e 0000:01:00.0: Firmware Version: ap_pcie
[ 9.149204] mt7603e 0000:01:00.0: Build Time: 20160107100755
[ 9.176482] mt7603e 0000:01:00.0: firmware init done
[ 9.361517] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[ 9.375757] pci 0000:00:01.0: enabling device (0006 -> 0007)
[ 9.381509] mt7615e 0000:02:00.0: enabling device (0000 -> 0002)
[ 9.402381] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht'
[ 9.402453] ieee80211 phy1: copying sband (band 1) due to VHT EXT NSS BW flag
[ 9.407845] kmodloader: done loading kernel modules from /etc/modules.d/*
[ 11.379060] mt7615e 0000:02:00.0: mediatek/mt7663pr2h.bin not found, switching to mediatek/mt7663pr2h_rebb.bin
[ 11.394436] mt7615e 0000:02:00.0: HW/SW Version: 0x65322d31, Build Time: 2009041715da1a1
[ 11.394436]
[ 11.557657] mt7615e 0000:02:00.0: N9 Firmware Version: 7663mp1827, Build Time: 20200904171623
[ 11.566300] mt7615e 0000:02:00.0: Region number: 0x3
[ 11.571339] mt7615e 0000:02:00.0: Parsing tailer Region: 0
[ 11.579924] mt7615e 0000:02:00.0: Region 0, override_addr = 0x00112c00
[ 11.586482] mt7615e 0000:02:00.0: Parsing tailer Region: 1
[ 11.592921] mt7615e 0000:02:00.0: Parsing tailer Region: 2
[ 11.598863] mt7615e 0000:02:00.0: override_addr = 0x00112c00, option = 3
any advice ?
HW v3.0 EU
flashed with v2 23.05-rc3
zekica
September 27, 2023, 8:18am
5
Can you try building using this tree?
I'm having a conversation with Djfe about a proper way to fix this on github issues
1 Like
NPeca75
September 27, 2023, 10:34am
6
Hi
i tried to apply @Djfe DIFF to 23.05-rc3
applied cleanly, but crashing
will try to compile directly from branch
[ 1.400792] spi-mt7621 1e000b00.spi: sys_freq: 220000000
[ 1.407742] spi-nor spi0.0: XM25QH128C (16384 Kbytes)
[ 1.412966] 7 fixed-partitions partitions found on MTD device spi0.0
[ 1.419335] OF: Bad cell count for /palmbus@1e000000/spi@b00/flash@0/partitions
[ 1.426670] OF: Bad cell count for /palmbus@1e000000/spi@b00/flash@0/partitions
[ 1.434280] OF: Bad cell count for /palmbus@1e000000/spi@b00/flash@0/partitions
[ 1.441633] OF: Bad cell count for /palmbus@1e000000/spi@b00/flash@0/partitions
[ 1.449177] Creating 7 MTD partitions on "spi0.0":
[ 1.453986] 0x000000000000-0x000000030000 : "u-boot"
[ 1.460124] 0x000000030000-0x000000040000 : "u-boot-env"
[ 1.466420] 0x000000040000-0x000000050000 : "factory"
[ 1.472566] 0x000000050000-0x000000fd0000 : "firmware"
[ 1.478965] 2 uimage-fw partitions found on MTD device firmware
[ 1.484945] Creating 2 MTD partitions on "firmware":
[ 1.489936] 0x000000000000-0x00000027e599 : "kernel"
[ 1.494887] mtd: partition "kernel" doesn't end on an erase/write block -- force read-only
[ 1.504240] 0x00000027e599-0x000000f80000 : "rootfs"
[ 1.509220] mtd: partition "rootfs" doesn't start on an erase/write block boundary -- force read-only
[ 1.519274] mtd: setting mtd5 (rootfs) as root device
[ 1.524471] 1 squashfs-split partitions found on MTD device rootfs
[ 1.530666] 0x000000590000-0x000000f80000 : "rootfs_data"
[ 1.537073] 0x000000fd0000-0x000000fe0000 : "debug"
[ 1.542973] 0x000000fe0000-0x000000ff0000 : "backup"
[ 1.548901] 0x000000ff0000-0x000001000000 : "bdinfo"
[ 1.554785] mtd mtd9: Failed to register NVMEM device
[ 1.560098] Deleting MTD partitions on "spi0.0":
[ 1.564704] Deleting u-boot MTD partition
[ 1.568695] ------------[ cut here ]------------
[ 1.573364] WARNING: CPU: 0 PID: 1 at block/genhd.c:589 del_mtd_blktrans_dev+0x38/0x178
[ 1.581388] Modules linked in:
[ 1.584443] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.15.127 #0
[ 1.590515] Stack : 80729c24 8007f6ec 00000000 00000004 00000000 00000000 80c2d81c 80940000
[ 1.598874] 80780000 806e5378 80c46c18 80784dc3 00000000 00000001 80c2d7c8 80c424c0
[ 1.607224] 00000000 00000000 806e5378 80c2d668 ffffefff 00000000 ffffffea 00000000
[ 1.615581] 80c2d674 000000b5 8078a960 ffffffff 806e5378 00000001 00000000 803e1b58
[ 1.623940] 00000009 80729980 80cadac8 00000006 00000018 803b25d0 00000000 80940000
[ 1.632298] ...
[ 1.634742] Call Trace:
[ 1.637171] [<80007f14>] show_stack+0x28/0xf0
[ 1.641537] [<8033d370>] dump_stack_lvl+0x60/0x80
[ 1.646241] [<8002d7a8>] __warn+0x9c/0x124
[ 1.650341] [<8002d88c>] warn_slowpath_fmt+0x5c/0xac
[ 1.655294] [<803e1b58>] del_mtd_blktrans_dev+0x38/0x178
[ 1.660589] [<803e0c9c>] blktrans_notify_remove+0x80/0xc0
[ 1.665972] [<803d7998>] del_mtd_device+0x60/0x100
[ 1.670772] [<803da124>] __del_mtd_partitions+0xa8/0x118
[ 1.676075] [<803db13c>] del_mtd_partitions+0x48/0x6c
[ 1.681107] [<803db670>] add_mtd_partitions+0xbc/0x1e0
[ 1.686231] [<803db574>] parse_mtd_partitions+0x414/0x454
[ 1.691610] [<803d7b34>] mtd_device_parse_register+0xfc/0x34c
[ 1.697342] [<80405738>] spi_nor_probe+0x258/0x310
[ 1.702137] [<803c14b0>] really_probe.part.0+0xac/0x354
[ 1.707372] [<803c19e4>] driver_probe_device+0x4c/0x154
[ 1.712581] [<803c203c>] __device_attach_driver+0xd0/0x15c
[ 1.718055] [<803bf4ac>] bus_for_each_drv+0x70/0xb0
[ 1.722918] [<803c1d60>] __device_attach+0xe0/0x180
[ 1.727786] [<803c03fc>] bus_probe_device+0xa0/0xbc
[ 1.732649] [<803be2a4>] device_add+0x3e4/0x8e0
[ 1.737171] [<80424370>] __spi_add_device+0x80/0x160
[ 1.742125] [<804244b0>] spi_add_device+0x60/0x9c
[ 1.746817] [<80424e54>] spi_register_controller+0x7f4/0xb34
[ 1.752456] [<80426fd0>] mt7621_spi_probe+0x168/0x220
[ 1.757497] [<803c3648>] platform_probe+0x50/0xa4
[ 1.762189] [<803c14b0>] really_probe.part.0+0xac/0x354
[ 1.767403] [<803c19e4>] driver_probe_device+0x4c/0x154
[ 1.772613] [<803c2174>] __driver_attach+0xac/0x1ac
[ 1.777480] [<803bf400>] bus_for_each_dev+0x68/0xa4
[ 1.782344] [<803c06d0>] bus_add_driver+0x150/0x238
[ 1.787211] [<803c27ac>] driver_register+0x98/0x154
[ 1.792071] [<80001644>] do_one_initcall+0x50/0x1b4
[ 1.796936] [<8080c180>] kernel_init_freeable+0x26c/0x308
[ 1.802341] [<80646f88>] kernel_init+0x20/0x110
[ 1.806861] [<80003038>] ret_from_kernel_thread+0x14/0x1c
[ 1.812245]
[ 1.813801] ---[ end trace dade8081483391f0 ]---
[ 1.819097] Deleting u-boot-env MTD partition
[ 1.824247] Deleting factory MTD partition
[ 1.828992] Deleting kernel MTD partition
[ 1.833739] Deleting rootfs MTD partition
[ 1.838346] Deleting rootfs_data MTD partition
[ 1.843572] Deleting firmware MTD partition
[ 1.848403] Deleting debug MTD partition
[ 1.853075] Deleting backup MTD partition
[ 1.991758] i2c_dev: i2c /dev entries driver
[ 1.998695] NET: Registered PF_INET6 protocol family
[ 2.005777] Segment Routing with IPv6
[ 2.009514] In-situ OAM (IOAM) with IPv6
[ 2.013576] NET: Registered PF_PACKET protocol family
[ 2.018987] 8021q: 802.1Q VLAN Support v1.8
[ 2.029714] spi-nor spi0.0: XM25QH128C (16384 Kbytes)
[ 2.034972] 7 fixed-partitions partitions found on MTD device spi0.0
[ 2.041363] Creating 7 MTD partitions on "spi0.0":
[ 2.046146] 0x000000000000-0x000000030000 : "u-boot"
[ 2.052553] 0x000000030000-0x000000040000 : "u-boot-env"
[ 2.058885] 0x000000040000-0x000000050000 : "factory"
[ 2.065015] 0x000000050000-0x000000fd0000 : "firmware"
[ 2.071267] 2 uimage-fw partitions found on MTD device firmware
[ 2.077211] Creating 2 MTD partitions on "firmware":
[ 2.082188] 0x000000000000-0x00000027e599 : "kernel"
[ 2.087136] mtd: partition "kernel" doesn't end on an erase/write block -- force read-only
[ 2.096479] 0x00000027e599-0x000000f80000 : "rootfs"
[ 2.101491] mtd: partition "rootfs" doesn't start on an erase/write block boundary -- force read-only
[ 2.111845] 0x000000fd0000-0x000000fe0000 : "debug"
[ 2.117739] 0x000000fe0000-0x000000ff0000 : "backup"
[ 2.123852] 0x000000ff0000-0x000001000000 : "bdinfo"
[ 2.129660] mtd mtd8: Failed to register NVMEM device
[ 2.134966] Deleting MTD partitions on "spi0.0":
[ 2.139572] Deleting u-boot MTD partition
[ 2.144214] Deleting u-boot-env MTD partition
[ 2.149254] Deleting factory MTD partition
[ 2.154083] Deleting kernel MTD partition
[ 2.158784] Deleting rootfs MTD partition
[ 2.163525] Deleting firmware MTD partition
[ 2.168437] Deleting debug MTD partition
[ 2.173101] Deleting backup MTD partition
[ 2.178292] rt2880-pinmux pinctrl: mdio is already enabled
[ 2.183916] rt2880-pinmux pinctrl: rgmii1 is already enabled
[ 2.189559] rt2880-pinmux pinctrl: rgmii2 is already enabled
[ 2.321775] spi-nor spi0.0: XM25QH128C (16384 Kbytes)
[ 2.326908] 7 fixed-partitions partitions found on MTD device spi0.0
[ 2.333308] Creating 7 MTD partitions on "spi0.0":
[ 2.338085] 0x000000000000-0x000000030000 : "u-boot"
[ 2.344060] 0x000000030000-0x000000040000 : "u-boot-env"
[ 2.350311] 0x000000040000-0x000000050000 : "factory"
[ 2.356387] 0x000000050000-0x000000fd0000 : "firmware"
[ 2.362664] 2 uimage-fw partitions found on MTD device firmware
[ 2.368607] Creating 2 MTD partitions on "firmware":
[ 2.373620] 0x000000000000-0x00000027e599 : "kernel"
[ 2.378570] mtd: partition "kernel" doesn't end on an erase/write block -- force read-only
[ 2.387892] 0x00000027e599-0x000000f80000 : "rootfs"
[ 2.392917] mtd: partition "rootfs" doesn't start on an erase/write block boundary -- force read-only
[ 2.403172] 0x000000fd0000-0x000000fe0000 : "debug"
[ 2.409032] 0x000000fe0000-0x000000ff0000 : "backup"
[ 2.415075] 0x000000ff0000-0x000001000000 : "bdinfo"
[ 2.421121] mtd mtd8: Failed to register NVMEM device
[ 2.426384] Deleting MTD partitions on "spi0.0":
[ 2.431030] Deleting u-boot MTD partition
[ 2.435716] Deleting u-boot-env MTD partition
[ 2.440823] Deleting factory MTD partition
[ 2.445656] Deleting kernel MTD partition
[ 2.450438] Deleting rootfs MTD partition
[ 2.455098] Deleting firmware MTD partition
[ 2.460120] Deleting debug MTD partition
[ 2.464777] Deleting backup MTD partition
[ 2.470126] rt2880-pinmux pinctrl: mdio is already enabled
[ 2.475632] rt2880-pinmux pinctrl: rgmii1 is already enabled
[ 2.481290] rt2880-pinmux pinctrl: rgmii2 is already enabled
[ 2.613136] /dev/root: Can't open blockdev
[ 2.617259] VFS: Cannot open root device "(null)" or unknown-block(31,5): error -6
[ 2.624824] Please append a correct "root=" boot option; here are the available partitions:
[ 2.633168] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,5)
[ 2.641500] Rebooting in 1 seconds..
Djfe
September 27, 2023, 10:57am
7
ups, I forgot to mention this to @zekica
For anything other than snapshot you need to leave out the last/latest commit.
commits 1 and 2 should work on older releases, but commit 3 only applies on snapshot because it uses a new nvmem feature
the actual fix is only the first (oldest) commit:
committed 02:55PM - 15 Sep 23 UTC
Both dts files are very similar. Create a common device tree for them.
The only… actual change in this commit involves fixing pcie nodes:
WR1300v2: invert order of pcie0 and pcie1 to match WR1300v1 upon merging
Replace compatible = "pci14c3,7603"; by compatible = "mediatek,mt76";
Remove led nodes from mt76
Signed-off-by: Felix Baumann <felix.bau@gmx.de>
NPeca75
September 27, 2023, 12:56pm
8
Hi @Djfe
tnx for info
so, compiled your DIFF on snapshot, i could confirm that WR1300 have ears on 2.4GHz
Ok, i will try again on 23.05
@zekica
i tried your PR on 23.05-rc3 but still 2.4GHz is deaf
zekica
September 27, 2023, 1:12pm
9
Good to hear. Do you have a v2 device by any chance? @Djfe wants to confirm that the change doesn't break anything on v2 and I don't have one available for testing.
zekica
September 27, 2023, 1:23pm
10
@NPeca75 I assume that the issue is that my v3 device has (just by chance) good enough calibration data for MT7603 to make it work. My patch only applies different calibration data to MT7613 which looks like is not a good solution.
Djfe's change is better as it just correctly maps the actual device calibration data to correct chips - the current v2 DTS appears to be wrong - it mixes up MT7603 and MT7613 calibration data offsets.
I did set up WR1300v2 device for a friend but since it's not mine, I cannot test Djfe's changes.
I have created a patch that just reverses the offsets and nothing else - that can be applied on top of 23.05.0-rc3.
cudy-wr1300-reverse-mtd-eeprom-offsets.patch
diff --git a/target/linux/ramips/dts/mt7621_cudy_wr1300-v2.dts b/target/linux/ramips/dts/mt7621_cudy_wr1300-v2.dts
index a5d2fc4607..a051d6277f 100644
--- a/target/linux/ramips/dts/mt7621_cudy_wr1300-v2.dts
+++ b/target/linux/ramips/dts/mt7621_cudy_wr1300-v2.dts
@@ -118,7 +118,7 @@
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
- mediatek,mtd-eeprom = <&factory 0x0000>;
+ mediatek,mtd-eeprom = <&factory 0x8000>;
This file has been truncated. show original
NPeca75
September 27, 2023, 4:24pm
11
Hi @zekica @Djfe
tnx both of you for your time & work
no, sorry, only 5 pcs fresh v3
with Djfe patch, only first commit, it is working very nice on 23.05-rc3
both 2.4 & 5Ghz, rx/tx
Djfe
September 27, 2023, 5:04pm
12
Good to know!
I guess I should just do a PR and fix led's later.
Else people will get the current "broken" support
1 Like
zekica
September 28, 2023, 9:09am
13
Do I remove my pull request from GitHub since the basic change in your solution - swapping eeprom offsets is better than what I put? And then you can prepare one yourself and possibly do a backport to the 23.05 branch.
Djfe
September 28, 2023, 11:44am
14
Sure, let's do it like that. I'll mention you in the PR
Hi i never try anything this can you help me from scratch ? my device: Cudy WR1300 v3
zekica
October 3, 2023, 3:24pm
16
Basically, you need to:
have a Linux x86_64 system to build the image
follow these instructions
do: git checkout v23.05.0-rc4
in menuconfig for target choose Mediatek Ralink MIPS
in menuconfig for subtarget choose MT7621
for target profile choose Cudy WR1300 v2
optionally, if you plan on installing further kernel packages in Global Settings select:
"Select all kernel module packages by default"
under "LuCI" / "Collections" enable "luci" - not as a module but as built-in <*>
exit and save the config
continue with the build
after you have done a stock build, you can manually apply the patch (the simple patch I made applies cleanly on v23.05, while Djfe's applies on the main branch) either type:
patch -p1 </path/to/cudy-wr1300-reverse-mtd-eeprom-offsets.patch
curl https://gist.githubusercontent.com/zekica/2062af6b959c87fe5b25daf6b0eb98db/raw/4d3dc2fd9f40762fd330739956e3979b0cf11c90/cudy-wr1300-reverse-mtd-eeprom-offsets.patch | patch -p1
make the build again:
The files will be in bin/targets/ramips/mt7621 . If you want to install kernel packages, you need to manually install them by copying them to /tmp on the device, or host them somewhere and configure opkg to prefer them over official ones.
There is a way to make a build that is compatible with official kernel modules, but that requires building packages for all devices in ramips/mt7621 target first.
1 Like
zekica
October 5, 2023, 11:20am
17
@Djfe Hi, I haven't seen any updates on your branch and no PR yet. Just wondering if you are planing to do so soon as I would really like to have it backported for 23.05.0 or at least 23.05.1.
1 Like
Djfe
October 6, 2023, 5:48pm
18
Welcome to the forum!
I'll leave it up to you whether you want to get into building your own image. It's a good skill and good to acquire more knowledge about OpenWrt. Cudy WR1300 v2 and v3 share the same image.
My current idea is to leave it like that since Cudy also provides one image for both.
If you don't want to build your own image, then I suggest downloading the v2 sysupgrade from here:
https://firmware-selector.openwrt.org/?version=23.05.0-rc4&target=ramips%2Fmt7621&id=cudy_wr1300-v2
I'll provide a compiled sysupgrade image with the wifi fix for you and everyone else here on Sunday.
How to install OpenWrt on WR1300v3:
Download the WR1300 v2, v3 update from this page:
http://www.cudytech.com/openwrt_software_download (only works on desktop browsers)
Install the update using the web gui (forget the config)
Then wait for it to restart.
Then open web gui again and go through the gui again and install the openwrt sysupgrade the same way (forget the config again (remove checkbox), you might need to force the install, I'm not sure)
@zekica
sorry, for taking so long. Understandable, me too.
The fix could've made openwrt 23 rc4 but only barely and only if anyone would've had the time to review and merge.
About pcie: I'm certain that the person adding support for v2 mixed up the order of the pcie nodes by accident because the source code of the cudy openwrt fork has the same pcie node order as v1.
pcie0 is 2.4ghz
pcie1 is 5.0ghz
That's why I unified the dts layout in my branch.
I could create it's own dts for v3 but I don't feel like it's necessary.
on that note: the next WR1300 appears to be the WR1300E. I just stumbled across this datasheet in their mobile download section. it links to this pdf
Anyway I'll take care of this in Sunday
zekica
October 6, 2023, 6:09pm
19
I completely agree with you that a separate build for v3 isn't needed.
That WR1300E looks like a cut down version - 8MB flash instead of 16MB and just 3 ethernet ports.
From their official vendor build (loosely based on 17.01.5) it appears that it is still MT7621 based with MT7603E and MT7613BE(N):
LEDE_BOARD="ramips/mt7621"
radio0-mt7603e.sh
radio1-mt7663e.sh
Some good news is that it appears that PR #10283 would still work.
Djfe
October 7, 2023, 3:18am
20
one thing: unless we can flash the WR1300E via serial, we would require a signed image from cudy to be able to sysupgrade it to openwrt
It's also the reason cudy lt400 and others never received support (there is a forum thread for that one)
1 Like