mediatek: port patch: add tx_power check during eeprom loading for BE14#19503
mediatek: port patch: add tx_power check during eeprom loading for BE14#19503danpawlik wants to merge 1 commit intoopenwrt:mainfrom
Conversation
4ef19ef to
337a52b
Compare
Some Banana Pi BPI-R4 BE14 WiFi modules are shipped with zeroed tx_power fields in EEPROM (2G/5G/6G). This leads to low transmit power on affected bands. Fallback to default values if invalid EEPROM content is detected. Original patch was done in mt76 project [1]. Related to: openwrt#17489 [1] openwrt/mt76#954 Co-Authored-By: Yukari Yakumo <mistelinn@gmail.com> Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com>
337a52b to
7c3448a
Compare
|
kindly ping @dangowrt what you think about that approach. |
|
Any updates on this? @danpawlik @dangowrt |
|
Kindly ping @nbd168 |
|
@nbd168 @dangowrt @hauke ===== thanks @danpawlik for following on this matter |
|
Instead of creating a patch file in |
|
@dangowrt I think that's why @danpawlik created a new patch for openwrt instead of the original one that was for mt76. |
|
I don't think @nbd168 is willing to accept downstream patches on mt76. And as it is a "problem that happens in the field" that's a good argument for upstream Linux as well. |
|
@dangowrt So maybe we could find a middle ground and keep it as a patch for OpenWrt directly as this PR is, without trying to get upstream on mt76 or the kernel? |
|
@dangowrt there is also similar patch done in mt76 project -openwrt/mt76#968 - where in the commit message it seems it was sent to upstream already (or they mail in cc: |
|
@yukariin @im-0. Please Your support @danpawlik I believe we need to move from our side to get confirmation to add this patch ..................... Im one of OpenWrt users who doesn't like to use customized build by other people ..I prefer the official one Im sure the people are suffering from poor wifi performance on BPI-R4 because of this issue from long time , where the manufacturer left his hand and can't support or replace this defected wifi boards ... In my humble opinion @openwrt team to add this patch under purposed file location for this device This issue from 2024 until to now not solved and this patch will solve a huge issue.. Your support is highly appreciated by all members |
|
Sorry for not responding earlier. I believe this patch is incomplete, since the driver in those cases needs to merge data from flash or default bin with data from OTP. Also, I believe some support for external EEPROM may also be missing. |
Great, thanks for looking into it :) |
|
Hi @nbd168 first of all thank you for all the amazing Openwrt work. When you talk about External EEPROM, is that similar to this PR #20005 ?
A few of us have been compiling the MTK Feed but we still need to hack / apply this patch to mt76 to make it work. The old mtk feed for Kernel 5.4 / Openwrt 21.04 seems to be using and mtd partition which is deprecated. Their doc also mentions a We may also be able to test a few things If you can share any pointers or guidance :) |
|
Ah, I shoulda make a upstream RP for it but I'm too busy to solve it. |
|
I applied this patch to my kernel fork and while it did fix the limitation issue, it also slashed my speeds. Prior to patching I was able to get ~2100 Mbps on 6 GHz, and at the same time between 800 and 1600 Mbps on another device through 5 GHz. After the patch, the moment I start transfering from the second device, the 6 GHz device halves it's speed down to only 1000 Mbps and then both stay at that speed. That's a downgrade from ~3 Gbps to ~2 Gbps. I don't know how to properly debug this any further. From what I understand this patch loads the default EEPROM from the firmware blob if the on-device EEPROM is filled with zeroes. I don't know what's stored on the EEPROM and I don't feel like it would be capable of slowing down operation. I did try artificially setting the 6 and 7 dB power limit back onto the 5 GHz band and 2.4 GHz band, but that didn't change anything. Any ideas on what else could possibly cause this? I mean it makes no sense, right? These are two separate radios with two separate circuits and even processors, they shouldn't influence each other? (I'll provide debug information when I find the time to) |
|
I can't believe this dumb workaround actually works diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt7996/eeprom.c
index da3231c9a..406974c31 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/eeprom.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/eeprom.c
@@ -148,12 +148,23 @@ mt7996_eeprom_check_or_use_default(struct mt7996_dev *dev, bool use_default)
goto out;
}
- if (!use_default && mt7996_eeprom_variant_valid(dev, fw->data))
- goto out;
-
- dev_warn(dev->mt76.dev, "eeprom load fail, use default bin\n");
- memcpy(eeprom, fw->data, MT7996_EEPROM_SIZE);
- dev->flash_mode = true;
+ // always use default tx power, regardless of use_default
+ eeprom[MT_EE_TX0_POWER_2G] = fw->data[MT_EE_TX0_POWER_2G];
+ eeprom[MT_EE_TX0_POWER_2G+1] = fw->data[MT_EE_TX0_POWER_2G+1];
+ eeprom[MT_EE_TX0_POWER_2G+2] = fw->data[MT_EE_TX0_POWER_2G+2];
+ eeprom[MT_EE_TX0_POWER_2G+3] = fw->data[MT_EE_TX0_POWER_2G+3];
+ eeprom[MT_EE_TX0_POWER_2G+4] = fw->data[MT_EE_TX0_POWER_2G+4];
+ eeprom[MT_EE_TX0_POWER_5G] = fw->data[MT_EE_TX0_POWER_5G];
+ eeprom[MT_EE_TX0_POWER_5G+1] = fw->data[MT_EE_TX0_POWER_5G+1];
+ eeprom[MT_EE_TX0_POWER_5G+2] = fw->data[MT_EE_TX0_POWER_5G+2];
+ eeprom[MT_EE_TX0_POWER_5G+3] = fw->data[MT_EE_TX0_POWER_5G+3];
+ eeprom[MT_EE_TX0_POWER_5G+4] = fw->data[MT_EE_TX0_POWER_5G+4];
+ eeprom[MT_EE_TX0_POWER_6G] = fw->data[MT_EE_TX0_POWER_6G];
+ eeprom[MT_EE_TX0_POWER_6G+1] = fw->data[MT_EE_TX0_POWER_6G+1];
+ eeprom[MT_EE_TX0_POWER_6G+2] = fw->data[MT_EE_TX0_POWER_6G+2];
+ eeprom[MT_EE_TX0_POWER_6G+3] = fw->data[MT_EE_TX0_POWER_6G+3];
+ eeprom[MT_EE_TX0_POWER_6G+4] = fw->data[MT_EE_TX0_POWER_6G+4];
out:
release_firmware(fw);Copies the transmit power, but nothing else. Seems to not slow down my network anymore. Someone who actually knows what the code does should probably take a look at this, not me. |
|
Nice. I will try this patch as soon as possible. It seems not the best code, but if works... |
Isn't it like openwrt/mt76#968? are ranges correct? +4 for 5G and +8 for 6G? and 2G? |
|
@dangowrt hey, so you mean something like that: https://github.com/openwrt/openwrt/blob/main/target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3-mini.dts#L589 ? Is it require to add new patch that removes EDIT: then in https://github.com/openwrt/openwrt/blob/main/target/linux/mediatek/image/filogic.mk#L672 add: is it right? Unfortunately, I'm not an expert on mbeded devices, so I had to take an advice from AI |
Yes exactly. |
…module. Some BE14 modules are shipped with zeroed or incorrect EEPROM calibration data. This overlay provides known-good EEPROM data (including correct tx_power values for 2G/5G/6G bands) dumped from a working BE14 module. Earlier proposal proposed in [1] was fallback to default values if invalid EEPROM content is detected. [1] openwrt#19503 Fixes: openwrt#17489 Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com>
…module Some BE14 modules are shipped with zeroed or incorrect EEPROM calibration data. This overlay provides known-good EEPROM data (including correct tx_power values for 2G/5G/6G bands) dumped from a working BE14 module. Earlier proposal proposed in [1] was fallback to default values if invalid EEPROM content is detected. [1] openwrt#19503 Fixes: openwrt#17489 Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com>
…module Some Banana Pi BPI-R4 BE14 WiFi modules are shipped with zeroed tx_power fields in EEPROM (2G/5G/6G). This leads to low transmit power on affected bands. This overlay provides known-good EEPROM data (including correct tx_power values for 2G/5G/6G bands) dumped from a working BE14 module. Earlier proposal proposed in [1] was fallback to default values if invalid EEPROM content is detected. [1] openwrt#19503 Fixes: openwrt#17489 Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com>
…module Some Banana Pi BPI-R4 BE14 WiFi modules are shipped with zeroed tx_power fields in EEPROM (2G/5G/6G). This leads to low transmit power on affected bands. This overlay provides known-good EEPROM data (including correct tx_power values for 2G/5G/6G bands) dumped from a working BE14 module. Earlier proposal proposed in [1] was fallback to default values if invalid EEPROM content is detected. [1] openwrt#19503 Fixes: openwrt#17489 Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com>
…module Some Banana Pi BPI-R4 BE14 WiFi modules are shipped with zeroed tx_power fields in EEPROM (2G/5G/6G). This leads to low transmit power on affected bands. This overlay provides known-good EEPROM data (including correct tx_power values for 2G/5G/6G bands) dumped from a working BE14 module. Earlier proposal proposed in [1] was fallback to default values if invalid EEPROM content is detected. [1] openwrt#19503 Fixes: openwrt#17489 Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com>
…module Some Banana Pi BPI-R4 BE14 WiFi modules are shipped with zeroed tx_power fields in EEPROM (2G/5G/6G). This leads to low transmit power on affected bands. This overlay provides known-good EEPROM data (including correct tx_power values for 2G/5G/6G bands) dumped from a working BE14 module. Earlier proposal proposed in [1] was fallback to default values if invalid EEPROM content is detected. [1] openwrt#19503 Fixes: openwrt#17489 Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com>
…module Some Banana Pi BPI-R4 BE14 WiFi modules are shipped with zeroed tx_power fields in EEPROM (2G/5G/6G). This leads to low transmit power on affected bands. This overlay provides known-good EEPROM data (including correct tx_power values for 2G/5G/6G bands) dumped from a working BE14 module. Earlier proposal proposed in [1] was fallback to default values if invalid EEPROM content is detected. [1] openwrt#19503 Fixes: openwrt#17489 Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com>
…module Some Banana Pi BPI-R4 BE14 WiFi modules are shipped with zeroed tx_power fields in EEPROM (2G/5G/6G). This leads to low transmit power on affected bands. This overlay provides known-good EEPROM data (including correct tx_power values for 2G/5G/6G bands) dumped from a working BE14 module. Earlier proposal proposed in [1] was fallback to default values if invalid EEPROM content is detected. [1] openwrt#19503 Fixes: openwrt#17489 Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com>
…module Some Banana Pi BPI-R4 BE14 WiFi modules are shipped with zeroed tx_power fields in EEPROM (2G/5G/6G). This leads to low transmit power on affected bands. This overlay provides known-good EEPROM data (including correct tx_power values for 2G/5G/6G bands) dumped from a working BE14 module. Earlier proposal proposed in [1] was fallback to default values if invalid EEPROM content is detected. [1] openwrt#19503 Fixes: openwrt#17489 Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com>
Some Banana Pi BPI-R4 BE14 WiFi modules are shipped with zeroed tx_power fields in EEPROM (2G/5G/6G). This leads to low transmit power on affected bands. This overlay provides known-good EEPROM data (including correct tx_power values for 2G/5G/6G bands) dumped from a working BE14 module. Earlier proposal proposed in [1] was fallback to default values if invalid EEPROM content is detected. [1] openwrt#19503 Fixes: openwrt#17489 Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com>
Some Banana Pi BPI-R4 BE14 WiFi modules are shipped with zeroed tx_power fields in EEPROM (2G/5G/6G). This leads to low transmit power on affected bands. This overlay provides known-good EEPROM data (including correct tx_power values for 2G/5G/6G bands) dumped from a working BE14 module. Earlier proposal proposed in [1] was fallback to default values if invalid EEPROM content is detected. [1] openwrt#19503 Fixes: openwrt#17489 Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com>
…module Some Banana Pi BPI-R4 BE14 WiFi modules are shipped with zeroed tx_power fields in EEPROM (2G/5G/6G). This leads to low transmit power on affected bands. This overlay provides known-good EEPROM data (including correct tx_power values for 2G/5G/6G bands) dumped from a working BE14 module. Earlier proposal proposed in [1] was fallback to default values if invalid EEPROM content is detected. [1] openwrt#19503 Fixes: openwrt#17489 Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com>
…module Some Banana Pi BPI-R4 BE14 WiFi modules are shipped with zeroed tx_power fields in EEPROM (2G/5G/6G). This leads to low transmit power on affected bands. This overlay provides known-good EEPROM data (including correct tx_power values for 2G/5G/6G bands) dumped from a working BE14 module. Earlier proposal proposed in [1] was fallback to default values if invalid EEPROM content is detected. [1] openwrt#19503 Fixes: openwrt#17489 Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com>
Some Banana Pi BPI-R4 BE14 WiFi modules are shipped with zeroed tx_power fields in EEPROM (2G/5G/6G). This leads to low transmit power on affected bands. This overlay provides known-good EEPROM data (including correct tx_power values for 2G/5G/6G bands) dumped from a working BE14 module. Earlier proposal proposed in [1] was fallback to default values if invalid EEPROM content is detected. [1] openwrt#19503 Fixes: openwrt#17489 Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com>
Some Banana Pi BPI-R4 BE14 WiFi modules are shipped with zeroed tx_power fields in EEPROM (2G/5G/6G). This leads to low transmit power on affected bands. This overlay provides known-good EEPROM data (including correct tx_power values for 2G/5G/6G bands) dumped from a working BE14 module. Earlier proposal proposed in [1] was fallback to default values if invalid EEPROM content is detected. [1] openwrt#19503 Fixes: openwrt#17489 Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com>
Some Banana Pi BPI-R4 BE14 WiFi modules are shipped with zeroed tx_power fields in EEPROM (2G/5G/6G). This leads to low transmit power on affected bands. This overlay provides known-good EEPROM data (including correct tx_power values for 2G/5G/6G bands) dumped from a working BE14 module. Earlier proposal proposed in [1] was fallback to default values if invalid EEPROM content is detected. [1] openwrt#19503 Fixes: openwrt#17489 Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com> Signed-off-by: Daniel Pawlik <dpawlik@redhat.com>
Some Banana Pi BPI-R4 BE14 WiFi modules are shipped with zeroed tx_power fields in EEPROM (2G/5G/6G). This leads to low transmit power on affected bands. This overlay provides known-good EEPROM data (including correct tx_power values for 2G/5G/6G bands) dumped from a working BE14 module. Earlier proposal proposed in [1] was fallback to default values if invalid EEPROM content is detected. [1] openwrt#19503 Fixes: openwrt#17489 Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com>
|
Going with overlay as Daniel suggested - #22447 |
Some Banana Pi BPI-R4 BE14 WiFi modules are shipped with zeroed tx_power fields in EEPROM (2G/5G/6G). This leads to low transmit power on affected bands. This overlay provides known-good EEPROM data (including correct tx_power values for 2G/5G/6G bands) dumped from a working BE14 module. Earlier proposal proposed in [1] was fallback to default values if invalid EEPROM content is detected. [1] openwrt#19503 Fixes: openwrt#17489 Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com>
Some Banana Pi BPI-R4 BE14 WiFi modules are shipped with zeroed tx_power fields in EEPROM (2G/5G/6G). This leads to low transmit power on affected bands. This overlay provides known-good EEPROM data (including correct tx_power values for 2G/5G/6G bands) dumped from a working BE14 module. Earlier proposal proposed in [1] was fallback to default values if invalid EEPROM content is detected. [1] openwrt#19503 Fixes: openwrt#17489 Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com>
Some Banana Pi BPI-R4 BE14 WiFi modules are shipped with zeroed tx_power fields in EEPROM (2G/5G/6G). This leads to low transmit power on affected bands. This overlay provides known-good EEPROM data (including correct tx_power values for 2G/5G/6G bands) dumped from a working BE14 module. Earlier proposal proposed in [1] was fallback to default values if invalid EEPROM content is detected. [1] openwrt#19503 Fixes: openwrt#17489 Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com>
Some Banana Pi BPI-R4 BE14 WiFi modules are shipped with zeroed tx_power fields in EEPROM (2G/5G/6G). This leads to low transmit power on affected bands. This overlay provides known-good EEPROM data (including correct tx_power values for 2G/5G/6G bands) dumped from a working BE14 module. Earlier proposal proposed in [1] was fallback to default values if invalid EEPROM content is detected. [1] openwrt#19503 Fixes: openwrt#17489 Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com>
Some Banana Pi BPI-R4 BE14 WiFi modules are shipped with zeroed tx_power fields in EEPROM (2G/5G/6G). This leads to low transmit power on affected bands. This overlay provides known-good EEPROM data (including correct tx_power values for 2G/5G/6G bands) dumped from a working BE14 module. Earlier proposal proposed in [1] was fallback to default values if invalid EEPROM content is detected. [1] openwrt#19503 Fixes: openwrt#17489 Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com> (cherry picked from commit 4235ed7)
Some Banana Pi BPI-R4 BE14 WiFi modules are shipped with zeroed tx_power fields in EEPROM (2G/5G/6G). This leads to low transmit power on affected bands. This overlay provides known-good EEPROM data (including correct tx_power values for 2G/5G/6G bands) dumped from a working BE14 module. Earlier proposal proposed in [1] was fallback to default values if invalid EEPROM content is detected. [1] openwrt#19503 Fixes: openwrt#17489 Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com> (cherry picked from commit 4235ed7) (cherry picked from commit 6d42a70)
Some Banana Pi BPI-R4 BE14 WiFi modules are shipped with zeroed
tx_power fields in EEPROM (2G/5G/6G). This leads to low transmit power
on affected bands.
This overlay provides known-good EEPROM data (including correct tx_power
values for 2G/5G/6G bands) dumped from a working BE14 module.
To enable BE14 overlay, add into u-boot bootconf_extra
parameter: 'mt7988a-bananapi-bpi-r4-wifi-be14'.
You can use example script:
overlay="mt7988a-bananapi-bpi-r4-wifi-be14"
current="$(fw_printenv -n bootconf_extra 2>/dev/null)"
if [ -n "${current}" ]; then
fw_setenv bootconf_extra "${current}#${overlay}"
else
fw_setenv bootconf_extra "${overlay}"
fi
Earlier proposal proposed in [1] was fallback to default values if
invalid EEPROM content is detected.
[1] openwrt#19503
Fixes: openwrt#17489
Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com>
Some Banana Pi BPI-R4 BE14 WiFi modules are shipped with zeroed tx_power fields in EEPROM (2G/5G/6G). This leads to low transmit power on affected bands.
Fallback to default values if invalid EEPROM content is detected.
Original patch was done in mt76 project [1].
Related to: #17489
[1] openwrt/mt76#954