Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipq40xx: use NVMEM-on-UBI for ASUS devices #14729

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dangowrt
Copy link
Member

@dangowrt dangowrt commented Feb 25, 2024

Some recent ASUS devices started storing their factory data inside a UBI volume. Instead of extracting WiFi EEPROM data and MAC addresses in userspace, use the now available new way to reference the NVMEM bits in device tree.

Lacking the hardware no runtime testing has been done on my end, hence I rely on users to give feedback if this series works as intended.

User tested and confirmed MAC addresses and WiFi EEPROM:

  • ASUS RT-AC42U
  • ASUS RT-AC58U
  • ASUS Lyra MAP-AC2200

Similar changes for mediatek/filogic-based ASUS devices:
#14676

@github-actions github-actions bot added kernel pull request/issue with Linux kernel related changes target/ipq40xx pull request/issue for ipq40xx target labels Feb 25, 2024
@dangowrt
Copy link
Member Author

@remittor Would be glad if you can take a look

@dangowrt dangowrt changed the title Ipq40xx: use NVMEM-on-UBI for ASUS devices ipq40xx: use NVMEM-on-UBI for ASUS devices Feb 25, 2024
@dangowrt dangowrt force-pushed the ipq40xx-asus-nvmem-on-ubi branch 2 times, most recently from 69e7a9a to 7268dc0 Compare February 25, 2024 23:59
@Leo-PL
Copy link
Contributor

Leo-PL commented Feb 26, 2024

I think I'll try to take my MR33 on a spin for it - it stores caldata on both raw MTD and UBI, the latter being currently preferred by OpenWrt implementation.

Instead of extracting WiFi precal as well as MAC addresses in userspace
use recently introduced NVMEM-on-UBI instead.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Instead of extracting WiFi precal as well as MAC addresses in userspace
use recently introduced NVMEM-on-UBI instead.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Instead of extracting WiFi precal as well as MAC addresses in userspace
use recently introduced NVMEM-on-UBI instead.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
@robimarko
Copy link
Contributor

Since I don't have any of these boards, I can just say that the changes look sane to me.

@dangowrt
Copy link
Member Author

dangowrt commented Mar 1, 2024

@robimarko Thank you for reviewing. The thing is that ASUS bootloaders are full of surprises and may do things like replacing the MTD partitions in DT... So it will need to be tested by someone who got the device.

@robimarko
Copy link
Contributor

Yes, which is why I am refraining from merging this until somebody runtime test this.

@chunkeey
Copy link
Member

chunkeey commented Mar 2, 2024

I've tested this with an ASUS RT-AC58U.

from what I can tell, it works.

[   15.887348] ath10k_ahb a000000.wifi: qca4019 hw1.0 target 0x01000000 chip_id 0x003b00ff sub 0000:0000
[   15.887435] ath10k_ahb a000000.wifi: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 0
[   15.899600] ath10k_ahb a000000.wifi: firmware ver 10.4-3.6-00140 api 5 features no-p2p,mfp,peer-flow-ctrl,btcoex-param,allows-mesh-bcast,no-ps crc32 ba79b746
[   16.050440] ath10k_ahb a000000.wifi: board_file api 2 bmi_id 0:16 crc32 d140cd7d
[   17.397544] ath10k_ahb a000000.wifi: 10.4 wmi init: vdevs: 16  peers: 528  tid: 102
[   17.397674] ath10k_ahb a000000.wifi: msdu-desc: 2500  skid: 32
[   17.458573] ath10k_ahb a000000.wifi: htt-ver 2.2 wmi-op 6 htt-op 4 cal pre-cal-nvmem max-sta 512 raw 0 hwcrypto 1
[   17.466898] ath: EEPROM regdomain: 0x0
[   17.466924] ath: EEPROM indicates default country code should be used
[   17.466932] ath: doing EEPROM country->regdmn map search
[   17.466943] ath: country maps to regdmn code: 0x3a
[   17.466953] ath: Country alpha2 being used: US
[   17.466963] ath: Regpair used: 0x3a
[   18.301316] ath10k_ahb a800000.wifi: qca4019 hw1.0 target 0x01000000 chip_id 0x003b00ff sub 0000:0000
[   18.301439] ath10k_ahb a800000.wifi: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 0
[   18.313579] ath10k_ahb a800000.wifi: firmware ver 10.4-3.6-00140 api 5 features no-p2p,mfp,peer-flow-ctrl,btcoex-param,allows-mesh-bcast,no-ps crc32 ba79b746
[   18.376092] ath10k_ahb a800000.wifi: board_file api 2 bmi_id 0:17 crc32 d140cd7d
[   19.723383] ath10k_ahb a800000.wifi: 10.4 wmi init: vdevs: 16  peers: 528  tid: 102
[   19.723468] ath10k_ahb a800000.wifi: msdu-desc: 2500  skid: 32
[   19.784098] ath10k_ahb a800000.wifi: htt-ver 2.2 wmi-op 6 htt-op 4 cal pre-cal-nvmem max-sta 512 raw 0 hwcrypto 1
[   19.792260] ath: EEPROM regdomain: 0x0
[   19.792286] ath: EEPROM indicates default country code should be used
[   19.792294] ath: doing EEPROM country->regdmn map search
[   19.792304] ath: country maps to regdmn code: 0x3a
[   19.792315] ath: Country alpha2 being used: US
[   19.792324] ath: Regpair used: 0x3a

Content of /dev/ubi0_1 (aka Factory) matches that of /sys/devices/platform/soc/78b5000.spi/spi_master/spi0/spi0.1/mtd/mtd8/ubi0/ubi0_1/ubi0_1/nvmem

EDIT:

Tested-by: Christian Lamparter <chunkeey@gmail.com> (ASUS RT-AC58U)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kernel pull request/issue with Linux kernel related changes target/ipq40xx pull request/issue for ipq40xx target
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants